Drupal investigation

ruleset.xml 9.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288
  1. <?xml version="1.0"?>
  2. <!-- See http://pear.php.net/manual/en/package.php.php-codesniffer.annotated-ruleset.php -->
  3. <ruleset name="Drupal">
  4. <description>Drupal coding standard</description>
  5. <!-- All Drupal code files must be UTF-8 encoded and we treat them as such. -->
  6. <arg name="encoding" value="utf-8"/>
  7. <arg name="extensions" value="php,module,inc,install,test,profile,theme,css,info,txt,md,yml"/>
  8. <rule ref="Internal.NoCodeFound">
  9. <!-- Empty files are fine, might be used for testing. -->
  10. <exclude-pattern>*</exclude-pattern>
  11. </rule>
  12. <rule ref="Drupal.Commenting.FileComment">
  13. <!-- Do not run this sniff on txt files. -->
  14. <exclude-pattern>*.txt</exclude-pattern>
  15. </rule>
  16. <rule ref="Drupal.Commenting.FileComment.SpacingAfterComment">
  17. <!-- Do not run this sniff on template files. -->
  18. <exclude-pattern>*.tpl.php</exclude-pattern>
  19. </rule>
  20. <rule ref="Drupal.ControlStructures.ControlSignature">
  21. <!-- Do not run this sniff on template files. -->
  22. <exclude-pattern>*.tpl.php</exclude-pattern>
  23. </rule>
  24. <!-- Silence deprecated sniff that will be removed in Coder 9.x. -->
  25. <rule ref="Drupal.Functions.FunctionDeclaration.SpaceAfter">
  26. <severity>0</severity>
  27. </rule>
  28. <rule ref="Drupal.Functions.FunctionDeclaration.SpaceBeforeParenthesis">
  29. <severity>0</severity>
  30. </rule>
  31. <!-- Silence mmethod name underscore warning which is coverd already in
  32. Drupal.NamingConventions.ValidFunctionName.ScopeNotCamelCaps. -->
  33. <rule ref="Drupal.Methods.MethodDeclaration.Underscore">
  34. <severity>0</severity>
  35. </rule>
  36. <rule ref="Drupal.WhiteSpace.ScopeIndent">
  37. <!-- Do not run this sniff on template files, as the indentation might follow
  38. the HTML -->
  39. <exclude-pattern>*.tpl.php</exclude-pattern>
  40. </rule>
  41. <rule ref="Generic.CodeAnalysis.UselessOverridingMethod" />
  42. <rule ref="Generic.Files.ByteOrderMark" />
  43. <rule ref="Generic.Formatting.SpaceAfterCast" />
  44. <rule ref="Generic.Functions.FunctionCallArgumentSpacing" />
  45. <rule ref="Generic.Functions.FunctionCallArgumentSpacing.NoSpaceAfterComma">
  46. <severity>0</severity>
  47. </rule>
  48. <rule ref="Generic.Functions.OpeningFunctionBraceKernighanRitchie">
  49. <properties>
  50. <property name="checkClosures" value="true"/>
  51. </properties>
  52. </rule>
  53. <rule ref="Generic.NamingConventions.ConstructorName" />
  54. <rule ref="Generic.NamingConventions.UpperCaseConstantName" />
  55. <rule ref="Generic.PHP.DeprecatedFunctions" />
  56. <rule ref="Generic.PHP.DisallowShortOpenTag" />
  57. <rule ref="Generic.PHP.LowerCaseKeyword" />
  58. <rule ref="Generic.PHP.UpperCaseConstant" />
  59. <rule ref="Generic.WhiteSpace.DisallowTabIndent" />
  60. <!-- Use Unix newlines -->
  61. <rule ref="Generic.Files.LineEndings">
  62. <properties>
  63. <property name="eolChar" value="\n"/>
  64. </properties>
  65. </rule>
  66. <rule ref="MySource.Debug.DebugCode" />
  67. <rule ref="PEAR.Files.IncludingFile" />
  68. <!-- Disable some error messages that we do not want. -->
  69. <rule ref="PEAR.Files.IncludingFile.UseIncludeOnce">
  70. <severity>0</severity>
  71. </rule>
  72. <rule ref="PEAR.Files.IncludingFile.UseInclude">
  73. <severity>0</severity>
  74. </rule>
  75. <rule ref="PEAR.Files.IncludingFile.UseRequireOnce">
  76. <severity>0</severity>
  77. </rule>
  78. <rule ref="PEAR.Files.IncludingFile.UseRequire">
  79. <severity>0</severity>
  80. </rule>
  81. <rule ref="PEAR.Functions.FunctionCallSignature"/>
  82. <!-- Disable some error messages that we already cover. -->
  83. <rule ref="PEAR.Functions.FunctionCallSignature.SpaceAfterOpenBracket">
  84. <severity>0</severity>
  85. </rule>
  86. <rule ref="PEAR.Functions.FunctionCallSignature.SpaceBeforeCloseBracket">
  87. <severity>0</severity>
  88. </rule>
  89. <!-- Disable some error messages that we do not want. -->
  90. <rule ref="PEAR.Functions.FunctionCallSignature.Indent">
  91. <severity>0</severity>
  92. </rule>
  93. <rule ref="PEAR.Functions.FunctionCallSignature.ContentAfterOpenBracket">
  94. <severity>0</severity>
  95. </rule>
  96. <rule ref="PEAR.Functions.FunctionCallSignature.CloseBracketLine">
  97. <severity>0</severity>
  98. </rule>
  99. <rule ref="PEAR.Functions.FunctionCallSignature.EmptyLine">
  100. <severity>0</severity>
  101. </rule>
  102. <rule ref="PEAR.Functions.ValidDefaultValue" />
  103. <rule ref="PSR2.Namespaces.NamespaceDeclaration" />
  104. <rule ref="PSR2.Namespaces.UseDeclaration" />
  105. <rule ref="Squiz.Arrays.ArrayDeclaration" />
  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.Arrays.ArrayBracketSpacing" />
  141. <rule ref="Squiz.ControlStructures.ForEachLoopDeclaration" />
  142. <!-- Disable some error messages that we already cover. -->
  143. <rule ref="Squiz.ControlStructures.ForEachLoopDeclaration.AsNotLower">
  144. <severity>0</severity>
  145. </rule>
  146. <rule ref="Squiz.ControlStructures.ForEachLoopDeclaration.SpaceAfterOpen">
  147. <severity>0</severity>
  148. </rule>
  149. <rule ref="Squiz.ControlStructures.ForEachLoopDeclaration.SpaceBeforeClose">
  150. <severity>0</severity>
  151. </rule>
  152. <rule ref="Squiz.ControlStructures.ForLoopDeclaration" />
  153. <!-- Disable some error messages that we already cover. -->
  154. <rule ref="Squiz.ControlStructures.ForLoopDeclaration.SpacingAfterOpen">
  155. <severity>0</severity>
  156. </rule>
  157. <rule ref="Squiz.ControlStructures.ForLoopDeclaration.SpacingBeforeClose">
  158. <severity>0</severity>
  159. </rule>
  160. <rule ref="Squiz.ControlStructures.SwitchDeclaration" />
  161. <!-- Disable some error messages that we do not want. -->
  162. <rule ref="Squiz.ControlStructures.SwitchDeclaration.BreakIndent">
  163. <severity>0</severity>
  164. </rule>
  165. <rule ref="Squiz.ControlStructures.SwitchDeclaration.CaseIndent">
  166. <severity>0</severity>
  167. </rule>
  168. <rule ref="Squiz.ControlStructures.SwitchDeclaration.CloseBraceAlign">
  169. <severity>0</severity>
  170. </rule>
  171. <rule ref="Squiz.ControlStructures.SwitchDeclaration.DefaultIndent">
  172. <severity>0</severity>
  173. </rule>
  174. <rule ref="Squiz.ControlStructures.SwitchDeclaration.DefaultNoBreak">
  175. <severity>0</severity>
  176. </rule>
  177. <rule ref="Squiz.ControlStructures.SwitchDeclaration.EmptyCase">
  178. <severity>0</severity>
  179. </rule>
  180. <rule ref="Squiz.ControlStructures.SwitchDeclaration.EmptyDefault">
  181. <severity>0</severity>
  182. </rule>
  183. <rule ref="Squiz.ControlStructures.SwitchDeclaration.MissingDefault">
  184. <severity>0</severity>
  185. </rule>
  186. <rule ref="Squiz.ControlStructures.SwitchDeclaration.SpacingAfterCase">
  187. <severity>0</severity>
  188. </rule>
  189. <rule ref="Squiz.ControlStructures.SwitchDeclaration.SpacingAfterDefaultBreak">
  190. <severity>0</severity>
  191. </rule>
  192. <rule ref="Squiz.ControlStructures.SwitchDeclaration.SpacingBeforeBreak">
  193. <severity>0</severity>
  194. </rule>
  195. <rule ref="Squiz.CSS.ClassDefinitionClosingBraceSpace" />
  196. <rule ref="Squiz.CSS.ClassDefinitionClosingBraceSpace.SpacingAfterClose">
  197. <severity>0</severity>
  198. </rule>
  199. <rule ref="Squiz.CSS.ClassDefinitionOpeningBraceSpace" />
  200. <rule ref="Squiz.CSS.ClassDefinitionOpeningBraceSpace.AfterNesting">
  201. <severity>0</severity>
  202. </rule>
  203. <rule ref="Squiz.CSS.ColonSpacing" />
  204. <rule ref="Squiz.CSS.DisallowMultipleStyleDefinitions" />
  205. <rule ref="Squiz.CSS.EmptyClassDefinition" />
  206. <rule ref="Squiz.CSS.EmptyStyleDefinition" />
  207. <rule ref="Squiz.CSS.Indentation">
  208. <properties>
  209. <property name="indent" value="2"/>
  210. </properties>
  211. </rule>
  212. <rule ref="Squiz.CSS.MissingColon" />
  213. <rule ref="Squiz.CSS.SemicolonSpacing" />
  214. <rule ref="Squiz.Functions.FunctionDeclarationArgumentSpacing">
  215. <properties>
  216. <property name="equalsSpacing" value="1"/>
  217. </properties>
  218. </rule>
  219. <rule ref="Squiz.Functions.FunctionDeclarationArgumentSpacing.NoSpaceBeforeArg">
  220. <severity>0</severity>
  221. </rule>
  222. <rule ref="Squiz.Functions.MultiLineFunctionDeclaration" />
  223. <rule ref="Squiz.Functions.MultiLineFunctionDeclaration.BraceOnSameLine">
  224. <severity>0</severity>
  225. </rule>
  226. <rule ref="Squiz.Functions.MultiLineFunctionDeclaration.ContentAfterBrace">
  227. <severity>0</severity>
  228. </rule>
  229. <!-- Standard yet to be finalized on this (https://www.drupal.org/node/1539712). -->
  230. <rule ref="Squiz.Functions.MultiLineFunctionDeclaration.FirstParamSpacing">
  231. <severity>0</severity>
  232. </rule>
  233. <rule ref="Squiz.Functions.MultiLineFunctionDeclaration.Indent">
  234. <severity>0</severity>
  235. </rule>
  236. <rule ref="Squiz.Functions.MultiLineFunctionDeclaration.CloseBracketLine">
  237. <severity>0</severity>
  238. </rule>
  239. <rule ref="Squiz.PHP.LowercasePHPFunctions" />
  240. <rule ref="Squiz.PHP.NonExecutableCode" />
  241. <rule ref="Squiz.Strings.ConcatenationSpacing">
  242. <properties>
  243. <property name="spacing" value="1"/>
  244. <property name="ignoreNewlines" value="true"/>
  245. </properties>
  246. </rule>
  247. <rule ref="Squiz.WhiteSpace.FunctionSpacing">
  248. <properties>
  249. <property name="spacing" value="1"/>
  250. </properties>
  251. </rule>
  252. <rule ref="Squiz.WhiteSpace.LanguageConstructSpacing" />
  253. <rule ref="Squiz.WhiteSpace.SemicolonSpacing" />
  254. <rule ref="Squiz.WhiteSpace.SuperfluousWhitespace" />
  255. <rule ref="Zend.Files.ClosingTag">
  256. <!-- Do not run this sniff on template files. -->
  257. <exclude-pattern>*.tpl.php</exclude-pattern>
  258. </rule>
  259. <!-- Ignore various version control directories. -->
  260. <exclude-pattern>*/\.git/*</exclude-pattern>
  261. <exclude-pattern>*/\.svn/*</exclude-pattern>
  262. <exclude-pattern>*/\.hg/*</exclude-pattern>
  263. <exclude-pattern>*/\.bzr/*</exclude-pattern>
  264. </ruleset>