<?xml version="1.0"?>
<ruleset name="WordPress Plugin Coding Standards">
  <!-- See https://github.com/squizlabs/PHP_CodeSniffer/wiki/Annotated-ruleset.xml -->
  <!-- See https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/blob/develop/WordPress-Core/ruleset.xml -->

  <!-- Set a description for this ruleset. -->
  <description>A custom set of code standard rules to check for WordPress plugins.</description>

  <!-- Include the WordPress ruleset, with exclusions. -->
  <rule ref="WordPress">
    <!-- Nazi-strict intendation rules we want to exclude -->
    <exclude name="Generic.WhiteSpace.ScopeIndent.IncorrectExact" />
    <exclude name="Generic.WhiteSpace.ScopeIndent.Incorrect" />
    <exclude name="Generic.WhiteSpace.DisallowSpaceIndent.SpacesUsed" />
    <exclude name="Generic.WhiteSpace.DisallowSpaceIndent" />
    <exclude name="PEAR.Functions.FunctionCallSignature.Indent" />
    <exclude name="WordPress.Arrays.ArrayIndentation.ItemNotAligned" />
    <exclude name="WordPress.Arrays.ArrayIndentation.MultiLineArrayItemNotAligned" />
    <exclude name="WordPress.WhiteSpace.DisallowInlineTabs.NonIndentTabsUsed" />
    <exclude name="WordPress.Arrays.ArrayIndentation.CloseBraceNotAligned" />
    <exclude name="PEAR.Functions.FunctionCallSignature.OpeningIndent" />

    <!-- Don't require too strict inline commenting, it's a good thing to documentate, let's not make it frustrating -->
    <exclude name="Squiz.Commenting.FunctionComment.WrongStyle" />
    <exclude name="Squiz.Commenting.ClassComment.WrongStyle" />
    <exclude name="Squiz.Commenting.InlineComment.InvalidEndChar" />
    <exclude name="Squiz.Commenting.FunctionComment.Missing" />
    <exclude name="Squiz.Commenting.FunctionComment.MissingParamTag" />
    <exclude name="Squiz.Commenting.InlineComment.SpacingAfter" />
    <exclude name="Squiz.Commenting.FileComment.Missing" />
    <exclude name="Squiz.Commenting.LongConditionClosingComment.Missing" />

    <!-- General code style related excludes -->
    <exclude name="Squiz.PHP.DisallowMultipleAssignments.Found" />
    <exclude name="Squiz.PHP.EmbeddedPhp.MultipleStatements" />
    <exclude name="Squiz.PHP.EmbeddedPhp.ContentAfterOpen" />
    <exclude name="Squiz.PHP.EmbeddedPhp.ContentBeforeEnd" />
    <exclude name="Generic.Formatting.DisallowMultipleStatements.SameLine" />
    <exclude name="WordPress.Arrays.ArrayDeclarationSpacing.AssociativeKeyFound" />
    <exclude name="WordPress.Arrays.ArrayDeclarationSpacing.AssociativeArrayFound" />
    <exclude name="Squiz.ControlStructures.ControlSignature.NewlineAfterOpenBrace" />
    <exclude name="PHPCompatibility.PHP.NewFunctionArrayDereferencing.Found" />

    <!-- General WordPress stuff we like to overrule -->
    <exclude name="WordPress.Files.FileName.InvalidClassFileName" />

    <!-- Very strict VIP/discouraged rules that are not needed -->
    <exclude name="WordPress.VIP.RestrictedFunctions" />
    <exclude name="WordPress.VIP.AdminBarRemoval.RemovalDetected" />
    <exclude name="WordPress.VIP.OrderByRand" />
    <exclude name="WordPress.VIP.OrderByRand.orderby" />
    <exclude name="WordPress.VIP.ValidatedSanitizedInput.MissingUnslash" />
    <exclude name="WordPress.XSS.EscapeOutput.OutputNotEscaped" />
    <exclude name="WordPress.Functions.DontExtract.extract_extract" />
    <exclude name="Generic.Functions.FunctionCallArgumentSpacing.TooMuchSpaceAfterComma" />
    <exclude name="Generic.Commenting.DocComment.MissingShort" />
    <exclude name="Squiz.PHP.EmbeddedPhp.NoSemicolon" />
    <exclude name="PHPCompatibility.PHP.NewClosure.Found" />

    <!-- EditorConfig makes sure this happens anyway & false positives happen with this -->
    <exclude name="Generic.Files.EndFileNewline.NotFound" />
  </rule>
</ruleset>
