1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-27 04:45:20 +01:00
psalm/docs/running_psalm/error_levels.md
Barney Laurance cd18cdc554 Re-order list of errors in docs
I think it makes more sense to have the errors that almost always appear
(level 7 errors) next to the errors that always appear, instead of
the level 1, least likely to appear errors being next to the ones that
always appear.

This also makes the order more similar to that output by the new
--by-issue-level format report.

Some time it might be nice to see if there's a way to auto generate most
of this docs page from the actual issue class definitions, or have
a test that checks the list of issues for each level is accurate and
complete.
2022-12-02 00:04:43 +00:00

16 KiB
Raw Blame History

Error levels

You can run Psalm in at different levels of strictness from 1 to 8.

Level 1 is the most strict, level 8 is the most lenient.

When no level is explicitly defined, psalm defaults to level 2.

Some issues are always treated as errors. These are issues with a very low probability of false-positives.

At level 1 all issues (except those emitted for opt-in features) that Psalm can find are treated as errors. Those issues include any situation where Psalm cannot infer the type of a given expression.

At level 2 Psalm ignores those Mixed* issues, but treats most other issues as errors.

At level 3 Psalm starts to be a little more lenient. For example Psalm allows missing param types, return types and property types.

At level 4 Psalm ignores issues for possible problems. These are more likely to be false positives where the application code may guarantee behaviour that Psalm isn't able to infer.

Level 5 and above allows a more non-verifiable code, and higher levels are even more permissive.

Always treated as errors

Errors that appear at level 7 and below

These issues are treated as errors at level 7 and below.

Errors that appear at level 6 and below

These issues are treated as errors at level 6 and below.

Errors that appear at level 5 and below

These issues are treated as errors at level 5 and below.

Errors that appear at level 4 and below

These issues are treated as errors at level 4 and below.

Errors that appear at level 3 and below

These issues are treated as errors at level 3 and below.

Errors that appear at level 2 and below

These issues are treated as errors at level 2 and below.

Errors that only appear at level 1

Feature-specific errors