phpcs.xml 7.42 KB
Newer Older
1 2 3 4
<?xml version="1.0"?>
<ruleset name="Drupal coding standards">
  <description>Drupal 8 coding standards</description>

5
  <file>.</file>
6
  <arg name="extensions" value="inc,install,module,php,profile,test,theme"/>
7 8 9

  <!--Exclude third party code.-->
  <exclude-pattern>./vendor/*</exclude-pattern>
10 11 12 13
  <!--Run Drupal standards.-->
  <rule ref="Drupal.Array"/>
  <rule ref="Drupal.Classes"/>
  <rule ref="Drupal.Commenting">
14 15 16 17
    <!-- 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"/>
18 19 20 21 22 23 24 25 26 27 28 29 30
  </rule>
  <rule ref="Drupal.ControlStructures"/>
  <rule ref="Drupal.CSS"/>
  <rule ref="Drupal.Files"/>
  <rule ref="Drupal.Formatting"/>
  <rule ref="Drupal.Functions"/>
  <rule ref="Drupal.InfoFiles"/>
  <rule ref="Drupal.Methods"/>
  <rule ref="Drupal.NamingConventions"/>
  <rule ref="Drupal.Scope"/>
  <rule ref="Drupal.Semantics"/>
  <rule ref="Drupal.Strings"/>
  <rule ref="Drupal.WhiteSpace"/>
31 32

  <!-- Drupal Practice sniffs -->
33
  <rule ref="DrupalPractice.Commenting"/>
34 35

  <!-- Generic sniffs -->
36 37
  <rule ref="Generic.Arrays.DisallowLongArraySyntax"/>
  <rule ref="Generic.Files.ByteOrderMark"/>
38
  <rule ref="Generic.Files.LineEndings"/>
39
  <rule ref="Generic.Formatting.SpaceAfterCast"/>
40
  <rule ref="Generic.Functions.FunctionCallArgumentSpacing"/>
41 42 43 44 45 46
  <rule ref="Generic.Functions.OpeningFunctionBraceKernighanRitchie">
    <properties>
      <property name="checkClosures" value="true"/>
    </properties>
  </rule>
  <rule ref="Generic.NamingConventions.ConstructorName"/>
47 48 49
  <rule ref="Generic.NamingConventions.UpperCaseConstantName"/>
  <rule ref="Generic.PHP.DeprecatedFunctions"/>
  <rule ref="Generic.PHP.DisallowShortOpenTag"/>
50
  <rule ref="Generic.PHP.LowerCaseKeyword"/>
51 52
  <rule ref="Generic.PHP.UpperCaseConstant"/>
  <rule ref="Generic.WhiteSpace.DisallowTabIndent"/>
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98

  <!-- 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>
99 100 101 102 103

  <!-- PSR-2 sniffs -->
  <rule ref="PSR2.Classes.PropertyDeclaration">
    <exclude name="PSR2.Classes.PropertyDeclaration.Underscore"/>
  </rule>
104 105 106 107
  <rule ref="PSR2.Namespaces.NamespaceDeclaration"/>
  <rule ref="PSR2.Namespaces.UseDeclaration">
    <exclude name="PSR2.Namespaces.UseDeclaration.UseAfterNamespace"/>
  </rule>
108 109

  <!-- Squiz sniffs -->
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193
  <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"/>
194 195 196 197 198
  <rule ref="Squiz.Strings.ConcatenationSpacing">
    <properties>
      <property name="spacing" value="1"/>
      <property name="ignoreNewlines" value="true"/>
    </properties>
199 200 201 202 203 204 205
  </rule>
  <rule ref="Squiz.WhiteSpace.LanguageConstructSpacing" />
  <rule ref="Squiz.WhiteSpace.SemicolonSpacing"/>
  <rule ref="Squiz.WhiteSpace.SuperfluousWhitespace"/>

  <!-- Zend sniffs -->
  <rule ref="Zend.Files.ClosingTag"/>
206 207

</ruleset>