Render line coverage from a Cobertura XML report
README.md

badgerp_cobertura #

Renders line coverage from a Cobertura XML report. Cobertura is produced by coverage tools across Python, Java, JavaScript, and other ecosystems, so it is the portable counterpart to Badger's LCOV plugin.

badge(
    producer=cobertura(report="coverage.xml"),
)

The badge uses Cobertura's root line-rate, or the compatible lines-covered/lines-valid counters. Coverage is green at 90% or higher, olive at 80%, yellow at 70%, and red below 70%. Invalid or unrelated XML is an error instead of a misleading badge.

Empty line counters show neutral no data. Namespaces are supported. Negative, impossible or contradictory counters and DTD/entity declarations are rejected. Reports describe their recorded run, not necessarily the current checkout.

Developing independently #

This is a plugin for Badger, not a standalone Python application. Badger supplies the badger runtime module. For tests outside the CLI, put the plugins directory from a compatible Badger checkout on PYTHONPATH:

PYTHONPATH=/path/to/Badger/plugins uv run --no-project --with pytest pytest tests -m 'not network'

To try working-tree changes in a separate Badger project, use register() with a local path pointing at this checkout. See the distribution guide.

Releasing #

Keep the existing badgerp_* distribution name so Badger can discover it. After updating the version (and uv.lock if present), build and check the artifacts from a clean checkout:

uv build --clear
uvx twine check dist/*

Publish only after coordinating with the Badger maintainers so the same version is not released from both checkouts. Supply UV_PUBLISH_TOKEN securely in the environment, then run uv publish --check-url https://pypi.org/simple/ dist/*.

This plugin is licensed under the Blue Oak Model License 1.0.0.