Skip to content

Commit

Permalink
Cleaning up phpcs.xml
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronware committed Feb 9, 2022
1 parent 77cfa6c commit c1eae3f
Show file tree
Hide file tree
Showing 6 changed files with 123 additions and 23 deletions.
11 changes: 10 additions & 1 deletion .distignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,13 @@ renovate.json
.distignore
.gitignore
.editorconfig
.gitattributes
.gitattributes
.phplint.yml
.vipgoci_lint_skip_folders
.vipgoci_phpcs_skip_folders
composer.lock
config.yml
courier-notices.code-workspace
gulpfile.babel.js
phpcs.xml
renovate.json
8 changes: 8 additions & 0 deletions .phplint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
path: ./
jobs: 10
cache: build/phplint.cache
extensions:
- php
exclude:
- vendor
warning: true
7 changes: 7 additions & 0 deletions .vipgoci_lint_skip_folders
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
node_modules
vendor
.github
.deployment
assets
sourcedata
wsdl
7 changes: 7 additions & 0 deletions .vipgoci_phpcs_skip_folders
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
node_modules
vendor
.github
.deployment
assets
sourcedata
wsdl
4 changes: 3 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@
],
"coverage": [
"@php ./vendor/phpunit/phpunit/phpunit"
]
],
"lint-fix": "phpcbf .",
"php-cs-fixer": "./vendor/friendsofphp/php-cs-fixer/php-cs-fixer fix ./ --config=./.php-cs-fixer.dist.php"
}
}
109 changes: 88 additions & 21 deletions phpcs.xml
Original file line number Diff line number Diff line change
@@ -1,22 +1,89 @@
<?xml version="1.0"?>
<ruleset name="LinchpinPHPCS">
<description>Linchpin WordPress Project PHPCS Sniffs</description>

<rule ref="WordPress">
<exclude name="WordPress.Files.FileName.NotHyphenatedLowercase" />
<exclude name="WordPress.Files.FileName.InvalidClassFileName" />
<exclude name="Generic.Arrays.DisallowShortArraySyntax.Found" />
</rule>

<rule ref="PHPCompatibility"/>
<config name="testVersion" value="7.3-"/>

<arg name="extensions" value="php"/>
<arg value="s"/>

<exclude-pattern>node_modules/*</exclude-pattern>
<exclude-pattern>vendor/*</exclude-pattern>
<exclude-pattern>.github/*</exclude-pattern>
<exclude-pattern>.deployment/*</exclude-pattern>
<exclude-pattern>/src/Helper/WP_List_Table.php</exclude-pattern>
</ruleset>
<ruleset name="LinchpinPHPCS"
namespace="WordPressCS\WordPress"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/squizlabs/PHP_CodeSniffer/master/phpcs.xsd">
<description>Linchpin WordPress Project PHPCS Sniffs</description>

<!-- Only scan PHP files. -->
<arg name="extensions" value="php"/>
<!-- Trim our base path for easier reading -->
<arg name="basepath" value="."/>
<arg name="colors"/>

<rule ref="Generic.Arrays.DisallowShortArraySyntax.Found">
<severity>0</severity>
</rule>

<config name="testVersion" value="7.4-"/>

<!-- Pass some flags to PHPCS:
p flag: Show progress of the run.
s flag: Show sniff codes in all reports.
-->
<arg value="ps"/>

<!-- Check up to 8 files simultaneously. -->
<arg name="parallel" value="8"/>

<!-- Check all files in this directory and the directories below it. -->
<file>.</file>

<!-- Exclude directories. -->
<exclude-pattern type="relative">\.github/*</exclude-pattern>
<exclude-pattern type="relative">\.deployment/*</exclude-pattern>
<exclude-pattern type="relative">\.wordpress-org/*</exclude-pattern>
<exclude-pattern type="relative">assets/*</exclude-pattern>
<exclude-pattern type="relative">wiki/*</exclude-pattern>
<exclude-pattern type="relative">vendor/*</exclude-pattern>
<exclude-pattern type="relative">node_modules/*</exclude-pattern>
<exclude-pattern type="relative">tests/*</exclude-pattern>
<exclude-pattern type="relative">templates/*</exclude-pattern>
<exclude-pattern type="relative">gulpfile\.js</exclude-pattern>
<exclude-pattern type="relative">*.css*</exclude-pattern>
<exclude-pattern type="relative">*.js*</exclude-pattern>
<exclude-pattern type="relative">^build/*</exclude-pattern>

<config name="minimum_supported_wp_version" value="5.7" />
<config name="testVersion" value="7.0-" />

<rule ref="WordPress">
<exclude name="WordPress.WP.GlobalVariablesOverride.Prohibited" />
<exclude name="Generic.ControlStructures.InlineControlStructure.NotAllowed" />
<!-- PSR4 -->
<exclude name="WordPress.Files.FileName.InvalidClassFileName" />
<exclude name="WordPress.Files.FileName.NotHyphenatedLowercase" />

<!-- PSR2 -->
<exclude name="Squiz.WhiteSpace.ControlStructureSpacing" />
<exclude name="Squiz.WhiteSpace.OperatorSpacing" />

<exclude name="Generic.Arrays.DisallowLongArraySyntax.Found" />
<exclude name="Generic.Arrays.DisallowShortArraySyntax.Found" />
</rule>

<rule ref="WordPress-Extra">
<exclude name="Generic.WhiteSpace.ScopeIndent.IncorrectExact" />
<exclude name="Generic.WhiteSpace.ScopeIndent.Incorrect" />
<exclude name="PEAR.Functions.FunctionCallSignature.Indent" />
<exclude name="WordPress.Files.FileName.NotHyphenatedLowercase" />
<exclude name="WordPress.Arrays.ArrayDeclarationSpacing.AssociativeKeyFound" />
</rule>

<!-- Not interested in whitespace issues in JS and CSS files at the moment -->
<rule ref="Squiz.WhiteSpace">
<exclude-pattern>*\.css</exclude-pattern>
<exclude-pattern>*\.js</exclude-pattern>
</rule>
<rule ref="WordPress.WhiteSpace">
<exclude-pattern>*\.css</exclude-pattern>
<exclude-pattern>*\.js</exclude-pattern>
</rule>

<rule ref="Generic.Files.EndFileNewline">
<exclude-pattern>*\.css</exclude-pattern>
<exclude-pattern>*\.js</exclude-pattern>
</rule>

<config name="testVersion" value="5.2-"/>
</ruleset>

0 comments on commit c1eae3f

Please # to comment.