You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ad...@apache.org on 2021/04/24 16:27:09 UTC
[maven-pmd-plugin] 02/02: [MPMD-312] Replace rules that are
deprecated with PMD 6.34.0
This is an automated email from the ASF dual-hosted git repository.
adangel pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-pmd-plugin.git
commit 23f28d1345b31d430020a1598350e86b23c3a957
Author: Andreas Dangel <ad...@apache.org>
AuthorDate: Sat Apr 24 18:22:22 2021 +0200
[MPMD-312] Replace rules that are deprecated with PMD 6.34.0
The rules UnusedImport, DontImportJavaLang, ImportFromSamePackage,
and DuplicateImports are deprecated.
The rule UnnecessaryImport is used instead.
---
src/main/resources/rulesets/java/maven-pmd-plugin-default.xml | 5 +----
src/main/resources/rulesets/maven.xml | 5 +----
src/site/apt/examples/multi-module-config.apt.vm | 4 +---
src/site/apt/examples/usingRuleSets.apt.vm | 5 +----
src/test/resources/unit/excludes/pmd_exclude.properties | 2 +-
5 files changed, 5 insertions(+), 16 deletions(-)
diff --git a/src/main/resources/rulesets/java/maven-pmd-plugin-default.xml b/src/main/resources/rulesets/java/maven-pmd-plugin-default.xml
index 472cade..7604fdc 100644
--- a/src/main/resources/rulesets/java/maven-pmd-plugin-default.xml
+++ b/src/main/resources/rulesets/java/maven-pmd-plugin-default.xml
@@ -34,18 +34,16 @@ under the License.
<rule ref="category/java/bestpractices.xml/AvoidUsingHardCodedIP" />
<rule ref="category/java/bestpractices.xml/CheckResultSet" />
- <rule ref="category/java/bestpractices.xml/UnusedImports" />
<rule ref="category/java/bestpractices.xml/UnusedFormalParameter" />
<rule ref="category/java/bestpractices.xml/UnusedLocalVariable" />
<rule ref="category/java/bestpractices.xml/UnusedPrivateField" />
<rule ref="category/java/bestpractices.xml/UnusedPrivateMethod" />
- <rule ref="category/java/codestyle.xml/DontImportJavaLang" />
- <rule ref="category/java/codestyle.xml/DuplicateImports" />
<rule ref="category/java/codestyle.xml/ExtendsObject" />
<rule ref="category/java/codestyle.xml/ForLoopShouldBeWhileLoop" />
<rule ref="category/java/codestyle.xml/TooManyStaticImports" />
<rule ref="category/java/codestyle.xml/UnnecessaryFullyQualifiedName" />
+ <rule ref="category/java/codestyle.xml/UnnecessaryImport" />
<rule ref="category/java/codestyle.xml/UnnecessaryModifier" />
<rule ref="category/java/codestyle.xml/UnnecessaryReturn" />
<rule ref="category/java/codestyle.xml/UselessParentheses" />
@@ -73,7 +71,6 @@ under the License.
<rule ref="category/java/errorprone.xml/EmptySynchronizedBlock" />
<rule ref="category/java/errorprone.xml/EmptyTryBlock" />
<rule ref="category/java/errorprone.xml/EmptyWhileStmt" />
- <rule ref="category/java/errorprone.xml/ImportFromSamePackage" />
<rule ref="category/java/errorprone.xml/JumbledIncrementer" />
<rule ref="category/java/errorprone.xml/MisplacedNullCheck" />
<rule ref="category/java/errorprone.xml/OverrideBothEqualsAndHashcode" />
diff --git a/src/main/resources/rulesets/maven.xml b/src/main/resources/rulesets/maven.xml
index e37ca6a..4386fdf 100644
--- a/src/main/resources/rulesets/maven.xml
+++ b/src/main/resources/rulesets/maven.xml
@@ -39,14 +39,12 @@ under the License.
<rule ref="category/java/bestpractices.xml/UnusedLocalVariable" />
<rule ref="category/java/bestpractices.xml/UnusedPrivateField" />
<rule ref="category/java/bestpractices.xml/UnusedPrivateMethod" />
- <rule ref="category/java/bestpractices.xml/UnusedImports" />
- <rule ref="category/java/codestyle.xml/DontImportJavaLang" />
- <rule ref="category/java/codestyle.xml/DuplicateImports" />
<rule ref="category/java/codestyle.xml/ExtendsObject" />
<rule ref="category/java/codestyle.xml/ForLoopShouldBeWhileLoop" />
<rule ref="category/java/codestyle.xml/TooManyStaticImports" />
<rule ref="category/java/codestyle.xml/UnnecessaryFullyQualifiedName" />
+ <rule ref="category/java/codestyle.xml/UnnecessaryImport" />
<rule ref="category/java/codestyle.xml/UnnecessaryModifier" />
<rule ref="category/java/codestyle.xml/UnnecessaryReturn" />
<rule ref="category/java/codestyle.xml/UselessParentheses" />
@@ -78,7 +76,6 @@ under the License.
<rule ref="category/java/errorprone.xml/EmptySynchronizedBlock" />
<rule ref="category/java/errorprone.xml/EmptyTryBlock" />
<rule ref="category/java/errorprone.xml/EmptyWhileStmt" />
- <rule ref="category/java/errorprone.xml/ImportFromSamePackage" />
<rule ref="category/java/errorprone.xml/JumbledIncrementer" />
<rule ref="category/java/errorprone.xml/MisplacedNullCheck" />
<rule ref="category/java/errorprone.xml/OverrideBothEqualsAndHashcode" />
diff --git a/src/site/apt/examples/multi-module-config.apt.vm b/src/site/apt/examples/multi-module-config.apt.vm
index 1ab1a89..1af734a 100644
--- a/src/site/apt/examples/multi-module-config.apt.vm
+++ b/src/site/apt/examples/multi-module-config.apt.vm
@@ -102,14 +102,12 @@ whizbang
<rule ref="category/java/bestpractices.xml/AvoidUsingHardCodedIP" />
<rule ref="category/java/bestpractices.xml/CheckResultSet" />
- <rule ref="category/java/bestpractices.xml/UnusedImports" />
<rule ref="category/java/bestpractices.xml/UnusedFormalParameter" />
<rule ref="category/java/bestpractices.xml/UnusedLocalVariable" />
<rule ref="category/java/bestpractices.xml/UnusedPrivateField" />
<rule ref="category/java/bestpractices.xml/UnusedPrivateMethod" />
- <rule ref="category/java/codestyle.xml/DontImportJavaLang" />
- <rule ref="category/java/codestyle.xml/DuplicateImports" />
+ <rule ref="category/java/codestyle.xml/UnnecessaryImport" />
<rule ref="category/java/errorprone.xml/AvoidBranchingStatementAsLastInLoop" />
<rule ref="category/java/errorprone.xml/AvoidDecimalLiteralsInBigDecimalConstructor" />
diff --git a/src/site/apt/examples/usingRuleSets.apt.vm b/src/site/apt/examples/usingRuleSets.apt.vm
index 7aba4cb..51cc118 100644
--- a/src/site/apt/examples/usingRuleSets.apt.vm
+++ b/src/site/apt/examples/usingRuleSets.apt.vm
@@ -96,18 +96,16 @@ The default ruleset
+-----+
<rule ref="category/java/bestpractices.xml/AvoidUsingHardCodedIP" />
<rule ref="category/java/bestpractices.xml/CheckResultSet" />
- <rule ref="category/java/bestpractices.xml/UnusedImports" />
<rule ref="category/java/bestpractices.xml/UnusedFormalParameter" />
<rule ref="category/java/bestpractices.xml/UnusedLocalVariable" />
<rule ref="category/java/bestpractices.xml/UnusedPrivateField" />
<rule ref="category/java/bestpractices.xml/UnusedPrivateMethod" />
- <rule ref="category/java/codestyle.xml/DontImportJavaLang" />
- <rule ref="category/java/codestyle.xml/DuplicateImports" />
<rule ref="category/java/codestyle.xml/ExtendsObject" />
<rule ref="category/java/codestyle.xml/ForLoopShouldBeWhileLoop" />
<rule ref="category/java/codestyle.xml/TooManyStaticImports" />
<rule ref="category/java/codestyle.xml/UnnecessaryFullyQualifiedName" />
+ <rule ref="category/java/codestyle.xml/UnnecessaryImport" />
<rule ref="category/java/codestyle.xml/UnnecessaryModifier" />
<rule ref="category/java/codestyle.xml/UnnecessaryReturn" />
<rule ref="category/java/codestyle.xml/UselessParentheses" />
@@ -135,7 +133,6 @@ The default ruleset
<rule ref="category/java/errorprone.xml/EmptySynchronizedBlock" />
<rule ref="category/java/errorprone.xml/EmptyTryBlock" />
<rule ref="category/java/errorprone.xml/EmptyWhileStmt" />
- <rule ref="category/java/errorprone.xml/ImportFromSamePackage" />
<rule ref="category/java/errorprone.xml/JumbledIncrementer" />
<rule ref="category/java/errorprone.xml/MisplacedNullCheck" />
<rule ref="category/java/errorprone.xml/OverrideBothEqualsAndHashcode" />
diff --git a/src/test/resources/unit/excludes/pmd_exclude.properties b/src/test/resources/unit/excludes/pmd_exclude.properties
index 98712de..07b5d52 100644
--- a/src/test/resources/unit/excludes/pmd_exclude.properties
+++ b/src/test/resources/unit/excludes/pmd_exclude.properties
@@ -17,5 +17,5 @@
# under the License.
#
def.configuration.App=UnusedPrivateField,EmptyCatchBlock,UselessParentheses
-def.configuration.App2=UnusedImports
+def.configuration.App2=UnnecessaryImport
def.configuration.AppSample=UnusedPrivateField,UnusedFormalParameter,UnusedPrivateMethod,UselessParentheses