Skip to content

Instantly share code, notes, and snippets.

@shrimp2t
Last active January 29, 2019 18:56
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shrimp2t/a1298ae43c1809151ddd464c9c207764 to your computer and use it in GitHub Desktop.
Save shrimp2t/a1298ae43c1809151ddd464c9c207764 to your computer and use it in GitHub Desktop.
Copy it in to ~/.composer/vendor/squizlabs/php_codesniffer/src/Standards/WordPress/ruleset.xml
<?xml version="1.0"?>
<ruleset name="WordPress" namespace="WordPress">
<description>WordPress Coding Standards</description>
<autoload>./PHPCSAliases.php</autoload>
<!--<rule ref="WordPress-Core"/> -->
<rule ref="WordPress-Core">
<exclude name="Generic.Commenting.DocComment.MissingShort" />
<exclude name="Generic.Formatting.MultipleStatementAlignment" />
<exclude name="Squiz.Commenting.ClassComment.Missing" />
<exclude name="Squiz.Commenting.FileComment.Missing" />
<exclude name="Squiz.Commenting.FunctionComment.Missing" />
<exclude name="Squiz.Commenting.FunctionComment.MissingParamComment" />
<exclude name="Squiz.Commenting.VariableComment.Missing" />
<exclude name="Squiz.PHP.EmbeddedPhp.ContentBeforeOpen" />
<exclude name="Squiz.PHP.EmbeddedPhp.ContentAfterOpen" />
<exclude name="Squiz.PHP.EmbeddedPhp.ContentBeforeEnd" />
<exclude name="Squiz.PHP.EmbeddedPhp.ContentAfterEnd" />
<exclude name="WordPress.Arrays.MultipleStatementAlignment" />
<exclude name="WordPress.CSRF.NonceVerification.NoNonceVerification" />
<exclude name="WordPress.Files.FileName.InvalidClassFileName" />
<exclude name="WordPress.Security.EscapeOutput.OutputNotEscaped"/>
<exclude name="WordPress.Security.EscapeOutput.UnsafePrintingFunction" />
<exclude name="WordPress.Security.NonceVerification.NoNonceVerification"/>
<exclude name="WordPress.WP.I18n.MissingTranslatorsComment" />
<exclude name="WordPress.WP.I18n.NonSingularStringLiteralSingle" />
<exclude name="WordPress.WP.I18n.NonSingularStringLiteralPlural" />
<exclude name="WordPress.XSS.EscapeOutput" />
<exclude name="WordPress.XSS.EscapeOutput.OutputNotEscaped" />
<exclude name="WordPress.WP.EnqueuedResources.NonEnqueuedStylesheet" />
<exclude name="WordPress.PHP.StrictComparisons" />
<exclude name="WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid" />
</rule>
<rule ref="WordPress-Docs"/>
<rule ref="WordPress-Extra">
<!-- Even though the VIP sniffs are not included in Extra, this will remove them from the scan. -->
<exclude name="WordPress.VIP"/>
</rule>
<rule ref="WordPress.PHP.DiscouragedPHPFunctions">
<!-- From "VIP": The obfuscation group is excluded as there are plenty of legitimate uses for the base64 functions. -->
<properties>
<property name="exclude" type="array" value="obfuscation"/>
</properties>
</rule>
<!--
#############################################################################
Account for deprecated sniffs.
These directives can be removed when the deprecated sniffs are removed.
#############################################################################
-->
<!-- Prevent deprecation notice when the sniff is not explicitly included. -->
<rule ref="WordPress.WP.PreparedSQL.DeprecatedSniff">
<severity>0</severity>
</rule>
<!-- Prevent duplicate messages from deprecated sniff. -->
<rule ref="WordPress.WP.PreparedSQL.NotPrepared">
<severity>0</severity>
</rule>
<!-- Prevent deprecation notice when the sniff is not explicitly included. -->
<rule ref="WordPress.Functions.DontExtract.DeprecatedSniff">
<severity>0</severity>
</rule>
<!-- Prevent duplicate messages from deprecated sniff. -->
<rule ref="WordPress.Functions.DontExtract.extract_extract">
<severity>0</severity>
</rule>
<!-- Prevent deprecation notice when the sniff is not explicitly included. -->
<rule ref="WordPress.CSRF.NonceVerification.DeprecatedSniff">
<severity>0</severity>
</rule>
<!-- Prevent duplicate messages from deprecated sniff. -->
<rule ref="WordPress.CSRF.NonceVerification.NoNonceVerification">
<severity>0</severity>
</rule>
<!-- Prevent deprecation notice when the sniff is not explicitly included. -->
<rule ref="WordPress.XSS.EscapeOutput.DeprecatedSniff">
<severity>0</severity>
</rule>
<!-- Prevent duplicate messages from deprecated sniff. -->
<rule ref="WordPress.XSS.EscapeOutput.DeprecatedCustomSanitizingFunctions">
<severity>0</severity>
</rule>
<!-- Prevent deprecation notice when the sniff is not explicitly included. -->
<rule ref="WordPress.Variables.GlobalVariables.DeprecatedSniff">
<severity>0</severity>
</rule>
<!-- Prevent duplicate messages from deprecated sniff. -->
<rule ref="WordPress.Variables.GlobalVariables.OverrideProhibited">
<severity>0</severity>
</rule>
<rule ref="WordPress.NamingConventions.ValidHookName">
<properties>
<property name="additionalWordDelimiters" value="/-" />
</properties>
</rule>
</ruleset>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment