source: josm/trunk/tools/pmd/josm-ruleset.xml@ 14716

Last change on this file since 14716 was 14638, checked in by simon04, 6 years ago

Run PMD on scripts/ and apply fixes

File size: 9.2 KB
Line 
1<?xml version="1.0"?>
2<ruleset name="JOSM ruleset"
3 xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
4 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5 xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 http://pmd.sourceforge.net/ruleset_2_0_0.xsd">
6
7 <description>JOSM PMD ruleset</description>
8
9 <rule ref="category/java/bestpractices.xml">
10 <exclude name="AccessorClassGeneration"/>
11 <exclude name="AccessorMethodGeneration"/>
12 <exclude name="ArrayIsStoredDirectly"/>
13 <exclude name="AvoidPrintStackTrace"/>
14 <exclude name="AvoidReassigningParameters"/>
15 <exclude name="AvoidStringBufferField"/>
16 <exclude name="AvoidUsingHardCodedIP"/>
17 <exclude name="ConstantsInInterface"/>
18 <exclude name="ForLoopCanBeForeach"/>
19 <exclude name="GuardLogStatement"/>
20 <exclude name="JUnit4TestShouldUseAfterAnnotation"/>
21 <exclude name="JUnit4TestShouldUseTestAnnotation"/>
22 <exclude name="LooseCoupling"/>
23 <exclude name="MethodReturnsInternalArray"/>
24 <exclude name="OneDeclarationPerLine"/>
25 <exclude name="PositionLiteralsFirstInComparisons"/>
26 <exclude name="PreserveStackTrace"/>
27 <exclude name="ReplaceHashtableWithMap"/>
28 <exclude name="SwitchStmtsShouldHaveDefault"/>
29 <exclude name="SystemPrintln"/>
30 <exclude name="UnusedFormalParameter"/>
31 <exclude name="UseVarargs"/>
32 </rule>
33 <rule ref="category/java/bestpractices.xml/PreserveStackTrace">
34 <properties>
35 <property name="violationSuppressXPath" value="//PrimaryExpression/PrimaryPrefix/Name[@Image='BugReport.intercept']"/>
36 </properties>
37 </rule>
38 <rule ref="category/java/bestpractices.xml/UnusedFormalParameter">
39 <properties>
40 <property name="violationSuppressXPath" value="//Annotation[MarkerAnnotation/Name/@Image='Deprecated']/..[MethodDeclaration|ConstructorDeclaration]"/>
41 </properties>
42 </rule>
43 <rule ref="category/java/codestyle.xml">
44 <exclude name="AbstractNaming"/>
45 <exclude name="AtLeastOneConstructor"/>
46 <exclude name="AvoidFinalLocalVariable"/>
47 <exclude name="AvoidPrefixingMethodParameters"/>
48 <exclude name="BooleanGetMethodName"/>
49 <exclude name="CallSuperInConstructor"/>
50 <exclude name="ClassNamingConventions"/>
51 <exclude name="CommentDefaultAccessModifier"/>
52 <exclude name="ConfusingTernary"/>
53 <exclude name="ControlStatementBraces"/>
54 <exclude name="DefaultPackage"/>
55 <exclude name="EmptyMethodInAbstractClassShouldBeAbstract"/>
56 <exclude name="FieldDeclarationsShouldBeAtStartOfClass"/>
57 <exclude name="FieldNamingConventions"/>
58 <exclude name="ForLoopsMustUseBraces"/>
59 <exclude name="IfElseStmtsMustUseBraces"/>
60 <exclude name="IfStmtsMustUseBraces"/>
61 <exclude name="LinguisticNaming"/>
62 <exclude name="LocalVariableCouldBeFinal"/>
63 <exclude name="LongVariable"/>
64 <exclude name="MethodArgumentCouldBeFinal"/>
65 <exclude name="MethodNamingConventions"/>
66 <exclude name="NoPackage"/>
67 <exclude name="OnlyOneReturn"/>
68 <exclude name="PrematureDeclaration"/>
69 <exclude name="ShortClassName"/>
70 <exclude name="ShortMethodName"/>
71 <exclude name="ShortVariable"/>
72 <exclude name="TooManyStaticImports"/>
73 <exclude name="UnnecessaryConstructor"/>
74 <exclude name="UselessParentheses"/>
75 <exclude name="UseUnderscoresInNumericLiterals"/>
76 <exclude name="VariableNamingConventions"/>
77 <exclude name="WhileLoopsMustUseBraces"/>
78 </rule>
79 <rule ref="category/java/codestyle.xml/ShortMethodName">
80 <properties>
81 <property name="violationSuppressXPath" value="//MethodDeclarator[@Image='at' or @Image='ht' or @Image='of' or @Image='ok' or @Image='tr']
82 | //MethodDeclarator/../../Annotation/MarkerAnnotation/Name[@Image='Deprecated']
83 | //MethodDeclarator/../../../..[@Image='LambertConformalConic']"/>
84 </properties>
85 </rule>
86 <rule ref="category/java/codestyle.xml/MethodNamingConventions">
87 <properties>
88 <property name="violationSuppressXPath" value="//MethodDeclarator/../../../..[@Image='Functions' or @Image='PseudoClasses' or @Image='Role' or @Image='TaggingPreset']"/>
89 </properties>
90 </rule>
91 <rule ref="category/java/codestyle.xml/FieldNamingConventions">
92 <properties>
93 <property name="enumConstantPattern" value="[A-Za-z][A-Za-z_0-9]*"/>
94 <property name="violationSuppressXPath" value="//FieldDeclaration[@Public='true']
95 | //FieldDeclaration/../Annotation/MarkerAnnotation/Name[@Image='pref']
96 | //FieldDeclaration/Type/ReferenceType/ClassOrInterfaceType[@Image!='Boolean' and
97 @Image!='Byte' and
98 @Image!='Character' and
99 @Image!='Class' and
100 @Image!='Double' and
101 @Image!='Enum' and
102 @Image!='Float' and
103 @Image!='Integer' and
104 @Image!='Long' and
105 @Image!='Number' and
106 @Image!='Short' and
107 @Image!='String' ]"/>
108 </properties>
109 </rule>
110 <rule ref="category/java/codestyle.xml/LongVariable">
111 <properties>
112 <property name="minimum" value="44"/>
113 </properties>
114 </rule>
115 <rule ref="category/java/design.xml">
116 <exclude name="AvoidCatchingGenericException"/>
117 <exclude name="AvoidDeeplyNestedIfStmts"/>
118 <exclude name="AvoidRethrowingException"/>
119 <exclude name="CollapsibleIfStatements"/>
120 <exclude name="CouplingBetweenObjects"/>
121 <exclude name="CyclomaticComplexity"/>
122 <exclude name="DataClass"/>
123 <exclude name="ExceptionAsFlowControl"/>
124 <exclude name="ExcessiveClassLength"/>
125 <exclude name="ExcessiveImports"/>
126 <exclude name="ExcessiveMethodLength"/>
127 <exclude name="ExcessiveParameterList"/>
128 <exclude name="ExcessivePublicCount"/>
129 <exclude name="GodClass"/>
130 <exclude name="ImmutableField"/>
131 <exclude name="LawOfDemeter"/>
132 <exclude name="LoosePackageCoupling"/>
133 <exclude name="NcssCount"/>
134 <exclude name="NPathComplexity"/>
135 <exclude name="SignatureDeclareThrowsException"/>
136 <exclude name="SimplifiedTernary"/>
137 <exclude name="SimplifyConditional"/>
138 <exclude name="SingularField"/>
139 <exclude name="SwitchDensity"/>
140 <exclude name="TooManyFields"/>
141 <exclude name="TooManyMethods"/>
142 <exclude name="UseObjectForClearerAPI"/>
143 <exclude name="UselessOverridingMethod"/>
144 <exclude name="UseUtilityClass"/>
145 </rule>
146 <rule ref="category/java/design.xml/SignatureDeclareThrowsException">
147 <properties>
148 <property name="violationSuppressXPath" value="//MethodDeclaration/../Annotation/MarkerAnnotation/Name[@Image='Override']"/>
149 <property name="IgnoreJUnitCompletely" value="true"/>
150 </properties>
151 </rule>
152 <rule ref="category/java/errorprone.xml">
153 <exclude name="AssignmentInOperand"/>
154 <exclude name="AssignmentToNonFinalStatic"/>
155 <exclude name="AvoidBranchingStatementAsLastInLoop"/>
156 <exclude name="AvoidCatchingNPE"/>
157 <exclude name="AvoidDuplicateLiterals"/>
158 <exclude name="AvoidFieldNameMatchingMethodName"/>
159 <exclude name="AvoidFieldNameMatchingTypeName"/>
160 <exclude name="AvoidInstanceofChecksInCatchClause"/>
161 <exclude name="AvoidLiteralsInIfCondition"/>
162 <exclude name="BeanMembersShouldSerialize"/>
163 <exclude name="CloneThrowsCloneNotSupportedException"/>
164 <exclude name="CompareObjectsWithEquals"/>
165 <exclude name="ConstructorCallsOverridableMethod"/>
166 <exclude name="DataflowAnomalyAnalysis"/>
167 <exclude name="DoNotCallSystemExit"/>
168 <exclude name="DontImportSun"/>
169 <exclude name="EmptyIfStmt"/>
170 <exclude name="EmptyWhileStmt"/>
171 <exclude name="MissingBreakInSwitch"/>
172 <exclude name="MissingSerialVersionUID"/>
173 <exclude name="MissingStaticMethodInNonInstantiatableClass"/>
174 <exclude name="NonStaticInitializer"/>
175 <exclude name="NullAssignment"/>
176 <exclude name="ReturnEmptyArrayRatherThanNull"/>
177 <exclude name="SimpleDateFormatNeedsLocale"/>
178 <exclude name="SingleMethodSingleton"/>
179 <exclude name="SingletonClassReturningNewInstance"/>
180 <exclude name="TestClassWithoutTestCases"/>
181 <exclude name="UseProperClassLoader"/>
182 </rule>
183 <rule ref="category/java/performance.xml">
184 <exclude name="AvoidInstantiatingObjectsInLoops"/>
185 <exclude name="AvoidUsingShortType"/>
186 <exclude name="ConsecutiveLiteralAppends"/>
187 <exclude name="InefficientEmptyStringCheck"/>
188 <exclude name="SimplifyStartsWith"/>
189 <exclude name="TooFewBranchesForASwitchStatement"/>
190 <exclude name="UseArrayListInsteadOfVector"/>
191 <exclude name="UselessStringValueOf"/>
192 <exclude name="UseStringBufferForStringAppends"/>
193 </rule>
194
195</ruleset>
Note: See TracBrowser for help on using the repository browser.