All Downloads are FREE. Search and download functionalities are using the official Maven repository.

pmd.pmd.xml Maven / Gradle / Ivy

There is a newer version: 0.7
Show newest version
<?xml version="1.0"?>
<ruleset name="Custom ruleset"
         xmlns="http://pmd.sf.net/ruleset/1.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0 http://pmd.sf.net/ruleset_xml_schema.xsd"
         xsi:noNamespaceSchemaLocation="http://pmd.sf.net/ruleset_xml_schema.xsd">
    <description>
        Ka Source Rule set
    </description>


    <rule ref="category/java/errorprone.xml">
        <exclude name="AvoidFieldNameMatchingMethodName"/> <!-- allow builder pattern -->
        <exclude name="BeanMembersShouldSerialize"/>
        <exclude name="DataflowAnomalyAnalysis"/>
    </rule>
    <rule ref="category/java/errorprone.xml/AvoidLiteralsInIfCondition">
        <properties>
            <property name="ignoreMagicNumbers" value="-1,0,1,2"/>
        </properties>
    </rule>
    <rule ref="category/java/errorprone.xml/EmptyCatchBlock">
        <properties>
            <property name="allowCommentedBlocks" value="true"/> <!-- Allow empty catch block to be commented, with a justification -->
        </properties>
    </rule>

    <rule ref="category/java/codestyle.xml">
        <exclude name="AtLeastOneConstructor"/> <!-- We do want to to use default empty constructors -->
        <exclude name="ShortVariable"/> <!-- variables like i and e are commonly used, and are in those cases the de-facto standard -->
        <exclude name="OnlyOneReturn"/> <!-- Not obvious the best way to code -->
        <exclude name="MethodArgumentCouldBeFinal"/> <!-- OK as hints, but will bloat the output -->
        <exclude name="LocalVariableCouldBeFinal"/> <!-- OK as hints, but will bloat the output -->
        <exclude name="CommentDefaultAccessModifier"/> <!-- Allow default scope without comments in code -->
        <exclude name="DefaultPackage"/>  <!-- Allow usage of default scope -->
        <exclude name="GenericsNaming"/> <!-- Allow Generic names like V1, V2 or VR -->
        <exclude name="ConfusingTernary"/> <!-- Exclude until the ignoreElseIf property can be set -->
    </rule>
    <rule ref="category/java/codestyle.xml/LongVariable">
        <properties>
            <property name="minimum" value="40"/> <!-- Change allowed maximum length of variables names -->
        </properties>
    </rule>
    <rule ref="category/java/codestyle.xml/ShortClassName">
        <properties>
            <property name="minimum" value="3"/> <!-- Change allowed minimum length of class names -->
        </properties>
    </rule>
    <rule ref="category/java/codestyle.xml/ShortMethodName">
        <properties>
            <property name="minimum" value="2"/> <!-- Change allowed minimum length of method names -->
        </properties>
    </rule>
    <rule ref="category/java/codestyle.xml/ClassNamingConventions">
        <properties>
            <property name="utilityClassPattern" value="[A-Z][a-zA-Z0-9]+(Utils?|Helper|Constants)" />
        </properties>
    </rule>

    <rule ref="category/java/bestpractices.xml">
        <exclude name="GuardLogStatement"/> <!-- only reasonable with debug and lower -->
        <exclude name="AccessorMethodGeneration"/> <!-- Not a performance issue and we are not on Android -->
        <exclude name="AccessorClassGeneration"/>  <!-- allow builder pattern -->
    </rule>
    <rule ref="category/java/performance.xml">
        <exclude name="AvoidUsingShortType"/> <!-- Highly speculative performance gains for banning short-->
        <exclude name="AvoidInstantiatingObjectsInLoops"/> <!-- Might be necessary -->
    </rule>
    <rule ref="category/java/security.xml"/>
    <rule ref="category/java/multithreading.xml"/>

</ruleset>




© 2015 - 2024 Weber Informatics LLC | Privacy Policy