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 2017/12/16 16:46:16 UTC

[maven-pmd-plugin] 02/07: [MPMD-247] Upgrade to PMD 6.0.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 f165857ecde4f4034a5112dc8af5b1431dbf5ac8
Author: Andreas Dangel <ad...@apache.org>
AuthorDate: Fri Dec 15 19:53:11 2017 +0100

    [MPMD-247] Upgrade to PMD 6.0.0
    
    Make use of new ruleset category structure
---
 .../src/main/pmd/ruleset.xml                       |  1 +
 .../mod-1/src/main/config/pmd/latin-1.xml          |  8 +++---
 .../mod-1/src/main/config/pmd/utf-8.xml            |  8 +++---
 src/it/multi-module/mod-2/rulesets/java/basic.xml  |  8 +++---
 .../multi-module/mod-3/src/main/config/pmd/abs.xml |  8 +++---
 .../multi-module/mod-3/src/main/config/pmd/rel.xml |  8 +++---
 .../resources/rulesets/custom.xml                  | 30 ++++++++++++----------
 .../rulesets/sonar-way-ruleset.xml                 |  9 ++++---
 8 files changed, 39 insertions(+), 41 deletions(-)

diff --git a/src/it/MPMD-89-232-typeresolution/src/main/pmd/ruleset.xml b/src/it/MPMD-89-232-typeresolution/src/main/pmd/ruleset.xml
index adaa539..fcd6bc4 100644
--- a/src/it/MPMD-89-232-typeresolution/src/main/pmd/ruleset.xml
+++ b/src/it/MPMD-89-232-typeresolution/src/main/pmd/ruleset.xml
@@ -23,5 +23,6 @@ under the License.
     xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 http://pmd.sourceforge.net/ruleset_2_0_0.xsd">
+    <description>Custom Ruleset for test case MPMD-89 and MPMP-232</description>
   <rule ref="rulesets/java/junit.xml/TestClassWithoutTestCases"/>
 </ruleset>
diff --git a/src/it/multi-module/mod-1/src/main/config/pmd/latin-1.xml b/src/it/multi-module/mod-1/src/main/config/pmd/latin-1.xml
index e4319a2..58cd8d2 100644
--- a/src/it/multi-module/mod-1/src/main/config/pmd/latin-1.xml
+++ b/src/it/multi-module/mod-1/src/main/config/pmd/latin-1.xml
@@ -18,13 +18,11 @@ specific language governing permissions and limitations
 under the License.
 -->
 <ruleset name="Custom ruleset"
-    xmlns="http://pmd.sf.net/ruleset/1.0.0"
-    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-    xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0 http://pmd.sf.net/ruleset_xml_schema.xsd"
-    xsi:noNamespaceSchemaLocation="http://pmd.sf.net/ruleset_xml_schema.xsd">
+   xmlns="http://pmd.sourceforge.net/ruleset/2.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 http://pmd.sourceforge.net/ruleset_2_0_0.xsd">
   <description>
     This ruleset is encoded with ISO-8859-1 to check proper encoding handling.
   </description>
-  <rule ref="rulesets/java/basic.xml/UnnecessaryReturn" message="LATIN-1-CHARS: ������߼���"/>
+  <rule ref="category/java/codestyle.xml/UnnecessaryReturn" message="LATIN-1-CHARS: ������߼���"/>
   <!-- note: ���� = 0xBC 0xBD 0xBE 0xA4 don't exist any more in Latin 15, replaced by OE oe Y" and euro -->
 </ruleset>
diff --git a/src/it/multi-module/mod-1/src/main/config/pmd/utf-8.xml b/src/it/multi-module/mod-1/src/main/config/pmd/utf-8.xml
index 335c06b..32ad786 100644
--- a/src/it/multi-module/mod-1/src/main/config/pmd/utf-8.xml
+++ b/src/it/multi-module/mod-1/src/main/config/pmd/utf-8.xml
@@ -18,12 +18,10 @@ specific language governing permissions and limitations
 under the License.
 -->
 <ruleset name="Custom ruleset"
