Skip to content

Commit 26bf3d3

Browse files
authored
Fix example ruleset (#194)
* Clean up ruleset * Fix indentation in example ruleset * Remove specific codes and options from example and refer to README
1 parent cc4fc9c commit 26bf3d3

File tree

2 files changed

+9
-71
lines changed

2 files changed

+9
-71
lines changed

VariableAnalysis/ruleset.xml

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,7 @@
11
<?xml version="1.0"?>
22
<ruleset name="VariableAnalysis">
3-
<description>A code sniff to detect problems with variables.</description>
4-
5-
<!-- If you want everything, with the defaults, just include this line -->
6-
<rule ref="VariableAnalysis.CodeAnalysis.VariableAnalysis"/>
7-
<!-- PHPCSUtils is required for this sniff to operate -->
8-
<rule ref="PHPCSUtils"/>
9-
<!--
10-
You can also refer to these policy codes to customize them:
11-
VariableAnalysis.CodeAnalysis.VariableAnalysis.UndefinedVariable
12-
VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable
13-
VariableAnalysis.CodeAnalysis.VariableAnalysis.VariableRedeclaration
14-
VariableAnalysis.CodeAnalysis.VariableAnalysis.SelfOutsideClass
15-
-->
3+
<description>Plugin for PHP_CodeSniffer static analysis tool that adds analysis of problematic variable use.</description>
4+
<rule ref="VariableAnalysis.CodeAnalysis.VariableAnalysis"/>
5+
<!-- PHPCSUtils is required for this sniff to operate -->
6+
<rule ref="PHPCSUtils"/>
167
</ruleset>
Lines changed: 5 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,11 @@
11
<?xml version="1.0"?>
22
<ruleset name="VariableAnalysis">
3-
<description>A code sniff to detect problems with variables.</description>
3+
<description>Plugin for PHP_CodeSniffer static analysis tool that adds analysis of problematic variable use.</description>
44

5-
<!-- If you want everything, with the defaults, just include this line -->
6-
<rule ref="VariableAnalysis.CodeAnalysis.VariableAnalysis"/>
7-
<!--
8-
You can also refer to these policy codes to customize them:
9-
VariableAnalysis.CodeAnalysis.VariableAnalysis.UndefinedVariable
10-
VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable
11-
VariableAnalysis.CodeAnalysis.VariableAnalysis.VariableRedeclaration
12-
VariableAnalysis.CodeAnalysis.VariableAnalysis.SelfOutsideClass
13-
-->
14-
15-
<!-- Include this block to customize VariableAnalysis behaviour -->
16-
<rule ref="VariableAnalysis.CodeAnalysis.VariableAnalysis">
17-
<properties>
18-
<!--
19-
Include the following property if you want to include your own list of pass-by-reference
20-
functions defined in your codebase.
21-
Format is "function:argnum" or "function:argnum1,argnum2" etc.
22-
Whitespace delimits function definitions.
23-
Argument numbers start at 1 and an elipsis '...' means all argument numbers
24-
after the previous should be considered pass-by-reference.
25-
-->
26-
<property name="sitePassByRefFunctions" value="
27-
function_with_first_arg_by_ref:1
28-
function_with_second_and_third_arg_by_ref:2,3
29-
function_with_third_and_remaining_args_by_ref:3,...
30-
"/>
31-
<!--
32-
Include the following property if you want to prevent exception variables declared
33-
in a catch block from causing an unused variable warning, this supports the common
34-
(but not always wanted) pattern of:
35-
try {
36-
// stuff here
37-
} catch (Exception $e) {
38-
// Do something without ever using $e
39-
}
40-
-->
41-
<property name="allowUnusedCaughtExceptions" value="1"/>
42-
<!--
43-
Include the following property if you want to prevent function parametets from causing an
44-
unused variable warning, this supports the common pattern of defining callback functions that
45-
demand a fixed parameter list without actually using all the paramets.
46-
function foo ($a, $b, $c) {
47-
// Do something without ever using some of $a, $b and/or $c
48-
}
49-
-->
50-
<property name="allowUnusedFunctionParameters" value="1"/>
5+
<!-- If you want everything, with the defaults, just include this line -->
6+
<rule ref="VariableAnalysis"/>
517
<!--
52-
Include the following property if you want to have a whitelist of variable names
53-
that are commonly used for placeholder "junk" values that ignored and that you
54-
don't want to provoke an unused variable warning for.
55-
Format is "variableName" without a leading $ with whitespace delimiting names.
8+
You can also refer to specific sniff codes to customize or disable them. See the README for a list of the available codes.
9+
There are also many options that can be set to change the behavior of this sniff. See the "Customization" section of the README.
5610
-->
57-
<property name="validUnusedVariableNames" value="
58-
junk
59-
dummy
60-
"/>
61-
</properties>
62-
</rule>
63-
6411
</ruleset>

0 commit comments

Comments
 (0)