|
| 1 | +<?xml version="1.0"?> |
| 2 | +<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| 3 | + name="Patchwork" |
| 4 | + xsi:noNamespaceSchemaLocation="./vendor/squizlabs/php_codesniffer/phpcs.xsd"> |
| 5 | + |
| 6 | + <description>Patchwork rules for PHP_CodeSniffer</description> |
| 7 | + |
| 8 | + <!-- |
| 9 | + ############################################################################# |
| 10 | + COMMAND LINE ARGUMENTS |
| 11 | + https://github.com/PHPCSStandards/PHP_CodeSniffer/wiki/Annotated-Ruleset |
| 12 | + ############################################################################# |
| 13 | + --> |
| 14 | + |
| 15 | + <!-- Scan all files. --> |
| 16 | + <file>.</file> |
| 17 | + |
| 18 | + <!-- Third party files and build files don't need to comply with these coding standards. --> |
| 19 | + <exclude-pattern>*/vendor/*</exclude-pattern> |
| 20 | + |
| 21 | + <!-- Test fixtures don't need to comply with these coding standards |
| 22 | + as we may be specifically testing a variation in how syntax can be written. |
| 23 | + --> |
| 24 | + <exclude-pattern>*/tests/includes/*</exclude-pattern> |
| 25 | + |
| 26 | + <!-- Only check PHP files. |
| 27 | + Note: at this time PHPCS can not scan .phpt files. |
| 28 | + There is a feature request open to change this. |
| 29 | + https://github.com/PHPCSStandards/PHP_CodeSniffer/issues/1363 |
| 30 | + --> |
| 31 | + <arg name="extensions" value="php"/> |
| 32 | + |
| 33 | + <!-- Show progress, show the error codes for each message (source). --> |
| 34 | + <arg value="ps"/> |
| 35 | + |
| 36 | + <!-- Strip the filepaths down to the relevant bit. --> |
| 37 | + <arg name="basepath" value="./"/> |
| 38 | + |
| 39 | + <!-- Check up to 8 files simultaneously. --> |
| 40 | + <arg name="parallel" value="8"/> |
| 41 | + |
| 42 | + |
| 43 | + <!-- |
| 44 | + ############################################################################# |
| 45 | + CHECK FOR PHP CROSS-VERSION COMPATIBILITY |
| 46 | + ############################################################################# |
| 47 | + --> |
| 48 | + |
| 49 | + <config name="testVersion" value="7.1-"/> |
| 50 | + <rule ref="PHPCompatibility"/> |
| 51 | + |
| 52 | + |
| 53 | + <!-- |
| 54 | + ############################################################################# |
| 55 | + FOLLOW PSR12 for CODING STYLE |
| 56 | + ############################################################################# |
| 57 | + --> |
| 58 | + |
| 59 | + <rule ref="PSR12"> |
| 60 | + <!-- Re-organising the files should be a separate consideration and needs discussion |
| 61 | + about whether or not to adopt PSR-4 or another convention. |
| 62 | + --> |
| 63 | + <exclude name="PSR1.Files.SideEffects"/> |
| 64 | + <exclude name="PSR1.Classes.ClassDeclaration.MultipleClasses"/> |
| 65 | + </rule> |
| 66 | + |
| 67 | + |
| 68 | + <!-- |
| 69 | + ############################################################################# |
| 70 | + SNIFF SPECIFIC CONFIGURATION |
| 71 | + ############################################################################# |
| 72 | + --> |
| 73 | + |
| 74 | + <!-- Allow for slightly longer line length than PSR12 (120) allows for. --> |
| 75 | + <rule ref="Generic.Files.LineLength"> |
| 76 | + <properties> |
| 77 | + <property name="lineLimit" value="140" /> |
| 78 | + </properties> |
| 79 | + </rule> |
| 80 | + |
| 81 | + |
| 82 | + <!-- |
| 83 | + ############################################################################# |
| 84 | + SELECTIVE EXCLUSIONS |
| 85 | + Exclude specific files for specific sniffs. |
| 86 | + ############################################################################# |
| 87 | + --> |
| 88 | + |
| 89 | + <!-- Renaming these methods from snake_case to camelCaps would be a BC-break. --> |
| 90 | + <rule ref="PSR1.Methods.CamelCapsMethodName.NotCamelCaps"> |
| 91 | + <exclude-pattern>/src/CodeManipulation/Stream\.php$</exclude-pattern> |
| 92 | + </rule> |
| 93 | + |
| 94 | + <!-- Renaming these constants from camelCaps to ALL_CAPPS would be a BC-break. --> |
| 95 | + <rule ref="Generic.NamingConventions.UpperCaseConstantName.ClassConstantNotUpperCase"> |
| 96 | + <exclude-pattern>/src/CodeManipulation/Actions/RedefinitionOfNew\.php$</exclude-pattern> |
| 97 | + </rule> |
| 98 | + |
| 99 | +</ruleset> |
0 commit comments