|
| 1 | +<?xml version="1.0"?> |
| 2 | +<ruleset name="yCodeTech"> |
| 3 | + <description>yCodeTech's Coding Standards</description> |
| 4 | + |
| 5 | + <!-- Scan all files in directory --> |
| 6 | + <file>.</file> |
| 7 | + |
| 8 | + <!-- Scan only PHP files --> |
| 9 | + <arg name="extensions" value="php"/> |
| 10 | + |
| 11 | + <!-- Ignore WordPress and Composer dependencies --> |
| 12 | + <exclude-pattern>web/wp</exclude-pattern> |
| 13 | + <exclude-pattern>web/app/plugins</exclude-pattern> |
| 14 | + <exclude-pattern>web/app/mu-plugins</exclude-pattern> |
| 15 | + <exclude-pattern>vendor/</exclude-pattern> |
| 16 | + <exclude-pattern>web/app/uploads/</exclude-pattern> |
| 17 | + |
| 18 | + <!-- Show colors in console --> |
| 19 | + <arg value="-colors"/> |
| 20 | + |
| 21 | + <!-- Show sniff codes in all reports --> |
| 22 | + <arg value="ns"/> |
| 23 | + |
| 24 | + <!-- Allow multiple classes in a single file ONLY for facades.php files, |
| 25 | + ie. exclude the file from the sniff. --> |
| 26 | + <rule ref="PSR1.Classes.ClassDeclaration.MultipleClasses"> |
| 27 | + <exclude-pattern>*facades.php</exclude-pattern> |
| 28 | + </rule> |
| 29 | + |
| 30 | + <!-- Use PSR-2 as a base --> |
| 31 | + <rule ref="PSR2"> |
| 32 | + <!-- Allow tab indent --> |
| 33 | + <exclude name="Generic.WhiteSpace.DisallowTabIndent"/> |
| 34 | + <!-- Allow php files to end without blank line --> |
| 35 | + <exclude name="PSR2.Files.EndFileNewline"/> |
| 36 | + <!-- Disallow indentation correction. Prevents wrong indentations with php in html. --> |
| 37 | + <exclude name="Generic.WhiteSpace.ScopeIndent.IncorrectExact"/> |
| 38 | + |
| 39 | + <!-- Allow braces on the same line as the function declaration. --> |
| 40 | + <exclude name="Squiz.Functions.MultiLineFunctionDeclaration.BraceOnSameLine" /> |
| 41 | + <!-- Allow inline if statements without braces --> |
| 42 | + <exclude name="Generic.ControlStructures.InlineControlStructure" /> |
| 43 | + |
| 44 | + <exclude name="PSR2.Classes.ClassDeclaration.OpenBraceNewLine" /> |
| 45 | + <exclude name="Squiz.ControlStructures.ControlSignature.SpaceAfterCloseBrace" /> |
| 46 | + <exclude name="PSR1.Classes.ClassDeclaration.MissingNamespace" /> |
| 47 | + <exclude name="PEAR.Functions.ValidDefaultValue.NotAtEnd" /> |
| 48 | + <!-- Allow same-line function call arguments, ie. prevent 1 argument per line. --> |
| 49 | + <exclude name="PEAR.Functions.FunctionCallSignature.MultipleArguments" /> |
| 50 | + <!-- Allow content after a function opening bracket, |
| 51 | + ie. allow arguments on same line as the opening bracket. --> |
| 52 | + <exclude name="PEAR.Functions.FunctionCallSignature.ContentAfterOpenBracket" /> |
| 53 | + <!-- Prevent function closing bracket from being on it's own line. --> |
| 54 | + <exclude name="PEAR.Functions.FunctionCallSignature.CloseBracketLine" /> |
| 55 | + <exclude name="Generic.Files.LineLength.TooLong" /> |
| 56 | + <exclude name="PSR2.Methods.FunctionClosingBrace.SpacingBeforeClose" /> |
| 57 | + <exclude name="PSR2.Methods.FunctionCallSignature.ContentAfterOpenBracket" /> |
| 58 | + <exclude name="PSR12.Classes.ClosingBrace.StatementAfter" /> |
| 59 | + <exclude name="Generic.Files.LineEndings.InvalidEOLChar" /> |
| 60 | + <exclude name="PSR1.Files.SideEffects.FoundWithSymbols" /> |
| 61 | + </rule> |
| 62 | + <!-- Allow same line opening brackets for functions --> |
| 63 | + <rule ref="Generic.Functions.OpeningFunctionBraceKernighanRitchie" /> |
| 64 | + <!-- Allow same line opening brackets for classes --> |
| 65 | + <rule ref="Generic.Classes.OpeningBraceSameLine"/> |
| 66 | + <!-- Disallow space indent --> |
| 67 | + <rule ref="Generic.WhiteSpace.DisallowSpaceIndent"/> |
| 68 | + <!-- Allow tab indents --> |
| 69 | + <rule ref="Generic.WhiteSpace.ScopeIndent"> |
| 70 | + <properties> |
| 71 | + <property name="indent" value="4"/> |
| 72 | + <property name="tabIndent" value="false"/> |
| 73 | + <property name="exact" value="true"/> |
| 74 | + </properties> |
| 75 | + </rule> |
| 76 | + <!-- Disallow spaces after opening and closing braces --> |
| 77 | + <rule ref="PEAR.Functions.FunctionCallSignature"> |
| 78 | + <properties> |
| 79 | + <property name="requiredSpacesAfterOpen" value="0" /> |
| 80 | + <property name="requiredSpacesBeforeClose" value="0" /> |
| 81 | + <property name="allowMultipleArguments" value="false"/> |
| 82 | + </properties> |
| 83 | + </rule> |
| 84 | + <!-- External standard. https://github.com/JParkinson1991/phpcodesniffer-standards/blob/master/docs/Standards/JPSR12/JPSR12.md --> |
| 85 | + <!-- Exclude certain sniffs. --> |
| 86 | + <rule ref="JPSR12"> |
| 87 | + <exclude name="JPSR12.Files" /> |
| 88 | + <exclude name="JPSR12.Operators.OperatorSpacing" /> |
| 89 | + <exclude name="JPSR12.Types.DeclareStrictTypes" /> |
| 90 | + <exclude name="JPSR12.Arrays.ArrayDeclaration.LastElementNoKeySpecified" /> |
| 91 | + </rule> |
| 92 | +</ruleset> |
0 commit comments