Created
August 15, 2023 15:44
-
-
Save bgoewert/f890845d68fcc0b18a5d4b53f8c4af7b to your computer and use it in GitHub Desktop.
Brennan's WordPress PHPCS Standard. A customized PHPCS Standard that prefers PSR-12 over WPCS. Any WPCS conflicts with PSR-12 are added as exclusions.
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
<?xml version="1.0"?> | |
<ruleset name="Brennan's WordPress PHPCS Standard" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | |
<description>Customized WordPress Coding Standard that prefers PSR-12 over WPCS.</description> | |
<!-- Standards to use --> | |
<config name="default_standard" value="PSR12" /> | |
<config name="installed_paths" value="vendor/wp-coding-standards/wpcs,vendor/phpcompatibility/php-compatibility,vendor/phpcompatibility/phpcompatibility-paragonie,vendor/phpcompatibility/phpcompatibility-wp" /> | |
<!-- What to scan --> | |
<file>.</file> | |
<exclude-pattern>/vendor/</exclude-pattern> | |
<exclude-pattern>/node_modules/</exclude-pattern> | |
<exclude-pattern>/tests/bootstrap.php</exclude-pattern> | |
<!-- How to scan --> | |
<!-- Usage instructions: https://github.com/squizlabs/PHP_CodeSniffer/wiki/Usage --> | |
<!-- Annotated ruleset: https://github.com/squizlabs/PHP_CodeSniffer/wiki/Annotated-ruleset.xml --> | |
<arg value="sp"/> <!-- Show sniff and progress --> | |
<arg name="basepath" value="./"/><!-- Strip the file paths down to the relevant bit --> | |
<arg name="colors"/> | |
<arg name="extensions" value="php"/> | |
<arg name="parallel" value="4"/><!-- Enables parallel processing when available for faster results. --> | |
<!-- Rules: Check PHP version compatibility --> | |
<!-- https://github.com/PHPCompatibility/PHPCompatibility#sniffing-your-code-for-compatibility-with-specific-php-versions --> | |
<config name="testVersion" value="8.0-"/> | |
<!-- Use PSR-12 instead of WordPres Coding Standards --> | |
<rule ref="PSR12"> | |
<!-- This was causing recursive loops. It was causing a conflict with itself. --> | |
<exclude name="PEAR.Functions.FunctionCallSignature"/> | |
</rule> | |
<!-- https://github.com/PHPCompatibility/PHPCompatibilityWP --> | |
<rule ref="PHPCompatibilityWP"/> | |
<!-- Rules: WordPress Coding Standards --> | |
<!-- Exclusions in favor of PSR-12 --> | |
<!-- https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards --> | |
<!-- https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/wiki/Customizable-sniff-properties --> | |
<config name="minimum_supported_wp_version" value="6.3"/> | |
<rule ref="WordPress"> | |
<exclude name="Squiz.WhiteSpace"/> | |
<exclude name="Generic.WhiteSpace"/> | |
<exclude name="Generic.Classes.OpeningBraceSameLine"/> | |
<exclude name="Generic.Functions.OpeningFunctionBraceKernighanRitchie"/> | |
<exclude name="WordPress.WhiteSpace.ControlStructureSpacing"/> | |
<exclude name="WordPress.WhiteSpace.OperatorSpacing"/> | |
<exclude name="WordPress.WhiteSpace.CastStructureSpacing"/> | |
</rule> | |
<rule ref="WordPress.NamingConventions.PrefixAllGlobals"> | |
<properties> | |
<!-- Value: replace the function, class, and variable prefixes used. Separate multiple prefixes with a comma. --> | |
<property name="prefixes" type="array" value="{{CUSTOM_SLUG}}"/> | |
</properties> | |
</rule> | |
<rule ref="WordPress.WP.I18n"> | |
<properties> | |
<!-- Value: replace the text domain used. --> | |
<property name="text_domain" type="array" value="{{CUSTOM_SLUG}}"/> | |
</properties> | |
</rule> | |
<rule ref="WordPress.WhiteSpace.ControlStructureSpacing"> | |
<properties> | |
<property name="blank_line_check" value="true"/> | |
</properties> | |
</rule> | |
</ruleset> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment