phpcs.xml.dist 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <?xml version="1.0"?>
  2. <ruleset name="themes">
  3. <description>Apply WordPress Coding Standards to all files</description>
  4. <!-- Only scan PHP files. -->
  5. <arg name="extensions" value="php"/>
  6. <!-- Whenever possible, cache the scan results and re-use those for unchanged files on the next scan. -->
  7. <arg name="cache"/>
  8. <!-- Set the memory limit to 256M.
  9. For most standard PHP configurations, this means the memory limit will temporarily be raised.
  10. Ref: https://github.com/squizlabs/PHP_CodeSniffer/wiki/Advanced-Usage#specifying-phpini-settings
  11. -->
  12. <ini name="memory_limit" value="256M"/>
  13. <!-- Strip the filepaths down to the relevant bit. -->
  14. <arg name="basepath" value="./"/>
  15. <!-- Check up to 20 files simultaneously. -->
  16. <arg name="parallel" value="20"/>
  17. <!-- Show sniff codes in all reports. -->
  18. <arg value="ps"/>
  19. <file>.</file>
  20. <rule ref="WordPress-Core"/>
  21. <rule ref="WordPress.CodeAnalysis.EmptyStatement"/>
  22. <!-- These rules are being set as warnings instead of errors, so we can error check the entire codebase. -->
  23. <rule ref="WordPress.PHP.YodaConditions.NotYoda">
  24. <type>warning</type>
  25. </rule>
  26. <rule ref="WordPress.NamingConventions.ValidVariableName.VariableNotSnakeCase">
  27. <type>warning</type>
  28. </rule>
  29. <rule ref="WordPress.DB.PreparedSQL.InterpolatedNotPrepared">
  30. <type>warning</type>
  31. </rule>
  32. <rule ref="WordPress.DB.PreparedSQL.NotPrepared">
  33. <type>warning</type>
  34. </rule>
  35. <rule ref="WordPress.Files.FileName.InvalidClassFileName">
  36. <type>warning</type>
  37. </rule>
  38. <!-- Directories and third party library exclusions. -->
  39. <exclude-pattern>/vendor/*</exclude-pattern>
  40. <!-- Assignments in while conditions are a valid method of looping over iterables. -->
  41. <rule ref="WordPress.CodeAnalysis.AssignmentInCondition.FoundInWhileCondition">
  42. <exclude-pattern>*</exclude-pattern>
  43. </rule>
  44. <!-- We're not going to rename files. -->
  45. <rule ref="WordPress.Files.FileName">
  46. <exclude-pattern>*</exclude-pattern>
  47. </rule>
  48. </ruleset>