Table of Contents
AvoidDeeplyNestedIfStmts
Since: PMD 5.1
Priority: Medium (3)
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.velocity.rule.design.AvoidDeeplyNestedIfStmtsRule
This rule has the following properties:
Name | Default Value | Description |
---|---|---|
problemDepth | 3 | The if statement depth reporting threshold |
Use this rule with the default properties by just referencing it:
<rule ref="category/velocity/design.xml/AvoidDeeplyNestedIfStmts" />
Use this rule and customize it:
<rule ref="category/velocity/design.xml/AvoidDeeplyNestedIfStmts">
<properties>
<property name="problemDepth" value="3" />
</properties>
</rule>
CollapsibleIfStatements
Since: PMD 5.1
Priority: Medium (3)
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.velocity.rule.design.CollapsibleIfStatementsRule
Use this rule by referencing it:
<rule ref="category/velocity/design.xml/CollapsibleIfStatements" />
ExcessiveTemplateLength
Since: PMD 5.1
Priority: Medium (3)
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.velocity.rule.design.ExcessiveTemplateLengthRule
This rule has the following properties:
Name | Default Value | Description |
---|---|---|
minimum | 1000 | Threshold above which a node is reported |
Use this rule with the default properties by just referencing it:
<rule ref="category/velocity/design.xml/ExcessiveTemplateLength" />
Use this rule and customize it:
<rule ref="category/velocity/design.xml/ExcessiveTemplateLength">
<properties>
<property name="minimum" value="1000" />
</properties>
</rule>
NoInlineJavaScript
Since: PMD 5.1
Priority: Medium High (2)
Avoid inline JavaScript. Import .js files instead.
This rule is defined by the following Java class: net.sourceforge.pmd.lang.velocity.rule.design.NoInlineJavaScriptRule
Use this rule by referencing it:
<rule ref="category/velocity/design.xml/NoInlineJavaScript" />
NoInlineStyles
Since: PMD 5.1
Priority: Medium High (2)
Avoid inline styles. Use css classes instead.
This rule is defined by the following XPath expression:
//Text[matches(@literal, "<[^>]+\s[sS][tT][yY][lL][eE]\s*=")]
Use this rule by referencing it:
<rule ref="category/velocity/design.xml/NoInlineStyles" />