add findbugs config xml and gradle task

Project: http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/commit/326071a3
Tree: 
http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/tree/326071a3
Diff: 
http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/diff/326071a3

Branch: refs/heads/master
Commit: 326071a338e68d2454351145be2f774058e607ba
Parents: 347d558
Author: Sagar <[email protected]>
Authored: Mon Jun 13 15:28:48 2016 +0530
Committer: Sagar <[email protected]>
Committed: Mon Jun 13 15:28:48 2016 +0530

----------------------------------------------------------------------
 .../quality/findbugs/android-exclude-filter.xml | 20 ++++++++++++
 config/quality/quality.gradle                   | 32 +++++++++++++++++++-
 2 files changed, 51 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/blob/326071a3/config/quality/findbugs/android-exclude-filter.xml
----------------------------------------------------------------------
diff --git a/config/quality/findbugs/android-exclude-filter.xml 
b/config/quality/findbugs/android-exclude-filter.xml
new file mode 100644
index 0000000..ccd73c6
--- /dev/null
+++ b/config/quality/findbugs/android-exclude-filter.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<FindBugsFilter>
+    <Match>
+        <Class name="~.*\.R\$.*"/>
+    </Match>
+    <Match>
+        <Class name="~.*\.Manifest\$.*"/>
+    </Match>
+
+
+    <!-- All bugs in test classes, except for JUnit-specific bugs -->
+    <Match>
+        <Class name="~.*\.*Test" />
+        <Not>
+            <Bug code="IJU" />
+        </Not>
+    </Match>
+
+
+</FindBugsFilter>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/blob/326071a3/config/quality/quality.gradle
----------------------------------------------------------------------
diff --git a/config/quality/quality.gradle b/config/quality/quality.gradle
index 978277f..b99c433 100644
--- a/config/quality/quality.gradle
+++ b/config/quality/quality.gradle
@@ -1,5 +1,6 @@
 apply plugin: 'checkstyle'
 apply plugin: 'pmd'
+apply plugin: 'findbugs'
 
 dependencies {
     checkstyle 'com.puppycrawl.tools:checkstyle:6.5'
@@ -8,7 +9,7 @@ dependencies {
 def qualityConfigDir = "$project.rootDir/config/quality";
 def reportsDir = "$project.buildDir/reports"
 
-check.dependsOn 'checkstyle', 'pmd'
+check.dependsOn 'checkstyle', 'pmd','findbugs'
 
 task checkstyle(type: Checkstyle, group: 'Verification', description: 'Runs 
code style checks') {
     configFile file("$qualityConfigDir/checkstyle/checkstyle-config.xml")
@@ -45,4 +46,33 @@ task pmd(type: Pmd, group: 'Verification', description: 
'Inspect sourcecode for
             destination "$reportsDir/pmd/pmd.html"
         }
     }
+}
+
+task findbugs(type: FindBugs,
+        group: 'Verification',
+        description: 'Inspect java bytecode for bugs',
+        dependsOn: ['compileDebugSources','compileReleaseSources']) {
+
+    ignoreFailures = false
+    effort = "max"
+    reportLevel = "high"
+    excludeFilter = new 
File("$qualityConfigDir/findbugs/android-exclude-filter.xml")
+    classes = files("$project.rootDir/app/build/intermediates/classes")
+
+    source 'src'
+    include '**/*.java'
+    exclude '**/gen/**'
+
+    reports {
+        xml.enabled = false
+        html.enabled = true
+        xml {
+            destination "$reportsDir/findbugs/findbugs.xml"
+        }
+        html {12
+            destination "$reportsDir/findbugs/findbugs.html"
+        }
+    }
+
+    classpath = files()
 }
\ No newline at end of file

Reply via email to