Hold changed lines and new files to the full WordPress standard#714
Open
obenland wants to merge 1 commit into
Open
Hold changed lines and new files to the full WordPress standard#714obenland wants to merge 1 commit into
obenland wants to merge 1 commit into
Conversation
Add phpcs-clean.xml.dist: the stock WordPress coding standard with no sniff exclusions, only the environment config (minimum_wp_version, testVersion, PHPCompatibilityWP) and the shared file/vendor exclude-patterns. Point phpcs-branch.php at this ruleset for both the changed-lines path (modified files) and the whole-file path (new files), so newly written code is held to the unmodified standard while the existing tree is only checked on the lines a branch actually touches. phpcs.xml.dist is untouched and remains the lenient baseline for the whole-repo `composer lint`. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0178d9rQN6YbCuz5LetN7Rzi
|
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. |
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.
Let's use
WordPressas our coding standard. With AI writing most of our code now, it's trivial to have it conform new and updated code to the full standard, and everyone reading the code get to benefit from it.What
Adds
phpcs-clean.xml.dist— the stock WordPress coding standard with no sniff exclusions — and points the branch linter (.github/bin/phpcs-branch.php) at it. Newly written code is now held to the unmodified standard, while the existing tree is only ever checked on the lines a branch actually touches.How it works
The linter already scopes itself to changed lines + new files:
phpcs-changed, reporting only on lines the branch changed.phpcson the whole file.Both paths now pass
--standard=./phpcs-clean.xml.dist. Existing code is untouched until someone edits it.Scope of each ruleset
phpcs.xml.distcomposer lint(whole repo) — unchangedphpcs-clean.xml.distWordPress, no exclusionsphpcs-branch.php(changed lines + new files)phpcs-clean.xml.distkeeps only the environment config (minimum_wp_version,testVersion,PHPCompatibilityWP) and the shared file/vendorexclude-patterns.Note
The stock
WordPress.WP.Capabilitiessniff is now active on changed code and will flag wporg-specific custom capabilities as unknown. When that happens, the cap gets documented in place rather than silenced:Because this only fires on changed lines and new files, the list grows only with caps that actually touch new code.
🤖 Generated with Claude Code
https://claude.ai/code/session_0178d9rQN6YbCuz5LetN7Rzi