Skip to content

Commit 8e704f5

Browse files
committed
Add a first version of a PMD ruleset to our check project
1 parent cd47237 commit 8e704f5

3 files changed

Lines changed: 98 additions & 0 deletions

File tree

‎plugins/network-elements/nicira-nvp/pom.xml‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@
5050
</execution>
5151
</executions>
5252
</plugin>
53+
<plugin>
54+
<groupId>org.apache.maven.plugins</groupId>
55+
<artifactId>maven-pmd-plugin</artifactId>
56+
</plugin>
5357
</plugins>
5458
</build>
5559

‎pom.xml‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -904,8 +904,18 @@
904904
<groupId>org.apache.maven.plugins</groupId>
905905
<artifactId>maven-pmd-plugin</artifactId>
906906
<version>3.1</version>
907+
<dependencies>
908+
<dependency>
909+
<groupId>org.apache.cloudstack</groupId>
910+
<artifactId>checkstyle</artifactId>
911+
<version>${project.version}</version>
912+
</dependency>
913+
</dependencies>
907914
<configuration>
908915
<failOnViolation>false</failOnViolation>
916+
<rulesets>
917+
<ruleset>cloud-pmd.xml</ruleset>
918+
</rulesets>
909919
</configuration>
910920
<executions>
911921
<execution>
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
4+
Licensed to the Apache Software Foundation (ASF) under one
5+
or more contributor license agreements. See the NOTICE file
6+
distributed with this work for additional information
7+
regarding copyright ownership. The ASF licenses this file
8+
to you under the Apache License, Version 2.0 (the
9+
"License"); you may not use this file except in compliance
10+
with the License. You may obtain a copy of the License at
11+
12+
http://www.apache.org/licenses/LICENSE-2.0
13+
14+
Unless required by applicable law or agreed to in writing,
15+
software distributed under the License is distributed on an
16+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17+
KIND, either express or implied. See the License for the
18+
specific language governing permissions and limitations
19+
under the License.
20+
21+
-->
22+
<ruleset name="Maven Ruleset"
23+
xmlns="http://pmd.sf.net/ruleset/1.0.0"
24+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
25+
xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0 http://pmd.sf.net/ruleset_xml_schema.xsd"
26+
xsi:noNamespaceSchemaLocation="http://pmd.sf.net/ruleset_xml_schema.xsd">
27+
28+
<description>
29+
Ruleset that brings all the rulesets we want from the pmd jar, because
30+
the maven-pmd-plugin doesn't find them otherwise. This is also the place
31+
to add our own future rulesets, if any.
32+
</description>
33+
34+
<rule ref="rulesets/java/basic.xml"/>
35+
<rule ref="rulesets/java/braces.xml"/>
36+
<rule ref="rulesets/java/clone.xml"/>
37+
<rule ref="rulesets/java/codesize.xml"/>
38+
<rule ref="rulesets/java/comments.xml">
39+
<!-- We shouldn't limit the number of lines in the header of a class -->
40+
<exclude name="CommentSize"/>
41+
<exclude name="CommentRequired" />
42+
</rule>
43+
<rule ref="rulesets/java/controversial.xml">
44+
<!-- The rule is good, but is not properly applied. It forces you to statically declare it as ConcurrentHashMap -->
45+
<exclude name="UseConcurrentHashMap"/>
46+
<exclude name="CallSuperInConstructor"/>
47+
<exclude name="AtLeastOneConstructor"/>
48+
<exclude name="AssignmentInOperand"/>
49+
<exclude name="NullAssignment"/>
50+
<exclude name="DataflowAnomalyAnalysis" />
51+
<exclude name="UseObjectForClearerAPI" />
52+
</rule>
53+
<rule ref="rulesets/java/coupling.xml">
54+
<exclude name="ExcessiveImports" />
55+
<exclude name="LawOfDemeter"/>
56+
</rule>
57+
<rule ref="rulesets/java/design.xml">
58+
<exclude name="ConstructorCallsOverridableMethod"/>
59+
<exclude name="AbstractClassWithoutAbstractMethod"/>
60+
<exclude name="AvoidSynchronizedAtMethodLevel"/>
61+
</rule>
62+
<rule ref="rulesets/java/empty.xml"/>
63+
<rule ref="rulesets/java/finalizers.xml"/>
64+
<rule ref="rulesets/java/imports.xml"/>
65+
<rule ref="rulesets/java/j2ee.xml"/>
66+
<rule ref="rulesets/java/junit.xml"/>
67+
<rule ref="rulesets/java/logging-java.xml"/>
68+
<rule ref="rulesets/java/naming.xml">
69+
<exclude name="ShortVariable"/>
70+
<exclude name="AbstractNaming"/>
71+
</rule>
72+
<rule ref="rulesets/java/naming.xml/LongVariable">
73+
<properties>
74+
<property name="minimum" value="32"/>
75+
</properties>
76+
</rule>
77+
<rule ref="rulesets/java/optimizations.xml"/>
78+
<rule ref="rulesets/java/strictexception.xml"/>
79+
<rule ref="rulesets/java/strings.xml"/>
80+
<rule ref="rulesets/java/sunsecure.xml"/>
81+
<rule ref="rulesets/java/typeresolution.xml"/>
82+
<rule ref="rulesets/java/unnecessary.xml"/>
83+
<rule ref="rulesets/java/unusedcode.xml"/>
84+
</ruleset>

0 commit comments

Comments
 (0)