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 8, 2022
1 parent 1dac32d commit af17ee9
Show file tree
Hide file tree
Showing 8 changed files with 108 additions and 82 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
11 changes: 7 additions & 4 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 @@ -43,7 +46,7 @@ public class RawContestConfig {
// OutputSettings: encapsulates the output settings
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
public static class OutputSettings {
static class OutputSettings {

public String contestName;
public String outputDirectory;
Expand All @@ -58,7 +61,7 @@ public static class OutputSettings {
// all indexes are 1-based
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
public static class CvrSource {
static class CvrSource {

private String filePath;
private String contestId;
Expand Down Expand Up @@ -203,7 +206,7 @@ public void setTreatBlankAsUndeclaredWriteIn(boolean treatBlankAsUndeclaredWrite
// Candidate encapsulates data for each candidate in a contest
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
public static class Candidate {
static class Candidate {

private String name;
private String code;
Expand Down Expand Up @@ -247,7 +250,7 @@ public void setExcluded(boolean excluded) {
@SuppressWarnings({"unused", "RedundantSuppression"})
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
public static class ContestRules {
static class ContestRules {

public String tiebreakMode;
public String overvoteRule;
Expand Down

0 comments on commit af17ee9

Please sign in to comment.