From 4d3360b04e2e7e22d3d592a11e945ec637b24108 Mon Sep 17 00:00:00 2001 From: Branden Archer Date: Wed, 13 Sep 2017 10:46:41 -0400 Subject: [PATCH 1/2] Change TAG field to be static --- app/src/main/java/protect/babymonitor/StartActivity.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/protect/babymonitor/StartActivity.java b/app/src/main/java/protect/babymonitor/StartActivity.java index ec777b0..df14884 100644 --- a/app/src/main/java/protect/babymonitor/StartActivity.java +++ b/app/src/main/java/protect/babymonitor/StartActivity.java @@ -25,7 +25,7 @@ import android.widget.Button; public class StartActivity extends Activity { - final String TAG = "BabyMonitor"; + static final String TAG = "BabyMonitor"; @Override protected void onCreate(Bundle savedInstanceState) From c88fc677acfa5a49e9cf01c68fa39a58ffe46d09 Mon Sep 17 00:00:00 2001 From: Branden Archer Date: Wed, 13 Sep 2017 10:47:01 -0400 Subject: [PATCH 2/2] Add support for running FindBugs --- .travis.yml | 2 +- app/build.gradle | 25 +++++++++++++++++++++++++ app/config/findbugs/exclude.xml | 10 ++++++++++ 3 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 app/config/findbugs/exclude.xml diff --git a/.travis.yml b/.travis.yml index d28835a..df7ab2e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,7 +9,7 @@ install: - echo y | android update sdk -u -a -t extra-google-m2repository - echo y | android update sdk -u -a -t extra-android-m2repository -script: ./gradlew assembleRelease testReleaseUnitTest lintRelease +script: ./gradlew assembleRelease testReleaseUnitTest lintRelease findbugs after_failure: - cat app/build/reports/findbugs/findbugs.html diff --git a/app/build.gradle b/app/build.gradle index ea5b731..e6439f5 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,4 +1,10 @@ apply plugin: 'com.android.application' +apply plugin: 'findbugs' + +findbugs { + sourceSets = [] + ignoreFailures = false +} android { compileSdkVersion 25 @@ -17,3 +23,22 @@ android { } } } + +task findbugs(type: FindBugs, dependsOn: 'assembleDebug') { + + description 'Run findbugs' + group 'verification' + + classes = fileTree('build/intermediates/classes/debug/') + source = fileTree('src/main/java') + classpath = files() + + effort = 'max' + + excludeFilter = file("./config/findbugs/exclude.xml") + + reports { + xml.enabled = false + html.enabled = true + } +} \ No newline at end of file diff --git a/app/config/findbugs/exclude.xml b/app/config/findbugs/exclude.xml new file mode 100644 index 0000000..8f7997b --- /dev/null +++ b/app/config/findbugs/exclude.xml @@ -0,0 +1,10 @@ + + + + + + + + + +