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.

  • Turning Sonar off for certain code
  • Checkstyle and Findbugs for changed files only on Jenkins (and/or Hudson)
  • Findbugs Bug SE_BAD_FIELD on boolean field
  • Customize gitk for each repository
  • How to get rid of “refs/bisect/bad” branches in Git
  • Did Apple remove the 'git gui' command in XCode 4.5 command line tools?
  • GIT: Creating new branch with reverted changes
  • Git push error: ssh: Could not resolve hostname domain.com: nodename nor servname provided, or not known
  • How to remove only intent-to-add files from index in git?
  • 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.