From 032096d699751ab2d0f5715e037fcb9306625ef2 Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Wed, 13 Jun 2018 11:02:02 -0700 Subject: [PATCH] Add checkstyle to build Add checkstyle to the build to enforce Spring Framework coding conventions. Rule suppressions are used for several classes where relaxing the rules makes more sense than fixing them. Issue: SPR-16968 --- build.gradle | 9 +- src/checkstyle/checkstyle-suppressions.xml | 78 +++++++++++ src/checkstyle/checkstyle.xml | 156 +++++++++++++++++++++ 3 files changed, 242 insertions(+), 1 deletion(-) create mode 100644 src/checkstyle/checkstyle-suppressions.xml create mode 100644 src/checkstyle/checkstyle.xml diff --git a/build.gradle b/build.gradle index 92c206ab97..7d99c9b71d 100644 --- a/build.gradle +++ b/build.gradle @@ -64,6 +64,7 @@ configure(allprojects) { project -> apply plugin: "test-source-set-dependencies" apply plugin: "io.spring.dependency-management" apply from: "${gradleScriptDir}/ide.gradle" + apply plugin: "checkstyle" dependencyManagement { resolutionStrategy { @@ -75,6 +76,11 @@ configure(allprojects) { project -> } } + checkstyle { + toolVersion = "8.10.1" + configDir = rootProject.file("src/checkstyle") + } + apply plugin: "kotlin" compileKotlin { kotlinOptions { @@ -163,9 +169,10 @@ configure(allprojects) { project -> testRuntime("org.apache.logging.log4j:log4j-core:${log4jVersion}") testRuntime("org.apache.logging.log4j:log4j-slf4j-impl:${log4jVersion}") testRuntime("org.apache.logging.log4j:log4j-jul:${log4jVersion}") - // JSR-305 only used for non-required meta-annotations + // JSR-305 only used for non-required meta-annotations compileOnly("com.google.code.findbugs:jsr305:3.0.2") testCompileOnly("com.google.code.findbugs:jsr305:3.0.2") + checkstyle("io.spring.javaformat:spring-javaformat-checkstyle:0.0.5") } ext.javadocLinks = [ diff --git a/src/checkstyle/checkstyle-suppressions.xml b/src/checkstyle/checkstyle-suppressions.xml new file mode 100644 index 0000000000..963710de13 --- /dev/null +++ b/src/checkstyle/checkstyle-suppressions.xml @@ -0,0 +1,78 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/checkstyle/checkstyle.xml b/src/checkstyle/checkstyle.xml new file mode 100644 index 0000000000..d69c423368 --- /dev/null +++ b/src/checkstyle/checkstyle.xml @@ -0,0 +1,156 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- GitLab