MapWithAI/config/pmd/ruleset.xml

198 wiersze
9.2 KiB
XML

<?xml version="1.0"?>
<ruleset name="Ruleset for josm-mapwithai-plugin"
xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 http://pmd.sourceforge.net/ruleset_2_0_0.xsd">
<description>
This ruleset checks some rules that you should normally follow for the JOSM-mapwithai plugin.
Copied from josm tools/pmd/josm-ruleset.xml
</description>
<rule ref="category/java/bestpractices.xml">
<exclude name="AccessorClassGeneration"/>
<exclude name="AccessorMethodGeneration"/>
<exclude name="ArrayIsStoredDirectly"/>
<exclude name="AvoidPrintStackTrace"/>
<exclude name="AvoidReassigningParameters"/>
<exclude name="AvoidStringBufferField"/>
<exclude name="AvoidUsingHardCodedIP"/>
<exclude name="ConstantsInInterface"/>
<exclude name="ForLoopCanBeForeach"/>
<exclude name="GuardLogStatement"/>
<exclude name="JUnit4TestShouldUseAfterAnnotation"/>
<exclude name="JUnit4TestShouldUseTestAnnotation"/>
<exclude name="LooseCoupling"/>
<exclude name="MethodReturnsInternalArray"/>
<exclude name="OneDeclarationPerLine"/>
<exclude name="PositionLiteralsFirstInComparisons"/>
<exclude name="PreserveStackTrace"/>
<exclude name="ReplaceHashtableWithMap"/>
<exclude name="SwitchStmtsShouldHaveDefault"/>
<exclude name="SystemPrintln"/>
<exclude name="UnusedFormalParameter"/>
<exclude name="UseVarargs"/>
</rule>
<rule ref="category/java/bestpractices.xml/PreserveStackTrace">
<properties>
<property name="violationSuppressXPath" value="//PrimaryExpression/PrimaryPrefix/Name[@Image='BugReport.intercept']"/>
</properties>
</rule>
<rule ref="category/java/bestpractices.xml/UnusedFormalParameter">
<properties>
<property name="violationSuppressXPath" value="//Annotation[MarkerAnnotation/Name/@Image='Deprecated']/..[MethodDeclaration|ConstructorDeclaration]"/>
</properties>
</rule>
<rule ref="category/java/codestyle.xml">
<exclude name="AbstractNaming"/>
<exclude name="AtLeastOneConstructor"/>
<exclude name="AvoidFinalLocalVariable"/>
<exclude name="AvoidPrefixingMethodParameters"/>
<exclude name="BooleanGetMethodName"/>
<exclude name="CallSuperInConstructor"/>
<exclude name="ClassNamingConventions"/>
<exclude name="CommentDefaultAccessModifier"/>
<exclude name="ConfusingTernary"/>
<exclude name="ControlStatementBraces"/>
<exclude name="DefaultPackage"/>
<exclude name="EmptyMethodInAbstractClassShouldBeAbstract"/>
<exclude name="FieldDeclarationsShouldBeAtStartOfClass"/>
<exclude name="FieldNamingConventions"/>
<exclude name="ForLoopsMustUseBraces"/>
<exclude name="IfElseStmtsMustUseBraces"/>
<exclude name="IfStmtsMustUseBraces"/>
<exclude name="LinguisticNaming"/>
<exclude name="LocalVariableCouldBeFinal"/>
<exclude name="LongVariable"/>
<exclude name="MethodArgumentCouldBeFinal"/>
<exclude name="MethodNamingConventions"/>
<exclude name="NoPackage"/>
<exclude name="OnlyOneReturn"/>
<exclude name="PrematureDeclaration"/>
<exclude name="ShortClassName"/>
<exclude name="ShortMethodName"/>
<exclude name="ShortVariable"/>
<exclude name="TooManyStaticImports"/>
<exclude name="UnnecessaryConstructor"/>
<exclude name="UselessParentheses"/>
<exclude name="UseUnderscoresInNumericLiterals"/>
<exclude name="VariableNamingConventions"/>
<exclude name="WhileLoopsMustUseBraces"/>
</rule>
<rule ref="category/java/codestyle.xml/ShortMethodName">
<properties>
<property name="violationSuppressXPath" value="//MethodDeclarator[@Image='at' or @Image='ht' or @Image='of' or @Image='ok' or @Image='tr']
| //MethodDeclarator/../../Annotation/MarkerAnnotation/Name[@Image='Deprecated']
| //MethodDeclarator/../../../..[@Image='LambertConformalConic']"/>
</properties>
</rule>
<rule ref="category/java/codestyle.xml/MethodNamingConventions">
<properties>
<property name="violationSuppressXPath" value="//MethodDeclarator/../../../..[@Image='Functions' or @Image='PseudoClasses' or @Image='Role' or @Image='TaggingPreset']"/>
</properties>
</rule>
<rule ref="category/java/codestyle.xml/FieldNamingConventions">
<properties>
<property name="enumConstantPattern" value="[A-Za-z][A-Za-z_0-9]*"/>
<property name="violationSuppressXPath" value="//FieldDeclaration[@Public='true']
| //FieldDeclaration/../Annotation/MarkerAnnotation/Name[@Image='pref']
| //FieldDeclaration/Type/ReferenceType/ClassOrInterfaceType[@Image!='Boolean' and
@Image!='Byte' and
@Image!='Character' and
@Image!='Class' and
@Image!='Double' and
@Image!='Enum' and
@Image!='Float' and
@Image!='Integer' and
@Image!='Long' and
@Image!='Number' and
@Image!='Short' and
@Image!='String' ]"/>
</properties>
</rule>
<rule ref="category/java/codestyle.xml/LongVariable">
<properties>
<property name="minimum" value="44"/>
</properties>
</rule>
<rule ref="category/java/design.xml">
<exclude name="AvoidCatchingGenericException"/>
<exclude name="AvoidDeeplyNestedIfStmts"/>
<exclude name="AvoidRethrowingException"/>
<exclude name="CollapsibleIfStatements"/>
<exclude name="CouplingBetweenObjects"/>
<exclude name="CyclomaticComplexity"/>
<exclude name="DataClass"/>
<exclude name="ExceptionAsFlowControl"/>
<exclude name="ExcessiveClassLength"/>
<exclude name="ExcessiveImports"/>
<exclude name="ExcessiveMethodLength"/>
<exclude name="ExcessiveParameterList"/>
<exclude name="ExcessivePublicCount"/>
<exclude name="GodClass"/>
<exclude name="ImmutableField"/>
<exclude name="LawOfDemeter"/>
<exclude name="LoosePackageCoupling"/>
<exclude name="NcssCount"/>
<exclude name="NPathComplexity"/>
<exclude name="SignatureDeclareThrowsException"/>
<exclude name="SimplifiedTernary"/>
<exclude name="SimplifyConditional"/>
<exclude name="SingularField"/>
<exclude name="SwitchDensity"/>
<exclude name="TooManyFields"/>
<exclude name="TooManyMethods"/>
<exclude name="UseObjectForClearerAPI"/>
<exclude name="UselessOverridingMethod"/>
<exclude name="UseUtilityClass"/>
</rule>
<rule ref="category/java/design.xml/SignatureDeclareThrowsException">
<properties>
<property name="violationSuppressXPath" value="//MethodDeclaration/../Annotation/MarkerAnnotation/Name[@Image='Override']"/>
<property name="IgnoreJUnitCompletely" value="true"/>
</properties>
</rule>
<rule ref="category/java/errorprone.xml">
<exclude name="AssignmentInOperand"/>
<exclude name="AssignmentToNonFinalStatic"/>
<exclude name="AvoidBranchingStatementAsLastInLoop"/>
<exclude name="AvoidCatchingNPE"/>
<exclude name="AvoidDuplicateLiterals"/>
<exclude name="AvoidFieldNameMatchingMethodName"/>
<exclude name="AvoidFieldNameMatchingTypeName"/>
<exclude name="AvoidInstanceofChecksInCatchClause"/>
<exclude name="AvoidLiteralsInIfCondition"/>
<exclude name="BeanMembersShouldSerialize"/>
<exclude name="CloneThrowsCloneNotSupportedException"/>
<exclude name="CompareObjectsWithEquals"/>
<exclude name="ConstructorCallsOverridableMethod"/>
<exclude name="DataflowAnomalyAnalysis"/>
<exclude name="DoNotCallSystemExit"/>
<exclude name="DontImportSun"/>
<exclude name="EmptyIfStmt"/>
<exclude name="EmptyWhileStmt"/>
<exclude name="MissingBreakInSwitch"/>
<exclude name="MissingSerialVersionUID"/>
<exclude name="MissingStaticMethodInNonInstantiatableClass"/>
<exclude name="NonStaticInitializer"/>
<exclude name="NullAssignment"/>
<exclude name="ReturnEmptyArrayRatherThanNull"/>
<exclude name="SimpleDateFormatNeedsLocale"/>
<exclude name="SingleMethodSingleton"/>
<exclude name="SingletonClassReturningNewInstance"/>
<exclude name="TestClassWithoutTestCases"/>
<exclude name="UseProperClassLoader"/>
</rule>
<rule ref="category/java/performance.xml">
<exclude name="AvoidInstantiatingObjectsInLoops"/>
<exclude name="AvoidUsingShortType"/>
<exclude name="ConsecutiveLiteralAppends"/>
<exclude name="InefficientEmptyStringCheck"/>
<exclude name="SimplifyStartsWith"/>
<exclude name="TooFewBranchesForASwitchStatement"/>
<exclude name="UseArrayListInsteadOfVector"/>
<exclude name="UselessStringValueOf"/>
<exclude name="UseStringBufferForStringAppends"/>
</rule>
</ruleset>