Skip to content

Bundle LCOV, Cobertura, and SARIF formatters #1266

Description

@sferik

We absorbed simplecov-html and simplecov_json_formatter into the gem. The three formats that downstream tools actually consume are still third-party gems.

  • LCOV is the lingua franca. Coveralls, Codecov, genhtml, and the Coverage Gutters extension for VS Code all read it.
  • Cobertura XML is what Jenkins, GitLab, and Azure Pipelines ingest.
  • SARIF puts uncovered lines into GitHub code scanning, which is how they get annotated on the diff without a bot account posting comments.

Each one is a few hundred lines against SourceFile and a fixture-based spec, and each replaces a dependency that projects carry for no reason other than getting their numbers into a service. Bundling them also means the formats stay correct when the resultset shape changes, which is not true of a formatter gem that nobody has touched since branch coverage landed.

The related cheap win is --annotate github on simplecov uncovered, emitting ::warning file=lib/foo.rb,line=41::Line not covered. That gets inline diff annotations in a plain workflow with no upload step and no code scanning permissions.

Prior art for bundling rather than farming out: go tool cover writes its own profile format and coverage.py ships xml, lcov, json, and html in the box.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions