New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Upgrade to PMD 7.1.0 #6597
Labels
build
Monorepo organization, gradle/cmake, upstream_utils, etc
Comments
calcmogul
added
the
build
Monorepo organization, gradle/cmake, upstream_utils, etc
label
May 7, 2024
I fixed the XML validation errors and updated the exclusions: diff --git a/shared/java/javastyle.gradle b/shared/java/javastyle.gradle
index 41ddb47e6..5c9a140ee 100644
--- a/shared/java/javastyle.gradle
+++ b/shared/java/javastyle.gradle
@@ -13,7 +13,7 @@ checkstyle {
apply plugin: 'pmd'
pmd {
- toolVersion = '6.55.0'
+ toolVersion = '7.1.0'
consoleOutput = true
reportsDir = file("$project.buildDir/reports/pmd")
ruleSetFiles = files(new File(rootDir, "styleguide/pmd-ruleset.xml"))
diff --git a/styleguide/pmd-ruleset.xml b/styleguide/pmd-ruleset.xml
index 1f6577e6f..b965fc981 100644
--- a/styleguide/pmd-ruleset.xml
+++ b/styleguide/pmd-ruleset.xml
@@ -31,6 +31,7 @@
<exclude name="SwitchStmtsShouldHaveDefault" />
<exclude name="SystemPrintln" />
<exclude name="UseVarargs" />
+ <exclude name="UnusedAssignment" />
</rule>
<rule ref="category/java/bestpractices.xml/UnusedPrivateMethod">
<properties>
@@ -42,20 +43,18 @@
<rule ref="category/java/design.xml">
<exclude name="AvoidThrowingRawExceptionTypes" />
<exclude name="CognitiveComplexity" />
+ <exclude name="CouplingBetweenObjects" />
<exclude name="CyclomaticComplexity" />
<exclude name="DataClass" />
- <exclude name="ExcessiveClassLength" />
<exclude name="ExcessiveImports" />
- <exclude name="ExcessiveMethodLength" />
<exclude name="ExcessiveParameterList" />
<exclude name="ExcessivePublicCount" />
<exclude name="GodClass" />
+ <exclude name="ImmutableField" />
<exclude name="LawOfDemeter" />
<exclude name="LoosePackageCoupling" />
<exclude name="NPathComplexity" />
- <exclude name="NcssConstructorCount" />
<exclude name="NcssCount" />
- <exclude name="NcssMethodCount" />
<exclude name="TooManyFields" />
<exclude name="TooManyMethods" />
</rule>
@@ -67,10 +66,8 @@
<exclude name="AvoidLiteralsInIfCondition" />
<exclude name="CloseResource" />
<exclude name="ConstructorCallsOverridableMethod" />
- <exclude name="DataflowAnomalyAnalysis" />
<exclude name="DoNotTerminateVM" />
<exclude name="EmptyCatchBlock" />
- <exclude name="EmptyWhileStmt" />
<exclude name="FinalizeDoesNotCallSuperFinalize" />
<exclude name="JUnitSpelling" />
<exclude name="MissingSerialVersionUID" />
@@ -86,7 +83,6 @@
</rule>
<rule ref="category/java/performance.xml">
- <exclude name="AvoidUsingShortType" />
<exclude name="AvoidInstantiatingObjectsInLoops" />
</rule>
@@ -98,7 +94,7 @@
<!-- Custom Rules -->
<rule name="UseRequireNonNull"
message="Use Objects.requireNonNull() instead of throwing a NullPointerException yourself."
- language="java" class="net.sourceforge.pmd.lang.rule.XPathRule">
+ language="java" class="net.sourceforge.pmd.lang.rule.xpath.XPathRule">
<description>Use Objects.requireNonNull() instead of throwing a
NullPointerException yourself.</description>
<properties>
Excluding the other linting warnings which haven't been fixed, the main problem now is that PMD throws a bunch of exceptions with "bad intersection" when trying to process MutableMeasure.java:
Not sure how to fix this. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Bump the PMD version here:
then run
./gradlew pmdDev pmdMain pmdPrintlog pmdTest
and fix the XML validation errors PMD prints.The text was updated successfully, but these errors were encountered: