Annotate DONOTCACHEPAGE so Plugin Check stops reporting it (1.0.3) - #9
Merged
Conversation
Plugin Check reports both define() calls as unprefixed constants. The constant cannot be prefixed — page caches look for that exact name, so a CITECUE_DONOTCACHEPAGE would be seen by nothing and bot-only responses would start being cached for humans, which is the bug it exists to stop. The exemption was already expressed, but in .phpcs.xml.dist, which only governs this repository's own PHPCS run. Plugin Check brings its own ruleset, so the reviewer saw the warning regardless. Moving it to phpcs:ignore annotations on the two lines makes it travel with the code, which is the route Plugin Check documents for a false positive. The ruleset exclusion is dropped rather than kept alongside: leaving both would mean the local run passes for a reason that has nothing to do with whether the annotations are correct. With it gone, phpcs here fails if an annotation is ever lost — verified by deleting one and watching the sniff fire.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The last Plugin Check run on 1.0.2 came back with exactly two findings, both
the same one:
DONOTCACHEPAGEdefined without a plugin prefix.The constant cannot be renamed. Page caches — W3 Total Cache, WP Super
Cache, WP Rocket, LiteSpeed, Batcache — all check for that exact name. A
CITECUE_DONOTCACHEPAGEwould be seen by nothing, and the bot-only responsesthis plugin emits would start being cached and served to humans. That is the
bug the constant exists to prevent.
So the finding is a false positive, and it was already documented — just
in the wrong place.
.phpcs.xml.distexcluded the sniff for those two files,which governs only this repository's PHPCS run. Plugin Check brings its own
ruleset, so the reviewer saw the warning anyway. That is why our CI was green
while the report was not.
Moving the exemption to
phpcs:ignoreannotations on the twodefine()lines makes it travel with the code, which is the route Plugin Check
documents for a false positive.
The ruleset exclusion is dropped rather than kept alongside. Keeping both
would mean the local run passes for a reason unrelated to whether the
annotations are right. With it gone the sniff is live, so phpcs here fails if
an annotation is ever lost — verified by deleting one:
Scope
No functional change — two comments and a config move. The constant, and
every line that runs, is byte-identical.
Expect a zero-finding Plugin Check report on the 1.0.3 zip.
🤖 Generated with Claude Code