Skip to content

Remove the unused PHPCS rulesets and widen the workflow triggers - #258

Merged
eason9487 merged 3 commits into
trunkfrom
chore/clean-up-phpcs-config
Jul 31, 2026
Merged

Remove the unused PHPCS rulesets and widen the workflow triggers#258
eason9487 merged 3 commits into
trunkfrom
chore/clean-up-phpcs-config

Conversation

@eason9487

Copy link
Copy Markdown
Member

Changes proposed in this Pull Request:

  • packages/php/compat-checker: removes phpcs.xml, composer.lock, and the require-dev and config.allow-plugins blocks from composer.json. All of it existed to supply the WooCommerce-Core standard for that one ruleset.
    • This also resolves the Dependabot alert 213, which flagged wp-coding-standards/wpcs 2.3.0 in packages/php/compat-checker/composer.lock for arbitrary command execution in the WordPress.WP.EnqueuedResourceParameters sniff (GHSA-3pwp-g2mj-5p3v).
  • plugins/grow-smooth-generator: removes phpcs.xml.dist. Its composer.json and composer.lock stay, since composer/installers is a real dependency that drives wordpress-plugin install paths.
  • .github/workflows/php-coding-standards.yml: adds **/composer.json, **/composer.lock and phpcs.xml.dist to the trigger paths. The existing manifest entries are root anchored, so a change like the two above started no run at all.

Why removing the two rulesets is safe:

  • The root phpcs.xml.dist already scans ./plugins and ./packages/php, which is exactly the source both local rulesets pointed at. No source file changes here, and CI still lints all of it.
  • Nothing ran them. CI runs PHPCS from the repository root, and Composer never installs a dependency's require-dev, so the extensions consuming compat-checker never saw it either.
  • Neither was runnable as written. Both reference WooCommerce-Core, which the root install has never provided, so running either fails at ERROR: Referenced sniff "WooCommerce-Core" does not exist. before reaching any rule.

The published compat-checker branch keeps serving the extensions that install the library through "woocommerce/grow": "dev-compat-checker". The package has no production dependencies, so their installs are unchanged.

Detailed test instructions:

  1. Check out this branch.
  2. Confirm the compat-checker manifest is still valid, from inside packages/php/compat-checker.
  3. From the repository root, confirm the root ruleset still lints both trees.
  4. Confirm the full tree still passes.
  5. Confirm the "PHP coding standards" check runs on this pull request, and that it passes.

The package carried its own phpcs ruleset from before this repo had any
PHP linting. Commit 609203b added the root `phpcs.xml.dist` and the
coding standards workflow in April 2024, and the root ruleset already
scans `./packages/php`, so the package copy has been redundant since.

The dependency existed only to supply the `WooCommerce-Core` standard that
ruleset referenced. The root install has never provided that standard and
never needed to, since the package source already passes the root ruleset.

Nothing runs the package copy. CI lints from the repo root, and Composer
never installs a dependency's require-dev, so the extensions consuming this
library never saw it either. Dropping it also drops the lock file that
carried the vulnerable WPCS version, which resolves the advisory by
removing the dependency rather than bumping it.
Like the `compat-checker` one removed in the previous commit, this ruleset
predates repo-wide PHP linting. Commit 609203b added the root
`phpcs.xml.dist` in April 2024, and its `<file>` entries already cover
`./plugins`.

This copy has never been runnable here. It references the `WooCommerce-Core`
standard, which ships in `woocommerce/woocommerce-sniffs`, and the plugin has
required only `composer/installers` since it was added. Running it fails at
`Referenced sniff "WooCommerce-Core" does not exist` before reaching any rule.

The plugin's `composer.json` and `composer.lock` stay, since
`composer/installers` drives the `wordpress-plugin` install path.
The `composer.json` and `composer.lock` trigger paths are root anchored, so a
change to `packages/php/compat-checker/composer.json` or any other nested
manifest starts no run. That is how the two removals in this branch would have
shipped unchecked.

`phpcs.xml.dist` is missing from the list too, so a change to the ruleset the
job actually enforces never starts a run either.

Both the bare and the `**/` prefixed forms are listed because a bare entry
matches the root file only, and whether a `**/` prefix also matches the root
is not stated in the filter pattern reference.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR removes unused, non-functional PHPCS rulesets/development dependencies from subpackages and updates the PHP coding standards workflow so CI runs when relevant package manifests change.

Changes:

  • Removed plugin/package-local PHPCS rulesets that referenced unavailable sniffs and were not used by CI.
  • Removed packages/php/compat-checker dev-only Composer artifacts (composer.lock, require-dev, and config.allow-plugins) tied to the unused ruleset.
  • Expanded .github/workflows/php-coding-standards.yml path triggers to include nested composer.json/composer.lock changes.

Reviewed changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
plugins/grow-smooth-generator/phpcs.xml.dist Removes an unused local PHPCS ruleset.
packages/php/compat-checker/phpcs.xml Removes an unused local PHPCS ruleset.
packages/php/compat-checker/composer.lock Removes a dev-only lockfile tied to the unused PHPCS setup.
packages/php/compat-checker/composer.json Drops dev-only PHPCS/sniffs configuration from the package.
.github/workflows/php-coding-standards.yml Broadens workflow triggers to include nested Composer manifest changes.
Suppressed comments (1)

.github/workflows/php-coding-standards.yml:23

  • Same as the push trigger: phpcs.xml.dist in pull_request.paths only matches the repo root. Add **/phpcs.xml.dist so changes to nested rulesets (or deletions like the one in this PR) reliably trigger the check.
      - "**/composer.json"
      - "**/composer.lock"
      - phpcs.xml.dist
      - .github/workflows/php-coding-standards.yml

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +11 to 14
- "**/composer.json"
- "**/composer.lock"
- phpcs.xml.dist
- .github/workflows/php-coding-standards.yml

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one does not apply here. Those nested rulesets are exactly what this PR removes, so the root phpcs.xml.dist ends up being the only one left.

@eason9487
eason9487 merged commit 705d982 into trunk Jul 31, 2026
6 checks passed
@eason9487
eason9487 deleted the chore/clean-up-phpcs-config branch July 31, 2026 12:32
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.

2 participants