-
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
Respect all sniffs when reviewing PHP_CodeSniffer itself #3914
Conversation
This was previously ignored due to the use of '-n' to ignore all warnings. There are too many violations of this sniff to warrant fixing these here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fredden I see where you are coming from, but I'm not keen on accepting this.
On the one hand, I presume the n
was added for a reason, so I'm not keen on removing it (though I run locally with w
to show warnings anyway).
On the other hand, the "fixes" being made are IMO wrong. The @link
tag is the correct tag to use for the links and changing the TODO
to to-do
, while the tag name is @todo
feels wrong too.
I think the better approach would be for me to update PR #3912 to change the warning from that sniff to an error.
From what I can tell, this parameter was included in the initial commit and hasn't been changed since. Perhaps @gsherwood can share some information regarding why this was included, but 8.5 years ago is a long time to remember this level of detail.
The sniff The documentation says that The Can you share some more information to help me understand why
Yes, this change I was less sure about. Would you prefer to see these two files excluded from the sniff as false positives? |
Superseded by PHPCSStandards/PHP_CodeSniffer#122 |
Description
While reviewing #3912, I was surprised that
Squiz.PHP.NonExecutableCode
did not seem to complain about anything when running this over the main branch (before applying the changes from that pull request). Upon further investigation, I found that the coding standard included a parameter of-n
, which ignores all warnings by default. Removing this allowed me to properly review #3912.This pull request removes the
-n
parameter and makes the necessary changes to the code-base (including the rule-set) so that no warnings are omitted. This means that when we addSquiz.PHP.NonExecutableCode
to the rule-set for PHP_CodeSniffer itself, the warnings it produces won't be ignored.Suggested changelog entry
Respect warnings as well as errors from sniffs within the coding standard for PHP_CodeSniffer itself.
Types of changes
PR checklist