Skip to content

Commit

Permalink
#164 : Fixed Gradle checkstyle plugin config
Browse files Browse the repository at this point in the history
  • Loading branch information
gazbert committed Apr 27, 2024
1 parent 2e8b1b7 commit c177e99
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 30 deletions.
37 changes: 19 additions & 18 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ buildscript {
}

plugins {
id 'org.sonarqube' version '5.0.0.4638' // https://plugins.gradle.org/plugin/org.sonarqube
id 'org.sonarqube' version '5.0.0.4638' // https://plugins.gradle.org/plugin/org.sonarqube
id 'jacoco'
id 'com.github.spotbugs' version '5.2.5' // https://plugins.gradle.org/plugin/com.github.spotbugs
id 'com.github.spotbugs' version '5.2.5' // https://plugins.gradle.org/plugin/com.github.spotbugs
}

buildScan {
Expand Down Expand Up @@ -100,7 +100,7 @@ allprojects {
apply plugin: 'application'
apply plugin: 'io.spring.dependency-management'
apply plugin: 'maven-publish'
// apply plugin: 'checkstyle'
apply plugin: 'checkstyle'
apply plugin: 'jacoco'
apply plugin: 'com.github.spotbugs'
apply plugin: 'org.sonarqube'
Expand Down Expand Up @@ -134,23 +134,24 @@ subprojects {
include "**/api/**"
}

// checkstyle {
// toolVersion "10.12.4"
// configFile = file("${rootDir}/etc/google_checks.xml")
// ignoreFailures = false
// showViolations = true
// maxErrors = 0
// maxWarnings = 0
// }
// checkstyleMain {
// source = 'src/main/java'
// }
// checkstyleTest {
// source = 'src/test/java'
// }
checkstyle {
toolVersion "10.15.0"
configFile = file("${rootDir}/etc/google_checks.xml")
configProperties = ["org.checkstyle.google.suppressionfilter.config": file("${rootDir}/etc/checkstyle-suppressions.xml")]
ignoreFailures = false
showViolations = true
maxErrors = 0
maxWarnings = 0
}
checkstyleMain {
source = 'src/main/java'
}
checkstyleTest {
source = 'src/test/java'
}

jacoco {
toolVersion = "0.8.11" // https://docs.gradle.org/current/userguide/jacoco_plugin.html
toolVersion = "0.8.12" // https://docs.gradle.org/current/userguide/jacoco_plugin.html
}
jacocoTestReport {
reports {
Expand Down
23 changes: 23 additions & 0 deletions etc/checkstyle-suppressions.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0"?>

<!DOCTYPE suppressions PUBLIC
"-//Checkstyle//DTD SuppressionFilter Configuration 1.2//EN"
"https://checkstyle.org/dtds/suppressions_1_2.dtd">

<suppressions>
<!-- Suppress JBehave javadocs -->
<suppress checks="JavadocMethod" files=".*Steps\.java"/>

<suppress checks="AbbreviationAsWordInName"
files="BitstampIT.java"
lines="1-9999"/>
<suppress checks="AbbreviationAsWordInName"
files="KrakenIT.java"
lines="1-9999"/>
<suppress checks="AbbreviationAsWordInName"
files="BitfinexIT.java"
lines="1-9999"/>
<suppress checks="AbbreviationAsWordInName"
files="GeminiIT.java"
lines="1-9999"/>
</suppressions>
10 changes: 8 additions & 2 deletions etc/google_checks.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,12 @@
<module name="BeforeExecutionExclusionFileFilter">
<property name="fileNamePattern" value="module\-info\.java$"/>
</module>

<!-- https://checkstyle.org/filters/suppressionfilter.html -->
<module name="SuppressionFilter">
<property name="file" value="${org.checkstyle.google.suppressionfilter.config}"
default="checkstyle-suppressions.xml" />
<property name="optional" value="true"/>
<property name="optional" value="false"/>
</module>

<!-- Checks for whitespace -->
Expand Down Expand Up @@ -93,10 +94,15 @@
<module name="RightCurly">
<property name="id" value="RightCurlyAlone"/>
<property name="option" value="alone"/>

<!-- FIXME: gazbert: Removed LITERAL_CASE as breaking with Gradle 8.7, Checkstyle tool version 10.15.0:
Caused by: com.puppycrawl.tools.checkstyle.api.CheckstyleException: cannot initialize module TreeWalker -
Token "LITERAL_CASE" was not found in Acceptable tokens list in check com.puppycrawl.tools.checkstyle.checks.blocks.RightCurlyCheck
-->
<property name="tokens"
value="CLASS_DEF, METHOD_DEF, CTOR_DEF, LITERAL_FOR, LITERAL_WHILE, STATIC_INIT,
INSTANCE_INIT, ANNOTATION_DEF, ENUM_DEF, INTERFACE_DEF, RECORD_DEF,
COMPACT_CTOR_DEF, LITERAL_SWITCH, LITERAL_CASE"/>
COMPACT_CTOR_DEF, LITERAL_SWITCH"/>
</module>
<module name="SuppressionXpathSingleFilter">
<!-- suppresion is required till https://github.com/checkstyle/checkstyle/issues/7541 -->
Expand Down
10 changes: 0 additions & 10 deletions etc/suppressions.xml

This file was deleted.

0 comments on commit c177e99

Please sign in to comment.