Skip to main content

PR-first code coverage report generator with modern UI

Project description

Covisible

PR-first code coverage report generator with modern UI

Covisible generates beautiful, interactive coverage reports focused on what matters: your PR changes.

Features

  • PR-first view — Shows coverage for new/modified lines, not the entire repo
  • Diff-based analysis — Integrates with git diff to highlight what changed
  • Modern UI — Dark/light theme, interactive charts, instant search
  • Smart summary — "−1.3% coverage, 3 new uncovered lines" instead of "83.42%"
  • 1-click drill-down — PR → file → function → line
  • Baseline comparison — Compare current coverage with previous runs
image

Installation

pip install covisible

Or install from source:

git clone https://github.com/LaGrunge/covisible
cd covisible
pip install -e ".[dev]"

Usage

Covisible is a command group. The main command is report; diff, files, and summary are console-only helpers. Coverage input is auto-detected: .json (and *.gcov.json) is parsed as gcov JSON, everything else as LCOV .info.

Generate a report (PR coverage)

covisible report \
  --current coverage.info \
  --baseline baseline.info \
  --git-diff HEAD~1..HEAD \
  --output report/ \
  --format both

Without --git-diff/--diff-file you get a whole-project report; with one of them the report focuses on new/modified lines.

To render the actual source code, covisible locates each file by the path recorded in the coverage data, then by --source-root — joining relative paths and matching absolute build paths by their longest existing suffix (so a foreign build prefix like /home/ci/build/... still resolves). Files it cannot find are rendered with coverage but no code, and the run prints how many were missing.

Generate gcov JSON coverage

# After running tests with coverage enabled
find . -name "*.gcno" -exec gcov --json-format {} \;
# Or use gcov on specific files
gcov --json-format --stdout myfile.cpp > coverage.json

report options

Option Description
-c, --current Coverage file (gcov JSON or lcov.info) — required. Repeatable: pass -c several times to merge shards/test runs (hit counts are summed)
-b, --baseline Baseline coverage for comparison (optional)
--git-diff Git diff range (e.g., main..HEAD)
--diff-file Path to unified diff file
-o, --output Output directory for HTML report (default: coverage-report/)
--format Output format: html, json, or both (default: html)
--config FILE Read option defaults from a TOML file (default: ./.covisible.toml if present). CLI flags override the file
--repo Path to git repository (for --git-diff / title)
--source-root Directory where the source files live, used to render code when coverage paths are absolute build paths or relative to another root (defaults to --repo)
--title Report title (default: Covisible: <project>)
--blame / --no-blame Include git blame analysis for uncovered code
--branches / --no-branches Show branch coverage columns in the report (off by default; only rendered when the coverage data has branch info)
--range LOW,HIGH Coverage color thresholds as percentages: below LOW is red, LOWHIGH yellow, at or above HIGH green (default: 50,80). Applies to the summary cards, module-table bars, sunburst and treemap
--precision N Decimal places shown for coverage percentages everywhere (default: 1)
--badge FILE Also write a shields-style SVG coverage badge to FILE: rounded line-coverage %, colored by --range, with the covisible eye logo
--cobertura FILE Also write a Cobertura XML report to FILE for CI tools (Jenkins, GitLab, Azure DevOps, SonarQube)
--history FILE Append this run to a JSON history file and render a coverage trend chart (commit it / cache it in CI to accumulate history)
--commit SHA Commit label for the --history entry (default: auto-detected from --repo)
--branch NAME Branch label for the --history entry (default: auto-detected from --repo; distinct from --branches)
--trend / --no-trend Render the coverage trend chart from --history data (default on). --no-trend keeps recording history but hides the chart
--fail-under PCT Exit with status 1 if overall line coverage is below PCT (the report is still written)
--fail-under-new PCT Exit with status 1 if coverage of new/changed lines is below PCT (PR mode only)
--exclude GLOB Glob of files to exclude (repeatable, e.g. --exclude '*_test.cpp')
--include GLOB Keep only files matching this glob, applied after --exclude (repeatable)
--omit-lines REGEXP Ignore source lines matching this regex, e.g. --omit-lines 'assert' (needs source on disk; repeatable)
--substitute s/RE/REPL/ Rewrite coverage file paths with a sed-style regex so they match source on disk, e.g. --substitute 's#/build/##' (repeatable)
--prefix PREFIX Strip a leading path PREFIX from coverage file paths
--strip N Strip the first N leading directory levels from coverage file paths
--ignore-config Path to an ignore config (YAML/JSON) with exclude/include/line_markers

