-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SideEffectsSniff does not obey localised ignore annotations #327
Comments
If you want to exclude, for example, a file called bootstrap.php, you can put this into your ruleset.xml file: <rule ref="PSR1.Files.SideEffects">
<exclude-pattern>*/bootstrap.php</exclude-pattern>
</rule> This stops that specific sniff from running on files that match the exclude pattern. You can use a regular expression in there if you need to. For this particular sniff, it doesn't make sense to ignore specific lines in a file because it is a whole-file sniff. It checks everything in the file and then reports 1 error, no matter how many side effects are found. So excluding the whole file is the best way to do things for this one. Does that help solve your problem? |
That makes sense. I was looking for an annotation to exclude a specific sniff, but the XML will work. Thanks for the quick response! |
From version 3.2, you'll be able to add the following comment to the top of your file to disable this sniff for a single file: See issue #604 for more details. |
…b_actions/peter-evans/create-pull-request-6 GH Actions: Bump peter-evans/create-pull-request from 5 to 6
It would be useful to ignore the SideEffectsSniff on certain files and/or lines.
A good example is a bootstrap file that sets INI values, includes files, defines constants, and declares functions/classes (autoloaders, etc).
The text was updated successfully, but these errors were encountered: