Open t0mspace opened 2 years ago
Count my vote for this feature. As an example - Phpstan has very usable implementation.
Hi,
The first (internal) version of this tool added a list of rule-specific <exclude-pattern>
tags to the phpcs.xml
. We ultimately switched to inline phpcs:ignore
comments for the following reasons:
phpcs:ignore
comments operate on the line level, while <exclude-pattern>
directives operate on the file level.phpcs:ignore
comments provide direct feedback whenever a violation is suppressed; this is not the case with <exclude-pattern>
tags, which requires a lookup in another file.I hope this clarifies our reasons for the way in which the tool is currently implemented.
Aad
Hello @aadmathijssen Thank you for reaching out!
As I understand with phpcs baseliner phpcs:ignore istatements would be added in the code. So if for example rule causing the warning would be removed or issue fixed manually - ignore statements would still remain in codebase until manually removed. No warning about redundant ignores would fire.
That means there is no way of knowing that ignore statement is no longer relevant.
I'll try to explain my workflow by using phpstan as an example. When baseline is created all issues are written to the file and ignored while checking code. If code has ben fixed or rules of phpstan have been changed in a way that makes excludes obsolete - phpstan throws exception that issues mentioned in the baseline are no longer present. To fix this I remove no longer valid lines from baseline file by running an update command. So there is no need for manual changes to remove no longer relevant ignores.
Please correct me if I don't understand usage of the library correctly.
Hi Isaac,
It would be great to offer the possibility to generate a file with all the baseline like do phpstan, instead of writing it in the source code
Thanks by advance and respect for your work
Tom