Findbugs for Git Pull Request

Is there a way to setup Findbugs (or any other static code analysis tool) in Jenkins to analyse the incoming pull requests and compare the result with the main branch? My goal is to reject pull requests which increase the number of static code analysis issues.

  • Findbugs Bug SE_BAD_FIELD on boolean field
  • Turning Sonar off for certain code
  • Checkstyle and Findbugs for changed files only on Jenkins (and/or Hudson)
  • Clarifying/clearing up line ending issues in GIT
  • Get error message ''fatal: sha1 information is lacking or useless“ when apply a patch using ”git am -3"
  • How can I keep a subfolder of a git repo in sync with a subfolder of another git repo
  • How to create and commit a branch in gitlab
  • GIT fatal: ambiguous argument 'HEAD': unknown revision or path not in the working tree
  • How to share a GIT branch without history? (Using GitLab)
  • One Solution collect form web for “Findbugs for Git Pull Request”

    You can realize your idea by using the Maven-plugins checkstyle, findbugs and pmd (-cpd).

    Each of this plugin has a “:check”-mojo, which can fail the build – based on zero or configured rule-violations.

    • checkstyle check-mojo
    • findbugs check-mojo
    • pmd check-mojo
    • pmd-cpd check-mojo

    This mojos are bound to the maven-“verify”-phase, so mvn verify will do the job – or you execute the mojos directly within your jenkins-build (job-configuration “Build” -> “Goals and options” -> mvn verfiy, or mvn test checkstyle:check).

    The plugins have different ways to configure a fail.

    For example, checkstyle-plugin has maxAllowedViolations-configuration-parameter. So you can set this parameter to your current violations-count, and use mvn verfiy or mvn checkstyle:check to let your build fail, if a new violation occurs. Of course, you would have to increase this parameter every time a checkstyle-violation is fixed.

    In fingbugs-plugin, your build would have to be free of violations, before you can use mvn findbugs:check.

    Git Baby is a git and github fan, let's start git clone.