Simplify Checkstyle configuration
* Move `checkstyle-conventions.gradle` content to the `build.gradle` since it is short enough * Remove `checkstyle-header.txt` and its handling in favor of Spring Javaformat out-of-the box logic * Upgrade to Gradle `8.5` * Remove suppression for `Javadoc*` checks since it is handled by Spring Javaformat * Leave only `MissingJavadocMethodCheck` exclusion from `SpringChecks` since all others really make sense for our code quality
This commit is contained in:
21
build.gradle
21
build.gradle
@@ -6,7 +6,7 @@ buildscript {
|
||||
plugins {
|
||||
id 'base'
|
||||
id 'io.spring.dependency-management' version '1.1.4'
|
||||
id "io.spring.javaformat" version "${javaFormatVersion}" apply false
|
||||
id 'io.spring.javaformat' version "${javaFormatVersion}"
|
||||
id 'com.github.spotbugs' version '6.0.4'
|
||||
id 'com.google.protobuf' version '0.9.4' apply false
|
||||
}
|
||||
@@ -66,8 +66,9 @@ configure(javaProjects) { subproject ->
|
||||
apply plugin: 'java-library'
|
||||
apply plugin: 'eclipse'
|
||||
apply plugin: 'idea'
|
||||
apply plugin: 'checkstyle'
|
||||
apply plugin: 'io.spring.javaformat'
|
||||
apply from: "${rootDir}/publish-maven.gradle"
|
||||
apply from: "${rootDir}/gradle/checkstyle-conventions.gradle"
|
||||
|
||||
sourceSets {
|
||||
test {
|
||||
@@ -138,6 +139,22 @@ configure(javaProjects) { subproject ->
|
||||
|
||||
[compileJava, compileTestJava]*.options*.compilerArgs = ['-Xlint:all,-options,-processing', '-parameters']
|
||||
|
||||
checkstyle {
|
||||
toolVersion = '10.3'
|
||||
configDirectory = rootProject.file('etc/checkstyle')
|
||||
ignoreFailures = true
|
||||
}
|
||||
|
||||
dependencies {
|
||||
// NOTE: We explicitly specify checkstyle dep before javaformat checkstyle due to antlr class mismatch
|
||||
checkstyle("com.puppycrawl.tools:checkstyle:${checkstyle.toolVersion}")
|
||||
checkstyle("io.spring.javaformat:spring-javaformat-checkstyle:${javaFormatVersion}")
|
||||
}
|
||||
|
||||
tasks.named('checkFormatMain') {
|
||||
exclude 'org/springframework/cloud/fn/object/detection/protos'
|
||||
}
|
||||
|
||||
test {
|
||||
maxHeapSize = '2g'
|
||||
jvmArgs '-XX:+HeapDumpOnOutOfMemoryError'
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
^\Q/*\E$
|
||||
^\Q * Copyright \E20\d\d(\-20\d\d)?\Q the original author or authors.\E$
|
||||
^\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$
|
||||
^$
|
||||
^.*$
|
||||
@@ -4,6 +4,6 @@
|
||||
"https://checkstyle.org/dtds/suppressions_1_2.dtd">
|
||||
<suppressions>
|
||||
<suppress files="package-info\.java" checks=".*" />
|
||||
<suppress files="[\\/]test[\\/]" checks="RequireThis|AvoidStaticImport|Javadoc*" />
|
||||
<suppress files="[\\/]test[\\/]" checks="RequireThis|AvoidStaticImport" />
|
||||
<suppress files="Proto" checks=".*"/>
|
||||
</suppressions>
|
||||
|
||||
@@ -7,13 +7,7 @@
|
||||
<property name="file"
|
||||
value="${config_loc}/checkstyle-suppressions.xml" />
|
||||
</module>
|
||||
<module name="com.puppycrawl.tools.checkstyle.checks.header.RegexpHeaderCheck">
|
||||
<property name="headerFile" value="${config_loc}/checkstyle-header.txt" />
|
||||
<property name="fileExtensions" value="java" />
|
||||
</module>
|
||||
<module name="io.spring.javaformat.checkstyle.SpringChecks">
|
||||
<property name="excludes" value="io.spring.javaformat.checkstyle.check.SpringHeaderCheck" />
|
||||
<property name="excludes" value="com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocPackageCheck" />
|
||||
<property name="excludes" value="com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocMethodCheck" />
|
||||
</module>
|
||||
<module name="com.puppycrawl.tools.checkstyle.TreeWalker">
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
|
||||
apply plugin: 'io.spring.javaformat'
|
||||
apply plugin: 'checkstyle'
|
||||
|
||||
checkstyle {
|
||||
toolVersion = "10.3"
|
||||
configDirectory = rootProject.file('etc/checkstyle')
|
||||
ignoreFailures = true
|
||||
}
|
||||
|
||||
dependencies {
|
||||
// NOTE: We explicitly specify checkstyle dep before javaformat checkstyle due to antlr class mismatch
|
||||
checkstyle("com.puppycrawl.tools:checkstyle:${checkstyle.toolVersion}")
|
||||
checkstyle("io.spring.javaformat:spring-javaformat-checkstyle:${javaFormatVersion}")
|
||||
}
|
||||
|
||||
tasks.named("checkFormatMain") {
|
||||
exclude "org/springframework/cloud/fn/object/detection/protos"
|
||||
}
|
||||
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
4
gradle/wrapper/gradle-wrapper.properties
vendored
4
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,7 +1,7 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionSha256Sum=3e1af3ae886920c3ac87f7a91f816c0c7c436f276a6eefdb3da152100fef72ae
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
|
||||
distributionSha256Sum=9d926787066a081739e8200858338b4a69e837c3a821a33aca9db09dd4a41026
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
|
||||
Reference in New Issue
Block a user