Skip to content

Commit 8f5e003

Browse files
committed
pmd: configure UnnecessaryLocalBeforeReturn rule to catch more cases.
Quote from https://pmd.github.io/pmd-5.6.0/overview/changelog.html: "The Java rule UnnecessaryLocalBeforeReturn (ruleset java-design) now has a new property statementOrderMatters. It is enabled by default to stay backwards compatible. But if this property is set to false, this rule no longer requires the variable declaration and return statement to be on consecutive lines. Any variable that is used solely in a return statement will be reported." Should be in 455eb7e commit. No functional changes.
1 parent 5937d16 commit 8f5e003

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/main/config/pmd.xml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,15 @@
99

1010
<!-- For rules description see http://pmd.github.io/pmd-5.5.2/pmd-java/rules/index.html -->
1111

12-
<rule ref="rulesets/java/design.xml" />
12+
<rule ref="rulesets/java/design.xml">
13+
<exclude name="UnnecessaryLocalBeforeReturn" />
14+
</rule>
15+
<rule ref="rulesets/java/design.xml/UnnecessaryLocalBeforeReturn">
16+
<properties>
17+
<property name="statementOrderMatters" value="false" />
18+
</properties>
19+
</rule>
20+
1321
<rule ref="rulesets/java/coupling.xml">
1422
<exclude name="LawOfDemeter" />
1523
<exclude name="LoosePackageCoupling" />

0 commit comments

Comments
 (0)