-
Notifications
You must be signed in to change notification settings - Fork 0
/
unusedcode.xml
105 lines (99 loc) · 2.99 KB
/
unusedcode.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
<?xml version="1.0"?>
<ruleset name="Unused Code Rules"
xmlns="http://pmd.sf.net/ruleset/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0 http://pmd.sf.net/ruleset_xml_schema.xsd"
xsi:noNamespaceSchemaLocation="http://pmd.sf.net/ruleset_xml_schema.xsd">
<description>
The Unused Code Ruleset contains a collection of rules that find unused code.
</description>
<rule name="UnusedPrivateField"
since="0.2"
message="Avoid unused private fields such as '{0}'."
class="PHPMD\Rule\UnusedPrivateField"
externalInfoUrl="http://phpmd.org/rules/unusedcode.html#unusedprivatefield">
<description>
Detects when a private field is declared and/or assigned a value, but not used.
</description>
<priority>3</priority>
<example>
<![CDATA[
class Something
{
private static $FOO = 2; // Unused
private $i = 5; // Unused
private $j = 6;
public function addOne()
{
return $this->j++;
}
}
]]>
</example>
</rule>
<rule name="UnusedLocalVariable"
since="0.2"
message="Avoid unused local variables such as '{0}'."
class="PHPMD\Rule\UnusedLocalVariable"
externalInfoUrl="http://phpmd.org/rules/unusedcode.html#unusedlocalvariable">
<description>
Detects when a local variable is declared and/or assigned, but not used.
</description>
<priority>3</priority>
<properties>
<property
name="allow-unused-foreach-variables"
description="Allow unused variables in foreach language constructs."
value="false" />
</properties>
<example>
<![CDATA[
class Foo {
public function doSomething()
{
$i = 5; // Unused
}
}
]]>
</example>
</rule>
<rule name="UnusedPrivateMethod"
since="0.2"
message="Avoid unused private methods such as '{0}'."
class="PHPMD\Rule\UnusedPrivateMethod"
externalInfoUrl="http://phpmd.org/rules/unusedcode.html#unusedprivatemethod">
<description>
Unused Private Method detects when a private method is declared but is unused.
</description>
<priority>3</priority>
<example>
<![CDATA[
class Something
{
private function foo() {} // unused
}
]]>
</example>
</rule>
<rule name="UnusedFormalParameter"
since="0.2"
message="Avoid unused parameters such as '{0}'."
class="PHPMD\Rule\UnusedFormalParameter"
externalInfoUrl="http://phpmd.org/rules/unusedcode.html#unusedformalparameter">
<description>
Avoid passing parameters to methods or constructors and then not using those parameters.
</description>
<priority>3</priority>
<example>
<![CDATA[
class Foo
{
private function bar($howdy)
{
// $howdy is not used
}
}
]]>
</example>
</rule>
</ruleset>