|
68 | 68 | <rule ref="Generic.Classes.OpeningBraceSameLine"/> |
69 | 69 | <rule ref="Totara.NamingConventions.ValidClassName"/> |
70 | 70 |
|
71 | | - <!-- Removed in PHPCS 4: Squiz.CSS.* class brace spacing sniffs. --> |
72 | | - |
73 | 71 | <!-- When instantiating a new class, parenthesis MUST always be present even when there are no arguments passed to the constructor. --> |
74 | 72 | <rule ref="PSR12.Classes.ClassInstantiation"/> |
75 | 73 |
|
|
87 | 85 |
|
88 | 86 | <!-- 4.4 Methods/Functions --> |
89 | 87 |
|
90 | | - <!-- TODO Add spacing rules for function calls and declarations --> |
| 88 | + <!-- Spacing rules for function calls and declarations --> |
| 89 | + |
| 90 | + <!-- No space between function name and opening parenthesis in calls --> |
| 91 | + <rule ref="Generic.Functions.FunctionCallArgumentSpacing"/> |
| 92 | + |
| 93 | + <!-- Space after comma in function arguments --> |
| 94 | + <rule ref="Squiz.Functions.FunctionDeclarationArgumentSpacing"> |
| 95 | + <properties> |
| 96 | + <property name="equalsSpacing" value="1"/> |
| 97 | + </properties> |
| 98 | + </rule> |
| 99 | + |
| 100 | + <!-- No space before semicolons --> |
| 101 | + <rule ref="Squiz.WhiteSpace.SemicolonSpacing"/> |
| 102 | + |
| 103 | + <!-- No space around cast operators --> |
| 104 | + <rule ref="Generic.Formatting.SpaceAfterCast"/> |
| 105 | + |
| 106 | + <!-- No space between function name and opening parenthesis --> |
| 107 | + <rule ref="Squiz.Functions.FunctionDeclaration"/> |
| 108 | + |
| 109 | + <!-- Space before/after function declaration --> |
| 110 | + <rule ref="Squiz.WhiteSpace.FunctionSpacing"> |
| 111 | + <properties> |
| 112 | + <property name="spacing" value="1"/> |
| 113 | + <property name="spacingBeforeFirst" value="0"/> |
| 114 | + <property name="spacingAfterLast" value="0"/> |
| 115 | + </properties> |
| 116 | + </rule> |
| 117 | + |
| 118 | + <!-- Correct spacing around operator in default parameter value --> |
| 119 | + <rule ref="Squiz.Functions.FunctionDeclarationArgumentSpacing.SpaceBeforeEquals"> |
| 120 | + <severity>0</severity> |
| 121 | + </rule> |
| 122 | + <rule ref="Squiz.Functions.FunctionDeclarationArgumentSpacing.SpaceAfterEquals"> |
| 123 | + <severity>0</severity> |
| 124 | + </rule> |
91 | 125 |
|
92 | 126 | <!-- Visibility MUST be declared on all methods. --> |
93 | 127 | <rule ref="Squiz.Scope.MethodScope"/> |
|
197 | 231 | <property name="absoluteNestingLevel" value="10"/> |
198 | 232 | </properties> |
199 | 233 | </rule> |
200 | | - <rule ref="Generic.Metrics.CyclomaticComplexity"> |
201 | | - <!-- php:S3776 Cognitive/cyclomatic complexity --> |
202 | | - <properties> |
203 | | - <property name="complexity" value="15"/> |
204 | | - <property name="absoluteComplexity" value="30"/> |
205 | | - </properties> |
206 | | - </rule> |
207 | 234 |
|
208 | | - <!-- SonarQube rule coverage (php:S1068, php:S1172) --> |
209 | 235 | <!-- Unused parameters --> |
210 | 236 | <rule ref="Generic.CodeAnalysis.UnusedFunctionParameter"/> |
211 | 237 |
|
212 | | - <!-- SonarQube rule coverage (php:S1116) --> |
213 | 238 | <!-- Empty PHP statements (;;) --> |
214 | 239 | <rule ref="Generic.CodeAnalysis.EmptyPHPStatement"/> |
215 | 240 |
|
216 | | - <!-- SonarQube rule coverage (php:S1186, php:S905) --> |
217 | 241 | <!-- Empty catch/if/else bodies --> |
218 | 242 | <rule ref="Generic.CodeAnalysis.EmptyStatement"/> |
219 | 243 |
|
220 | | - <!-- SonarQube rule coverage (php:S1121) --> |
221 | 244 | <!-- Assignment in condition --> |
222 | 245 | <rule ref="Generic.CodeAnalysis.AssignmentInCondition"/> |
223 | 246 |
|
224 | | - <!-- SonarQube rule coverage (php:S1145) --> |
225 | 247 | <!-- if (true) / if (false) unconditional --> |
226 | 248 | <rule ref="Generic.CodeAnalysis.UnconditionalIfStatement"/> |
227 | 249 |
|
228 | | - <!-- SonarQube rule coverage (php:S1185) --> |
229 | 250 | <!-- Useless overriding methods that just call parent --> |
230 | 251 | <rule ref="Generic.CodeAnalysis.UselessOverridingMethod"/> |
231 | 252 |
|
232 | | - <!-- SonarQube rule coverage (php:S1110) --> |
233 | 253 | <!-- Unnecessary parentheses --> |
234 | 254 | <rule ref="Generic.WhiteSpace.ArbitraryParenthesesSpacing"/> |
235 | 255 |
|
236 | | - <!-- SonarQube rule coverage (php:S1134) --> |
237 | 256 | <!-- FIXME comments --> |
238 | 257 | <rule ref="Generic.Commenting.Fixme"/> |
239 | 258 |
|
240 | | - <!-- SonarQube rule coverage (php:S1135) --> |
241 | 259 | <!-- TODO comments --> |
242 | 260 | <rule ref="Generic.Commenting.Todo"/> |
243 | 261 |
|
244 | | - <!-- SonarQube rule coverage (php:S125) --> |
245 | 262 | <!-- Commented-out code --> |
246 | 263 | <rule ref="Squiz.PHP.CommentedOutCode"> |
247 | 264 | <properties> |
248 | 265 | <property name="maxPercentage" value="35"/> |
249 | 266 | </properties> |
250 | 267 | </rule> |
251 | 268 |
|
252 | | - <!-- SonarQube rule coverage (php:S1763, php:S881) --> |
253 | 269 | <!-- Dead/non-executable code after return/throw/etc --> |
254 | 270 | <rule ref="Squiz.PHP.NonExecutableCode"/> |
255 | 271 |
|
256 | | - <!-- SonarQube rule coverage (php:S139) --> |
257 | 272 | <!-- Inline comments after statements --> |
258 | 273 | <rule ref="Squiz.Commenting.PostStatementComment"/> |
259 | 274 |
|
260 | | - <!-- SonarQube rule coverage (php:S1788) --> |
261 | 275 | <!-- Default parameter values must not follow non-default params --> |
262 | 276 | <rule ref="PEAR.Functions.ValidDefaultValue"/> |
263 | 277 |
|
264 | | - <!-- SonarQube rule coverage (php:S907) --> |
265 | 278 | <!-- Discourage goto --> |
266 | 279 | <rule ref="Generic.PHP.DiscourageGoto"/> |
267 | 280 |
|
268 | | - <!-- SonarQube rule coverage (php:S2068) --> |
269 | | - <!-- No hardcoded credentials / passwords in code --> |
| 281 | + <!-- Forbidden/dangerous functions (e.g. eval, var_dump, sizeof → configure as needed) --> |
270 | 282 | <rule ref="Generic.PHP.ForbiddenFunctions"/> |
271 | 283 |
|
272 | | - <!-- SonarQube rule coverage (php:S1192) --> |
273 | 284 | <!-- Unnecessary string concatenation --> |
274 | 285 | <rule ref="Generic.Strings.UnnecessaryStringConcat"/> |
275 | 286 |
|
276 | | - <!-- SonarQube rule coverage (php:S1301) --> |
277 | | - <!-- Single-case switch statements --> |
| 287 | + <!-- Jumbled loop incrementers (e.g. same variable in nested for-loops) --> |
278 | 288 | <rule ref="Generic.CodeAnalysis.JumbledIncrementer"/> |
279 | 289 |
|
280 | | - <!-- SonarQube rule coverage (php:S1155, php:S3699) --> |
281 | 290 | <!-- Duplicate class names --> |
282 | 291 | <rule ref="Generic.Classes.DuplicateClassName"/> |
283 | 292 |
|
284 | | - <!-- SonarQube rule coverage (php:S2612) --> |
285 | 293 | <!-- No silenced errors (@) --> |
286 | 294 | <rule ref="Generic.PHP.NoSilencedErrors"/> |
287 | 295 |
|
|
0 commit comments