-    xmlns="http://pmd.sf.net/ruleset/1.0.0"
-    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-    xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0 http://pmd.sf.net/ruleset_xml_schema.xsd"
-    xsi:noNamespaceSchemaLocation="http://pmd.sf.net/ruleset_xml_schema.xsd">
+    xmlns="http://pmd.sourceforge.net/ruleset/2.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 http://pmd.sourceforge.net/ruleset_2_0_0.xsd">
   <description>
     This ruleset is encoded with UTF-8 to check proper encoding handling.
   </description>
-  <rule ref="rulesets/java/basic.xml/EmptyStatementNotInLoop" message="UTF-8-CHARS: ÄÖÜäöüß¼½¾¤"/>
+  <rule ref="category/java/errorprone.xml/EmptyStatementNotInLoop" message="UTF-8-CHARS: ÄÖÜäöüß¼½¾¤"/>
 </ruleset>
diff --git a/src/it/multi-module/mod-2/rulesets/java/basic.xml b/src/it/multi-module/mod-2/rulesets/java/basic.xml
index 7facb8b..1bf2692 100644
--- a/src/it/multi-module/mod-2/rulesets/java/basic.xml
+++ b/src/it/multi-module/mod-2/rulesets/java/basic.xml
@@ -18,12 +18,10 @@ specific language governing permissions and limitations
 under the License.
 -->
 <ruleset name="Custom ruleset"
-    xmlns="http://pmd.sf.net/ruleset/1.0.0"
-    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-    xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0 http://pmd.sf.net/ruleset_xml_schema.xsd"
-    xsi:noNamespaceSchemaLocation="http://pmd.sf.net/ruleset_xml_schema.xsd">
+    xmlns="http://pmd.sourceforge.net/ruleset/2.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 http://pmd.sourceforge.net/ruleset_2_0_0.xsd">
   <description>
     The relative path of this ruleset matches the built-in ruleset "basic".
   </description>
-  <rule ref="rulesets/java/basic.xml/EmptyStatementNotInLoop" message="TEST: LOCAL-FILE-RULESET"/>
+  <rule ref="category/java/errorprone.xml/EmptyStatementNotInLoop" message="TEST: LOCAL-FILE-RULESET"/>
 </ruleset>
diff --git a/src/it/multi-module/mod-3/src/main/config/pmd/abs.xml b/src/it/multi-module/mod-3/src/main/config/pmd/abs.xml
index 1457b47..5dae0d9 100644
--- a/src/it/multi-module/mod-3/src/main/config/pmd/abs.xml
+++ b/src/it/multi-module/mod-3/src/main/config/pmd/abs.xml
@@ -18,12 +18,10 @@ specific language governing permissions and limitations
 under the License.
 -->
 <ruleset name="Custom ruleset"
-    xmlns="http://pmd.sf.net/ruleset/1.0.0"
-    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-    xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0 http://pmd.sf.net/ruleset_xml_schema.xsd"
-    xsi:noNamespaceSchemaLocation="http://pmd.sf.net/ruleset_xml_schema.xsd">
+    xmlns="http://pmd.sourceforge.net/ruleset/2.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 http://pmd.sourceforge.net/ruleset_2_0_0.xsd">
   <description>
     This ruleset is specified via an absolute filesystem path.
   </description>
-  <rule ref="rulesets/java/basic.xml/UnnecessaryReturn" message="TEST: ABSOLUTE-PATH"/>
+  <rule ref="category/java/codestyle.xml/UnnecessaryReturn" message="TEST: ABSOLUTE-PATH"/>
 </ruleset>
diff --git a/src/it/multi-module/mod-3/src/main/config/pmd/rel.xml b/src/it/multi-module/mod-3/src/main/config/pmd/rel.xml
index dcb1a75..05fa23c 100644
--- a/src/it/multi-module/mod-3/src/main/config/pmd/rel.xml
+++ b/src/it/multi-module/mod-3/src/main/config/pmd/rel.xml
@@ -18,12 +18,10 @@ specific language governing permissions and limitations
 under the License.
 -->
 <ruleset name="Custom ruleset"
