Skip to content

Annotate DONOTCACHEPAGE so Plugin Check stops reporting it (1.0.3) - #9

Merged
henry-mosh merged 1 commit into
mainfrom
chore/donotcachepage-annotation
Aug 6, 2026
Merged

Annotate DONOTCACHEPAGE so Plugin Check stops reporting it (1.0.3)#9
henry-mosh merged 1 commit into
mainfrom
chore/donotcachepage-annotation

Conversation

@henry-mosh

Copy link
Copy Markdown
Collaborator

The last Plugin Check run on 1.0.2 came back with exactly two findings, both
the same one: DONOTCACHEPAGE defined 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_DONOTCACHEPAGE would be seen by nothing, and the bot-only responses
this 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.dist excluded 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:ignore annotations on the two define()
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:

330 | ERROR | Global constants defined by a theme/plugin should start with the
    |       | theme/plugin prefix. Found: "DONOTCACHEPAGE".

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

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.
@henry-mosh
henry-mosh merged commit 18d89fe into main Aug 6, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant