Skip to content

Fix WordPress Coding Standards CI check#97

Draft
apermo wants to merge 3 commits into
Zodiac1978:developfrom
apermo:fix/wpcs-coding-standards
Draft

Fix WordPress Coding Standards CI check#97
apermo wants to merge 3 commits into
Zodiac1978:developfrom
apermo:fix/wpcs-coding-standards

Conversation

@apermo

@apermo apermo commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

Summary

Makes the WordPress Coding Standards and Plugin Check CI jobs pass.

Coding Standards (3 errors)

  • Add a project .phpcs.xml.dist ruleset that extends the WordPress
    standard and excludes WordPress.Files.FileName.InvalidClassFileName.
    The plugin ships as a single bootstrap file named after the plugin
    (rt-plugin-report.php); renaming it to class-*.php would break the
    entry point, so this sniff does not apply. The ruleset also configures
    the text domain (plugin-report) and global prefixes.
  • Point the CI WPCS step at the ruleset (standard: .phpcs.xml.dist).
  • Exclude .phpcs.xml.dist from the distributed plugin zip via .distignore.
  • Convert the two else { if (...) } blocks in render_table_row() to
    elseif, resolving Universal.ControlStructures.DisallowLonelyIf. This
    also removes the two // phpcs:ignore comments that never took effect —
    they were placed on the if line, but the sniff reports the violation on
    the else line above. Behaviour is unchanged.

Plugin Check (hidden_files / application_files errors)

Plugin Check scans the raw repo checkout, so it flagged .wp-env.json and
.phpcs.xml.dist as hidden/application files (.dist is a flagged
extension). Both are development-only files already excluded from the
distributed plugin via .distignore, so the Plugin Check step now excludes
them with exclude-files. Only ERROR-type results fail the action, so the
remaining warnings (restricted term "plugin" in the name/slug, the
RT_Plugin_Report prefix, auto-update detection, .github directory) are
non-blocking and left untouched — they reflect the established, published
plugin and aren't introduced here.

⚠️ Rebase note

This branch is cut from current develop. Several other open PRs touch
rt-plugin-report.php (e.g. #92). Please rebase this branch once those are
merged
so the elseif refactor applies on top of the final line numbers and
avoids conflicts. Kept as a draft until then.

Disclosure

Claude (Anthropic) assisted with diagnosing the CI failures and preparing this
change. I (the human author) reviewed it and take responsibility for the
contribution.

apermo and others added 2 commits June 21, 2026 20:32
Replace two `else { if (...) }` blocks with `elseif` in the
repository and auto-update columns of render_table_row(). This
resolves the Universal.ControlStructures.DisallowLonelyIf errors
and removes the misplaced phpcs:ignore comments that never took
effect (they sat on the `if` line while the sniff reports on the
`else`). Behaviour is unchanged.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add a project .phpcs.xml.dist that extends the WordPress standard
and excludes WordPress.Files.FileName.InvalidClassFileName, since
the plugin ships as a single bootstrap file named after the plugin
and cannot be renamed to class-*.php. Also configures the text
domain and global prefixes.

Point the CI WPCS step at the ruleset and exclude the ruleset file
from the distributed plugin zip via .distignore.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Plugin Check scans the raw repo checkout, so it flags .wp-env.json
and .phpcs.xml.dist as hidden/application files (.dist is a flagged
extension). Both are development-only files already excluded from
the distributed plugin via .distignore, so exclude them from the
check. Resolves the hidden_files and application_files errors.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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