-    xmlns="http://pmd.sf.net/ruleset/1.0.0"
-    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-    xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0 http://pmd.sf.net/ruleset_xml_schema.xsd"
-    xsi:noNamespaceSchemaLocation="http://pmd.sf.net/ruleset_xml_schema.xsd">
+    xmlns="http://pmd.sourceforge.net/ruleset/2.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 http://pmd.sourceforge.net/ruleset_2_0_0.xsd">
   <description>
     This ruleset is specified via a relative filesystem path.
   </description>
-  <rule ref="rulesets/java/basic.xml/EmptyStatementNotInLoop" message="TEST: RELATIVE-PATH"/>
+  <rule ref="category/java/errorprone.xml/EmptyStatementNotInLoop" message="TEST: RELATIVE-PATH"/>
 </ruleset>
diff --git a/src/test/resources/unit/custom-configuration/resources/rulesets/custom.xml b/src/test/resources/unit/custom-configuration/resources/rulesets/custom.xml
index 6d99edd..2d2da0a 100644
--- a/src/test/resources/unit/custom-configuration/resources/rulesets/custom.xml
+++ b/src/test/resources/unit/custom-configuration/resources/rulesets/custom.xml
@@ -19,20 +19,24 @@ under the License.
 -->
 
 <ruleset name="customRuleset"
-  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-  xsi:noNamespaceSchemaLocation="http://pmd.sf.net/ruleset_xml_schema.xsd">
-  <description>Just the braces rules I like</description>
-  <rule ref="rulesets/java/braces.xml">
-    <exclude name="WhileLoopsMustUseBraces"/>
-    <exclude name="IfElseStmtsMustUseBraces"/>
-  </rule>   
-  
-  <description>Lowest priority for unnecessary constructor</description>
-  <rule ref="rulesets/java/controversial.xml/UnnecessaryConstructor" >
-	<priority>5</priority>
-  </rule>
+    xmlns="http://pmd.sourceforge.net/ruleset/2.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 http://pmd.sourceforge.net/ruleset_2_0_0.xsd">
+    <description>Just the braces rules I like</description>
+
+    <rule ref="category/java/codestyle.xml">
+        <exclude name="WhileLoopsMustUseBraces"/>
+        <exclude name="IfElseStmtsMustUseBraces"/>
+
+        <!-- needed to be excluded, otherwise the variable 'noSoLongVariableName' will be reported -->
+        <exclude name="LocalVariableCouldBeFinal"/>
+    </rule>
+
+    <!-- Lowest priority for unnecessary constructor -->
+    <rule ref="category/java/codestyle.xml/UnnecessaryConstructor" >
+        <priority>5</priority>
+    </rule>
 
-    <rule ref="rulesets/java/naming.xml/LongVariable">
+    <rule ref="category/java/codestyle.xml/LongVariable">
         <properties>
             <property name="minimum" value="25"/>
         </properties>
diff --git a/src/test/resources/unit/default-configuration/rulesets/sonar-way-ruleset.xml b/src/test/resources/unit/default-configuration/rulesets/sonar-way-ruleset.xml
index 9d1f5f7..3dcb153 100644
--- a/src/test/resources/unit/default-configuration/rulesets/sonar-way-ruleset.xml
+++ b/src/test/resources/unit/default-configuration/rulesets/sonar-way-ruleset.xml
@@ -19,11 +19,14 @@ specific language governing permissions and limitations
 under the License.
 -->
 
-<ruleset>
-  <rule ref="rulesets/java/strings.xml/UselessStringValueOf">
+<ruleset name="SonarWay"
+    xmlns="http://pmd.sourceforge.net/ruleset/2.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 http://pmd.sourceforge.net/ruleset_2_0_0.xsd">
+    <description>Sonar Way Rule Set</description>
+  <rule ref="category/java/performance.xml/UselessStringValueOf">
     <priority>4</priority>
   </rule>
-  <rule ref="rulesets/java/strings.xml/AvoidDuplicateLiterals">
+  <rule ref="category/java/errorprone.xml/AvoidDuplicateLiterals">
     <priority>3</priority>
   </rule>
 </ruleset>
\ No newline at end of file

-- 
To stop receiving notification emails like this one, please contact
"commits@maven.apache.org" <co...@maven.apache.org>.