otj-pmd-rulesets.ot-pmd.xml Maven / Gradle / Ivy
<?xml version="1.0" encoding="UTF-8"?> <!-- Copyright (C) 2012 Ness Computing, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <ruleset name="OpenTable PMD Ruleset" 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>OpenTable PMD Ruleset</description> <rule ref="category/java/bestpractices.xml"> <exclude name="AccessorMethodGeneration" /> <exclude name="AvoidReassigningParameters" /> <exclude name="UseVarargs" /> <exclude name="JUnitTestContainsTooManyAsserts" /> <exclude name="JUnitAssertionsShouldIncludeMessage" /> <exclude name="GuardLogStatement" /> <exclude name="JUnit4TestShouldUseTestAnnotation" /> <exclude name="UnusedFormalParameter"/> <!-- added --> <exclude name="MissingOverride" /> <exclude name="LooseCoupling" /> <!-- A prod best left to the ide --> <exclude name="ForLoopCanBeForeach" /> <exclude name="UnusedLocalVariable" /> </rule> <rule ref="category/java/codestyle.xml"> <exclude name="UselessQualifiedThis" /> <exclude name="UseExplicitTypes" /> <!-- too many fp --> <exclude name="UnnecessaryBoxing" /> <exclude name="ConfusingTernary" /> <exclude name="FieldDeclarationsShouldBeAtStartOfClass" /> <exclude name="EmptyMethodInAbstractClassShouldBeAbstract" /> <exclude name="TooManyStaticImports" /> <exclude name="UselessParentheses" /> <!-- Added in PMD 6+, complains if you rely on implicit noargs --> <exclude name="AtLeastOneConstructor" /> <!-- I'm sympathetic to the aims of this rule, but... --> <exclude name="MethodArgumentCouldBeFinal" /> <!-- same.. --> <exclude name="LocalVariableCouldBeFinal" /> <!-- spiritual agreement, but --> <exclude name="ShortVariable" /> <!-- yeah, right require comments for every default acccess method, class, constructor. That's sane --> <exclude name="CommentDefaultAccessModifier" /> <!-- I agree, but ... --> <exclude name="BooleanGetMethodName" /> <exclude name="UseDiamondOperator" /> <exclude name="LongVariable" /> <exclude name="OnlyOneReturn" /> <exclude name="ClassNamingConventions" /> <!-- aka boilerplate --> <exclude name="CallSuperInConstructor" /> <!-- nice idea, bad idea --> <exclude name="PrematureDeclaration" /> <exclude name="ShortMethodName" /> <exclude name="MethodNamingConventions" /> <exclude name="ShortClassName" /> <exclude name="GenericsNaming" /> <!-- Way too picky @Goofy("star") vs @Goofy(value = "star") is ok --> <exclude name="UnnecessaryAnnotationValueElement" /> <!-- Too agressive! For example serialNumberUUID is wrong --> <exclude name="FieldNamingConventions" /> <!-- misguided attempt to avoid boolean setter getter confusion --> <exclude name="LinguisticNaming" /> <!-- requires _ in numerics, which is crazy --> <exclude name="UseUnderscoresInNumericLiterals" /> <!-- Intellij can't handle this rule --> <exclude name="UnnecessaryFullyQualifiedName" /> <exclude name="UnnecessarySemicolon"/> </rule> <rule ref="category/java/design.xml"> <exclude name="SimplifyBooleanReturns" /> <exclude name="ExceptionAsFlowControl" /> <exclude name="ClassWithOnlyPrivateConstructorsShouldBeFinal" /> <exclude name="AvoidDeeplyNestedIfStmts" /> <exclude name="GodClass" /> <!-- Though please don't --> <exclude name="AvoidCatchingGenericException" /> <exclude name="AvoidThrowingRawExceptionTypes" /> <exclude name="SignatureDeclareThrowsException" /> <!-- Also added. --> <exclude name="LawOfDemeter" /> <exclude name="DataClass" /> <!-- Without context configured, meaningless --> <exclude name="LoosePackageCoupling" /> <!-- On the fence on this one - usually is code smell --> <exclude name="TooManyMethods" /> <!-- I've always found the next two...dubious --> <exclude name="CognitiveComplexity" /> <exclude name="CyclomaticComplexity" /> <exclude name="NPathComplexity" /> <exclude name="ExcessivePublicCount" /> <exclude name="NcssCount" /> <exclude name="ExcessiveImports" /> <!-- sounds good, but a lot of false positives --> <exclude name="CouplingBetweenObjects" /> <!-- Chris, David have expressed reservations to these 3 --> <exclude name="UseObjectForClearerAPI" /> <exclude name="TooManyFields" /> <exclude name="ExcessiveParameterList" /> <!-- This is just silly --> <exclude name="AvoidUncheckedExceptionsInSignatures" /> </rule> <rule ref="category/java/documentation.xml"> <exclude name="UncommentedEmptyConstructor" /> <exclude name="UncommentedEmptyMethodBody" /> <!-- Added for PMD 6+ Complains if constructor/class is not commented --> <exclude name="CommentRequired" /> <exclude name="CommentSize" /> </rule> <rule ref="category/java/errorprone.xml/AvoidDuplicateLiterals"> <properties> <property name="maxDuplicateLiterals" value="8" /> <property name="minimumLength" value="3" /> <property name="skipAnnotations" value="true" /> <property name="exceptionList" value="" /> </properties> </rule> <rule ref="category/java/errorprone.xml"> <exclude name="ReturnEmptyCollectionRatherThanNull" /> <exclude name="NonSerializableClass"/> <exclude name="TestClassWithoutTestCases"/> <exclude name="CompareObjectsWithEquals" /> <!-- no. just no. This should be discussed in PRs not by PMD --> <exclude name="AvoidLiteralsInIfCondition" /> <!-- On the border here, but ... --> <exclude name="AvoidFieldNameMatchingMethodName" /> <!-- no assigning to null! --> <exclude name="NullAssignment" /> </rule> <rule ref="category/java/multithreading.xml"> <exclude name="AvoidSynchronizedAtMethodLevel" /> <!-- Added --> <!-- people misuse, for certain but should be a PR issue --> <exclude name="AvoidUsingVolatile" /> <!-- As a local variable - I'm sorry that's awful advice --> <exclude name="UseConcurrentHashMap" /> <!-- J2EE doesn't like threads so no one should ??? --> <exclude name="DoNotUseThreads" /> </rule> <rule ref="category/java/performance.xml"> <exclude name="OptimizableToArrayCall" /> <exclude name="ConsecutiveAppendsShouldReuse" /> <exclude name="ConsecutiveLiteralAppends" /> <!-- Added --> <!-- borderline eg private boolean goo = false; --> <exclude name="RedundantFieldInitializer" /> <!-- case by case, most of the time stream/map is better --> <exclude name="AvoidInstantiatingObjectsInLoops" /> <!-- obviously true, but triggers for a single concatenation which is unreasonable --> <exclude name="UseStringBufferForStringAppends" /> <exclude name="AvoidFileStream" /> </rule> <rule ref="category/java/security.xml" /> </ruleset>
© 2015 - 2025 Weber Informatics LLC | Privacy Policy