Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<FindBugsFilter>
<Match>
<Class name="~.*R\$.*"/>
</Match>
<Match>
<Class name="~.*Manifest\$.*"/>
</Match>
<Match>
<Class name="~.*_234$"/>
</Match>
<Match>
<Bug pattern="EI_EXPOSE_REP"/>
</Match>
<Match>
<Bug pattern="EI_EXPOSE_REP2"/>
</Match>
</FindBugsFilter>
<?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>
<rule ref="rulesets/java/android.xml"/>
<rule ref="rulesets/java/clone.xml" />
<rule ref="rulesets/java/finalizers.xml" />
<rule ref="rulesets/java/imports.xml" />
<rule ref="rulesets/java/logging-java.xml" />
<rule ref="rulesets/java/braces.xml" />
<rule ref="rulesets/java/strings.xml" />
<rule ref="rulesets/java/basic.xml" />
<rule ref="rulesets/java/naming.xml">
<exclude name="AbstractNaming" />
<exclude name="LongVariable" />
<exclude name="ShortMethodName" />
<exclude name="ShortVariable" />
<exclude name="AvoidFieldNameMatchingMethodName" />
<exclude name="VariableNamingConventions" />
</rule>
<rule ref="rulesets/java/imports.xml/TooManyStaticImports">
<properties>
<property name="maximumStaticImports" value="15" />
</properties>
</rule>
</ruleset>
apply plugin: 'checkstyle'
apply plugin: 'findbugs'
apply plugin: 'pmd'
task checkstyle(type: Checkstyle) {
description 'Checks if the code is somewhat acceptable'
group 'verification'
configFile file('./qa-checks/checkstyle.xml')
source 'src'
include '**/*.java'
exclude '**/gen/**'
classpath = files()
ignoreFailures = false
}
task findbugs(type: FindBugs) {
description 'Run findbugs'
group 'verification'
classes = files("$project.buildDir/intermediates/classes")
source 'src'
classpath = files()
effort 'max'
excludeFilter file('./qa-checks/findbugs-exclude.xml')
reports {
xml.enabled = true
html.enabled = false
}
ignoreFailures = true
}
task pmd(type: Pmd) {
description 'Run PMD'
group 'verification'
ruleSetFiles = files("./qa-checks/pmd-ruleset.xml")
ruleSets = []
source 'src'
include '**/*.java'
exclude '**/gen/**'
reports {
xml.enabled = false
html.enabled = true
}
ignoreFailures = true
}
assembleDebug.doLast {
project.tasks.getByName("checkstyle").execute()
project.tasks.getByName("findbugs").execute()
project.tasks.getByName("pmd").execute()
project.tasks.getByName("lint").execute()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment