Share a Psalm report

Psalm's error levels run from 1 (strictest) to 8, and almost every real codebase is sitting somewhere in the middle with a baseline file holding back the tide. Tightening that is a team activity, and team activities need an artifact everyone can point at.

Psalm writes plenty of formats. HTML isn't one of them — but SARIF is, and SARIF renders.

SARIF → HTML

composer require --dev vimeo/psalm
pip install sarif-tools

./vendor/bin/psalm --report=psalm.sarif --no-cache || true
sarif html psalm.sarif --output psalm.html

SARIF keeps the issue type (PossiblyNullReference, MixedArgument), the severity and the file region, so the rendered page groups the way a human would triage it.

Publish it

Drag psalm.html into the app, or from CI:

curl -fsS -X PATCH "https://commareports.com/api/v1/reports/$REPORT_ID" \
  -H "Authorization: Bearer $COMMA_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d "$(jq -n --rawfile html psalm.html \
        --arg title "Psalm — $GITHUB_REF_NAME" '{title: $title, html: $html}')"

Keep ./vendor/bin/psalm as its own unmuted step if you want the build to fail on new issues.

The baseline is the story

psalm --set-baseline=psalm-baseline.xml is how most projects adopt Psalm: freeze the existing issues, fail on new ones. That works, and it also makes the debt invisible — nothing in the daily run mentions the thousand entries sitting in the baseline file.

Publish a second report without --baseline on a schedule and you get the number back:

  • A routine re-runs it weekly and PATCHes the same id, so the real total is a URL rather than a guess.
  • Anchored threads on a cluster — "these forty are all the same untyped array shape in the legacy mailer" — so the cleanup can be claimed in slices. See commenting on HTML.

Limits

  • Entry HTML: 5 MB. Assets: 25 MB per file, 250 MB and 500 files total. An unbaselined first run on a large app is the one that gets close — scope it to a directory for the shareable view.
  • 60 requests/minute per token.

Try it

Comma is free — unlimited reports, unlimited commenters, unlimited revision history.

Publish a static analysis report →

Related