From aea0fea5d93bc4922dec4eef1c08f4ca01a9125d Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Fri, 24 Jul 2020 11:37:53 -0700 Subject: [PATCH] Add Spring Checkstyle with all checks disabled Introduce checkstyle rules from spring-javaformat, but keep them disabled so that fixes can be introduced one commit at a time. Issue gh-8945 --- build.gradle | 15 +++++- etc/checkstyle/checkstyle-suppressions.xml | 47 ++++++++++++++++++ etc/checkstyle/checkstyle.xml | 56 ++++------------------ etc/checkstyle/header.txt | 16 ------- etc/checkstyle/suppressions.xml | 19 -------- 5 files changed, 69 insertions(+), 84 deletions(-) create mode 100644 etc/checkstyle/checkstyle-suppressions.xml delete mode 100644 etc/checkstyle/header.txt delete mode 100644 etc/checkstyle/suppressions.xml diff --git a/build.gradle b/build.gradle index 66c2497d076..fb65d2623f8 100644 --- a/build.gradle +++ b/build.gradle @@ -42,9 +42,22 @@ subprojects { allprojects { apply plugin: 'io.spring.javaformat' + apply plugin: 'checkstyle' + + pluginManager.withPlugin("io.spring.convention.checkstyle", { plugin -> + configure(plugin) { + dependencies { + checkstyle "io.spring.javaformat:spring-javaformat-checkstyle:$springJavaformatVersion" + } + checkstyle { + toolVersion = '8.34' + } + } + }) + if (project.name.contains('sample')) { tasks.whenTaskAdded { task -> - if (task.name.contains('format') || task.name.contains('checkFormat')) { + if (task.name.contains('format') || task.name.contains('checkFormat') || task.name.contains("checkstyle")) { task.enabled = false } } diff --git a/etc/checkstyle/checkstyle-suppressions.xml b/etc/checkstyle/checkstyle-suppressions.xml new file mode 100644 index 00000000000..ab8baf9d389 --- /dev/null +++ b/etc/checkstyle/checkstyle-suppressions.xml @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/etc/checkstyle/checkstyle.xml b/etc/checkstyle/checkstyle.xml index d7b392014db..deb31f3d5b4 100644 --- a/etc/checkstyle/checkstyle.xml +++ b/etc/checkstyle/checkstyle.xml @@ -1,51 +1,11 @@ - - - + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + \ No newline at end of file diff --git a/etc/checkstyle/header.txt b/etc/checkstyle/header.txt deleted file mode 100644 index 5e5d28b99ff..00000000000 --- a/etc/checkstyle/header.txt +++ /dev/null @@ -1,16 +0,0 @@ -^\Q/*\E$ -^\Q * Copyright\E (\d{4}(\-\d{4})? the original author or authors\.|(\d{4}, )*(\d{4}) Acegi Technology Pty Limited)$ -^\Q *\E$ -^\Q * Licensed under the Apache License, Version 2.0 (the "License");\E$ -^\Q * you may not use this file except in compliance with the License.\E$ -^\Q * You may obtain a copy of the License at\E$ -^\Q *\E$ -^\Q * https://www.apache.org/licenses/LICENSE-2.0\E$ -^\Q *\E$ -^\Q * Unless required by applicable law or agreed to in writing, software\E$ -^\Q * distributed under the License is distributed on an "AS IS" BASIS,\E$ -^\Q * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\E$ -^\Q * See the License for the specific language governing permissions and\E$ -^\Q * limitations under the License.\E$ -^\Q */\E$ -^.*$ diff --git a/etc/checkstyle/suppressions.xml b/etc/checkstyle/suppressions.xml deleted file mode 100644 index 297f0624c93..00000000000 --- a/etc/checkstyle/suppressions.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - - - - - - - - -