Repository navigation
chore: make the PHPCS ruleset runnable and gate changed files in CI - #356
Merged
arifulhoque7 merged 2 commits intoSep 8, 2026
Merged
Conversation
The committed .phpcs.xml.dist was the stock WPCS scaffold, never adapted:
prefixes and text_domain both "my-plugin", testVersion 5.3-, WordPress 4.6.
On WPCS 3.x it does not even start, because WordPress.VIP was removed in
WPCS 2.0:
ERROR: Referenced sniff "WordPress.VIP" does not exist.
No workflow ran PHPCS either, so the standard has never been enforced here.
The replacement follows the WPUF rulesets: same shape, same exclusions, with
the weDocs text domain and prefixes and the real 7.4 / WP 6.6 floors. Space
indentation is excluded because the plugin is indented with spaces and
enforcing tabs would rewrite every line. Escaping stays on, unlike WPUF,
since that sniff is what caught the unescaped output in the Elementor PR.
CI lints only the PHP files a change touches. A full-tree run would fail
every build on legacy violations, which teaches everyone to ignore the job.
Claude-Session: https://claude.ai/code/session_019wvVjJ8agR8TWAVrrKVESH
Takes the changed-file list from 'git diff HEAD^1 HEAD' on the merge commit rather than the pull request files API, matching Dokan. No token, no pagination limit, and a depth-2 checkout is all it needs. Also adds the paths filter and the concurrency group from that workflow. Claude-Session: https://claude.ai/code/session_019wvVjJ8agR8TWAVrrKVESH
arifulhoque7
added a commit
that referenced
this pull request
Sep 8, 2026
Brings the branch up to date with develop: the PHPCS ruleset and workflow (#356) and the Requires PHP header (#355). No conflicts, and nothing in the Elementor work is touched. Claude-Session: https://claude.ai/code/session_019wvVjJ8agR8TWAVrrKVESH
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.
The committed
.phpcs.xml.distwas the stock WPCS scaffold, never adapted to this plugin:prefixesandtext_domainboth left asmy-plugin,testVersion 5.3-, WordPress floor 4.6. On WPCS 3.x it does not even start:WordPress.VIPwas removed in WPCS 2.0. No workflow ran PHPCS either, so the standard has never actually been enforced in this repo.The ruleset
Renamed to
phpcs.xml.distand rewritten to follow the WPUF rulesets, so the four weDevs plugins look the same: same shape, same severity-0 list, with the weDocs text domain andWeDevs\WeDocsprefix and the real floors from the plugin header (testVersion 7.4-, WP 6.6).Two deliberate choices:
Space indentation is excluded. A plain
WordPressruleset reports 92.7% of its findings as one sniff,Generic.WhiteSpace.DisallowSpaceIndent. This plugin is indented with four spaces. Enforcing tabs would rewrite every line and throw away the blame history, which is not worth it for a formatting preference. WPUF made the same call.Escaping stays ON. Both WPUF rulesets set
WordPress.Security.EscapeOutput.OutputNotEscapedto severity 0. I kept it as an error here. It is the sniff that found the unescaped output in the Elementor widgets PR (wedocs-plugin#324, 35 hits), and silencing it is how that ships unnoticed.CI gates changed files only
.github/workflows/phpcs.ymlmirrors the WPUFInspectionsworkflow:on: pull_request,cs2pr --graceful-warningsfor inline annotations, and the changed-file list from the PR files API. The rest of the plugin still carries legacy violations, so a full-tree run would fail every build and teach everyone to ignore the job.Two small upgrades over the WPUF copy:
actions/checkout@v7andactions/cache@v4instead of@v2and the third-partypat-s/always-upload-cache@v1.1.4, and?per_page=100on the files API so a large PR is not silently truncated at 30.One divergence, with a reason
The tools are installed into
$RUNNER_TEMP, not the plugin's ownvendor/.weDocs lists
includes/functions.phpin composer'sautoload.files, and that file calls WordPress functions at file scope (wedocs_is_plugin_active()at :397,add_actionat :583 and :584,add_filterat :613). PHPCS includesvendor/autoload.phpwhen it exists, so installing the tooling in the plugin's ownvendor/makes phpcs fatal before it lints anything:The fix is a one-line
if ( ! defined( 'ABSPATH' ) ) { return; }guard at the top of that file, which I verified locally: with it,composer installruns the dealerdirect installer,installed_pathsis set, andphpcs -ilists the WordPress standards.I deliberately left that guard out of this PR. Adding it makes this PR touch
includes/functions.php, which then falls under the new gate, and that file reports 44 non-formatting violations including unslashed$_SERVERreads inwedocs_get_client_ip(), unescaped output, and missing nonce checks. Those need their own review, not a ride-along in a tooling change. Filed as weDevsOfficial/wedocs-pro#420 with the full list and the order to do it in.WPUF is unaffected by this: neither WPUF repo has an
autoload.filesentry. weDocs Pro has one but itsfunctions.phphas no file-scope calls, so weDevsOfficial/wedocs-pro#419 usesvendor/bin/phpcsnormally.Verified
This PR changes no PHP, so its own inspection run reports nothing to check.
Locally, against the files this release touches:
Related: weDevsOfficial/plugin-internal-tasks#9, weDevsOfficial/wedocs-pro#419, weDevsOfficial/wedocs-pro#420
https://claude.ai/code/session_019wvVjJ8agR8TWAVrrKVESH