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

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

see #15574:

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