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

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

enable new PMD rule AvoidFileStream - see https://pmd.github.io/pmd-6.0.0/pmd_rules_java_performance.html#avoidfilestream / https://bugs.openjdk.java.net/browse/JDK-8080225 for details

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