Skip to content

Show the error level on issue pages - #157

Merged
alies-dev merged 1 commit into
masterfrom
alies-dev/issue-level-badges
Nov 24, 2026
Merged

alies-dev merged 1 commit into
masterfrom
alies-dev/issue-level-badges

Conversation

@alies-dev

@alies-dev alies-dev commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Context

Issue pages such as DuplicateEnumCase don't say at which error levels the issue is an error. To learn whether RedundantCondition fails a project at errorLevel="3", you have to find it on the error levels page. And no page says which psalm.xml setting turns on feature-specific issues such as TaintedSql or UnusedMethod.

Refs #0

Solution

Every issue page now shows badges under its title, in the style of php.watch's split pills:

Issue Badges
RedundantCondition (level 4) Error at levels | 1–4 Default (2) | Error
MixedAssignment (level 1) Error at levels | 1 only Default (2) | Info
DuplicateEnumCase (always an error) Error at levels | All
TaintedSql (feature-specific) Error at levels | All Config | runTaintAnalysis

Each badge links to the issue's section of the error levels page and has a tooltip with the details (for Config: the default and the CLI flag, where there is one).

At build time, the theme takes the level from the heading the issue is listed under in running_psalm/error_levels.md. Psalm generates that page from each issue's ERROR_LEVEL, and its tests check that every issue is under the right heading, so the badges agree with the page they link to, and a new or moved issue needs no change here. The Config attribute is not in any Psalm doc, so it is a list in theme/partials/issue-level.html, and a new feature-specific issue needs an entry there to get a Config badge. UnevaluatedCode has none on purpose: Psalm reports it with and without unused-variable detection.

It is only a theme override, with no plugin or hook, so it works with the server's mkdocs 1.1 and mkdocs-material 4.6.3. I built the docs with those versions: all 341 issue pages get badges (PluginIssue has no level and gets none). The badges go into the same content block as the newsletter form, which stays under every page.

The colours and sizes are CSS custom properties on .psalm-level, and each kind of pill only overrides --pill-*. Rebuilding mkdocs_material_extra.css with the local webpack reformats the whole file, so I added only the compiled badge rules to the committed file.

@alies-dev alies-dev self-assigned this Nov 14, 2026
@alies-dev
alies-dev force-pushed the alies-dev/issue-level-badges branch from 64a8890 to 56139dd Compare November 24, 2026 14:16
@alies-dev
alies-dev merged commit 2abfd17 into master Nov 24, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant