<?xml version="1.0" encoding="UTF-8"?>
<ruleset name="drupal_core">
  <description>Default PHP CodeSniffer configuration for Drupal core.</description>
  <file>.</file>
  <arg name="extensions" value="inc,install,module,php,profile,test,theme"/>

  <!--Exclude third party code.-->
  <exclude-pattern>./assets/vendor/*</exclude-pattern>

  <!--Exclude test files that are intentionally empty, or intentionally violate coding standards.-->
  <exclude-pattern>./modules/system/tests/fixtures/HtaccessTest</exclude-pattern>

  <!-- Only include specific sniffs that pass. This ensures that, if new sniffs are added, HEAD does not fail.-->
  <!-- Drupal sniffs -->
  <rule ref="Drupal.Classes.ClassCreateInstance"/>
  <rule ref="Drupal.Classes.ClassDeclaration"/>
  <rule ref="Drupal.Classes.FullyQualifiedNamespace"/>
  <rule ref="Drupal.Classes.UnusedUseStatement"/>
  <rule ref="Drupal.CSS.ClassDefinitionNameSpacing"/>
  <rule ref="Drupal.CSS.ColourDefinition"/>
  <rule ref="Drupal.Commenting.ClassComment">
    <exclude name="Drupal.Commenting.ClassComment.Missing"/>
  </rule>
  <rule ref="Drupal.Commenting.DocComment">
    <!-- Sniff for these errors: SpacingAfterTagGroup, WrongEnd, SpacingBetween,
      ContentAfterOpen, SpacingBeforeShort, TagValueIndent, ShortStartSpace,
      SpacingAfter -->
    <exclude name="Drupal.Commenting.DocComment.LongNotCapital"/>
    <!-- ParamNotFirst still not decided for PHPUnit-based tests.
      @see https://www.drupal.org/node/2253915 -->
    <exclude name="Drupal.Commenting.DocComment.ParamNotFirst"/>
    <exclude name="Drupal.Commenting.DocComment.SpacingBeforeTags"/>
    <exclude name="Drupal.Commenting.DocComment.LongFullStop"/>
    <exclude name="Drupal.Commenting.DocComment.ShortNotCapital"/>
    <exclude name="Drupal.Commenting.DocComment.ShortFullStop"/>
    <!-- TagsNotGrouped and ParamGroup have false-positives.
      @see https://www.drupal.org/node/2060925 -->
    <exclude name="Drupal.Commenting.DocComment.TagsNotGrouped"/>
    <exclude name="Drupal.Commenting.DocComment.ParamGroup"/>
    <exclude name="Drupal.Commenting.DocComment.ShortSingleLine"/>
    <exclude name="Drupal.Commenting.DocComment.TagGroupSpacing"/>
    <exclude name="Drupal.Commenting.DocComment.MissingShort"/>
  </rule>
  <rule ref="Drupal.Commenting.DocCommentStar"/>
  <rule ref="Drupal.Commenting.FileComment"/>
  <rule ref="Drupal.Commenting.FunctionComment">
    <exclude name="Drupal.Commenting.FunctionComment.IncorrectTypeHint"/>
    <exclude name="Drupal.Commenting.FunctionComment.InvalidNoReturn"/>
    <exclude name="Drupal.Commenting.FunctionComment.InvalidReturnNotVoid"/>
    <exclude name="Drupal.Commenting.FunctionComment.InvalidTypeHint"/>
    <exclude name="Drupal.Commenting.FunctionComment.Missing"/>
    <exclude name="Drupal.Commenting.FunctionComment.MissingFile"/>
    <exclude name="Drupal.Commenting.FunctionComment.MissingParamComment"/>
    <exclude name="Drupal.Commenting.FunctionComment.MissingParamType"/>
    <exclude name="Drupal.Commenting.FunctionComment.MissingReturnComment"/>
    <exclude name="Drupal.Commenting.FunctionComment.MissingReturnType"/>
    <exclude name="Drupal.Commenting.FunctionComment.ParamCommentFullStop"/>
    <exclude name="Drupal.Commenting.FunctionComment.ParamCommentIndentation"/>
    <exclude name="Drupal.Commenting.FunctionComment.ParamCommentNewLine"/>
    <exclude name="Drupal.Commenting.FunctionComment.ParamCommentNotCapital"/>
    <exclude name="Drupal.Commenting.FunctionComment.ParamMissingDefinition"/>
    <exclude name="Drupal.Commenting.FunctionComment.ParamNameNoMatch"/>
    <exclude name="Drupal.Commenting.FunctionComment.ParamTypeSpaces"/>
    <exclude name="Drupal.Commenting.FunctionComment.ReturnCommentIndentation"/>
    <exclude name="Drupal.Commenting.FunctionComment.ReturnTypeSpaces"/>
    <exclude name="Drupal.Commenting.FunctionComment.TypeHintMissing"/>
  </rule>
  <rule ref="Drupal.ControlStructures.ElseIf"/>
  <rule ref="Drupal.ControlStructures.ControlSignature"/>
  <rule ref="Drupal.Files.EndFileNewline"/>
  <rule ref="Drupal.Files.TxtFileLineLength"/>
  <rule ref="Drupal.Formatting.SpaceInlineIf"/>
  <rule ref="Drupal.Formatting.SpaceUnaryOperator"/>
  <rule ref="Drupal.Functions.DiscouragedFunctions"/>
  <rule ref="Drupal.Functions.FunctionDeclaration.SpaceAfter"/>
  <rule ref="Drupal.Functions.FunctionDeclaration.SpaceBeforeParenthesis"/>
  <rule ref="Drupal.InfoFiles.AutoAddedKeys"/>
  <rule ref="Drupal.InfoFiles.ClassFiles"/>
  <rule ref="Drupal.InfoFiles.DuplicateEntry"/>
  <rule ref="Drupal.InfoFiles.Required"/>
  <rule ref="Drupal.Scope.MethodScope"/>
  <rule ref="Drupal.Semantics.EmptyInstall"/>
  <rule ref="Drupal.Semantics.FunctionT">
    <exclude name="Drupal.Semantics.FunctionT.BackslashSingleQuote"/>
    <exclude name="Drupal.Semantics.FunctionT.NotLiteralString"/>
    <exclude name="Drupal.Semantics.FunctionT.ConcatString"/>
  </rule>
  <rule ref="Drupal.Semantics.FunctionWatchdog"/>
  <rule ref="Drupal.Semantics.InstallHooks"/>
  <rule ref="Drupal.Semantics.LStringTranslatable"/>
  <rule ref="Drupal.Semantics.PregSecurity"/>
  <rule ref="Drupal.Semantics.TInHookMenu"/>
  <rule ref="Drupal.Semantics.TInHookSchema"/>
  <rule ref="Drupal.WhiteSpace.Comma"/>
  <rule ref="Drupal.WhiteSpace.ObjectOperatorIndent"/>
  <rule ref="Drupal.WhiteSpace.ObjectOperatorSpacing"/>
  <rule ref="Drupal.WhiteSpace.OpenTagNewline"/>
  <rule ref="Drupal.WhiteSpace.OperatorSpacing"/>
  <rule ref="Drupal.WhiteSpace.ScopeIndent"/>

  <!-- Drupal Practice sniffs -->
  <rule ref="DrupalPractice.Commenting.ExpectedException"/>

  <!-- Generic sniffs -->
  <rule ref="Generic.Files.LineEndings"/>
  <rule ref="Generic.Functions.FunctionCallArgumentSpacing"/>
  <rule ref="Generic.NamingConventions.UpperCaseConstantName"/>
  <rule ref="Generic.PHP.DeprecatedFunctions"/>
  <rule ref="Generic.PHP.DisallowShortOpenTag"/>
  <rule ref="Generic.PHP.UpperCaseConstant"/>
  <rule ref="Generic.WhiteSpace.DisallowTabIndent"/>
  <rule ref="Generic.Arrays.DisallowLongArraySyntax" />

  <!-- PSR-2 sniffs -->
  <rule ref="PSR2.Classes.PropertyDeclaration">
    <exclude name="PSR2.Classes.PropertyDeclaration.Underscore"/>
  </rule>

  <!-- Squiz sniffs -->
  <rule ref="Squiz.Strings.ConcatenationSpacing">
    <properties>
      <property name="spacing" value="1"/>
      <property name="ignoreNewlines" value="true"/>
    </properties>
 </rule>

</ruleset>