Skip to content

Instantly share code, notes, and snippets.

@mslepko
Created March 14, 2024 10:02
Show Gist options
  • Save mslepko/6ad786fd9f5e7044d867c901ef94e981 to your computer and use it in GitHub Desktop.
Save mslepko/6ad786fd9f5e7044d867c901ef94e981 to your computer and use it in GitHub Desktop.
phpcs config for WordPress related projects
<?xml version="1.0"?>
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="WordPress Coding Standards" xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/PHPCSStandards/PHP_CodeSniffer/master/phpcs.xsd">
<description>The Coding standard for the WordPress.</description>
<file>.</file>
<exclude-pattern>/docroot/wp-admin/*</exclude-pattern>
<exclude-pattern>/docroot/wp-includes/*</exclude-pattern>
<exclude-pattern>/docroot/wp-*.php</exclude-pattern>
<exclude-pattern>/docroot/index.php</exclude-pattern>
<exclude-pattern>/docroot/xmlrpc.php</exclude-pattern>
<exclude-pattern>/docroot/wp-content/plugins/*</exclude-pattern>
<exclude-pattern>/vendor/*</exclude-pattern>
<exclude-pattern>/node_modules/*</exclude-pattern>
<exclude-pattern>*.min.js</exclude-pattern>
<arg name="extensions" value="php"/>
<arg value="ps"/>
<arg name="basepath" value="."/>
<arg name="parallel" value="8"/>
<rule ref="WordPress">
<exclude name="WordPress.PHP.YodaConditions.NotYoda"/>
<exclude name="WordPress.PHP.StrictInArray.MissingTrueStrict"/>
<exclude name="Squiz.Commenting.FileComment.MissingPackageTag"/>
<exclude name="WordPress.Files.FileName.NotHyphenatedLowercase"/>
<exclude name="WordPress.Files.FileName.InvalidClassFileName"/>
<exclude name="Universal.Classes.RequireFinalClass.NonFinalClassFound"/>
</rule>
</ruleset>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment