Skip to content

Commit ddfe6af

Browse files
GaryJonesclaude
andcommitted
Rename phpcs.xml.dist to .phpcs.xml.dist
This standardizes the PHPCS configuration file naming convention by prefixing it with a dot, making it a hidden file consistent with other configuration files like .editorconfig and .gitignore. Updated all references to the renamed file in composer.json scripts and bin/phpcs-diff.sh. Simplified composer scripts to use auto-discovery of the .phpcs.xml.dist configuration file. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 0532893 commit ddfe6af

File tree

5 files changed

+582
-230
lines changed

5 files changed

+582
-230
lines changed

.phpcs.xml.dist

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
<?xml version="1.0"?>
2+
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="wp-parsely" xsi:noNamespaceSchemaLocation="vendor/squizlabs/php_codesniffer/phpcs.xsd">
3+
<description>Custom ruleset for Edit Flow plugin.</description>
4+
5+
<!-- For help in understanding this file: https://github.com/squizlabs/PHP_CodeSniffer/wiki/Annotated-ruleset.xml -->
6+
<!-- For help in using PHPCS: https://github.com/squizlabs/PHP_CodeSniffer/wiki/Usage -->
7+
8+
<!-- What to scan -->
9+
<file>.</file>
10+
<!-- Ignoring Files and Folders:
11+
https://github.com/squizlabs/PHP_CodeSniffer/wiki/Advanced-Usage#ignoring-files-and-folders -->
12+
<exclude-pattern>/node_modules/</exclude-pattern>
13+
<exclude-pattern>/vendor/</exclude-pattern>
14+
<exclude-pattern>/tests/</exclude-pattern>
15+
16+
<!-- How to scan -->
17+
<!-- Usage instructions: https://github.com/squizlabs/PHP_CodeSniffer/wiki/Usage -->
18+
<!-- Annotated ruleset: https://github.com/squizlabs/PHP_CodeSniffer/wiki/Annotated-ruleset.xml -->
19+
<!-- Show sniff and progress -->
20+
<arg value="sp"/>
21+
<!-- Strip the file paths down to the relevant bit -->
22+
<arg name="basepath" value="./"/>
23+
<!-- Show results with colors -->
24+
<arg name="colors"/>
25+
<!-- Limit to PHP files -->
26+
<arg name="extensions" value="php"/>
27+
<!-- Enables parallel processing when available for faster results. -->
28+
<arg name="parallel" value="8"/>
29+
30+
<!-- Rules: Check PHP version compatibility - see
31+
https://github.com/PHPCompatibility/PHPCompatibilityWP -->
32+
<rule ref="PHPCompatibilityWP"/>
33+
<!-- For help in understanding this testVersion:
34+
https://github.com/PHPCompatibility/PHPCompatibility#sniffing-your-code-for-compatibility-with-specific-php-versions -->
35+
<config name="testVersion" value="8.0-"/>
36+
37+
<!-- Rules: WordPress Coding Standards - see
38+
https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards -->
39+
<!-- WordPress-Extra includes WordPress-Core -->
40+
<rule ref="WordPress-Extra"/>
41+
<rule ref="WordPress-Docs"/>
42+
<!-- For help in understanding these custom sniff properties:
43+
https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/wiki/Customizable-sniff-properties -->
44+
<config name="minimum_supported_wp_version" value="6.4"/>
45+
46+
<!-- Rules: WordPress VIP - see
47+
https://github.com/Automattic/VIP-Coding-Standards -->
48+
<rule ref="WordPress-VIP-Go">
49+
<!-- These disallow anonymous functions as action callbacks -->
50+
<exclude name="PEAR.Functions.FunctionCallSignature.ContentAfterOpenBracket" />
51+
<exclude name="PEAR.Functions.FunctionCallSignature.MultipleArguments" />
52+
<exclude name="PEAR.Functions.FunctionCallSignature.CloseBracketLine" />
53+
54+
<!-- Allow short array syntax -->
55+
<exclude name="Universal.Arrays.DisallowShortArraySyntax.Found" />
56+
57+
<!-- Do not enforce 'class-' prefix -->
58+
<exclude name="WordPress.Files.FileName.InvalidClassFileName" />
59+
60+
<!-- Allow short ternaries -->
61+
<exclude name="WordPress.PHP.DisallowShortTernary.Found" />
62+
63+
<!-- Generates too many false positives -->
64+
<exclude name="WordPress.WP.CapitalPDangit.Misspelled" />
65+
66+
<!-- We use trigger_error extensively -->
67+
<exclude name="WordPress.PHP.DevelopmentFunctions.error_log_trigger_error" />
68+
69+
<!-- ToDo: Remove these exceptions over time -->
70+
<!-- These are for legacy reasons, as EditFlow's main file cannot be altered -->
71+
<exclude name="WordPress.Files.FileName.NotHyphenatedLowercase" />
72+
<exclude name="Universal.Files.SeparateFunctionsFromOO.Mixed" />
73+
<exclude name="PEAR.NamingConventions.ValidClassName.StartWithCapital" />
74+
<exclude name="PEAR.NamingConventions.ValidClassName.Invalid" />
75+
<!-- Allow not returning after the setup theme filter for now -->
76+
<exclude name="WordPressVIPMinimum.Hooks.AlwaysReturnInFilter.MissingReturnStatement" />
77+
<!-- Localization is done in a legacy manner in some places, and its been left as is for now -->
78+
<exclude name="WordPress.WP.I18n.InterpolatedVariableSingular" />
79+
<exclude name="WordPress.WP.I18n.InterpolatedVariablePlural" />
80+
<exclude name="WordPress.WP.I18n.MissingSingularPlaceholder" />
81+
<exclude name="WordPress.WP.I18n.NonSingularStringLiteralText" />
82+
<!-- This rule is hard to solve given the heavy use of JS in the PHP code right now -->
83+
<exclude name="Squiz.PHP.DisallowMultipleAssignments.FoundInControlStructure" />
84+
<exclude name="WordPress.DateTime.RestrictedFunctions.date_date" />
85+
</rule>
86+
87+
<rule ref="WordPress.NamingConventions.PrefixAllGlobals">
88+
<properties>
89+
<property name="prefixes" type="array">
90+
<element value="ef"/>
91+
<element value="Edit_Flow"/>
92+
</property>
93+
</properties>
94+
</rule>
95+
96+
<rule ref="WordPress.WP.I18n">
97+
<properties>
98+
<property name="text_domain" type="array">
99+
<element value="edit-flow"/>
100+
</property>
101+
</properties>
102+
</rule>
103+
104+
<rule ref="WordPress.WhiteSpace.ControlStructureSpacing">
105+
<properties>
106+
<property name="blank_line_check" value="true"/>
107+
</properties>
108+
</rule>
109+
110+
</ruleset>

bin/phpcs-diff.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ git remote set-branches --add origin master
88
git fetch origin master
99
git diff origin/master > $DIFF_FILE
1010

11-
$DIR/../vendor/bin/phpcs --extensions=php --standard=phpcs.xml.dist --report=json > $PHPCS_FILE || true
11+
$DIR/../vendor/bin/phpcs --extensions=php --standard=.phpcs.xml.dist --report=json > $PHPCS_FILE || true
1212

1313
$DIR/../vendor/bin/diffFilter --phpcs $DIFF_FILE $PHPCS_FILE 100

composer.json

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,13 @@
1616
"require-dev": {
1717
"automattic/vipwpcs": "^3.0",
1818
"exussum12/coverage-checker": "^1.0.0",
19+
"phpcompatibility/phpcompatibility-wp": "^2.1",
1920
"phpunit/phpunit": "^9.0",
2021
"yoast/phpunit-polyfills": "^2.0"
2122
},
2223
"scripts": {
23-
"cs": [
24-
"@php ./vendor/bin/phpcs -p -s -v -n . --standard=\"phpcs.xml.dist\" --extensions=php --ignore=\"/vendor/*,/node_modules/*,/tests/*\""
25-
],
26-
"cbf": [
27-
"@php ./vendor/bin/phpcbf -p -s -v -n . --standard=\"phpcs.xml.dist\" --extensions=php --ignore=\"/vendor/*,/node_modules/*,/tests/*\""
28-
],
24+
"cs": "@php ./vendor/bin/phpcs",
25+
"cs-fix": "@php ./vendor/bin/phpcbf",
2926
"integration": "wp-env run tests-cli --env-cwd=wp-content/plugins/Edit-Flow ./vendor/bin/phpunit",
3027
"integration-ms": "wp-env run tests-cli --env-cwd=wp-content/plugins/Edit-Flow /bin/bash -c 'WP_MULTISITE=1 ./vendor/bin/phpunit'"
3128
},

0 commit comments

Comments
 (0)