You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using the phpcs:disable, phpcs:enable pattern and subsequently an annotation phpcs:ignore is made, the phpcs:ignore is not ignoring the flag anymore.
A short example:
/**
* Disable WPCS rules
*
* Note to reviewers:
* (Whatever message here)
* phpcs:disable WordPress.Security.NonceVerification.Recommended
* phpcs:disable WordPress.Security.ValidatedSanitizedInput.InputNotValidated
*/
[Whatever related code here]
/**
* Enableble WPCS rules
* phpcs:enable WordPress.Security.NonceVerification.Recommended
* phpcs:enable WordPress.Security.ValidatedSanitizedInput.InputNotValidated
*/
[Some more code]
// phpcs:ignore WordPress.Security.NonceVerification.Recommended
[Whatever other related code here]
In this example, the last annotation will not "work", meaning that [Whatever other related code here] is still flagged even if we ignore the specific rule.
This does not happen, if we do not use the disable/enable pattern prior to the ignore annotation.
I am aware that this might be a PHPCS issue rather than a WPCS issue, I have however not found any such related complaint when looking for this issue in PHPCS-only related topics.
Has anyone here experienced the same, and/or resolved it?
(other than just keep using enable/disable for all other annotations too)
The text was updated successfully, but these errors were encountered:
@smileBeda This is 100% a PHPCS issue and nothing to do with WPCS.
I'm surprised to hear about this though and would like to see some real code to test with as I tested that feature extensively when it came out and fixed any and all bugs I could find at the time.
@smileBeda Just to satisfy my curiousity I've just tested this with a sniff I was working on and some test code for that sniff, using the pattern of annotations for your example, and I cannot reproduce the issue.
This will need a solid reproduction sample if you want to report this upstream (as otherwise I will have to close the issue there just the same).
Bug Description
When using the
phpcs:disable
,phpcs:enable
pattern and subsequently an annotationphpcs:ignore
is made, thephpcs:ignore
is not ignoring the flag anymore.A short example:
In this example, the last annotation will not "work", meaning that
[Whatever other related code here]
is still flagged even if we ignore the specific rule.This does not happen, if we do not use the
disable/enable
pattern prior to theignore
annotation.I am aware that this might be a PHPCS issue rather than a WPCS issue, I have however not found any such related complaint when looking for this issue in PHPCS-only related topics.
Has anyone here experienced the same, and/or resolved it?
(other than just keep using
enable/disable
for all other annotations too)The text was updated successfully, but these errors were encountered: