phpcs.xml 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. <?xml version="1.0"?>
  2. <ruleset name="Drupal coding standards">
  3. <description>Drupal 8 coding standards</description>
  4. <file>.</file>
  5. <arg name="extensions" value="inc,install,module,php,profile,test,theme"/>
  6. <!--Exclude third party code.-->
  7. <exclude-pattern>./vendor/*</exclude-pattern>
  8. <!--Run Drupal standards.-->
  9. <rule ref="Drupal.Array"/>
  10. <rule ref="Drupal.Classes"/>
  11. <rule ref="Drupal.Commenting">
  12. <!-- TagsNotGrouped and ParamGroup have false-positives.
  13. @see https://www.drupal.org/node/2060925 -->
  14. <exclude name="Drupal.Commenting.DocComment.TagsNotGrouped"/>
  15. <exclude name="Drupal.Commenting.DocComment.ParamGroup"/>
  16. </rule>
  17. <rule ref="Drupal.ControlStructures"/>
  18. <rule ref="Drupal.CSS"/>
  19. <rule ref="Drupal.Files"/>
  20. <rule ref="Drupal.Formatting"/>
  21. <rule ref="Drupal.Functions"/>
  22. <rule ref="Drupal.InfoFiles"/>
  23. <rule ref="Drupal.Methods"/>
  24. <rule ref="Drupal.NamingConventions"/>
  25. <rule ref="Drupal.Scope"/>
  26. <rule ref="Drupal.Semantics"/>
  27. <rule ref="Drupal.Strings"/>
  28. <rule ref="Drupal.WhiteSpace"/>
  29. <!-- Drupal Practice sniffs -->
  30. <rule ref="DrupalPractice.Commenting"/>
  31. <!-- Generic sniffs -->
  32. <rule ref="Generic.Arrays.DisallowLongArraySyntax"/>
  33. <rule ref="Generic.Files.ByteOrderMark"/>
  34. <rule ref="Generic.Files.LineEndings"/>
  35. <rule ref="Generic.Formatting.SpaceAfterCast"/>
  36. <rule ref="Generic.Functions.FunctionCallArgumentSpacing"/>
  37. <rule ref="Generic.Functions.OpeningFunctionBraceKernighanRitchie">
  38. <properties>
  39. <property name="checkClosures" value="true"/>
  40. </properties>
  41. </rule>
  42. <rule ref="Generic.NamingConventions.ConstructorName"/>
  43. <rule ref="Generic.NamingConventions.UpperCaseConstantName"/>
  44. <rule ref="Generic.PHP.DeprecatedFunctions"/>
  45. <rule ref="Generic.PHP.DisallowShortOpenTag"/>
  46. <rule ref="Generic.PHP.LowerCaseKeyword"/>
  47. <rule ref="Generic.PHP.UpperCaseConstant"/>
  48. <rule ref="Generic.WhiteSpace.DisallowTabIndent"/>
  49. <!-- MySource sniffs -->
  50. <rule ref="MySource.Debug.DebugCode"/>
  51. <!-- PEAR sniffs -->
  52. <rule ref="PEAR.Files.IncludingFile"/>
  53. <!-- Disable some error messages that we do not want. -->
  54. <rule ref="PEAR.Files.IncludingFile.UseIncludeOnce">
  55. <severity>0</severity>
  56. </rule>
  57. <rule ref="PEAR.Files.IncludingFile.UseInclude">
  58. <severity>0</severity>
  59. </rule>
  60. <rule ref="PEAR.Files.IncludingFile.UseRequireOnce">
  61. <severity>0</severity>
  62. </rule>
  63. <rule ref="PEAR.Files.IncludingFile.UseRequire">
  64. <severity>0</severity>
  65. </rule>
  66. <rule ref="PEAR.Functions.ValidDefaultValue"/>
  67. <!-- PEAR sniffs -->
  68. <rule ref="PEAR.Functions.FunctionCallSignature"/>
  69. <!-- The sniffs inside PEAR.Functions.FunctionCallSignature silenced below are
  70. also silenced in Drupal CS' ruleset.xml. The code below is a 1-on-1 copy
  71. from that file. -->
  72. <!-- Disable some error messages that we already cover. -->
  73. <rule ref="PEAR.Functions.FunctionCallSignature.SpaceAfterOpenBracket">
  74. <severity>0</severity>
  75. </rule>
  76. <rule ref="PEAR.Functions.FunctionCallSignature.SpaceBeforeCloseBracket">
  77. <severity>0</severity>
  78. </rule>
  79. <!-- Disable some error messages that we do not want. -->
  80. <rule ref="PEAR.Functions.FunctionCallSignature.Indent">
  81. <severity>0</severity>
  82. </rule>
  83. <rule ref="PEAR.Functions.FunctionCallSignature.ContentAfterOpenBracket">
  84. <severity>0</severity>
  85. </rule>
  86. <rule ref="PEAR.Functions.FunctionCallSignature.CloseBracketLine">
  87. <severity>0</severity>
  88. </rule>
  89. <rule ref="PEAR.Functions.FunctionCallSignature.EmptyLine">
  90. <severity>0</severity>
  91. </rule>
  92. <!-- PSR-2 sniffs -->
  93. <rule ref="PSR2.Classes.PropertyDeclaration">
  94. <exclude name="PSR2.Classes.PropertyDeclaration.Underscore"/>
  95. </rule>
  96. <rule ref="PSR2.Namespaces.NamespaceDeclaration"/>
  97. <rule ref="PSR2.Namespaces.UseDeclaration">
  98. <exclude name="PSR2.Namespaces.UseDeclaration.UseAfterNamespace"/>
  99. </rule>
  100. <!-- Squiz sniffs -->
  101. <rule ref="Squiz.Arrays.ArrayBracketSpacing"/>
  102. <rule ref="Squiz.Arrays.ArrayDeclaration">
  103. <exclude name="Squiz.Arrays.ArrayDeclaration.NoKeySpecified"/>
  104. <exclude name="Squiz.Arrays.ArrayDeclaration.KeySpecified"/>
  105. </rule>
  106. <!-- Disable some error messages that we do not want. -->
  107. <rule ref="Squiz.Arrays.ArrayDeclaration.CloseBraceNotAligned">
  108. <severity>0</severity>
  109. </rule>
  110. <rule ref="Squiz.Arrays.ArrayDeclaration.DoubleArrowNotAligned">
  111. <severity>0</severity>
  112. </rule>
  113. <rule ref="Squiz.Arrays.ArrayDeclaration.FirstValueNoNewline">
  114. <severity>0</severity>
  115. </rule>
  116. <rule ref="Squiz.Arrays.ArrayDeclaration.KeyNotAligned">
  117. <severity>0</severity>
  118. </rule>
  119. <rule ref="Squiz.Arrays.ArrayDeclaration.MultiLineNotAllowed">
  120. <severity>0</severity>
  121. </rule>
  122. <rule ref="Squiz.Arrays.ArrayDeclaration.NoComma">
  123. <severity>0</severity>
  124. </rule>
  125. <rule ref="Squiz.Arrays.ArrayDeclaration.NoCommaAfterLast">
  126. <severity>0</severity>
  127. </rule>
  128. <rule ref="Squiz.Arrays.ArrayDeclaration.NotLowerCase">
  129. <severity>0</severity>
  130. </rule>
  131. <rule ref="Squiz.Arrays.ArrayDeclaration.SingleLineNotAllowed">
  132. <severity>0</severity>
  133. </rule>
  134. <rule ref="Squiz.Arrays.ArrayDeclaration.ValueNotAligned">
  135. <severity>0</severity>
  136. </rule>
  137. <rule ref="Squiz.Arrays.ArrayDeclaration.ValueNoNewline">
  138. <severity>0</severity>
  139. </rule>
  140. <rule ref="Squiz.ControlStructures.ForEachLoopDeclaration"/>
  141. <!-- Disable some error messages that we already cover. -->
  142. <rule ref="Squiz.ControlStructures.ForEachLoopDeclaration.AsNotLower">
  143. <severity>0</severity>
  144. </rule>
  145. <rule ref="Squiz.ControlStructures.ForEachLoopDeclaration.SpaceAfterOpen">
  146. <severity>0</severity>
  147. </rule>
  148. <rule ref="Squiz.ControlStructures.ForEachLoopDeclaration.SpaceBeforeClose">
  149. <severity>0</severity>
  150. </rule>
  151. <rule ref="Squiz.ControlStructures.ForLoopDeclaration"/>
  152. <!-- Disable some error messages that we already cover. -->
  153. <rule ref="Squiz.ControlStructures.ForLoopDeclaration.SpacingAfterOpen">
  154. <severity>0</severity>
  155. </rule>
  156. <rule ref="Squiz.ControlStructures.ForLoopDeclaration.SpacingBeforeClose">
  157. <severity>0</severity>
  158. </rule>
  159. <rule ref="Squiz.Functions.MultiLineFunctionDeclaration"/>
  160. <rule ref="Squiz.Functions.MultiLineFunctionDeclaration.BraceOnSameLine">
  161. <severity>0</severity>
  162. </rule>
  163. <rule ref="Squiz.Functions.MultiLineFunctionDeclaration.ContentAfterBrace">
  164. <severity>0</severity>
  165. </rule>
  166. <!-- Standard yet to be finalized on this (https://www.drupal.org/node/1539712). -->
  167. <rule ref="Squiz.Functions.MultiLineFunctionDeclaration.FirstParamSpacing">
  168. <severity>0</severity>
  169. </rule>
  170. <rule ref="Squiz.Functions.MultiLineFunctionDeclaration.Indent">
  171. <severity>0</severity>
  172. </rule>
  173. <rule ref="Squiz.Functions.MultiLineFunctionDeclaration.CloseBracketLine">
  174. <severity>0</severity>
  175. </rule>
  176. <rule ref="Squiz.Functions.FunctionDeclarationArgumentSpacing">
  177. <properties>
  178. <property name="equalsSpacing" value="1"/>
  179. </properties>
  180. </rule>
  181. <rule ref="Squiz.Functions.FunctionDeclarationArgumentSpacing.NoSpaceBeforeArg">
  182. <severity>0</severity>
  183. </rule>
  184. <rule ref="Squiz.PHP.LowercasePHPFunctions"/>
  185. <rule ref="Squiz.Strings.ConcatenationSpacing">
  186. <properties>
  187. <property name="spacing" value="1"/>
  188. <property name="ignoreNewlines" value="true"/>
  189. </properties>
  190. </rule>
  191. <rule ref="Squiz.WhiteSpace.LanguageConstructSpacing" />
  192. <rule ref="Squiz.WhiteSpace.SemicolonSpacing"/>
  193. <rule ref="Squiz.WhiteSpace.SuperfluousWhitespace"/>
  194. <!-- Zend sniffs -->
  195. <rule ref="Zend.Files.ClosingTag"/>
  196. </ruleset>