|
<?xml version="1.0"?> |
|
|
|
<ruleset name="Custom Rules" |
|
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 https://pmd.sourceforge.io/ruleset_2_0_0.xsd"> |
|
|
|
<description> |
|
My custom rules |
|
</description> |
|
|
|
<rule ref="category/java/errorprone.xml/DetachedTestCase" /> |
|
<rule ref="category/java/errorprone.xml/JUnitSpelling" /> |
|
<rule ref="category/java/errorprone.xml/JUnitStaticSuite" /> |
|
<rule ref="category/java/errorprone.xml/UnnecessaryBooleanAssertion" /> |
|
|
|
<rule ref="category/java/bestpractices.xml/LiteralsFirstInComparisons" /> |
|
|
|
<rule ref="category/java/bestpractices.xml/LooseCoupling" /> |
|
<rule ref="category/java/bestpractices.xml/AbstractClassWithoutAbstractMethod" /> |
|
<rule ref="category/java/bestpractices.xml/ArrayIsStoredDirectly" /> |
|
<rule ref="category/java/bestpractices.xml/AvoidPrintStackTrace" /> |
|
<rule ref="category/java/bestpractices.xml/AvoidReassigningLoopVariables" /> |
|
<rule ref="category/java/bestpractices.xml/AvoidStringBufferField" /> |
|
<rule ref="category/java/bestpractices.xml/AvoidUsingHardCodedIP" /> |
|
<rule ref="category/java/bestpractices.xml/ConstantsInInterface" /> |
|
<rule ref="category/java/bestpractices.xml/DefaultLabelNotLastInSwitchStmt" /> |
|
<rule ref="category/java/bestpractices.xml/ForLoopCanBeForeach" /> |
|
<rule ref="category/java/bestpractices.xml/MethodReturnsInternalArray" /> |
|
<rule ref="category/java/bestpractices.xml/MissingOverride" /> |
|
<rule ref="category/java/bestpractices.xml/PreserveStackTrace" /> |
|
<rule ref="category/java/bestpractices.xml/ReplaceHashtableWithMap" /> |
|
<rule ref="category/java/bestpractices.xml/ReplaceVectorWithList" /> |
|
<rule ref="category/java/bestpractices.xml/SwitchStmtsShouldHaveDefault" /> |
|
<rule ref="category/java/bestpractices.xml/SystemPrintln" /> |
|
<rule ref="category/java/bestpractices.xml/UnusedFormalParameter" /> |
|
<rule ref="category/java/bestpractices.xml/UnusedImports" /> |
|
<rule ref="category/java/bestpractices.xml/UnusedLocalVariable" /> |
|
<rule ref="category/java/bestpractices.xml/UseCollectionIsEmpty" /> |
|
<rule ref="category/java/bestpractices.xml/WhileLoopWithLiteralBoolean" /> |
|
<!-- rule ref="category/java/bestpractices.xml/UnusedPrivateField" /--> |
|
<rule ref="category/java/bestpractices.xml/UnusedPrivateField"> |
|
<properties> |
|
<property name="ignoredAnnotations" value="lombok.Setter|lombok.Getter|lombok.Builder|lombok.Data|lombok.RequiredArgsConstructor|lombok.AllArgsConstructor|lombok.Value|lombok.NoArgsConstructor|java.lang.Deprecated|javafx.fxml.FXML|lombok.experimental.Delegate" /> |
|
</properties> |
|
</rule> |
|
|
|
<rule ref="category/java/codestyle.xml/AvoidProtectedFieldInFinalClass" /> |
|
<rule ref="category/java/codestyle.xml/AvoidProtectedMethodInFinalClassNotExtending" /> |
|
<rule ref="category/java/codestyle.xml/AvoidUsingNativeCode" /> |
|
<rule ref="category/java/codestyle.xml/CallSuperInConstructor" /> |
|
<rule ref="category/java/codestyle.xml/ClassNamingConventions" /> |
|
<rule ref="category/java/codestyle.xml/ConfusingTernary"> |
|
<properties> |
|
<property name="ignoreElseIf" value="false" /> |
|
</properties> |
|
</rule> |
|
<rule ref="category/java/codestyle.xml/ControlStatementBraces" /> |
|
<rule ref="category/java/codestyle.xml/DontImportJavaLang" /> |
|
<rule ref="category/java/codestyle.xml/DuplicateImports" /> |
|
<rule ref="category/java/codestyle.xml/ExtendsObject" /> |
|
<rule ref="category/java/codestyle.xml/FieldDeclarationsShouldBeAtStartOfClass" /> |
|
<rule ref="category/java/codestyle.xml/ForLoopShouldBeWhileLoop" /> |
|
<rule ref="category/java/codestyle.xml/IdenticalCatchBranches" /> |
|
<rule ref="category/java/codestyle.xml/LinguisticNaming" /> |
|
<rule ref="category/java/codestyle.xml/LongVariable"> |
|
<properties> |
|
<property name="minimum" value="50" /> |
|
</properties> |
|
</rule> |
|
<rule ref="category/java/codestyle.xml/MDBAndSessionBeanNamingConvention" /> |
|
<rule ref="category/java/codestyle.xml/NoPackage" /> |
|
<rule ref="category/java/codestyle.xml/PackageCase" /> |
|
<rule ref="category/java/codestyle.xml/PrematureDeclaration" /> |
|
<rule ref="category/java/codestyle.xml/ShortClassName" /> |
|
<rule ref="category/java/codestyle.xml/ShortMethodName" /> |
|
<rule ref="category/java/codestyle.xml/ShortVariable" /> |
|
<!-- |
|
|
|
Por regra de segurança o Next recomenda o uso de import específico por |
|
isso eliminar essa regra |
|
|
|
rule ref="category/java/codestyle.xml/TooManyStaticImports"> |
|
<properties> |
|
<property name="maximumStaticImports" value="4" /> |
|
</properties> |
|
</rule --> |
|
<rule ref="category/java/codestyle.xml/UnnecessaryCast" /> |
|
<rule ref="category/java/codestyle.xml/UnnecessaryConstructor" /> |
|
<rule ref="category/java/codestyle.xml/UnnecessaryFullyQualifiedName" /> |
|
<rule ref="category/java/codestyle.xml/UnnecessaryLocalBeforeReturn" /> |
|
<rule ref="category/java/codestyle.xml/UnnecessaryModifier" /> |
|
<rule ref="category/java/codestyle.xml/UnnecessaryReturn" /> |
|
<rule ref="category/java/codestyle.xml/UseDiamondOperator" /> |
|
<rule ref="category/java/codestyle.xml/UselessParentheses" /> |
|
<rule ref="category/java/codestyle.xml/UselessQualifiedThis" /> |
|
<rule ref="category/java/codestyle.xml/UseShortArrayInitializer" /> |
|
<rule ref="category/java/codestyle.xml/UseUnderscoresInNumericLiterals" /> |
|
|
|
<rule ref="category/java/design.xml/AbstractClassWithoutAnyMethod" /> |
|
<rule ref="category/java/design.xml/AvoidDeeplyNestedIfStmts" /> |
|
<rule ref="category/java/design.xml/AvoidRethrowingException" /> |
|
<rule ref="category/java/design.xml/AvoidThrowingNewInstanceOfSameException" /> |
|
|
|
<rule ref="category/java/errorprone.xml/AssignmentInOperand" /> |
|
<rule ref="category/java/errorprone.xml/AssignmentToNonFinalStatic" /> |
|
<rule ref="category/java/errorprone.xml/AvoidAssertAsIdentifier" /> |
|
<rule ref="category/java/errorprone.xml/AvoidCallingFinalize" /> |
|
<rule ref="category/java/errorprone.xml/AvoidCatchingThrowable" /> |
|
<rule ref="category/java/errorprone.xml/AvoidCatchingNPE" /> |
|
<rule ref="category/java/errorprone.xml/AvoidEnumAsIdentifier" /> |
|
<rule ref="category/java/errorprone.xml/AvoidFieldNameMatchingMethodName" /> |
|
<rule ref="category/java/errorprone.xml/AvoidFieldNameMatchingTypeName" /> |
|
<rule ref="category/java/errorprone.xml/AvoidInstanceofChecksInCatchClause" /> |
|
<rule ref="category/java/errorprone.xml/AvoidMultipleUnaryOperators" /> |
|
<rule ref="category/java/errorprone.xml/AvoidUsingOctalValues" /> |
|
<rule ref="category/java/errorprone.xml/BadComparison" /> |
|
<rule ref="category/java/errorprone.xml/BrokenNullCheck" /> |
|
<rule ref="category/java/errorprone.xml/ClassCastExceptionWithToArray" /> |
|
<rule ref="category/java/errorprone.xml/CloneMethodMustBePublic" /> |
|
<rule ref="category/java/errorprone.xml/CloneMethodMustImplementCloneable" /> |
|
<rule ref="category/java/errorprone.xml/CompareObjectsWithEquals" /> |
|
<rule ref="category/java/errorprone.xml/ConstructorCallsOverridableMethod" /> |
|
<rule ref="category/java/errorprone.xml/DataflowAnomalyAnalysis" /> |
|
<rule ref="category/java/errorprone.xml/DoNotExtendJavaLangThrowable" /> |
|
<rule ref="category/java/errorprone.xml/DoNotHardCodeSDCard" /> |
|
<rule ref="category/java/errorprone.xml/DontImportSun" /> |
|
<rule ref="category/java/errorprone.xml/DontUseFloatTypeForLoopIndices" /> |
|
<rule ref="category/java/errorprone.xml/EmptyCatchBlock" /> |
|
<rule ref="category/java/errorprone.xml/EmptyFinalizer" /> |
|
<rule ref="category/java/errorprone.xml/EmptyFinallyBlock" /> |
|
<rule ref="category/java/errorprone.xml/EmptyIfStmt" /> |
|
<rule ref="category/java/errorprone.xml/EmptyInitializer" /> |
|
<rule ref="category/java/errorprone.xml/EmptyStatementBlock" /> |
|
<rule ref="category/java/errorprone.xml/EmptyStatementNotInLoop" /> |
|
<rule ref="category/java/errorprone.xml/EmptySwitchStatements" /> |
|
<rule ref="category/java/errorprone.xml/EmptySynchronizedBlock" /> |
|
<rule ref="category/java/errorprone.xml/EmptyTryBlock" /> |
|
<rule ref="category/java/errorprone.xml/EmptyWhileStmt" /> |
|
<rule ref="category/java/errorprone.xml/EqualsNull" /> |
|
<rule ref="category/java/errorprone.xml/IdempotentOperations" /> |
|
<rule ref="category/java/errorprone.xml/ImportFromSamePackage" /> |
|
<rule ref="category/java/errorprone.xml/InstantiationToGetClass" /> |
|
<rule ref="category/java/errorprone.xml/InvalidLogMessageFormat" /> |
|
<rule ref="category/java/errorprone.xml/JumbledIncrementer" /> |
|
<rule ref="category/java/errorprone.xml/MethodWithSameNameAsEnclosingClass" /> |
|
<rule ref="category/java/errorprone.xml/MisplacedNullCheck" /> |
|
<rule ref="category/java/errorprone.xml/MissingBreakInSwitch" /> |
|
<rule ref="category/java/errorprone.xml/MissingSerialVersionUID" /> |
|
<rule ref="category/java/errorprone.xml/MissingStaticMethodInNonInstantiatableClass"> |
|
<properties> |
|
<property name="annotations" value="org.springframework.beans.factory.annotation.Autowired, javax.inject.Inject" /> |
|
</properties> |
|
</rule> |
|
<rule ref="category/java/errorprone.xml/MoreThanOneLogger" /> |
|
<rule ref="category/java/errorprone.xml/NonCaseLabelInSwitchStatement" /> |
|
<rule ref="category/java/errorprone.xml/NonStaticInitializer" /> |
|
<rule ref="category/java/errorprone.xml/NullAssignment" /> |
|
<rule ref="category/java/errorprone.xml/ProperCloneImplementation" /> |
|
<rule ref="category/java/errorprone.xml/ReturnEmptyArrayRatherThanNull" /> |
|
<rule ref="category/java/errorprone.xml/ReturnFromFinallyBlock" /> |
|
<rule ref="category/java/errorprone.xml/SimpleDateFormatNeedsLocale" /> |
|
<rule ref="category/java/errorprone.xml/SingleMethodSingleton" /> |
|
<rule ref="category/java/errorprone.xml/SingletonClassReturningNewInstance" /> |
|
<rule ref="category/java/errorprone.xml/StaticEJBFieldShouldBeFinal" /> |
|
<rule ref="category/java/errorprone.xml/StringBufferInstantiationWithChar" /> |
|
<rule ref="category/java/errorprone.xml/SuspiciousEqualsMethodName" /> |
|
<rule ref="category/java/errorprone.xml/SuspiciousHashcodeMethodName" /> |
|
<rule ref="category/java/errorprone.xml/SuspiciousOctalEscape" /> |
|
<rule ref="category/java/errorprone.xml/TestClassWithoutTestCases" /> |
|
<rule ref="category/java/errorprone.xml/UnconditionalIfStatement" /> |
|
<rule ref="category/java/errorprone.xml/UnnecessaryCaseChange" /> |
|
<rule ref="category/java/errorprone.xml/UnnecessaryConversionTemporary" /> |
|
<rule ref="category/java/errorprone.xml/UnusedNullCheckInEquals" /> |
|
<rule ref="category/java/errorprone.xml/UseEqualsToCompareStrings" /> |
|
<rule ref="category/java/errorprone.xml/UselessOperationOnImmutable" /> |
|
<rule ref="category/java/errorprone.xml/UseLocaleWithCaseConversions" /> |
|
<rule ref="category/java/errorprone.xml/UseProperClassLoader" /> |
|
|
|
<rule ref="category/java/multithreading.xml/AvoidSynchronizedAtMethodLevel" /> |
|
<rule ref="category/java/multithreading.xml/AvoidThreadGroup" /> |
|
<rule ref="category/java/multithreading.xml/AvoidUsingVolatile" /> |
|
<rule ref="category/java/multithreading.xml/DoNotUseThreads" /> |
|
<rule ref="category/java/multithreading.xml/DontCallThreadRun" /> |
|
<rule ref="category/java/multithreading.xml/DoubleCheckedLocking" /> |
|
<rule ref="category/java/multithreading.xml/NonThreadSafeSingleton" /> |
|
<rule ref="category/java/multithreading.xml/UseConcurrentHashMap" /> |
|
<rule ref="category/java/multithreading.xml/UseNotifyAllInsteadOfNotify" /> |
|
|
|
<rule ref="category/java/performance.xml/AddEmptyString" /> |
|
<rule ref="category/java/performance.xml/AppendCharacterWithChar" /> |
|
<rule ref="category/java/performance.xml/AvoidArrayLoops" /> |
|
<rule ref="category/java/performance.xml/AvoidCalendarDateCreation" /> |
|
<rule ref="category/java/performance.xml/AvoidFileStream" /> |
|
<rule ref="category/java/performance.xml/AvoidInstantiatingObjectsInLoops" /> |
|
<rule ref="category/java/performance.xml/AvoidUsingShortType" /> |
|
<rule ref="category/java/performance.xml/BigIntegerInstantiation" /> |
|
<rule ref="category/java/performance.xml/BooleanInstantiation" /> |
|
<rule ref="category/java/performance.xml/ByteInstantiation" /> |
|
<rule ref="category/java/performance.xml/ConsecutiveAppendsShouldReuse" /> |
|
<rule ref="category/java/performance.xml/ConsecutiveLiteralAppends" /> |
|
<rule ref="category/java/performance.xml/InefficientEmptyStringCheck" /> |
|
<rule ref="category/java/performance.xml/InefficientStringBuffering" /> |
|
<rule ref="category/java/performance.xml/InsufficientStringBufferDeclaration" /> |
|
<rule ref="category/java/performance.xml/IntegerInstantiation" /> |
|
<rule ref="category/java/performance.xml/LongInstantiation" /> |
|
<rule ref="category/java/performance.xml/OptimizableToArrayCall" /> |
|
<rule ref="category/java/performance.xml/RedundantFieldInitializer" /> |
|
<rule ref="category/java/performance.xml/ShortInstantiation" /> |
|
<rule ref="category/java/performance.xml/SimplifyStartsWith" /> |
|
<rule ref="category/java/performance.xml/StringInstantiation" /> |
|
<rule ref="category/java/performance.xml/StringToString" /> |
|
<rule ref="category/java/performance.xml/TooFewBranchesForASwitchStatement" /> |
|
<rule ref="category/java/performance.xml/UnnecessaryWrapperObjectCreation" /> |
|
<rule ref="category/java/performance.xml/UseArrayListInsteadOfVector" /> |
|
<rule ref="category/java/performance.xml/UseArraysAsList" /> |
|
<rule ref="category/java/performance.xml/UseIndexOfChar" /> |
|
<rule ref="category/java/performance.xml/UseIOStreamsWithApacheCommonsFileItem" /> |
|
<rule ref="category/java/performance.xml/UselessStringValueOf" /> |
|
<rule ref="category/java/performance.xml/UseStringBufferForStringAppends" /> |
|
<rule ref="category/java/performance.xml/UseStringBufferLength" /> |
|
|
|
<rule ref="category/java/security.xml/HardCodedCryptoKey" /> |
|
<rule ref="category/java/security.xml/InsecureCryptoIv" /> |
|
|
|
|
|
</ruleset> |
https://pmd.github.io/pmd-6.23.0/index.html
Ferramenta interessante para análise de código dos seguintes linguagens: Apex; Ecmascript; Java; Java Server Pages; Maven POM; Modelica; PLSQL; Salesforce VisualForce; VM; XML; XSL; Scala