Skip to content

Fix Gradle PMD and Checkstyle #1318

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Sep 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 21 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ plugins {
id 'jacoco'
id "com.github.spotbugs" version "4.7.2"
id 'pmd'
id 'checkstyle'

// download the RR tools which have no Maven Repository
id "de.undercouch.download" version "4.1.2"
Expand Down Expand Up @@ -44,6 +45,10 @@ compileJavacc {
java {
withSourcesJar()
withJavadocJar()

spotbugs
pmd

}

jacoco {
Expand Down Expand Up @@ -98,9 +103,10 @@ pmd {

sourceSets = [sourceSets.main]

// clear the ruleset in order to use configured rules only, although we should apply the Prio 1 rules eventually
// clear the ruleset in order to use configured rules only
ruleSets = []
rulesMinimumPriority = 1

//rulesMinimumPriority = 1

ruleSetFiles = files("ruleset.xml")

Expand All @@ -111,6 +117,19 @@ pmd {
}
}

checkstyle {
toolVersion "8.45.1"
sourceSets = [sourceSets.main, sourceSets.test]
configFile =rootProject.file('config/checkstyle/checkstyle.xml')
}

tasks.withType(Checkstyle) {
reports {
xml.required = false
html.required = true
}
}

task renderRR() {
doLast {
// these WAR files have been provided as a courtesy by Gunther Rademacher
Expand Down
36 changes: 36 additions & 0 deletions config/checkstyle/checkstyle.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
"https://checkstyle.org/dtds/configuration_1_3.dtd">

<module name="Checker">
<module name="SuppressWarningsFilter" />
<module name="FileTabCharacter" />
<!-- git checkout may change linefeeds on the fly
<module name="RegexpMultiline">
<property name="format" value="(?s:(\r\n|\r).*)" />
<property name="message" value="CRLF and CR line endings are prohibited, but this file uses them." />
</module>
-->
<module name="TreeWalker">
<module name="AvoidNestedBlocks" />
<module name="ConstantName" />
<module name="EmptyCatchBlock" />
<module name="EmptyStatement" />
<module name="MissingOverride" />
<module name="MultipleVariableDeclarations" />
<module name="ParameterAssignment" />
<module name="StringLiteralEquality" />
<module name="RedundantImport" />
<module name="UnusedImports" />

<module name="WhitespaceAfter" />

<module name="NeedBraces" />
<module name="UnnecessaryParentheses" />
<module name="LeftCurly" />
<module name="RightCurly" />

<module name="SuppressWarningsHolder" />
</module>
</module>
Loading