Rule |
Description |
KPI |
URL |
CyclomaticComplexity |
Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are ‘if’, ‘while’, ‘for’, and ‘case labels’. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity. |
Maintainability |
https://phpmd.org/rules/codesize.html |
NPathComplexity |
The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity. |
Maintainability |
https://phpmd.org/rules/codesize.html |
ExcessiveMethodLength |
Violations of this rule usually indicate that the method is doing too much. Try to reduce the method size by creating helper methods and removing any copy/pasted code. |
Maintainability |
https://phpmd.org/rules/codesize.html |
ExcessiveClassLength |
Long Class files are indications that the class may be trying to do too much. Try to break it down, and reduce the size to something manageable. |
Maintainability |
https://phpmd.org/rules/codesize.html |
ExcessiveClassComplexity |
The Weighted Method Count (WMC) of a class is a good indicator of how much time and effort is required to modify and maintain this class. The WMC metric is defined as the sum of complexities of all methods declared in a class. A large number of methods also means that this class has a greater potential impact on derived classes. |
Robustness |
https://phpmd.org/rules/codesize.html |
UnusedPrivateField |
Detects when a private field is declared and/or assigned a value, but not used. |
Maintainability |
https://phpmd.org/rules/unusedcode.html#UnusedPrivateField |
UnusedLocalVariable |
Detects when a local variable is declared and/or assigned, but not used. |
Maintainability |
https://phpmd.org/rules/unusedcode.html#UnusedLocalVariable |
UnusedPrivateMethod |
Unused Private Method detects when a private method is declared but is unused. |
Maintainability |
https://phpmd.org/rules/unusedcode.html#UnusedPrivateMethod |
UnusedFormalParameter |
Avoid passing parameters to methods or constructors and then not using those parameters. |
Maintainability |
https://phpmd.org/rules/unusedcode.html#UnusedFormalParameter |