pmd.ruleset.xml Maven / Gradle / Ivy
<?xml version="1.0"?> <ruleset name="Custom 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 https://pmd.sourceforge.io/ruleset_2_0_0.xsd"> <description>FreeLibrary PMD Rules</description> <exclude-pattern>.*/test/.*</exclude-pattern> <exclude-pattern>.*/generated/.*</exclude-pattern> <!-- For details about the Java rules, cf. https://pmd.github.io/pmd/pmd_rules_java --> <rule ref="category/java/bestpractices.xml"> <exclude name="GuardLogStatement" /> <exclude name="LooseCoupling" /> </rule> <rule ref="category/java/bestpractices.xml/UnusedPrivateMethod"> <properties> <property name="ignoredAnnotations" value="com.fasterxml.jackson.annotation.JsonSetter,com.fasterxml.jackson.annotation.JsonGetter" /> </properties> </rule> <rule ref="category/java/bestpractices.xml/ForLoopVariableCount"> <properties> <property name="maximumVariables" value="2" /> </properties> </rule> <rule ref="category/java/codestyle.xml"> <exclude name="OnlyOneReturn" /> <exclude name="CommentDefaultAccessModifier" /> <exclude name="CallSuperInConstructor" /> <!-- Default super is handled by default --> <exclude name="ConfusingTernary" /> <!-- It makes more sense to ask if something isn't null, IMHO --> <exclude name="PrematureDeclaration" /> <!-- Sometimes useful, but more often than not a false positive --> <exclude name="UnnecessaryConstructor" /> <!-- Javadocs requires even default constructors to have docs --> <exclude name="AtLeastOneConstructor" /> <!-- Non-public classes can have default constructors --> </rule> <rule ref="category/java/codestyle.xml/ClassNamingConventions"> <properties> <property name="classPattern" value="[A-Z][a-zA-Z0-9]*" /> <property name="abstractClassPattern" value="Abstract[A-Z][a-zA-Z0-9]*" /> <property name="interfacePattern" value="[A-Z][a-zA-Z0-9]*" /> <property name="enumPattern" value="[A-Z][a-zA-Z0-9]*" /> <property name="annotationPattern" value="[A-Z][a-zA-Z0-9]*" /> <property name="utilityClassPattern" value="[A-Z][a-zA-Z0-9]*" /> </properties> </rule> <rule ref="category/java/codestyle.xml/LinguisticNaming"> <properties> <property name="ignoredAnnotations" value="java.lang.Override" /> <property name="checkBooleanMethod" value="true" /> <property name="checkGetters" value="true" /> <property name="checkSetters" value="false" /> <property name="booleanMethodPrefixes" value="is|has|should" /> <property name="transformMethodNames" value="to|as|from" /> <property name="checkFields" value="true" /> <property name="checkVariables" value="true" /> <property name="booleanFieldPrefixes" value="is|has|should" /> </properties> </rule> <rule ref="category/java/codestyle.xml/LongVariable"> <properties> <property name="minimum" value="35" /> </properties> </rule> <rule ref="category/java/codestyle.xml/ShortVariable"> <properties> <property name="minimum" value="1" /> </properties> </rule> <rule ref="category/java/codestyle.xml/ShortClassName"> <properties> <property name="minimum" value="2" /> </properties> </rule> <rule ref="category/java/design.xml"> <exclude name="LawOfDemeter" /> <exclude name="LoosePackageCoupling" /> <exclude name="SimplifyBooleanReturns" /> <exclude name="DataClass" /> </rule> <rule ref="category/java/design.xml/TooManyMethods"> <properties> <property name="maxmethods" value="20" /> </properties> </rule> <rule ref="category/java/documentation.xml" /> <rule ref="category/java/documentation.xml/CommentSize"> <properties> <property name="maxLines" value="30" /> <property name="maxLineLength" value="120" /> </properties> </rule> <rule ref="category/java/errorprone.xml"> <exclude name="AssignmentInOperand" /> <exclude name="InvalidLogMessageFormat" /> <exclude name="MissingStaticMethodInNonInstantiatableClass" /> </rule> <rule ref="category/java/performance.xml"> <exclude name="AvoidInstantiatingObjectsInLoops" /> </rule> <rule ref="category/java/security.xml" /> </ruleset>
© 2015 - 2024 Weber Informatics LLC | Privacy Policy