Add repository-wide PHPCS specification and PR enforcement workflow#573
Add repository-wide PHPCS specification and PR enforcement workflow#573dd32 wants to merge 3 commits intoWordPress:trunkfrom
Conversation
Introduces PHP coding standards enforcement modeled after WordCamp.org: - phpcs.xml.dist with WordPress-Core, WordPress-Docs, and WordPress-Extra rules - PHPCompatibility checks for PHP 8.4+ - GitHub Actions workflow that only flags new violations via phpcs-changed - Root composer.json with dev dependencies for local and CI linting Fixes WordPress#571. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
- Bumps minimum_wp_version from 6.8 to 6.9 - Excludes plugin-directory/libs, theme-directory/lib, and wpf-stripe/stripe-php Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Existing PHPCS Violations ReportBaseline scan of the repository with third-party libraries excluded. 21,885 errors and 9,890 warnings across 1,133 files (19,974 auto-fixable by Top 30 Violations by Count
Summary by Category
344 distinct sniff sources total, 141 of which are auto-fixable. Sniff RecommendationsBased on this baseline, here are suggested changes to the Sniffs to consider excluding (high noise, low signal for this codebase)
Sniffs to consider enabling explicitly (currently active, high value)
Since this workflow only flags new violations on changed lines (via |
- Squiz.Commenting.InlineComment.InvalidEndChar (1,858 violations) - Squiz.Commenting.FunctionComment.Missing (1,257) - Squiz.Commenting.FunctionComment.ParamCommentFullStop (217) - WordPress.WP.Capabilities.Unknown (266) - Squiz.PHP.CommentedOutCode.Found (224) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Take two, I missed composer.json in [14754]. Closes #573 git-svn-id: https://meta.svn.wordpress.org/sites/trunk@14755 74240141-8908-4e6f-9713-ba540dce6ec7
Summary
phpcs.xml.distwith WordPress-Core, WordPress-Docs, and WordPress-Extra rules (modeled after WordCamp.org), including PHPCompatibility checks for PHP 8.4+phpcs-changedto only flag new violations on changed lines, avoiding noise from pre-existing issuescomposer.jsonwith dev dependencies for local linting (composer lint,composer phpcs-changed)vendor/to.gitignoreThis replaces the approach in #572 with one consistent with how WordCamp.org handles PHPCS — using
phpcs-changedto incrementally enforce standards without blocking PRs on pre-existing violations.Fixes #571.
Test plan
composer install && composer lintworks locallycomposer phpcs-changedworks locally against trunk🤖 Generated with Claude Code