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

Last change on this file was 15588, checked in by Don-vip, 4 months ago

tools update: checkstyle 8.27, pmd 6.20, spotbugs 3.1.12

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