|
5 | 5 |
|
6 | 6 | <config name="ignore_warnings_on_exit" value="1" />
|
7 | 7 |
|
8 |
| - <rule ref="./vendor/webthink/codesniffer/src/Webthink/ruleset.xml"> |
9 |
| - <exclude name="Generic.Files.LineLength.TooLong" /> |
10 |
| - <exclude name="Generic.Strings.UnnecessaryStringConcat" /> |
11 |
| - <exclude name="PEAR.Commenting.FunctionComment" /> |
12 |
| - <exclude name="Webthink.Formatting.UseInAlphabeticalOrder.UseInAlphabeticalOrder" /> |
| 8 | + <rule ref="PSR12" /> |
| 9 | + <!-- Force array element indentation with 4 spaces --> |
| 10 | + <rule ref="Generic.Arrays.ArrayIndent"/> |
| 11 | + <!-- Forbid `array(...)` --> |
| 12 | + <rule ref="Generic.Arrays.DisallowLongArraySyntax"/> |
| 13 | + <!-- Forbid final methods in final classes --> |
| 14 | + <rule ref="Generic.CodeAnalysis.UnnecessaryFinalModifier"/> |
| 15 | + <!-- Forbid useless empty method overrides --> |
| 16 | + <rule ref="Generic.CodeAnalysis.UselessOverridingMethod"/> |
| 17 | + <!-- Forbid Yoda --> |
| 18 | + <rule ref="Generic.ControlStructures.DisallowYodaConditions"/> |
| 19 | + <!-- Forbid inline HTML in PHP code --> |
| 20 | + <rule ref="Generic.Files.InlineHTML"/> |
| 21 | + <!-- Forbid PHP 4 constructors --> |
| 22 | + <rule ref="Generic.NamingConventions.ConstructorName"/> |
| 23 | + <!-- Forbid any content before opening tag --> |
| 24 | + <rule ref="Generic.PHP.CharacterBeforePHPOpeningTag"/> |
| 25 | + <!-- Forbid deprecated functions --> |
| 26 | + <rule ref="Generic.PHP.DeprecatedFunctions"/> |
| 27 | + <rule ref="Generic.PHP.ForbiddenFunctions"> |
| 28 | + <properties> |
| 29 | + <property name="forbiddenFunctions" type="array"> |
| 30 | + <element key="chop" value="rtrim"/> |
| 31 | + <element key="close" value="closedir"/> |
| 32 | + <element key="compact" value="null"/> |
| 33 | + <element key="delete" value="unset"/> |
| 34 | + <element key="doubleval" value="floatval"/> |
| 35 | + <element key="extract" value="null"/> |
| 36 | + <element key="fputs" value="fwrite"/> |
| 37 | + <element key="ini_alter" value="ini_set"/> |
| 38 | + <element key="is_double" value="is_float"/> |
| 39 | + <element key="is_integer" value="is_int"/> |
| 40 | + <element key="is_long" value="is_int"/> |
| 41 | + <element key="is_null" value="null"/> |
| 42 | + <element key="is_real" value="is_float"/> |
| 43 | + <element key="is_writeable" value="is_writable"/> |
| 44 | + <element key="join" value="implode"/> |
| 45 | + <element key="key_exists" value="array_key_exists"/> |
| 46 | + <element key="pos" value="current"/> |
| 47 | + <element key="settype" value="null"/> |
| 48 | + <element key="show_source" value="highlight_file"/> |
| 49 | + <element key="sizeof" value="count"/> |
| 50 | + <element key="strchr" value="strstr"/> |
| 51 | + <element key="user_error" value="trigger_error"/> |
| 52 | + </property> |
| 53 | + </properties> |
| 54 | + </rule> |
| 55 | + <!-- Forbid useless inline string concatenation --> |
| 56 | + <rule ref="Generic.Strings.UnnecessaryStringConcat"> |
| 57 | + <!-- But multiline is useful for readability --> |
| 58 | + <properties> |
| 59 | + <property name="allowMultiline" value="true"/> |
| 60 | + </properties> |
| 61 | + </rule> |
| 62 | + <!-- Forbid backtick operator --> |
| 63 | + <rule ref="Generic.PHP.BacktickOperator"/> |
| 64 | + <!-- Force PHP 7 param and return types to be lowercased --> |
| 65 | + <rule ref="Generic.PHP.LowerCaseType"/> |
| 66 | + <!-- Forbid `php_sapi_name()` function --> |
| 67 | + <rule ref="Generic.PHP.SAPIUsage"/> |
| 68 | + <!-- Forbid comments starting with # --> |
| 69 | + <rule ref="PEAR.Commenting.InlineComment"/> |
| 70 | + |
| 71 | + <rule ref="PEAR.WhiteSpace.ObjectOperatorIndent" /> |
| 72 | + |
| 73 | + <!-- Forbid global functions --> |
| 74 | + <rule ref="Squiz.Functions.GlobalFunction" /> |
| 75 | + <!-- Force camelCase variables --> |
| 76 | + <rule ref="Squiz.NamingConventions.ValidVariableName"> |
| 77 | + <exclude name="Squiz.NamingConventions.ValidVariableName.PrivateNoUnderscore" /> |
| 78 | + </rule> |
| 79 | + <!-- Forbid `AND` and `OR`, require `&&` and `||` --> |
| 80 | + <rule ref="Squiz.Operators.ValidLogicalOperators" /> |
| 81 | + <!-- Forbid `global` --> |
| 82 | + <rule ref="Squiz.PHP.GlobalKeyword" /> |
| 83 | + <!-- Forbid functions inside functions --> |
| 84 | + <rule ref="Squiz.PHP.InnerFunctions" /> |
| 85 | + <!-- Require PHP function calls in lowercase --> |
| 86 | + <rule ref="Squiz.PHP.LowercasePHPFunctions" /> |
| 87 | + <!-- Forbid dead code --> |
| 88 | + <rule ref="Squiz.PHP.NonExecutableCode" /> |
| 89 | + |
| 90 | + <!-- Forbid `$this` inside static function --> |
| 91 | + <rule ref="Squiz.Scope.StaticThisUsage" /> |
| 92 | + |
| 93 | + <!-- Disallow double quote usage --> |
| 94 | + <rule ref="Squiz.Strings.DoubleQuoteUsage"> |
| 95 | + <exclude name="Squiz.Strings.DoubleQuoteUsage.ContainsVar" /> |
13 | 96 | </rule>
|
14 |
| - <rule ref="Generic.CodeAnalysis.EmptyStatement"> |
15 |
| - <exclude-pattern>/tests/</exclude-pattern> |
| 97 | + <!-- Forbid blank line after function opening brace --> |
| 98 | + <rule ref="Squiz.WhiteSpace.FunctionOpeningBraceSpace"/> |
| 99 | + <!-- Require 1 line before and after function, except at the top and bottom --> |
| 100 | + <rule ref="Squiz.WhiteSpace.FunctionSpacing"> |
| 101 | + <properties> |
| 102 | + <property name="spacing" value="1" /> |
| 103 | + <property name="spacingBeforeFirst" value="0"/> |
| 104 | + <property name="spacingAfterLast" value="0"/> |
| 105 | + </properties> |
16 | 106 | </rule>
|
17 |
| - <rule ref="Generic.Metrics.CyclomaticComplexity"> |
| 107 | + <!-- Require space after language constructs --> |
| 108 | + <rule ref="Squiz.WhiteSpace.LanguageConstructSpacing" /> |
| 109 | + <!-- Require space around logical operators --> |
| 110 | + <rule ref="Squiz.WhiteSpace.LogicalOperatorSpacing" /> |
| 111 | + <!-- Forbid spaces around `->` operator --> |
| 112 | + <rule ref="Squiz.WhiteSpace.ObjectOperatorSpacing"> |
18 | 113 | <properties>
|
19 |
| - <property name="complexity" value="5" /> |
20 |
| - <property name="absoluteComplexity" value="10" /> |
| 114 | + <property name="ignoreNewlines" value="true" /> |
21 | 115 | </properties>
|
22 | 116 | </rule>
|
23 |
| - <rule ref="Squiz.Strings.DoubleQuoteUsage" /> |
| 117 | + |
| 118 | + <!-- Forbid spaces before semicolon `;` --> |
| 119 | + <rule ref="Squiz.WhiteSpace.SemicolonSpacing" /> |
| 120 | + <!-- Forbid superfluous whitespaces --> |
| 121 | + <rule ref="Squiz.WhiteSpace.SuperfluousWhitespace"> |
| 122 | + <properties> |
| 123 | + <!-- turned on by PSR-12 -> turning back off --> |
| 124 | + <property name="ignoreBlankLines" value="false" /> |
| 125 | + </properties> |
| 126 | + </rule> |
| 127 | + <rule ref="Squiz.WhiteSpace.SuperfluousWhitespace.EmptyLines"> |
| 128 | + <!-- turned off by PSR-12 -> turning back on --> |
| 129 | + <severity>5</severity> |
| 130 | + </rule> |
24 | 131 | </ruleset>
|
0 commit comments