psalm icon indicating copy to clipboard operation
psalm copied to clipboard

--alter not respecting configuration suppression

Open kochen opened this issue 8 months ago • 1 comments

When adding a suppression issueHandler to the configuration file, it is properly suppressed (and issues are ignored), but when running with --alter (with or without --dry-run) these suppressions are ignored!

Examples: before suppression (issue is found): vendor/bin/psalm --no-cache

ERROR: ClassMustBeFinal - src/ReadModel/MyReadModel.php:10:7 - Class ReadModel\MyReadModel is never extended and is not part of the public API, and thus must be made final. (see https://psalm.dev/361)
class MyReadModel

after suppression:

        <ClassMustBeFinal>
            <errorLevel type="suppress">
                <directory name="src/ReadModel"/>
            </errorLevel>
        </ClassMustBeFinal>
------------------------------

       No errors found!

------------------------------

When running with --alter: vendor/bin/psalm --no-cache --alter --issues=ClassMustBeFinal --dry-run

/var/www/api/src/ReadModel/MyreadModel.php:
--- /var/www/api/src/ReadModel/MyreadModel.php
+++ /var/www/api/src/ReadModel/MyreadModel.php
@@ -10,7 +10,7 @@

-class MyReadModel
+final class MyReadModel
 {
    ...

the expectation here is of course that the suppression is respected also when running with --alter.

kochen avatar Apr 29 '25 06:04 kochen