diff --git a/.github/workflows/gradle-test.yml b/.github/workflows/gradle-test.yml index e9d1ac5e..8220f95d 100644 --- a/.github/workflows/gradle-test.yml +++ b/.github/workflows/gradle-test.yml @@ -23,6 +23,9 @@ jobs: java-version: '17' distribution: corretto + - name: Run checkstyle + run: ./gradlew checkstyleMain + - name: Run Gradle test run: ./gradlew test -i diff --git a/build.gradle b/build.gradle index 1ac2222e..e9599676 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,9 @@ +import com.vanniktech.maven.publish.SonatypeHost + plugins { + id 'checkstyle' id 'java' + // this is a hopefully temporary plugin until maven central can add official gradle support id 'com.vanniktech.maven.publish' version '0.29.0' } @@ -47,7 +51,7 @@ dependencies { } mavenPublishing { - publishToMavenCentral(com.vanniktech.maven.publish.SonatypeHost.CENTRAL_PORTAL) + publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL) signAllPublications() coordinates(project.group, project.name, project.version) @@ -88,13 +92,13 @@ mavenPublishing { // tasks -task printVersion { +tasks.register('printVersion') { doLast { println project.version } } -task writeProps(type: WriteProperties) { +tasks.register('writeProps', WriteProperties) { destinationFile = file("src/main/resources/version.properties") encoding = 'UTF-8' property('version', project.version) @@ -109,5 +113,17 @@ tasks.register('packageJar', Zip) { } } +checkstyle { + toolVersion = '10.19.0' // Latest Checkstyle version at the time of writing + ignoreFailures = false +} + +tasks.withType(Checkstyle).configureEach { + reports { + xml.required = false + html.required = true + } +} + processResources.dependsOn(writeProps) sourcesJar.dependsOn(writeProps) diff --git a/config/checkstyle/checkstyle.xml b/config/checkstyle/checkstyle.xml new file mode 100644 index 00000000..2697520e --- /dev/null +++ b/config/checkstyle/checkstyle.xml @@ -0,0 +1,431 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file