Skip to content

Commit

Permalink
Run check in CI rather than build
Browse files Browse the repository at this point in the history
This also checks style. Update to checkstyle 10.2 while I'm here and
clean up all existing style violations (mainly missing docs comments on
public classes).
  • Loading branch information
tamird committed May 9, 2022
1 parent 6fc4e5c commit 1ed2679
Show file tree
Hide file tree
Showing 8 changed files with 118 additions and 83 deletions.
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
6 changes: 4 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,13 @@ application {

// ### Checkstyle plugin settings
checkstyle {
toolVersion = "8.36.2"
toolVersion = '10.2'
// Keep the below file updated along with subsequent versions of Checkstyle (make sure to choose
// the tag matching the toolVersion above):
// https:/checkstyle/checkstyle/blob/checkstyle-8.36.2/src/main/resources/google_checks.xml
// https:/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",
"$projectDir/config/checkstyle/checkstyle-suppressions.xml")
Expand Down
160 changes: 86 additions & 74 deletions config/checkstyle/google_checks.xml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/main/java/network/brightspots/rcv/GuiApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import javafx.stage.Stage;

@SuppressWarnings("WeakerAccess")
public class GuiApplication extends Application {
class GuiApplication extends Application {

private static final int STAGE_HEIGHT = 1000;
private static final int STAGE_WIDTH = 1200;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@
import network.brightspots.rcv.Tabulator.TiebreakMode;
import network.brightspots.rcv.Tabulator.WinnerElectionMode;

/**
* View controller for config layout.
*/
@SuppressWarnings({"WeakerAccess"})
public class GuiConfigController implements Initializable {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
import javafx.scene.control.ListView;
import javafx.stage.Stage;

/**
* View controller for tiebreaker layout.
*/
@SuppressWarnings("WeakerAccess")
public class GuiTiebreakerController {

Expand Down
3 changes: 3 additions & 0 deletions src/main/java/network/brightspots/rcv/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
import java.util.ArrayList;
import java.util.List;

/**
* Main entry point to the RCV tabulator program.
*/
@SuppressWarnings("WeakerAccess")
public class Main extends GuiApplication {

Expand Down
22 changes: 17 additions & 5 deletions src/main/java/network/brightspots/rcv/RawContestConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
import com.fasterxml.jackson.annotation.JsonInclude;
import java.util.List;

/**
* Contest configuration that can be serialized and deserialized.
*/
@SuppressWarnings("WeakerAccess")
@JsonIgnoreProperties(ignoreUnknown = true)
public class RawContestConfig {
Expand All @@ -40,7 +43,9 @@ public class RawContestConfig {
RawContestConfig() {
}

// OutputSettings: encapsulates the output settings
/**
* Output settings that can be serialized and deserialized.
*/
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
public static class OutputSettings {
Expand All @@ -54,8 +59,11 @@ public static class OutputSettings {
public boolean generateCdfJson;
}

// CvrSource: encapsulates a source cast vote record file
// all indexes are 1-based
/**
* Source cast vote record file that can be serialized and deserialized.
*
* <p>All indexes are 1-based. </p>
*/
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
public static class CvrSource {
Expand Down Expand Up @@ -200,7 +208,9 @@ public void setTreatBlankAsUndeclaredWriteIn(boolean treatBlankAsUndeclaredWrite
}
}

// Candidate encapsulates data for each candidate in a contest
/**
* Contest candidate data that can be serialized and deserialized.
*/
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
public static class Candidate {
Expand Down Expand Up @@ -243,7 +253,9 @@ public void setExcluded(boolean excluded) {
}
}

// ContestRules: encapsulates the set of rules required to perform contest tabulation
/**
* Contest rules necessary for tabulation that can be serialized and deserialized.
*/
@SuppressWarnings({"unused", "RedundantSuppression"})
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
Expand Down

0 comments on commit 1ed2679

Please sign in to comment.