groovyfmt

A fast formatter and linter for Groovy, Gradle build scripts and Jenkinsfiles. One static binary, no JVM.

before
dependencies {
        implementation 'junit:junit:4.13.2'
}
tasks.register('hello') {
  doLast {
println 'hello'
      }
}
after groovyfmt
dependencies {
    implementation 'junit:junit:4.13.2'
}
tasks.register('hello') {
    doLast {
        println 'hello'
    }
}

Install

brew install costajohnt/tap/groovyfmt

Or npm install --save-dev groovyfmt, cargo install --locked groovyfmt, the ghcr.io/costajohnt/groovyfmt Docker image, or a prebuilt binary for Linux, macOS or Windows from the releases. Then run groovyfmt --check in a repository.

View the source on GitHub

What it does

Who it's for

Teams with Gradle builds, Jenkins pipelines or Groovy code who want consistent formatting and early warnings in CI, without starting a JVM. Coming from CodeNarc or npm-groovy-lint? groovyfmt --import-codenarc converts your config.