Frederic G. MARAND / gocoverstats · GitLab
source link: https://gitlab.com/fgmarand/gocoverstats
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
gocoverstats
Produce aggregate coverage statistics for CI integration of Go projects.
What does it do ?
gocoverstats
produces aggregated coverage information by parsing standard go test
coverage files
to produce a global coverage ratio like the one emitted by go test
itself,
and optionally a per-package coverage report.
Why is it needed ?
It answers the needs of teams maintaining projects with an existing metrics toolchain, and who want to track their coverage over time, globally or per-package, while not wishing to use complete/complex coverage analysis solutions, and more specifically SaaS solutions like CodeClimate, CodeCov, or Coveralls.
This is likely to happen most often for proprietary code to avoid the cost and safety issues of providing access to such third parties, and without the need for an on-premises complete code coverage solution.
What does the aggregate ratio represent ?
The single ratio produced without -v
or at the last line of the ratio table
with -v
, called Global weighted coverage
is a weighted average of package ratios,
accounting for the size of each package.
How do I use gocoverstats ?
Simple use
Just 3 steps:
Integration with DataDog or Graphite metrics
- Install the Datadog Python library, following their instructions
- Configure your
~/.dogrc
, or theDATADOG_API_KEY
environment variable. - To post the single aggregate as a simple metric:
- To post the per-package metrics as tags on a given metric, without the aggregate, you can use something like this:
You can than graph all of these metrics in a dashboard by generating curves on
the package
tag of the foo_project.coverage
metric.
For more details and for the Graphite integration, follow the steps outlined in this article.
What commands are provided by the tool ?
When installing with go install
, nothing but the gocoverstats
command itself.
When working on a clone of the repo, you get a Makefile with the following tasks:
-
clean
: remove generated files like coverage and local builds -
install
: build and install the command to$GOBIN
-
lint
: perform static analysis tasks on the project -
test-native
: updates thecalc/testdata
fixtures with the coverage for the current version of GoCoverStats. -
cover
: run the test suite, generating coverage, and cleaning after itself -
run
: build and run the project itseftestdata
, to demonstrate usage and the difference between per-statement and per-line coverage.
Support
For any question, use the Gitlab issue tracker for the project.
If you want to warn about a security issue, or anything confidential, be sure to check the checkbox marking the issue as confidential on the issue form.
Roadmap
Future features being imagined, with no landing date defined:
- output formats
- badge generation
Contributing
This project is open to contributions. Be aware that the project is Open Source, so any code you contribute must be under the project license.
License
This project is published under the MIT License, as provided in the repository.
Credits
Gopher with a medium head coverage ratio by Renee French, under Creative Commons Attribution 3.0 license.
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK