Skip to content

Commit

Permalink
Give 0 marks for automated style if Checkstyle exits unsuccessfully
Browse files Browse the repository at this point in the history
Fixes #5
  • Loading branch information
maxcmiller committed Apr 4, 2021
1 parent 3a0c3f3 commit 5563cac
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/chalkbox/java/checkstyle/Checkstyle.java
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,11 @@ public Collection run(Collection collection) {
int numViolations = Math.max(0,
checkstyleOutput.split("\n").length - 2);

// if Checkstyle didn't exit successfully, give 0 marks for automated style
if (!checkstyleOutput.contains("Audit done.")) {
numViolations = Integer.MAX_VALUE; // many violations -> 0 marks
}

JSONArray tests = (JSONArray) feedback.get("tests");
Data result = new Data();
result.set("name", "Automated Style");
Expand Down

0 comments on commit 5563cac

Please sign in to comment.