Skip to content

Commit

Permalink
update pmd and checkstyle configs:
Browse files Browse the repository at this point in the history
checkstyle MultipleStringLiterals - change defauilt
pmd AvoidAccessibilityAlteration and ReturnEmptyArrayRatherThanNull disabled
pmd CognitiveComplexity change default
  • Loading branch information
xvik committed Jul 2, 2022
1 parent a57dd28 commit dd96fd6
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,13 @@
Option might be used to force backport for java >=11 or to disable backport at all
* Update checkstyle config:
- Add [UnusedLocalVariable](https://checkstyle.sourceforge.io/config_coding.html#UnusedLocalVariable)
- Change [MultipleStringLiterals](https://checkstyle.org/config_coding.html#MultipleStringLiterals)
to react on strings more than 2 chars only and allow 2 duplicates (to avoid warning in trivial cases)
* Update pmd 6.34 -> 6.47 (java 17-18 support)
* Update pmd config:
- Disable [AvoidAccessibilityAlteration](https://pmd.github.io/pmd-6.47.0/pmd_rules_java_errorprone.html#avoidaccessibilityalteration)
- Change [CognitiveComplexity](https://pmd.github.io/pmd-6.47.0/pmd_rules_java_design.html#cognitivecomplexity) reportLevel to 21 (default 15)
- Disable [ReturnEmptyArrayRatherThanNull](https://pmd.github.io/pmd-6.47.0/pmd_rules_java_errorprone.html#returnemptyarrayratherthannull) as deprecated
* Update codenarc 2.2.0 -> 3.1.0 (groovy 4 support)
* New option: quality.codenarcGroovy4 (by default, true)
Since codenarc 3.1 separate groovy4-based codenarc jar produced (codenarc-groovy4)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,10 @@
<!--<module name="MissingCtor"/>-->
<module name="MissingSwitchDefault"/>
<module name="ModifiedControlVariable"/>
<module name="MultipleStringLiterals"/>
<module name="MultipleStringLiterals">
<property name="allowedDuplicates" value="2"/>
<property name="ignoreStringsRegexp" value='^".{0,2}"$'/>
</module>
<module name="MultipleVariableDeclarations"/>
<module name="NestedForDepth">
<property name="max" value="2"/>
Expand Down
7 changes: 7 additions & 0 deletions src/main/resources/ru/vyarus/quality/config/pmd/pmd.xml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@
<property name="problemDepth" value="4"/>
</properties>
</rule>
<rule ref="category/java/design.xml/CognitiveComplexity">
<properties>
<property name="reportLevel" value="21"/>
</properties>
</rule>
<rule ref="category/java/design.xml/CyclomaticComplexity">
<properties>
<property name="cycloOptions" value="ignoreBooleanPaths"/>
Expand Down Expand Up @@ -110,6 +115,7 @@
<!-- Error prone (https://pmd.github.io/pmd-6.0.1/pmd_rules_java_errorprone.html) -->
<rule ref="category/java/errorprone.xml">
<exclude name="AssignmentInOperand"/>
<exclude name="AvoidAccessibilityAlteration"/>
<exclude name="AvoidCatchingThrowable"/>
<exclude name="BeanMembersShouldSerialize"/>
<exclude name="DataflowAnomalyAnalysis"/>
Expand All @@ -124,6 +130,7 @@
<exclude name="LoggerIsNotStaticFinal"/>
<exclude name="MissingSerialVersionUID"/>
<exclude name="NullAssignment"/> <!-- disabled due to false positive for initialization with ternary operator -->
<exclude name="ReturnEmptyArrayRatherThanNull"/>
<exclude name="StaticEJBFieldShouldBeFinal"/> <!-- earlier j2ee group-->
<exclude name="UseCorrectExceptionLogging"/>
<exclude name="UseLocaleWithCaseConversions"/>
Expand Down

0 comments on commit dd96fd6

Please sign in to comment.