Skip to content

Latest commit

 

History

History
308 lines (301 loc) · 84.6 KB

RULES.md

File metadata and controls

308 lines (301 loc) · 84.6 KB

PMD Rules

Note: this page is not up-to-date.

The purpose of this document is to support resolving #110. For that purpose, we track the current rule status:

  • Is the description up to date?
  • Is the rule deprecated - meaning is there a built-in rule that replaces the PMD rule?
  • If so, what is the alternative?

The PMD rules are divided into two sub categories:

  • PMD Rules
  • PMD Unit Test Rules

PMD Rules

Rule name Deprecated? Alternative Description up-to-date Checked on
AbstractClassWithoutAbstractMethod ☑️ S1694 2019-04-23
AbstractClassWithoutAnyMethod ☑️ S1694 2019-04-23
AbstractNaming ☑️ S118 2019-04-23
AccessorClassGeneration 2019-04-23
AddEmptyString 2019-04-23
AppendCharacterWithChar 2019-04-23
ArrayIsStoredDirectly ☑️ S2384 2019-04-23
AssignmentInOperand ☑️ java:AssignmentInSubExpressionCheck 2019-04-23
AssignmentToNonFinalStatic 2019-04-23
AtLeastOneConstructor ☑️ S1118, S1258 2019-04-23
AvoidAccessibilityAlteration 2019-04-25
AvoidArrayLoops 2019-04-25
AvoidAssertAsIdentifier ☑️ S1190 2019-04-25
AvoidBranchingStatementAsLastInLoop 2019-04-25
AvoidCallingFinalize ☑️ java:ObjectFinalizeCheck 2019-04-25
AvoidCatchingGenericException ☑️ S2221 2019-04-25
AvoidCatchingNPE ☑️ S1696 2019-04-25
AvoidCatchingThrowable ☑️ S1181 2019-04-25
AvoidConstantsInterface ☑️ S1214 2019-04-25
AvoidDecimalLiteralsInBigDecimalConstructor ☑️ S2111 2019-04-25
AvoidDeeplyNestedIfStmts ☑️ S134 2019-04-25
AvoidDollarSigns
AvoidDuplicateLiterals
AvoidEnumAsIdentifier
AvoidFieldNameMatchingMethodName
AvoidFieldNameMatchingTypeName
AvoidFinalLocalVariable
AvoidInstanceofChecksInCatchClause
AvoidInstantiatingObjectsInLoops
AvoidLiteralsInIfCondition
AvoidLosingExceptionInformation
AvoidMultipleUnaryOperators
AvoidPrefixingMethodParameters
AvoidPrintStackTrace
AvoidProtectedFieldInFinalClass
AvoidProtectedMethodInFinalClassNotExtending
AvoidReassigningParameters
AvoidRethrowingException
AvoidStringBufferField
AvoidSynchronizedAtMethodLevel
AvoidThreadGroup
AvoidThrowingNewInstanceOfSameException
AvoidThrowingNullPointerException
AvoidThrowingRawExceptionTypes
AvoidUsingHardCodedIP
AvoidUsingNativeCode
AvoidUsingOctalValues
AvoidUsingShortType
AvoidUsingVolatile
BadComparison
BeanMembersShouldSerialize
BigIntegerInstantiation
BooleanGetMethodName
BooleanInstantiation
BrokenNullCheck
ByteInstantiation
CallSuperFirst
CallSuperInConstructor
CallSuperLast
CheckResultSet
CheckSkipResult
ClassCastExceptionWithToArray
ClassNamingConventions
ClassWithOnlyPrivateConstructorsShouldBeFinal
CloneMethodMustBePublic
CloneMethodMustImplementCloneable
CloneMethodMustImplementCloneableWithTypeResolution
CloneMethodReturnTypeMustMatchClassName
CloneThrowsCloneNotSupportedException
CloseResource
CollapsibleIfStatements
CommentContent
CommentDefaultAccessModifier
CommentRequired
CommentSize
CompareObjectsWithEquals
ConfusingTernary
ConsecutiveAppendsShouldReuse
ConsecutiveLiteralAppends
ConstructorCallsOverridableMethod
CouplingBetweenObjects
CyclomaticComplexity
DataflowAnomalyAnalysis
DefaultLabelNotLastInSwitchStmt
DefaultPackage
DoNotCallGarbageCollectionExplicitly
DoNotCallSystemExit
DoNotExtendJavaLangError
DoNotHardCodeSDCard
DoNotThrowExceptionInFinally
DoNotUseThreads
DontCallThreadRun
DontImportJavaLang
DontImportSun
DontUseFloatTypeForLoopIndices
DoubleCheckedLocking
DuplicateImports
EmptyCatchBlock
EmptyFinalizer
EmptyFinallyBlock
EmptyIfStmt
EmptyInitializer
EmptyMethodInAbstractClassShouldBeAbstract
EmptyStatementBlock
EmptyStatementNotInLoop
EmptyStaticInitializer
EmptySwitchStatements
EmptySynchronizedBlock
EmptyTryBlock
EmptyWhileStmt
EqualsNull
ExceptionAsFlowControl
ExcessiveClassLength
ExcessiveImports
ExcessiveMethodLength
ExcessiveParameterList
ExcessivePublicCount
ExtendsObject
FieldDeclarationsShouldBeAtStartOfClass
FinalFieldCouldBeStatic
FinalizeDoesNotCallSuperFinalize
FinalizeOnlyCallsSuperFinalize
FinalizeOverloaded
FinalizeShouldBeProtected
ForLoopShouldBeWhileLoop
ForLoopsMustUseBraces
GenericsNaming
GodClass
GuardDebugLogging
GuardLogStatement
GuardLogStatementJavaUtil
IdempotentOperations
IfElseStmtsMustUseBraces
IfStmtsMustUseBraces
ImmutableField
ImportFromSamePackage
InefficientEmptyStringCheck
InefficientStringBuffering
InstantiationToGetClass
InsufficientStringBufferDeclaration
IntegerInstantiation
JumbledIncrementer
LawOfDemeter
LocalHomeNamingConvention
LocalInterfaceSessionNamingConvention
LocalVariableCouldBeFinal
LoggerIsNotStaticFinal
LogicInversion
LongInstantiation
LongVariable
LooseCoupling
LooseCouplingWithTypeResolution
LoosePackageCoupling
MDBAndSessionBeanNamingConvention
MethodArgumentCouldBeFinal
MethodNamingConventions
MethodReturnsInternalArray
MethodWithSameNameAsEnclosingClass
MisleadingVariableName
MisplacedNullCheck
MissingBreakInSwitch
MissingSerialVersionUID
MissingStaticMethodInNonInstantiatableClass
ModifiedCyclomaticComplexity
MoreThanOneLogger
NPathComplexity
NcssConstructorCount
NcssMethodCount
NcssTypeCount ☑️ S104 2020-12-15
NoPackage
NonCaseLabelInSwitchStatement
NonStaticInitializer
NonThreadSafeSingleton
NullAssignment
OneDeclarationPerLine
OnlyOneReturn
OptimizableToArrayCall
OverrideBothEqualsAndHashcode
PackageCase
PositionLiteralsFirstInCaseInsensitiveComparisons
PositionLiteralsFirstInComparisons
PrematureDeclaration
PreserveStackTrace
ProperCloneImplementation
ProperLogger
RedundantFieldInitializer
RemoteInterfaceNamingConvention
RemoteSessionInterfaceNamingConvention
ReplaceEnumerationWithIterator
ReplaceHashtableWithMap
ReplaceVectorWithList
ReturnEmptyArrayRatherThanNull
ReturnFromFinallyBlock
ShortClassName
ShortInstantiation
ShortMethodName
ShortVariable
SignatureDeclareThrowsException
SignatureDeclareThrowsExceptionWithTypeResolution
SimpleDateFormatNeedsLocale
SimplifiedTernary
SimplifyBooleanExpressions
SimplifyBooleanReturns
SimplifyConditional
SimplifyStartsWith
SingleMethodSingleton
SingletonClassReturningNewInstance
SingularField
StaticEJBFieldShouldBeFinal
StdCyclomaticComplexity
StringBufferInstantiationWithChar
StringInstantiation
StringToString
SuspiciousConstantFieldName
SuspiciousEqualsMethodName
SuspiciousHashcodeMethodName
SuspiciousOctalEscape
SwitchDensity
SwitchStmtsShouldHaveDefault
SystemPrintln
TooFewBranchesForASwitchStatement
TooManyFields
TooManyMethods
TooManyStaticImports
UncommentedEmptyConstructor
UncommentedEmptyMethodBody
UnconditionalIfStatement
UnnecessaryCaseChange
UnnecessaryConstructor
UnnecessaryConversionTemporary
UnnecessaryFinalModifier
UnnecessaryFullyQualifiedName
UnnecessaryLocalBeforeReturn
UnnecessaryParentheses
UnnecessaryReturn
UnnecessaryWrapperObjectCreation
UnsynchronizedStaticDateFormatter
UnusedFormalParameter
UnusedImports
UnusedImportsWithTypeResolution
UnusedLocalVariable
UnusedModifier
UnusedNullCheckInEquals
UnusedPrivateField
UnusedPrivateMethod
UseArrayListInsteadOfVector
UseArraysAsList
UseCollectionIsEmpty
UseConcurrentHashMap
UseCorrectExceptionLogging
UseEqualsToCompareStrings
UseIndexOfChar
UseLocaleWithCaseConversions
UseNotifyAllInsteadOfNotify
UseObjectForClearerAPI
UseProperClassLoader
UseStringBufferForStringAppends
UseStringBufferLength
UseUtilityClass
UseVarargs
UselessOperationOnImmutable
UselessOverridingMethod
UselessParentheses
UselessQualifiedThis
UselessStringValueOf
VariableNamingConventions
WhileLoopsMustUseBraces
XPathRule

PMD Unit Test Rules

Rule name Deprecated? Alternative Description up-to-date Checked on
JUnit4SuitesShouldUseSuiteAnnotation
JUnit4TestShouldUseAfterAnnotation
JUnit4TestShouldUseBeforeAnnotation
JUnit4TestShouldUseTestAnnotation
JUnitAssertionsShouldIncludeMessage
JUnitSpelling
JUnitStaticSuite
JUnitTestContainsTooManyAsserts
JUnitTestsShouldIncludeAssert
JUnitUseExpected
SimplifyBooleanAssertion
TestClassWithoutTestCases
UnnecessaryBooleanAssertion
UseAssertEqualsInsteadOfAssertTrue
UseAssertNullInsteadOfAssertTrue
UseAssertSameInsteadOfAssertTrue
UseAssertTrueInsteadOfAssertEquals