123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254 |
- <?xml version="1.0" encoding="UTF-8"?>
- <ruleset name="search_api">
- <description>Default PHP CodeSniffer configuration for the Search API module.</description>
- <file>.</file>
- <arg name="extensions" value="inc,install,module,php,profile,test,theme"/>
- <!-- Only include specific sniffs that pass. This ensures that, if new sniffs are added, HEAD does not fail.-->
- <!-- Drupal sniffs -->
- <rule ref="Drupal.Array.DisallowLongArraySyntax"/>
- <rule ref="Drupal.Classes.ClassCreateInstance"/>
- <rule ref="Drupal.Classes.ClassDeclaration"/>
- <rule ref="Drupal.Classes.FullyQualifiedNamespace"/>
- <rule ref="Drupal.Classes.InterfaceName"/>
- <rule ref="Drupal.Classes.UnusedUseStatement"/>
- <rule ref="Drupal.Classes.UseLeadingBackslash"/>
- <rule ref="Drupal.CSS.ClassDefinitionNameSpacing"/>
- <rule ref="Drupal.CSS.ColourDefinition"/>
- <rule ref="Drupal.Commenting.ClassComment"/>
- <rule ref="Drupal.Commenting.DataTypeNamespace" />
- <rule ref="Drupal.Commenting.DocComment"/>
- <rule ref="Drupal.Commenting.DocCommentStar"/>
- <rule ref="Drupal.Commenting.FileComment"/>
- <rule ref="Drupal.Commenting.FunctionComment"/>
- <rule ref="Drupal.Commenting.InlineComment">
- <!-- This is impractical when commenting code out. -->
- <exclude name="Drupal.Commenting.InlineComment.InvalidEndChar" />
- <!-- We (rarely) use comments as "headings" for multiple functions. -->
- <exclude name="Drupal.Commenting.InlineComment.SpacingAfter" />
- <!--
- This disallows indentation in comments, even though it can sometimes be
- helpful for structured explanations.
- @see \Drupal\search_api\Plugin\search_api\processor\ContentAccess::addNodeAccess()
- -->
- <exclude name="Drupal.Commenting.InlineComment.SpacingBefore" />
- </rule>
- <rule ref="Drupal.Commenting.VariableComment">
- <!-- This finds false positives when @code is used. -->
- <exclude name="Drupal.Commenting.VariableComment.VarOrder"/>
- </rule>
- <rule ref="Drupal.Commenting.PostStatementComment"/>
- <rule ref="Drupal.ControlStructures.ElseIf"/>
- <rule ref="Drupal.ControlStructures.ControlSignature"/>
- <rule ref="Drupal.ControlStructures.InlineControlStructure"/>
- <rule ref="Drupal.Files.EndFileNewline"/>
- <rule ref="Drupal.Files.FileEncoding"/>
- <rule ref="Drupal.Files.TxtFileLineLength"/>
- <rule ref="Drupal.Formatting.MultiLineAssignment"/>
- <rule ref="Drupal.Formatting.SpaceInlineIf"/>
- <rule ref="Drupal.Formatting.SpaceUnaryOperator"/>
- <rule ref="Drupal.Functions.DiscouragedFunctions"/>
- <rule ref="Drupal.Functions.FunctionDeclaration"/>
- <rule ref="Drupal.InfoFiles.AutoAddedKeys"/>
- <rule ref="Drupal.InfoFiles.ClassFiles"/>
- <rule ref="Drupal.InfoFiles.DuplicateEntry"/>
- <rule ref="Drupal.InfoFiles.Required"/>
- <rule ref="Drupal.Methods.MethodDeclaration"/>
- <rule ref="Drupal.NamingConventions.ValidVariableName">
- <!-- This interferes with the stored entity properties. -->
- <exclude name="Drupal.NamingConventions.ValidVariableName.LowerCamelName"/>
- </rule>
- <rule ref="Drupal.Scope.MethodScope"/>
- <rule ref="Drupal.Semantics.EmptyInstall"/>
- <rule ref="Drupal.Semantics.FunctionAlias"/>
- <rule ref="Drupal.Semantics.FunctionT"/>
- <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.CloseBracketSpacing"/>
- <rule ref="Drupal.WhiteSpace.Comma"/>
- <rule ref="Drupal.WhiteSpace.EmptyLines"/>
- <rule ref="Drupal.WhiteSpace.Namespace"/>
- <rule ref="Drupal.WhiteSpace.ObjectOperatorIndent"/>
- <rule ref="Drupal.WhiteSpace.ObjectOperatorSpacing"/>
- <rule ref="Drupal.WhiteSpace.OpenBracketSpacing"/>
- <rule ref="Drupal.WhiteSpace.OpenTagNewline"/>
- <rule ref="Drupal.WhiteSpace.OperatorSpacing"/>
- <rule ref="Drupal.WhiteSpace.ScopeClosingBrace"/>
- <rule ref="Drupal.WhiteSpace.ScopeIndent"/>
- <!-- Drupal Practice sniffs -->
- <rule ref="DrupalPractice.Commenting.ExpectedException"/>
- <!-- Generic sniffs -->
- <rule ref="Generic.Files.ByteOrderMark"/>
- <rule ref="Generic.Files.LineEndings"/>
- <rule ref="Generic.Formatting.SpaceAfterCast"/>
- <rule ref="Generic.Functions.FunctionCallArgumentSpacing"/>
- <rule ref="Generic.Functions.OpeningFunctionBraceKernighanRitchie">
- <properties>
- <property name="checkClosures" value="true"/>
- </properties>
- </rule>
- <rule ref="Generic.NamingConventions.ConstructorName"/>
- <rule ref="Generic.NamingConventions.UpperCaseConstantName"/>
- <rule ref="Generic.PHP.DeprecatedFunctions"/>
- <rule ref="Generic.PHP.DisallowShortOpenTag"/>
- <rule ref="Generic.PHP.LowerCaseKeyword"/>
- <rule ref="Generic.PHP.UpperCaseConstant"/>
- <rule ref="Generic.WhiteSpace.DisallowTabIndent"/>
- <!-- MySource sniffs -->
- <rule ref="MySource.Debug.DebugCode"/>
- <!-- PEAR sniffs -->
- <rule ref="PEAR.Files.IncludingFile"/>
- <!-- Disable some error messages that we do not want. -->
- <rule ref="PEAR.Files.IncludingFile.UseIncludeOnce">
- <severity>0</severity>
- </rule>
- <rule ref="PEAR.Files.IncludingFile.UseInclude">
- <severity>0</severity>
- </rule>
- <rule ref="PEAR.Files.IncludingFile.UseRequireOnce">
- <severity>0</severity>
- </rule>
- <rule ref="PEAR.Files.IncludingFile.UseRequire">
- <severity>0</severity>
- </rule>
- <rule ref="PEAR.Functions.ValidDefaultValue"/>
- <!-- PEAR sniffs -->
- <rule ref="PEAR.Functions.FunctionCallSignature"/>
- <!-- The sniffs inside PEAR.Functions.FunctionCallSignature silenced below are
- also silenced in Drupal CS' ruleset.xml. The code below is a 1-on-1 copy
- from that file. -->
- <!-- Disable some error messages that we already cover. -->
- <rule ref="PEAR.Functions.FunctionCallSignature.SpaceAfterOpenBracket">
- <severity>0</severity>
- </rule>
- <rule ref="PEAR.Functions.FunctionCallSignature.SpaceBeforeCloseBracket">
- <severity>0</severity>
- </rule>
- <!-- Disable some error messages that we do not want. -->
- <rule ref="PEAR.Functions.FunctionCallSignature.Indent">
- <severity>0</severity>
- </rule>
- <rule ref="PEAR.Functions.FunctionCallSignature.ContentAfterOpenBracket">
- <severity>0</severity>
- </rule>
- <rule ref="PEAR.Functions.FunctionCallSignature.CloseBracketLine">
- <severity>0</severity>
- </rule>
- <rule ref="PEAR.Functions.FunctionCallSignature.EmptyLine">
- <severity>0</severity>
- </rule>
- <!-- PSR-2 sniffs -->
- <rule ref="PSR2.Classes.PropertyDeclaration"/>
- <rule ref="PSR2.Namespaces.NamespaceDeclaration"/>
- <rule ref="PSR2.Namespaces.UseDeclaration"/>
- <!-- Squiz sniffs -->
- <rule ref="Squiz.Arrays.ArrayBracketSpacing"/>
- <rule ref="Squiz.Arrays.ArrayDeclaration">
- <exclude name="Squiz.Arrays.ArrayDeclaration.NoKeySpecified"/>
- <exclude name="Squiz.Arrays.ArrayDeclaration.KeySpecified"/>
- </rule>
- <!-- Disable some error messages that we do not want. -->
- <rule ref="Squiz.Arrays.ArrayDeclaration.CloseBraceNotAligned">
- <severity>0</severity>
- </rule>
- <rule ref="Squiz.Arrays.ArrayDeclaration.DoubleArrowNotAligned">
- <severity>0</severity>
- </rule>
- <rule ref="Squiz.Arrays.ArrayDeclaration.FirstValueNoNewline">
- <severity>0</severity>
- </rule>
- <rule ref="Squiz.Arrays.ArrayDeclaration.KeyNotAligned">
- <severity>0</severity>
- </rule>
- <rule ref="Squiz.Arrays.ArrayDeclaration.MultiLineNotAllowed">
- <severity>0</severity>
- </rule>
- <rule ref="Squiz.Arrays.ArrayDeclaration.NoComma">
- <severity>0</severity>
- </rule>
- <rule ref="Squiz.Arrays.ArrayDeclaration.NoCommaAfterLast">
- <severity>0</severity>
- </rule>
- <rule ref="Squiz.Arrays.ArrayDeclaration.NotLowerCase">
- <severity>0</severity>
- </rule>
- <rule ref="Squiz.Arrays.ArrayDeclaration.SingleLineNotAllowed">
- <severity>0</severity>
- </rule>
- <rule ref="Squiz.Arrays.ArrayDeclaration.ValueNotAligned">
- <severity>0</severity>
- </rule>
- <rule ref="Squiz.Arrays.ArrayDeclaration.ValueNoNewline">
- <severity>0</severity>
- </rule>
- <rule ref="Squiz.ControlStructures.ForEachLoopDeclaration"/>
- <!-- Disable some error messages that we already cover. -->
- <rule ref="Squiz.ControlStructures.ForEachLoopDeclaration.AsNotLower">
- <severity>0</severity>
- </rule>
- <rule ref="Squiz.ControlStructures.ForEachLoopDeclaration.SpaceAfterOpen">
- <severity>0</severity>
- </rule>
- <rule ref="Squiz.ControlStructures.ForEachLoopDeclaration.SpaceBeforeClose">
- <severity>0</severity>
- </rule>
- <rule ref="Squiz.ControlStructures.ForLoopDeclaration"/>
- <!-- Disable some error messages that we already cover. -->
- <rule ref="Squiz.ControlStructures.ForLoopDeclaration.SpacingAfterOpen">
- <severity>0</severity>
- </rule>
- <rule ref="Squiz.ControlStructures.ForLoopDeclaration.SpacingBeforeClose">
- <severity>0</severity>
- </rule>
- <rule ref="Squiz.Functions.MultiLineFunctionDeclaration"/>
- <rule ref="Squiz.Functions.MultiLineFunctionDeclaration.BraceOnSameLine">
- <severity>0</severity>
- </rule>
- <rule ref="Squiz.Functions.MultiLineFunctionDeclaration.ContentAfterBrace">
- <severity>0</severity>
- </rule>
- <!-- Standard yet to be finalized on this (https://www.drupal.org/node/1539712). -->
- <rule ref="Squiz.Functions.MultiLineFunctionDeclaration.FirstParamSpacing">
- <severity>0</severity>
- </rule>
- <rule ref="Squiz.Functions.MultiLineFunctionDeclaration.Indent">
- <severity>0</severity>
- </rule>
- <rule ref="Squiz.Functions.MultiLineFunctionDeclaration.CloseBracketLine">
- <severity>0</severity>
- </rule>
- <rule ref="Squiz.Functions.FunctionDeclarationArgumentSpacing">
- <properties>
- <property name="equalsSpacing" value="1"/>
- </properties>
- </rule>
- <rule ref="Squiz.Functions.FunctionDeclarationArgumentSpacing.NoSpaceBeforeArg">
- <severity>0</severity>
- </rule>
- <rule ref="Squiz.PHP.LowercasePHPFunctions"/>
- <rule ref="Squiz.Strings.ConcatenationSpacing">
- <properties>
- <property name="spacing" value="1"/>
- <property name="ignoreNewlines" value="true"/>
- </properties>
- </rule>
- <rule ref="Squiz.WhiteSpace.LanguageConstructSpacing" />
- <rule ref="Squiz.WhiteSpace.SemicolonSpacing"/>
- <rule ref="Squiz.WhiteSpace.SuperfluousWhitespace"/>
- <!-- Zend sniffs -->
- <rule ref="Zend.Files.ClosingTag"/>
- </ruleset>
|