You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by hu...@apache.org on 2014/06/11 14:06:30 UTC

[2/3] git commit: updated refs/heads/master to 9855a84

Add a first version of a PMD ruleset to our check project


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/8e704f5e
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/8e704f5e
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/8e704f5e

Branch: refs/heads/master
Commit: 8e704f5eee07a2a52632a886b606633d6c3dbf6a
Parents: cd47237
Author: Hugo Trippaers <ht...@schubergphilis.com>
Authored: Wed Jun 11 12:06:32 2014 +0200
Committer: Hugo Trippaers <ht...@schubergphilis.com>
Committed: Wed Jun 11 14:06:16 2014 +0200

----------------------------------------------------------------------
 plugins/network-elements/nicira-nvp/pom.xml     |  4 +
 pom.xml                                         | 10 +++
 .../checkstyle/src/main/resources/cloud-pmd.xml | 84 ++++++++++++++++++++
 3 files changed, 98 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8e704f5e/plugins/network-elements/nicira-nvp/pom.xml
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/pom.xml b/plugins/network-elements/nicira-nvp/pom.xml
index b046610..86a1699 100644
--- a/plugins/network-elements/nicira-nvp/pom.xml
+++ b/plugins/network-elements/nicira-nvp/pom.xml
@@ -50,6 +50,10 @@
           </execution>
         </executions>
       </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-pmd-plugin</artifactId>
+      </plugin>
     </plugins>
   </build>
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8e704f5e/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 1763d68..e7f56f9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -904,8 +904,18 @@
           <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-pmd-plugin</artifactId>
           <version>3.1</version>
+          <dependencies>
+            <dependency>
+              <groupId>org.apache.cloudstack</groupId>
+              <artifactId>checkstyle</artifactId>
+              <version>${project.version}</version>
+            </dependency>
+          </dependencies>
           <configuration>
             <failOnViolation>false</failOnViolation>
+           <rulesets>
+             <ruleset>cloud-pmd.xml</ruleset>
+           </rulesets>
           </configuration>
           <executions>
             <execution>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8e704f5e/tools/checkstyle/src/main/resources/cloud-pmd.xml
----------------------------------------------------------------------
diff --git a/tools/checkstyle/src/main/resources/cloud-pmd.xml b/tools/checkstyle/src/main/resources/cloud-pmd.xml
new file mode 100644
index 0000000..ec2914f
--- /dev/null
+++ b/tools/checkstyle/src/main/resources/cloud-pmd.xml
@@ -0,0 +1,84 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+
+-->
+<ruleset name="Maven 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">
+  
+  <description>
+    Ruleset that brings all the rulesets we want from the pmd jar, because
+    the maven-pmd-plugin doesn't find them otherwise. This is also the place
+    to add our own future rulesets, if any.
+  </description>
+  
+  <rule ref="rulesets/java/basic.xml"/>
+  <rule ref="rulesets/java/braces.xml"/>
+  <rule ref="rulesets/java/clone.xml"/>
+  <rule ref="rulesets/java/codesize.xml"/>
+  <rule ref="rulesets/java/comments.xml">
+    <!-- We shouldn't limit the number of lines in the header of a class -->
+    <exclude name="CommentSize"/>
+    <exclude name="CommentRequired" />
+  </rule>
+  <rule ref="rulesets/java/controversial.xml">
+    <!-- The rule is good, but is not properly applied. It forces you to statically declare it as ConcurrentHashMap -->
+    <exclude name="UseConcurrentHashMap"/>
+    <exclude name="CallSuperInConstructor"/>
+    <exclude name="AtLeastOneConstructor"/>
+    <exclude name="AssignmentInOperand"/>
+    <exclude name="NullAssignment"/>
+    <exclude name="DataflowAnomalyAnalysis" />
+    <exclude name="UseObjectForClearerAPI" />
+  </rule>
+  <rule ref="rulesets/java/coupling.xml">
+    <exclude name="ExcessiveImports" />
+    <exclude name="LawOfDemeter"/>
+  </rule>
+  <rule ref="rulesets/java/design.xml">
+    <exclude name="ConstructorCallsOverridableMethod"/>
+    <exclude name="AbstractClassWithoutAbstractMethod"/>
+    <exclude name="AvoidSynchronizedAtMethodLevel"/>
+  </rule>
+  <rule ref="rulesets/java/empty.xml"/>
+  <rule ref="rulesets/java/finalizers.xml"/>
+  <rule ref="rulesets/java/imports.xml"/>
+  <rule ref="rulesets/java/j2ee.xml"/>
+  <rule ref="rulesets/java/junit.xml"/>
+  <rule ref="rulesets/java/logging-java.xml"/>
+  <rule ref="rulesets/java/naming.xml">
+    <exclude name="ShortVariable"/>
+    <exclude name="AbstractNaming"/>
+  </rule>
+  <rule ref="rulesets/java/naming.xml/LongVariable">
+    <properties>
+      <property name="minimum" value="32"/>
+    </properties>
+  </rule>
+  <rule ref="rulesets/java/optimizations.xml"/>
+  <rule ref="rulesets/java/strictexception.xml"/>
+  <rule ref="rulesets/java/strings.xml"/>
+  <rule ref="rulesets/java/sunsecure.xml"/>
+  <rule ref="rulesets/java/typeresolution.xml"/>
+  <rule ref="rulesets/java/unnecessary.xml"/>
+  <rule ref="rulesets/java/unusedcode.xml"/>
+</ruleset>