Heartless code review

Sat Aug 15, 2015

I talked about code review at potatotips #20.

Sometimes I think that code review is not only for code but also for human. If bots can review code completely, reviewing code by human has value.

My FindBugs’ setting is below.

// FindBugs - Gradle DSL Version 2.5 https://docs.gradle.org/current/dsl/org.gradle.api.plugins.quality.FindBugs.html
apply plugin: 'findbugs'

task findbugs(type: FindBugs, dependsOn: assembleDebug) {
    description 'Run findbugs'
    group 'verification'

    classes = fileTree(dir: rootProject.projectDir,
            includes: ['*/build/intermediates/classes/**/*.class'],
            exclude: '**/*test*/**')

    source = fileTree(dir: rootProject.projectDir,
            includes: ['*/src/**/java/com/app/**/*.java'],
            exclude: '**/*test*/**')

    classpath = files()

    excludeFilter = file("$rootProject.projectDir/gradle/findbugs/exclude.xml")

    def report = "xml" // default output format is xml
    if (project.hasProperty("report")) {
        report = project.getProperty("report")
    }

    switch (report) {
        case "xml":
            reports {
                xml.enabled = true
                xml.withMessages = true
                html.enabled = false
            }
            break
        case "html":
            reports {
                xml.enabled = false
                xml.withMessages = false
                html.enabled = true
            }
            break
        default:
            throw new IllegalArgumentException("Undefined report format is specified: " + report)
    }

    effort = 'max'
    reportLevel = 'low'

    ignoreFailures = true
}
<?xml version="1.0" encoding="UTF-8"?>
<FindBugsFilter>
    <Match>
        <Class name="~.*BuildConfig.*" />
    </Match>
    <Match>
        <Class name="~.*R\$.*" />
    </Match>
    <Match>
        <Class name="~.*\$\$ViewBinder.*" />
    </Match>
    <Match>
        <Class name="~.*\.*Test" />
        <Not>
            <Bug code="IJU" />
        </Not>
    </Match>
    <Bug code="SIC,UPM,UrF,UwF," />
</FindBugsFilter>


Next: »