Cross-language Coverage Report CLI Parser in Go
Parse coverage reports from Rust, Go, TypeScript, JavaScript, and Python with one unified tool.
-
Multi-language Support: Parses coverage files from:
- Rust: LCOV format (
.lcov,.info) generated by grcov or tarpaulin - Go: Native coverage format (
.out) - TypeScript/JavaScript: LCOV format (
lcov.info) generated by nyc (Istanbul) - Python: Cobertura XML and JSON formats
- Rust: LCOV format (
-
Auto-detection: Automatically detects coverage file format by extension or content
-
Multiple Output Formats: Table (default), JSON, CSV
-
Interactive TUI: Explore coverage data with a terminal user interface
-
Robust Parsing: Handles malformed lines gracefully with warnings
-
High Test Coverage: >80% test coverage for all parser modules
-
Direct Upload: Upload coverage reports directly to SonarQube and Codecov platforms
-
CI Integration: Check coverage thresholds for continuous integration
-
Coverage Diff: Compare coverage between git commits
git clone https://github.com/Chapati-Systems/covpeek.git
cd covpeek
go build -o covpeek ./cmd/covpeekgo install github.com/Chapati-Systems/covpeek/cmd/covpeek@latestDownload from GitHub Releases.
Parse a coverage file and display summary table:
covpeek --file coverage.lcov
Parse with different output formats:
# Table format (default) - sorted by coverage descending
covpeek --file coverage.lcov --output table
# JSON format for programmatic use
covpeek --file lcov.info --output json
# CSV format for spreadsheet import
covpeek --file coverage.out --output csv
Launch interactive TUI for exploring coverage data:
covpeek --file coverage.lcov --tui
Force a specific format (bypass auto-detection):
covpeek --file coverage.txt --format lcov
covpeek --file coverage.dat --format go
Filter files below coverage threshold:
covpeek --file coverage.lcov --below 80
Generate an SVG badge for embedding in README or dashboards:
covpeek badge --file coverage.lcov --output coverage-badge.svg
Auto-detect coverage file:
covpeek badge --output coverage-badge.svg
Customize label and style:
covpeek badge --file coverage.out --label "test coverage" --style plastic --output badge.svg
Supported styles: flat, plastic, flat-square
Upload parsed coverage reports directly to popular platforms like SonarQube and Codecov:
# Upload to SonarQube
covpeek upload --to sonarqube --project-key myproject --file coverage/lcov.info --token $SONAR_TOKEN
# Upload to Codecov
covpeek upload --to codecov --repo-token $CODECOV_TOKEN
Auto-detect coverage file:
covpeek upload --to codecov --repo-token $CODECOV_TOKEN
Custom SonarQube server URL:
covpeek upload --to sonarqube --project-key myproj --url https://sonar.mycompany.com/ --token $SONAR_TOKEN
Check total coverage against minimum threshold:
covpeek ci --min 80
Compare coverage reports from two git commits:
covpeek diff --file coverage/lcov.info --commit-a HEAD~5 --commit-b HEAD
Generate an SVG badge for embedding in README or dashboards:
covpeek badge --file coverage.lcov --output coverage-badge.svg
Auto-detect coverage file:
covpeek badge --output coverage-badge.svg
Customize label and style:
covpeek badge --file coverage.out --label "test coverage" --style plastic --output badge.svg
Supported styles: flat, plastic, flat-square
Upload parsed coverage reports directly to popular platforms like SonarQube and Codecov:
# Upload to SonarQube
covpeek upload --to sonarqube --project-key myproject --file coverage/lcov.info --token $SONAR_TOKEN
# Upload to Codecov
covpeek upload --to codecov --repo-token $CODECOV_TOKEN
Auto-detect coverage file:
covpeek upload --to codecov --repo-token $CODECOV_TOKEN
Custom SonarQube server URL:
covpeek upload --to sonarqube --project-key myproj --url https://sonar.mycompany.com/ --token $SONAR_TOKEN
Parse Rust coverage (generated by grcov):
cargo tarpaulin --out Lcov
covpeek --file lcov.info
Parse Go coverage:
go test -coverprofile=coverage.out ./...
covpeek --file coverage.out
Parse TypeScript/JavaScript coverage (generated by nyc):
nyc --reporter=lcov npm test
covpeek --file coverage/lcov.info
Parse Python coverage (Cobertura XML):
coverage xml
covpeek --file coverage.xml
Parse Python coverage (JSON):
coverage json
covpeek --file coverage.json
Used by Rust (grcov, tarpaulin) and TypeScript/JavaScript (nyc):
- File extensions:
.lcov,.info,lcov.info - Records: TN, SF, FN, FNDA, DA, LH, LF, end_of_record
- Branch coverage (BRF, BRH, BRDA) is supported but optional
Native Go coverage format:
- File extension:
.out - Format:
mode: set|count|atomicfollowed by coverage entries - Example:
file.go:5.10,7.2 1 1
Cobertura XML and JSON formats generated by the coverage package:
- XML:
coverage.xml - JSON:
coverage.json
Install pre-commit hooks:
pre-commit install
Run program:
go run ./cmd/covpeek
Run tests:
go test ./...
Run tests with coverage:
go test -coverprofile=coverage.out ./...
go tool cover -html=coverage.out
go build -o covpeek ./cmd/covpeek
See https://freshman.tech/snippets/go/cross-compile-go-programs/
GOOS=linux GOARCH=amd64 go build -o covpeek ./cmd/covpeek
GOOS=darwin GOARCH=arm64 go build -o covpeek ./cmd/covpeek
covpeek/
├── cmd/covpeek/ # CLI application entry point
│ ├── main.go
│ ├── root.go
│ ├── parse.go
│ ├── upload.go
│ ├── ci.go
│ ├── badge.go
│ ├── diff.go
│ └── tui.go
├── pkg/
│ ├── models/ # Data structures
│ │ └── coverage.go
│ ├── parser/ # Coverage file parsers
│ │ ├── lcov.go # LCOV format parser
│ │ ├── gocover.go # Go coverage parser
│ │ ├── pycover_xml.go # Python XML parser
│ │ └── pycover_json.go # Python JSON parser
│ └── uploader/ # Platform uploaders
│ └── uploader.go
├── internal/
│ └── detector/ # Format auto-detection
│ ├── detector.go
│ └── detector_test.go
└── testdata/ # Sample coverage files for testing
├── coverage.json
├── coverage.xml
├── sample.lcov
├── sample.out
└── typescript.info
All parser modules maintain >80% test coverage with comprehensive test cases including:
- Valid coverage files
- Malformed/incomplete entries
- Edge cases (empty files, missing fields)
- Multiple files
- Different coverage modes
Run tests:
go test -v ./...
Licensed under the AGPL-3.0 license
See LICENSE file for details.