Permalink
Browse files

Create blank slate findbugs subproject

  • Loading branch information...
rschlaikjer committed Mar 9, 2017
1 parent 9f9ca39 commit e32741a1694f767b55bae182c99cf6e1fa61810d
@@ -27,9 +27,15 @@ dependencies {
})
compile 'com.android.support:appcompat-v7:25.1.1'
testCompile 'junit:junit:4.12'

// Add a dependency on our findbugs detectors
findbugs configurations.findbugsPlugins.dependencies
findbugsPlugins fileTree(include: ['*.jar'], dir: '../findbugs/build/libs')
}

task findbugs(type: FindBugs, dependsOn: [":app:assembleDebug"]) {
task findbugs(type: FindBugs, dependsOn: [":app:assembleDebug", ":findbugs:assemble"]) {

pluginClasspath = project.configurations.findbugsPlugins

classes = fileTree('build/intermediates/classes/debug/')
source = fileTree('src/main/java')
@@ -0,0 +1 @@
/build
@@ -0,0 +1,9 @@
apply plugin: 'java'

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.google.code.findbugs:findbugs:3.0.1'
}

sourceCompatibility = "1.7"
targetCompatibility = "1.7"
@@ -0,0 +1,20 @@
package com.schlaikjer.bugplugins;

import edu.umd.cs.findbugs.BugAccumulator;
import edu.umd.cs.findbugs.BugReporter;
import edu.umd.cs.findbugs.bcel.OpcodeStackDetector;

public class CursorNotFinallyClosedDetector extends OpcodeStackDetector {

protected final BugAccumulator bugAccumulator;

public CursorNotFinallyClosedDetector(BugReporter bugReporter) {
this.bugAccumulator = new BugAccumulator(bugReporter);
}

@Override
public void sawOpcode(int seen) {

}

}
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<FindbugsPlugin xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" defaultenabled="true"
pluginid="com.schlaikjer.bugplugins" provider="Ross Schlaikjer">
<Detector class="com.schlaikjer.bugplugins.CursorNotFinallyClosedDetector" reports="DB_CURSOR_NOT_FINALLY_CLOSED"
speed="slow" />
</FindbugsPlugin>
@@ -0,0 +1,12 @@
<MessageCollection xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

<Plugin>
<ShortDescription>Set of custom FindBugs plugins</ShortDescription>
</Plugin>


<Detector class="com.schlaikjer.bugplugins.CursorNotFinallyClosedDetector">
<Details>Checks for cursors that are not closed in a finally block</Details>
</Detector>

</MessageCollection>
@@ -1 +1 @@
include ':app'
include ':app', ':findbugs'

0 comments on commit e32741a

Please sign in to comment.