Skip to content
Static code review for your Gerrit patchsets. Runs Checkstyle, PMD, FindBugs, Scalastyle, CodeNarc, JSLint for you!
Java Shell Groovy Kotlin JavaScript TypeScript Other
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
gradle/wrapper Update Java to 1.8 and Gradle to 5.4.1 (#196) Jun 14, 2019
src Upgrade groovy and kotlin processors (#197) Jun 24, 2019
.gitignore sputnik config Oct 22, 2015
.travis.yml Running gradle wrapper when building on Travis. Apr 20, 2016
LICENSE Initial commit Mar 12, 2014 Drop SonarQube incremental support. Closes #150, #161 and #115. Jun 14, 2019
build.gradle Upgrade groovy and kotlin processors (#197) Jun 24, 2019 fix Oct 21, 2015
gradlew bump Oct 9, 2015
gradlew.bat gradle wrapper Oct 9, 2015
settings.gradle project name Oct 9, 2015
sun_checks.xml Bump checkstyle and code narc versions May 29, 2015


Static code review for your Gerrit and Stash patchsets. Runs Checkstyle, PMD, SpotBugs (formerly known as FindBugs), Scalastyle, CodeNarc, JSLint, JSHint, TSLint and Detekt for you!

Build Status Maven Central Coverage Status Sputnik Join the chat at


Sputnik runs Checkstyle, PMD, SpotBugs, CodeNarc, JSHint (or JSLint), TSLint, Ktlint and Detekt only on files affected by Gerrit's patchset. It collects all violations and report them back to Gerrit or Stash.

Typical configuration file looks like this:


If you want sputnik to use your SonarQube rules just download them from your SonarQube profile and use these with checkstyle.configurationFile, pmd.ruleSets and spotbugs.includeFilter variables.

To ease migration from FindBugs to SpotBugs these three configuration properties still work and affect SpotBugs now: findbugs.enabled, findbugs.includeFilter and findbugs.excludeFilter.


  • clone this repository and build it: gradle distZip or download distribution
  • copy distribution file build/distributions/ to your installation dir, e.g. /opt/sputnik and unzip it
  • to avoid problems with deployment keep the structure unchanged, so sputnik file is in bin/ directory, jars in lib/
  • create configuration file (you can just paste and edit an example above), e.g. /opt/sputnik/
  • you can now run sputnik like this:
/opt/sputnik/bin/sputnik --conf /opt/sputnik/ --changeId I0a2afb7ae4a94ab1ab473ba00e2ec7de381799a0 --revisionId 3f37692af2290e8e3fd16d2f43701c24346197f0

Build tool

Sputnik is intended to run just after your Jenkins/CI server build. It should be executed in the root directory of the analyzed project to find files to analyze.

Sputnik currently supports Maven (default) and Gradle. Some processors (e.g. SpotBugs) analyze compiled classes, so it's important to set the build tool property correctly. To change it to Gradle just set in your file.

Gerrit support

Three parameters are required: your configuration file (details below), Gerrit's changeId and revisionId:

sputnik --conf /path/to/ --changeId I0a2afb7ae4a94ab1ab473ba00e2ec7de381799a0 --revisionId 3f37692af2290e8e3fd16d2f43701c24346197f0

There's a bug/feature in Gerrit when you push same change set identified by particular changeId into two branches, for example your working branch and review branch. You can recognize it by the following error message

Request not successful. Message: Not Found. Status-Code: 404. Content: Not found: yours_change_id

Then it's necessary to add repository and target branch name to distinguish which change set you're addressing. Target branch would be typically master but actually it's the one you're using making

git push origin HEAD:refs/for/BRANCH_NAME

So add REPO_NAMEBRANCH_NAME to changeId Sputnik's param, for example:

sputnik --conf /path/to/ --changeId myProject~master~I0a2afb7ae4a94ab1ab473ba00e2ec7de381799a0 --revisionId 3f37692af2290e8e3fd16d2f43701c24346197f0

Stash support

If you choose to run sputnik with Stash instead of Gerrit, you'll need to run it in the following manner:

/opt/sputnik/bin/sputnik --conf /opt/sputnik/ --pullRequestId 15

It is convenient to add sputnik's configuration file ( in the above example) to your project's repo. This way, it will be easier to run it from CI server.

SSL verification

SSL trust verification and hostname verification is disabled by default. You can enable it by setting connector.verifySsl=true property.

Add Post-Build step to Jenkins/CI server

If you have Jenkins job that uses Gerrit Trigger plugin it's very easy to integrate it as Post-Build step:

/opt/sputnik/bin/sputnik --conf /opt/sputnik/ --changeId $GERRIT_CHANGE_ID --revisionId $GERRIT_PATCHSET_REVISION
# This line makes sure that this Post-Build step always returns exit code 0
# so it won't affect your main build result
echo "exit 0 workaround"

Add Post-Build step to Bamboo

When stash is build on Bamboo there is no direct way to check which pull request id it matches. This is a simple way to find required id.


  • there is sputnik's config file named in project's root directory
  • user and password are configured in bamboo plan as variables (e.g. ecosystem.username and ecosystem.password)
  • config file has placeholders for user and password:

With those steps in place you can use a step from contrib/

current_branch=${} sputnik_distribution_url= stash_password=${bamboo_ecosystem_password} stash_user=${bamboo_ecosystem_username} ./

Launching with Maven

If you prefer running Sputnik from Maven, there is a plugin developed by Karol Lassak here: Read plugin documentation for reference.

Launching with Gradle

If you prefer running Sputnik from Gradle all you need is to have Gradle installed. Put build.gradle file in your repository, add config file and run:

gradle run -Dexec.args="--conf --changeId 1234 --revisionId 4321"


  • Gerrit 2.8 is required (REST API for reviews was introduced in this version)
  • Jenkins or other CI server to download and build patchsets


  • Tomasz Kalkosiński
  • Marcin Cylke
  • Piotr Jagielski
  • Karol Lassak
  • Henning Hoefer
  • Dominik Przybysz
  • Damian Szczepanik
  • Rafał Nowak
  • Filip Majewski


This project is licenced under Apache License.

You can’t perform that action at this time.