diff --git a/examples/clang-tidy/sillycode b/examples/clang-tidy/sillycode index 580d9c9..4b00eac 160000 --- a/examples/clang-tidy/sillycode +++ b/examples/clang-tidy/sillycode @@ -1 +1 @@ -Subproject commit 580d9c9e20ae887551af2f87483d82cf6efa6f6d +Subproject commit 4b00eacf88277a06bbb5052e5b2688cd622521d0 diff --git a/internal/parsers/clang_tidy/parser.go b/internal/parsers/clang_tidy/parser.go index 58a8a7d..a416b25 100644 --- a/internal/parsers/clang_tidy/parser.go +++ b/internal/parsers/clang_tidy/parser.go @@ -1,9 +1,11 @@ package clang_tidy import ( + "fmt" "strings" "focs.ji.sjtu.edu.cn/git/FOCS-dev/JOJ3/internal/stage" + "github.com/criyle/go-judge/envexec" ) type Match struct { @@ -21,21 +23,24 @@ type ClangTidy struct{} func Parse(executorResult stage.ExecutorResult, conf Conf) stage.ParserResult { stdout := executorResult.Files["stdout"] + stderr := executorResult.Files["stderr"] lines := strings.SplitAfter(stdout, "\n") messages := parse_lines(lines, conf) formatted_messages := format(messages) - // TODO: Handle unexpected errors from executor - // if executorResult.Status != stage.Status(envexec.StatusAccepted) { - // return stage.ParserResult{ - // Score: 0, - // Comment: fmt.Sprintf( - // "Unexpected executor status: %s.\nStderr: %s", - // executorResult.Status, stderr, - // ), - // } - // } + if executorResult.Status != stage.Status(envexec.StatusAccepted) { + if !((executorResult.Status == stage.Status(envexec.StatusNonzeroExitStatus)) && + (executorResult.ExitStatus == 1)) { + return stage.ParserResult{ + Score: 0, + Comment: fmt.Sprintf( + "Unexpected executor status: %s.\nStderr: %s", + executorResult.Status, stderr, + ), + } + } + } return stage.ParserResult{ Score: get_score(formatted_messages, conf), Comment: get_comment(formatted_messages),