Skip to content

About

Generate self-contained HTML visualizations of documentation, test, and code line distribution.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

9 Commits

Folders and files

Repository files navigation

loc-visuals

CI License: MIT

loc-visuals scans a project and creates a self-contained HTML report showing how its non-empty physical lines are distributed across documentation, tests, and code.

The generated report has no external assets or network dependencies. Open it locally, attach it to a build, or publish it as a CI artifact.

Install

Linux and macOS

curl -fsSL https://raw.githubusercontent.com/EzyGang/loc-visuals/main/scripts/install.sh | sh

The installer selects the current operating system and architecture, verifies the release checksum, and installs the binary to ~/.local/bin by default.

Set LOC_VISUALS_VERSION to install a specific release or LOC_VISUALS_INSTALL_DIR to change the destination:

curl -fsSL https://raw.githubusercontent.com/EzyGang/loc-visuals/main/scripts/install.sh | LOC_VISUALS_VERSION=0.1.1 LOC_VISUALS_INSTALL_DIR="$HOME/bin" sh

Windows

irm https://raw.githubusercontent.com/EzyGang/loc-visuals/main/scripts/install.ps1 | iex

The PowerShell installer verifies the release checksum, copies the executable to %USERPROFILE%\.local\bin, and adds that directory to both the persistent user PATH and the current PowerShell session. It installs the executable itself rather than a shortcut.

$env:LOC_VISUALS_VERSION="0.1.1"; $env:LOC_VISUALS_INSTALL_DIR="$HOME\bin"; irm https://raw.githubusercontent.com/EzyGang/loc-visuals/main/scripts/install.ps1 | iex

Build from source

Go 1.25 or newer is required.

git clone https://github.com/EzyGang/loc-visuals.git && cd loc-visuals && go build -o bin/loc-visuals ./cmd/loc-visuals

Usage

Scan the current project and write loc-report.html:

loc-visuals .

Choose another output path or project:

loc-visuals -o artifacts/lines.html ../project

Scan several folders without scanning their parent directory:

loc-visuals -o artifacts/lines.html ./cmd ./internal/scan ./internal/report

Any number of paths can be provided. Duplicate and nested paths are scanned only once. Multi-path reports show combined totals alongside a separate composition breakdown for every selected folder.

Print the installed version:

loc-visuals version

Successful interactive runs check the GitHub Releases API at most once every 24 hours and report when a newer version is available. Set LOC_VISUALS_NO_UPDATE_CHECK=1 to disable this check.

Classification

Files are classified in this order:

  1. Files under test or spec directories are tests.
  2. Filenames containing a standalone test, tests, spec, or specs token are tests.
  3. Markdown, MDX, reStructuredText, and AsciiDoc files are documentation.
  4. All other scanned text files are code.

Dependencies, caches, build output, lock files, minified files, source maps, symlinks, binary files, and the requested report path are excluded.

Development

go test ./... && go vet ./... && go build -o bin/loc-visuals ./cmd/loc-visuals && ./bin/loc-visuals -o /tmp/loc-report.html .

CI runs tests, vet, and builds on Linux, macOS, and Windows.

Releases

Releases are manual:

  1. Update Current in internal/version/version.go.
  2. Run the Release workflow from the intended branch or commit in GitHub Actions.

The workflow reads the package version, builds Linux, macOS, and Windows archives for amd64 and arm64, creates the matching vMAJOR.MINOR.PATCH release, and attaches the archives, installers, and SHA-256 checksums.

License

MIT

About

Generate self-contained HTML visualizations of documentation, test, and code line distribution.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages