Since: PMD 5.1
Avoid creating deeply nested if-then statements since they are harder to read and error-prone to maintain.
This rule is defined by the following Java class: net.sourceforge.pmd.lang.vm.rule.basic.AvoidDeeplyNestedIfStmtsRule
This rule has the following properties:
Name | Default Value | Description |
---|---|---|
violationSuppressRegex | Suppress violations with messages matching a regular expression | |
violationSuppressXPath | Suppress violations on nodes which match a given relative XPath expression. | |
problemDepth | 3 | The if statement depth reporting threshold |
Since: PMD 5.1
Sometimes two consecutive 'if' statements can be consolidated by separating their conditions with a boolean short-circuit operator.
This rule is defined by the following Java class: net.sourceforge.pmd.lang.vm.rule.basic.CollapsibleIfStatementsRule
This rule has the following properties:
Name | Default Value | Description |
---|---|---|
violationSuppressRegex | Suppress violations with messages matching a regular expression | |
violationSuppressXPath | Suppress violations on nodes which match a given relative XPath expression. |
Since: PMD 5.1
The template is too long. It should be broken up into smaller pieces.
This rule is defined by the following Java class: net.sourceforge.pmd.lang.vm.rule.basic.ExcessiveTemplateLengthRule
This rule has the following properties:
Name | Default Value | Description |
---|---|---|
minimum | 1000 | |
violationSuppressRegex | Suppress violations with messages matching a regular expression | |
violationSuppressXPath | Suppress violations on nodes which match a given relative XPath expression. | |
topscore | Top score value | |
minimum | Minimum reporting threshold | |
sigma | Sigma value |
Since: PMD 5.1
Reassigning values to incoming parameters is not recommended. Use temporary local variables instead.
This rule is defined by the following Java class: net.sourceforge.pmd.lang.vm.rule.basic.AvoidReassigningParametersRule
This rule has the following properties:
Name | Default Value | Description |
---|---|---|
violationSuppressRegex | Suppress violations with messages matching a regular expression | |
violationSuppressXPath | Suppress violations on nodes which match a given relative XPath expression. |
Since: PMD 5.1
Empty if statements should be deleted.
This rule is defined by the following Java class: net.sourceforge.pmd.lang.vm.rule.basic.EmptyIfStmtRule
This rule has the following properties:
Name | Default Value | Description |
---|---|---|
violationSuppressRegex | Suppress violations with messages matching a regular expression | |
violationSuppressXPath | Suppress violations on nodes which match a given relative XPath expression. |
Since: PMD 5.1
Empty foreach statements should be deleted.
This rule is defined by the following Java class: net.sourceforge.pmd.lang.vm.rule.basic.EmptyForeachStmtRule
This rule has the following properties:
Name | Default Value | Description |
---|---|---|
violationSuppressRegex | Suppress violations with messages matching a regular expression | |
violationSuppressXPath | Suppress violations on nodes which match a given relative XPath expression. |
Since: PMD 5.1
Avoid unused macro parameters. They should be deleted.
This rule is defined by the following Java class: net.sourceforge.pmd.lang.vm.rule.basic.UnusedMacroParameterRule
This rule has the following properties:
Name | Default Value | Description |
---|---|---|
violationSuppressRegex | Suppress violations with messages matching a regular expression | |
violationSuppressXPath | Suppress violations on nodes which match a given relative XPath expression. |
Since: PMD 5.1
Avoid inline JavaScript. Import .js files instead.
This rule is defined by the following Java class: net.sourceforge.pmd.lang.vm.rule.basic.NoInlineJavaScriptRule
This rule has the following properties:
Name | Default Value | Description |
---|---|---|
violationSuppressRegex | Suppress violations with messages matching a regular expression | |
violationSuppressXPath | Suppress violations on nodes which match a given relative XPath expression. |