Archived
fix(pmd): update rules for test conventions and style preferences
- Allow underscores in JUnit 5 test method names (junit5TestPattern) - Exclude LocalVariableCouldBeFinal (style preference, not a bug) - Exclude MethodArgumentCouldBeFinal (style preference) - Exclude LinguisticNaming (getter-like test names are fine) - Exclude UseUnderscoresInNumericLiterals (12345L is readable) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
0a846cc9d5
commit
d3ef55a8ce
1 file changed
+11
@@ -48,6 +48,12 @@
|
|||||||
<exclude name="CommentDefaultAccessModifier"/>
|
<exclude name="CommentDefaultAccessModifier"/>
|
||||||
<!-- Java 21+ has useful implicit classes -->
|
<!-- Java 21+ has useful implicit classes -->
|
||||||
<exclude name="UnnecessaryFullyQualifiedName"/>
|
<exclude name="UnnecessaryFullyQualifiedName"/>
|
||||||
|
<!-- Final local vars are a style preference, not a bug -->
|
||||||
|
<exclude name="LocalVariableCouldBeFinal"/>
|
||||||
|
<!-- Final method args are a style preference -->
|
||||||
|
<exclude name="MethodArgumentCouldBeFinal"/>
|
||||||
|
<!-- Getter-like test names (getX_shouldY) are fine -->
|
||||||
|
<exclude name="LinguisticNaming"/>
|
||||||
</rule>
|
</rule>
|
||||||
|
|
||||||
<rule ref="category/java/codestyle.xml/ClassNamingConventions">
|
<rule ref="category/java/codestyle.xml/ClassNamingConventions">
|
||||||
@@ -60,9 +66,12 @@
|
|||||||
<properties>
|
<properties>
|
||||||
<property name="methodPattern" value="[a-z][a-zA-Z0-9]*"/>
|
<property name="methodPattern" value="[a-z][a-zA-Z0-9]*"/>
|
||||||
<property name="nativePattern" value="[a-z][a-zA-Z0-9]*"/>
|
<property name="nativePattern" value="[a-z][a-zA-Z0-9]*"/>
|
||||||
|
<!-- Allow underscores in JUnit 5 test method names (BDD style: method_condition_result) -->
|
||||||
|
<property name="junit5TestPattern" value="[a-z][a-zA-Z0-9_]*"/>
|
||||||
</properties>
|
</properties>
|
||||||
</rule>
|
</rule>
|
||||||
|
|
||||||
|
|
||||||
<!-- ================================================================== -->
|
<!-- ================================================================== -->
|
||||||
<!-- DESIGN -->
|
<!-- DESIGN -->
|
||||||
<!-- ================================================================== -->
|
<!-- ================================================================== -->
|
||||||
@@ -123,6 +132,8 @@
|
|||||||
<exclude name="BeanMembersShouldSerialize"/>
|
<exclude name="BeanMembersShouldSerialize"/>
|
||||||
<!-- Too strict -->
|
<!-- Too strict -->
|
||||||
<exclude name="DataflowAnomalyAnalysis"/>
|
<exclude name="DataflowAnomalyAnalysis"/>
|
||||||
|
<!-- Underscores in numeric literals optional for small numbers -->
|
||||||
|
<exclude name="UseUnderscoresInNumericLiterals"/>
|
||||||
</rule>
|
</rule>
|
||||||
|
|
||||||
<rule ref="category/java/errorprone.xml/AvoidLiteralsInIfCondition">
|
<rule ref="category/java/errorprone.xml/AvoidLiteralsInIfCondition">
|
||||||
|
|||||||
Reference in new issue
Block a user