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

Last change on this file since 14209 was 14209, checked in by Don-vip, 13 months ago

see #16681 - spotbugs / pmd

File size: 9.0 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="ForLoopsMustUseBraces"/>
58    <exclude name="IfElseStmtsMustUseBraces"/>
59    <exclude name="IfStmtsMustUseBraces"/>
60    <exclude name="LocalVariableCouldBeFinal"/>
61    <exclude name="LongVariable"/>
62    <exclude name="MethodArgumentCouldBeFinal"/>
63    <exclude name="MethodNamingConventions"/>
64    <exclude name="OnlyOneReturn"/>
65    <exclude name="PrematureDeclaration"/>
66    <exclude name="ShortClassName"/>
67    <exclude name="ShortMethodName"/>
68    <exclude name="ShortVariable"/>
69    <exclude name="TooManyStaticImports"/>
70    <exclude name="UnnecessaryConstructor"/>
71    <exclude name="UselessParentheses"/>
72    <exclude name="VariableNamingConventions"/>
73    <exclude name="WhileLoopsMustUseBraces"/>
74  </rule>
75  <rule ref="category/java/codestyle.xml/ShortMethodName">
76    <properties>
77        <property name="violationSuppressXPath" value="//MethodDeclarator[@Image='at' or @Image='ht' or @Image='of' or @Image='ok' or @Image='tr']
78          | //MethodDeclarator/../../Annotation/MarkerAnnotation/Name[@Image='Deprecated']
79          | //MethodDeclarator/../../../..[@Image='LambertConformalConic']"/>
80    </properties>
81  </rule>
82  <rule ref="category/java/codestyle.xml/MethodNamingConventions">
83    <properties>
84        <property name="violationSuppressXPath" value="//MethodDeclarator/../../../..[@Image='Functions' or @Image='PseudoClasses' or @Image='Role' or @Image='TaggingPreset']"/>
85    </properties>
86  </rule>
87  <rule ref="category/java/codestyle.xml/VariableNamingConventions">
88    <properties>
89        <property name="violationSuppressXPath" value="//FieldDeclaration[@Public='true']
90          | //FieldDeclaration/../Annotation/MarkerAnnotation/Name[@Image='pref']
91          | //FieldDeclaration/Type/ReferenceType/ClassOrInterfaceType[@Image!='Boolean' and
92                                                                       @Image!='Byte' and
93                                                                       @Image!='Character' and
94                                                                       @Image!='Class' and
95                                                                       @Image!='Double' and
96                                                                       @Image!='Enum' and
97                                                                       @Image!='Float' and
98                                                                       @Image!='Integer' and
99                                                                       @Image!='Long' and
100                                                                       @Image!='Number' and
101                                                                       @Image!='Short' and
102                                                                       @Image!='String' ]"/>
103    </properties>
104  </rule>
105  <rule ref="category/java/codestyle.xml/LongVariable">
106    <properties>
107        <property name="minimum" value="44"/>
108    </properties>
109  </rule>
110  <rule ref="category/java/design.xml">
111    <exclude name="AvoidCatchingGenericException"/>
112    <exclude name="AvoidDeeplyNestedIfStmts"/>
113    <exclude name="AvoidRethrowingException"/>
114    <exclude name="CollapsibleIfStatements"/>
115    <exclude name="CouplingBetweenObjects"/>
116    <exclude name="CyclomaticComplexity"/>
117    <exclude name="DataClass"/>
118    <exclude name="ExceptionAsFlowControl"/>
119    <exclude name="ExcessiveClassLength"/>
120    <exclude name="ExcessiveImports"/>
121    <exclude name="ExcessiveMethodLength"/>
122    <exclude name="ExcessiveParameterList"/>
123    <exclude name="ExcessivePublicCount"/>
124    <exclude name="GodClass"/>
125    <exclude name="ImmutableField"/>
126    <exclude name="LawOfDemeter"/>
127    <exclude name="LoosePackageCoupling"/>
128    <exclude name="NcssCount"/>
129    <exclude name="NPathComplexity"/>
130    <exclude name="SignatureDeclareThrowsException"/>
131    <exclude name="SimplifiedTernary"/>
132    <exclude name="SimplifyConditional"/>
133    <exclude name="SingularField"/>
134    <exclude name="SwitchDensity"/>
135    <exclude name="TooManyFields"/>
136    <exclude name="TooManyMethods"/>
137    <exclude name="UseObjectForClearerAPI"/>
138    <exclude name="UselessOverridingMethod"/>
139    <exclude name="UseUtilityClass"/>
140  </rule>
141  <rule ref="category/java/design.xml/SignatureDeclareThrowsException">
142    <properties>
143        <property name="violationSuppressXPath" value="//MethodDeclaration/../Annotation/MarkerAnnotation/Name[@Image='Override']"/>
144        <property name="IgnoreJUnitCompletely" value="true"/>
145    </properties>
146  </rule>
147  <rule ref="category/java/errorprone.xml">
148    <exclude name="AssignmentInOperand"/>
149    <exclude name="AssignmentToNonFinalStatic"/>
150    <exclude name="AvoidBranchingStatementAsLastInLoop"/>
151    <exclude name="AvoidCatchingNPE"/>
152    <exclude name="AvoidDuplicateLiterals"/>
153    <exclude name="AvoidFieldNameMatchingMethodName"/>
154    <exclude name="AvoidFieldNameMatchingTypeName"/>
155    <exclude name="AvoidInstanceofChecksInCatchClause"/>
156    <exclude name="AvoidLiteralsInIfCondition"/>
157    <exclude name="BeanMembersShouldSerialize"/>
158    <exclude name="CloneThrowsCloneNotSupportedException"/>
159    <exclude name="CompareObjectsWithEquals"/>
160    <exclude name="ConstructorCallsOverridableMethod"/>
161    <exclude name="DataflowAnomalyAnalysis"/>
162    <exclude name="DoNotCallSystemExit"/>
163    <exclude name="DontImportSun"/>
164    <exclude name="EmptyIfStmt"/>
165    <exclude name="EmptyWhileStmt"/>
166    <exclude name="MissingBreakInSwitch"/>
167    <exclude name="MissingSerialVersionUID"/>
168    <exclude name="MissingStaticMethodInNonInstantiatableClass"/>
169    <exclude name="NonStaticInitializer"/>
170    <exclude name="NullAssignment"/>
171    <exclude name="ReturnEmptyArrayRatherThanNull"/>
172    <exclude name="SimpleDateFormatNeedsLocale"/>
173    <exclude name="SingleMethodSingleton"/>
174    <exclude name="SingletonClassReturningNewInstance"/>
175    <exclude name="TestClassWithoutTestCases"/>
176    <exclude name="UseProperClassLoader"/>
177  </rule>
178  <rule ref="category/java/performance.xml">
179    <exclude name="AvoidInstantiatingObjectsInLoops"/>
180    <exclude name="AvoidUsingShortType"/>
181    <exclude name="ConsecutiveLiteralAppends"/>
182    <exclude name="InefficientEmptyStringCheck"/>
183    <exclude name="SimplifyStartsWith"/>
184    <exclude name="TooFewBranchesForASwitchStatement"/>
185    <exclude name="UseArrayListInsteadOfVector"/>
186    <exclude name="UselessStringValueOf"/>
187    <exclude name="UseStringBufferForStringAppends"/>
188  </rule>
189
190</ruleset>
Note: See TracBrowser for help on using the repository browser.