<?xml version="1.0"?>
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Android Application Rules"
         xmlns="http://pmd.sf.net/ruleset/1.0.0"
         xsi:noNamespaceSchemaLocation="http://pmd.sf.net/ruleset_xml_schema.xsd"
         xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0 http://pmd.sf.net/ruleset_xml_schema.xsd">

    <description>Custom ruleset for Android application</description>

    <exclude-pattern>.*/R.java</exclude-pattern>
    <exclude-pattern>.*/gen/.*</exclude-pattern>
    <exclude-pattern>.*/test/.*</exclude-pattern>
    <exclude-pattern>.*/androidTest/.*</exclude-pattern>

    <rule ref="rulesets/java/android.xml"/>

    <rule ref="rulesets/java/basic.xml"/>
    <rule ref="rulesets/java/braces.xml"/>
    <rule ref="rulesets/java/clone.xml"/>
    <rule ref="rulesets/java/codesize.xml">
        <exclude name="TooManyMethods"/>
    </rule>
    <rule ref="rulesets/java/codesize.xml/TooManyMethods">
        <properties>
            <property name="maxmethods" value="20"/>
        </properties>
    </rule>
    <rule ref="rulesets/java/comments.xml">
        <exclude name="CommentSize"/>
        <!-- javadoc is checked by checkstyle -->
        <exclude name="CommentRequired"/>
        <exclude name="CommentDefaultAccessModifier"/>
    </rule>
    <rule ref="rulesets/java/controversial.xml">
        <exclude name="AtLeastOneConstructor"/>

        <!-- better to keep dagger module class provide methods as package private -->
        <exclude name="DefaultPackage"/>

        <!-- annoying -->
        <exclude name="AvoidFinalLocalVariable"/>

        <!-- Singleton usage -->
        <exclude name="AvoidUsingVolatile"/>

        <exclude name="AvoidPrefixingMethodParameters"/>

        <exclude name="OnlyOneReturn"/>
    </rule>
    <rule ref="rulesets/java/coupling.xml">
        <!-- this is too strictly -->
        <exclude name="LawOfDemeter"/>
        <exclude name="ExcessiveImports"/>
    </rule>
    <rule ref="rulesets/java/design.xml">
        <exclude name="UncommentedEmptyMethodBody"/>
    </rule>
    <rule ref="rulesets/java/empty.xml"/>
    <rule ref="rulesets/java/finalizers.xml"/>
    <rule ref="rulesets/java/imports.xml">
        <!-- Espresso is designed this way !-->
        <exclude name="TooManyStaticImports"/>
    </rule>

    <rule ref="rulesets/java/junit.xml">
        <!-- mockito assert -->
        <exclude name="JUnitTestsShouldIncludeAssert"/>
        <exclude name="JUnitTestContainsTooManyAsserts"/>
        <exclude name="JUnitAssertionsShouldIncludeMessage"/>
    </rule>
    <rule ref="rulesets/java/logging-java.xml"/>

    <rule ref="rulesets/java/naming.xml">
        <exclude name="AbstractNaming"/>
        <exclude name="LongVariable"/>
        <!--<exclude name="LongMethodName" />-->
        <exclude name="ShortMethodName"/>
        <exclude name="ShortVariable"/>
        <exclude name="VariableNamingConventions"/>
    </rule>
    <rule ref="rulesets/java/optimizations.xml"/>
    <rule ref="rulesets/java/strictexception.xml"/>
    <rule ref="rulesets/java/strings.xml">
        <exclude name="AvoidDuplicateLiterals"/>
    </rule>
    <rule ref="rulesets/java/strings.xml/AvoidDuplicateLiterals">
        <properties>
            <property name="skipAnnotations" value="true"/>
        </properties>
    </rule>
    <!--<rule ref="rulesets/java/typeresolutoin.xml"/>-->
    <rule ref="rulesets/java/unnecessary.xml"/>
    <rule ref="rulesets/java/unusedcode.xml"/>
</ruleset>