Skip to content

Commit 1975141

Browse files
authored
Merge pull request #9 from sirbrillig/remove/default-config-settings
Remove example config from ruleset.xml
2 parents 977590a + b1bfc6c commit 1975141

File tree

3 files changed

+65
-51
lines changed

3 files changed

+65
-51
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ If you already have installed paths, [use a comma to separate them](https://gith
5757
## Customization
5858

5959
There's a variety of options to customize the behaviour of VariableAnalysis, take
60-
a look at the included ruleset.xml for commented examples of a configuration.
60+
a look at the included ruleset.xml.example for commented examples of a configuration.
6161

6262
## Original
6363

VariableAnalysis/ruleset.xml

Lines changed: 0 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -11,54 +11,4 @@
1111
VariableAnalysis.CodeAnalysis.VariableAnalysis.VariableRedeclaration
1212
VariableAnalysis.CodeAnalysis.VariableAnalysis.SelfOutsideClass
1313
-->
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"/>
51-
<!--
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.
56-
-->
57-
<property name="validUnusedVariableNames" value="
58-
junk
59-
dummy
60-
"/>
61-
</properties>
62-
</rule>
63-
6414
</ruleset>
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
<?xml version="1.0"?>
2+
<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+
<!--
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"/>
51+
<!--
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.
56+
-->
57+
<property name="validUnusedVariableNames" value="
58+
junk
59+
dummy
60+
"/>
61+
</properties>
62+
</rule>
63+
64+
</ruleset>

0 commit comments

Comments
 (0)