Skip to content
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

Add spotbugs and correct found problems #587

Merged
merged 4 commits into from
May 10, 2022
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ jobs:
java-version: '17'
distribution: 'temurin'
- name: Test with Gradle
run: ./gradlew build
run: ./gradlew check
tamird marked this conversation as resolved.
Show resolved Hide resolved
2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

41 changes: 24 additions & 17 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
plugins {
id "application"
id "checkstyle"
id "com.github.spotbugs" version "5.0.6"
tamird marked this conversation as resolved.
Show resolved Hide resolved
id "idea"
id "java-library"
id "org.openjfx.javafxplugin" version "0.0.11"
id "org.beryx.jlink" version "2.20.0"
id "org.openjfx.javafxplugin" version "0.0.11"
}

repositories {
mavenCentral()
}

dependencies {
implementation "org.apache.commons:commons-csv:1.8"
implementation "org.apache.poi:poi-ooxml:4.1.2"
implementation "com.fasterxml.jackson.core:jackson-core:2.11.1"
implementation "com.fasterxml.jackson.core:jackson-annotations:2.11.1"
implementation "com.fasterxml.jackson.core:jackson-databind:2.11.1"
implementation "com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.11.1"
testImplementation "org.junit.jupiter:junit-jupiter-api:5.6.2"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:5.6.2"
implementation 'org.apache.commons:commons-csv:1.9.0'
implementation 'org.apache.poi:poi-ooxml:5.2.2'
implementation 'com.fasterxml.jackson.core:jackson-core:2.13.2'
implementation 'com.fasterxml.jackson.core:jackson-annotations:2.13.2'
implementation 'com.fasterxml.jackson.core:jackson-databind:2.13.2.2'
implementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.13.2'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.2'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.2'
}

// ### Application plugin settings
Expand All @@ -35,15 +36,22 @@ application {

// ### Checkstyle plugin settings
checkstyle {
toolVersion = "8.36.2"
toolVersion = '10.2'
tamird marked this conversation as resolved.
Show resolved Hide resolved
// Keep the below file updated along with subsequent versions of Checkstyle (make sure to choose
// the tag matching the toolVersion above):
// https://github.com/checkstyle/checkstyle/blob/checkstyle-8.36.2/src/main/resources/google_checks.xml
// https://github.com/checkstyle/checkstyle/blob/checkstyle-10.2/src/main/resources/google_checks.xml
configFile = file("$projectDir/config/checkstyle/google_checks.xml")
maxWarnings = 0
ignoreFailures = false
}
System.setProperty( "org.checkstyle.google.suppressionfilter.config",
System.setProperty("org.checkstyle.google.suppressionfilter.config",
"$projectDir/config/checkstyle/checkstyle-suppressions.xml")

spotbugs {
toolVersion = '4.6.0'
excludeFilter = file("config/spotbugs/exclude.xml")
}

// ### Idea plugin settings
idea {
module {
Expand All @@ -52,11 +60,10 @@ idea {
}

// ### Java plugin settings
sourceCompatibility = JavaVersion.VERSION_17

compileJava.dependsOn(clean)
compileJava {
options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(17))
}
}

test {
Expand Down
160 changes: 86 additions & 74 deletions config/checkstyle/google_checks.xml

Large diffs are not rendered by default.

19 changes: 19 additions & 0 deletions config/spotbugs/exclude.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
tamird marked this conversation as resolved.
Show resolved Hide resolved
<FindBugsFilter
xmlns="https://github.com/spotbugs/filter/4.6.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
xsi:schemaLocation="https://raw.githubusercontent.com/spotbugs/spotbugs/4.6.0/spotbugs/etc/findbugsfilter.xsd">
<Match>
<Class name="~network\.brightspots\.rcv\.(HartCvrReader\$(Contest|Option|PrecinctSplit)|RawContestConfig\$ContestRules)"/>
<Bug code="UwF"/>
</Match>
<Match>
<Class name="~network\.brightspots\.rcv\.HartCvrReader\$(Party|Contest|WriteInData|Option)"/>
<Bug code="UuF"/>
</Match>
<Match>
<Class name="network.brightspots.rcv.HartCvrReader"/>
<Method name="readCastVoteRecord"/>
<Bug code="NP"/>
</Match>
</FindBugsFilter>
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
tamird marked this conversation as resolved.
Show resolved Hide resolved
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists