ci: move PHPCS settings to own config

This commit is contained in:
Ben Goldsworthy 2021-05-02 20:44:00 +01:00
parent 8bb41c7a7a
commit 760e7cc2d0
2 changed files with 32 additions and 2 deletions

View file

@ -11,8 +11,8 @@
"build": "./_tools/build.sh",
"lint": "composer run lint:php; npm run lint",
"lint:fix": "composer run lint:php:fix; npm run lint:fix",
"lint:php": "./vendor/bin/phpcs --standard=WordPress,PHPCompatibilityWP --runtime-set testVersion 7.4- --colors --encoding=utf-8 -p --ignore=index.php ./src/*.php ./src/*/*.php ./src/*/*/*.php",
"lint:php:fix": "./vendor/bin/phpcbf --standard=WordPress,PHPCompatibilityWP --runtime-set testVersion 7.4- --colors --encoding=utf-8 -p --ignore=index.php ./src/*.php ./src/*/*.php ./src/*/*/*.php",
"lint:php": "./vendor/bin/phpcs",
"lint:php:fix": "./vendor/bin/phpcbf",
"lint:css": "npm run lint:css",
"lint:css:fix": "npm run lint:css:fix",
"lint:js": "npm run lint:js",

30
phpcs.xml.dist Normal file
View file

@ -0,0 +1,30 @@
<?xml version="1.0"?>
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="PHP_CodeSniffer" xsi:noNamespaceSchemaLocation="phpcs.xsd">
<description>The coding standard for PHP_CodeSniffer itself.</description>
<file>src</file>
<exclude-pattern>index.php</exclude-pattern>
<arg name="extensions" value="php"/>
<arg name="encoding" value="utf-8"/>
<arg name="colors"/>
<arg name="parallel" value="75"/>
<arg value="sp"/>
<config name="testVersion" value="8.0"/>
<rule ref="WordPress"/>
<rule ref="PHPCompatibilityWP"/>
<!-- `WordPress` is incompatible with PHP 8.0 -->
<rule ref="WordPress">
<exclude name="Squiz.PHP.CommentedOutCode.Found"/>
<exclude name="Squiz.Commenting.FunctionComment.MissingParamTag"/>
<exclude name="Squiz.Commenting.VariableComment.Missing"/>
<exclude name="Squiz.Commenting.VariableComment.MissingVar"/>
<exclude name="Generic.PHP.Syntax.PHPSyntax"/>
</rule>
</ruleset>