/checkstyle-config

✔️Custom Checkstyle config for Java projects

MIT LicenseMIT

Custom Checkstyle Config

Custom Checkstyle config for Java projects.

Installation

  1. Put checkstyle.xml to $rootDir/config/checkstyle.
  2. Add the following to the Gradle build file:

Groovy DSL:

plugins {
    id "checkstyle"
}

checkstyle {
    toolVersion "10.12.4"
    sourceSets = [] // Don't check anything with Checkstyle during 'check' task
}

task checkstyle(type: Checkstyle) {
    source "src"
    classpath = files()
}

Kotlin DSL:

plugins {
    checkstyle
}

checkstyle {
    toolVersion = "10.12.4"
    sourceSets = listOf() // Don't check anything with Checkstyle during 'check' task
}

tasks.register("checkstyle", Checkstyle::class) {
    source = fileTree("$rootDir/src")
    classpath = files()
}

Check last version here: https://checkstyle.sourceforge.io/releasenotes.html

Usage

Run ./gradlew checkstyle.