The report ships a light/dark theme that follows the OS prefers-color-scheme by default, with a header toggle (or press t) that persists your choice.

Config file

Put commonly-used options in .covisible.toml (auto-discovered in the current directory, or point at one with --config). CLI flags always override it:

[report]
range = "50,75"
precision = 2
branches = true
exclude = ["*_test.cpp", "third_party/*"]
fail_under = 80
fail_under_new = 90
badge = "coverage.svg"
cobertura = "coverage.xml"

CI gating

Merge shards, fail the build under a threshold, and emit artifacts CI can ingest:

covisible report -c shard1.info -c shard2.info -o report/ \
  --git-diff origin/main..HEAD --repo . \
  --fail-under 80 --fail-under-new 90 \
  --cobertura coverage.xml --badge coverage.svg --history history.json

Other commands

# CodeCov-style coverage diff (console), optional markdown brief for CI comments
covisible diff coverage_new.info -b coverage_old.info --markdown brief.md

# List files by coverage (-n 0 lists all, no limit)
covisible files coverage.info --sort uncovered --limit 20

# One-file summary
covisible summary coverage.info

Excluding files and lines

Pass --exclude one or more times, or point --ignore-config at a YAML/JSON file:

# covisible-ignore.yaml
ignore:
  exclude:
    - "*_test.cpp"
    - "third_party/*"
  line_markers:
    - "// LCOV_EXCL_LINE"
    - "# pragma: no cover"

Excluded files are dropped from the report; lines matched by a marker (or a LCOV_EXCL_START/STOP block) are removed from their file's coverage.

Development

# Install dev dependencies
pip install -e ".[dev]"

# Run tests
pytest

# Lint
ruff check src tests
mypy src

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

covisible-0.2.3.tar.gz (378.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

covisible-0.2.3-py3-none-any.whl (368.7 kB view details)

Uploaded Python 3

File details

Details for the file covisible-0.2.3.tar.gz.

File metadata

  • Download URL: covisible-0.2.3.tar.gz
  • Upload date:
  • Size: 378.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for covisible-0.2.3.tar.gz
Algorithm Hash digest
SHA256 8a4d00b39272f06abaf9e69a7cb33d30fa81312ea1796ea23fbda69bff295c57
MD5 5deec2b204467d49126e05987a391de4
BLAKE2b-256 8c5a79b802e1e69f5706e139cd53bc108250379554014d27ad6d1a195d734d76

See more details on using hashes here.

Provenance

The following attestation bundles were made for covisible-0.2.3.tar.gz:

Publisher: publish.yml on LaGrunge/covisible

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file covisible-0.2.3-py3-none-any.whl.

File metadata

  • Download URL: covisible-0.2.3-py3-none-any.whl
  • Upload date:
  • Size: 368.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for covisible-0.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 f53be665f31ab8d17ec8c65a9e6324d5ba29e7d1f08d5421854651d51bf672b9
MD5 b961e0f7323ea26c855f54f0b0c37772
BLAKE2b-256 2fe161157dda2e58f0b12ce8ad29eadd0a98f2e6bea8efeab45b77b070e39f67

See more details on using hashes here.

Provenance

The following attestation bundles were made for covisible-0.2.3-py3-none-any.whl:

Publisher: publish.yml on LaGrunge/covisible

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page