Count diagnostics in SARIF, ESLint JSON, or Ruff JSON reports
README.md

badgerp_analysis #

A single diagnostic pipeline reads three standard saved formats: SARIF 2.1.0, ESLint JSON and Ruff JSON. It never starts a scan or uploads source.

badge(
    primary=color("#24292f"),
    secondary=color("#0969da"),
    producer=analysis(report="report.sarif", format="sarif"),
)

level selects all, error, warning, note, or none. SARIF rule defaults are respected; explicit result levels win. Counts include suppressed findings; pass and notApplicable results are excluded. Runs with failed invocations, error-level execution/configuration notifications, null results, or external result references fail explicitly rather than showing green. No runs is not a successful scan. ESLint counters must match its diagnostic messages. Ruff has no severity field, so diagnostics are counted as warnings.

The format must be explicit: empty Ruff/ESLint arrays mean 0 reported only under that selected format. This is not a security verdict, validation of the whole report schema, or report-freshness check. Local JSON is limited to 4 MiB; duplicate keys and nonfinite numbers are rejected.

Sources: SARIF, ESLint, Ruff. Fixtures: fixtures/sarif.json, fixtures/eslint.json, fixtures/ruff.json.

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.