Skip to content

Instantly share code, notes, and snippets.

@Rarst
Created August 27, 2020 12:57
Show Gist options
  • Save Rarst/62fbcc5dd89a7b6a304242a7c72079a2 to your computer and use it in GitHub Desktop.
Save Rarst/62fbcc5dd89a7b6a304242a7c72079a2 to your computer and use it in GitHub Desktop.
My personal PHPCS ruleset for WP projects.
<?xml version="1.0"?>
<ruleset name="WordPress-Modified">
<description>A custom coding standard.</description>
<rule ref="CognitiveComplexity.Complexity.MaximumComplexity">
<properties>
<property name="maxCognitiveComplexity" value="5"/>
</properties>
</rule>
<rule ref="WordPress">
<exclude name="WordPress.PHP.DiscouragedFunctions.Discouraged" />
<exclude name="WordPress.PHP.DevelopmentFunctions" />
<exclude name="WordPress.NamingConventions.ValidFunctionName" />
<exclude name="WordPress.NamingConventions.ValidVariableName" />
<!--<exclude name="WordPress.WP.PreparedSQL.NotPrepared" />-->
<exclude name="Generic.Commenting.DocComment.MissingShort" />
<exclude name="Generic.Arrays.DisallowShortArraySyntax.Found" />
<exclude name="Squiz.Commenting.FileComment" />
<exclude name="Squiz.Commenting.FunctionComment" />
<exclude name="Squiz.Commenting.VariableComment" />
<exclude name="Squiz.Commenting.ClassComment" />
<exclude name="Squiz.Commenting.InlineComment.SpacingAfter" />
<exclude name="Squiz.PHP.CommentedOutCode.Found" />
<exclude name="WordPress.Files.FileName" />
<exclude name="Generic.Files.LowercasedFilename.NotFound" />
<exclude name="PEAR.Functions.FunctionCallSignature" />
<exclude name="WordPress.WhiteSpace.ScopeIndent.Incorrect" />
<exclude name="WordPress.WhiteSpace.PrecisionAlignment.Found" />
<exclude name="Generic.WhiteSpace.DisallowSpaceIndent.SpacesUsed" />
<exclude name="WordPress.DB.DirectDatabaseQuery" />
</rule>
</ruleset>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment