/usr/share/php/data/PHP_PMD/resources/rulesets/design.xml is in phpmd 1.5.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 | <?xml version="1.0"?>
<ruleset name="Design 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 Code Size Ruleset contains a collection of rules that find software design related problems.
</description>
<rule name="ExitExpression"
since="0.2"
message = "The {0} {1}() contains an exit expression."
class="PHP_PMD_Rule_Design_ExitExpression"
externalInfoUrl="http://phpmd.org/rules/design.html#exitexpression">
<description>
<![CDATA[
An exit-expression within regular code is untestable and therefore it should
be avoided. Consider to move the exit-expression into some kind of startup
script where an error/exception code is returned to the calling environment.
]]>
</description>
<priority>1</priority>
<properties />
<example>
<![CDATA[
class Foo {
public function bar($param) {
if ($param === 42) {
exit(23);
}
}
}
]]>
</example>
</rule>
<rule name="EvalExpression"
since="0.2"
message = "The {0} {1}() contains an eval expression."
class="PHP_PMD_Rule_Design_EvalExpression"
externalInfoUrl="http://phpmd.org/rules/design.html#evalexpression">
<description>
<![CDATA[
An eval-expression is untestable, a security risk and bad practice. Therefore
it should be avoided. Consider to replace the eval-expression with regular
code.
]]>
</description>
<priority>1</priority>
<properties />
<example>
<![CDATA[
class Foo {
public function bar($param) {
if ($param === 42) {
eval('$param = 23;');
}
}
}
]]>
</example>
</rule>
<rule name="GotoStatement"
since="1.1.0"
message="The {0} {1}() utilizes a goto statement."
class="PHP_PMD_Rule_Design_GotoStatement"
externalInfoUrl="http://phpmd.org/rules/design.html#gotostatement">
<description>
<![CDATA[
Goto makes code harder to read and it is nearly impossible to understand the
control flow of an application that uses this language construct. Therefore it
should be avoided. Consider to replace Goto with regular control structures and
separate methods/function, which are easier to read.
]]>
</description>
<priority>1</priority>
<properties />
<example>
<![CDATA[
class Foo {
public function bar($param) {
A:
if ($param === 42) {
goto X;
}
Y:
if (time() % 42 === 23) {
goto Z;
}
X:
if (time() % 23 === 42) {
goto Y;
}
Z:
return 42;
}
}
]]>
</example>
</rule>
<rule name="NumberOfChildren"
since="0.2"
message = "The {0} {1} has {2} children. Consider to rebalance this class hierarchy to keep number of children under {3}."
class="PHP_PMD_Rule_Design_NumberOfChildren"
externalInfoUrl="http://phpmd.org/rules/design.html#numberofchildren">
<description>
<![CDATA[
A class with an excessive number of children is an indicator for an unbalanced
class hierarchy. You should consider to refactor this class hierarchy.
]]>
</description>
<priority>2</priority>
<properties>
<property name="minimum" value="15" description="Maximum number of acceptable child classes." />
</properties>
<example />
</rule>
<rule name="DepthOfInheritance"
since="0.2"
message = "The {0} {1} has {2} parents. Consider to reduce the depth of this class hierarchy to under {3}."
class="PHP_PMD_Rule_Design_DepthOfInheritance"
externalInfoUrl="http://phpmd.org/rules/design.html#depthofinheritance">
<description>
<![CDATA[
A class with many parents is an indicator for an unbalanced and wrong class
hierarchy. You should consider to refactor this class hierarchy.
]]>
</description>
<priority>2</priority>
<properties>
<property name="minimum" value="6" description="Maximum number of acceptable parent classes." />
</properties>
<example />
</rule>
<rule name="CouplingBetweenObjects"
since="1.1.0"
message="The class {0} has a coupling between objects value of {1}. Consider to reduce the number of dependencies under {2}."
class="PHP_PMD_Rule_Design_CouplingBetweenObjects"
externalInfoUrl="http://phpmd.org/rules/design.html#couplingbetweenobjects">
<description>
<![CDATA[
A class with to many dependencies has negative impacts on several quality
aspects of a class. This includes quality criterias like stability,
maintainability and understandability
]]>
</description>
<priority>2</priority>
<properties>
<property name="minimum" value="13" description="Maximum number of acceptable dependencies." />
</properties>
<example>
<![CDATA[
class Foo {
/**
* @var \foo\bar\X
*/
private $x = null;
/**
* @var \foo\bar\Y
*/
private $y = null;
/**
* @var \foo\bar\Z
*/
private $z = null;
public function setFoo(\Foo $foo) {}
public function setBar(\Bar $bar) {}
public function setBaz(\Baz $baz) {}
/**
* @return \SplObjectStorage
* @throws \OutOfRangeException
* @throws \InvalidArgumentException
* @throws \ErrorException
*/
public function process(Iterator $it) {}
// ...
}
]]>
</example>
</rule>
</ruleset>
|