clang-tidy parser and executor #26

Merged
张泊明518370910136 merged 26 commits from clang-tidy into master 2024-05-18 02:50:13 +08:00
2 changed files with 16 additions and 11 deletions
Showing only changes of commit 6429d820a9 - Show all commits

@ -1 +1 @@
Subproject commit 580d9c9e20ae887551af2f87483d82cf6efa6f6d Subproject commit 4b00eacf88277a06bbb5052e5b2688cd622521d0

View File

@ -1,9 +1,11 @@
package clang_tidy package clang_tidy
import ( import (
"fmt"
"strings" "strings"
"focs.ji.sjtu.edu.cn/git/FOCS-dev/JOJ3/internal/stage" "focs.ji.sjtu.edu.cn/git/FOCS-dev/JOJ3/internal/stage"
"github.com/criyle/go-judge/envexec"
) )
type Match struct { type Match struct {
@ -21,21 +23,24 @@ type ClangTidy struct{}
func Parse(executorResult stage.ExecutorResult, conf Conf) stage.ParserResult { func Parse(executorResult stage.ExecutorResult, conf Conf) stage.ParserResult {
stdout := executorResult.Files["stdout"] stdout := executorResult.Files["stdout"]
stderr := executorResult.Files["stderr"]
lines := strings.SplitAfter(stdout, "\n") lines := strings.SplitAfter(stdout, "\n")
messages := parse_lines(lines, conf) messages := parse_lines(lines, conf)
formatted_messages := format(messages) formatted_messages := format(messages)
// TODO: Handle unexpected errors from executor if executorResult.Status != stage.Status(envexec.StatusAccepted) {
// if executorResult.Status != stage.Status(envexec.StatusAccepted) { if !((executorResult.Status == stage.Status(envexec.StatusNonzeroExitStatus)) &&
// return stage.ParserResult{ (executorResult.ExitStatus == 1)) {
// Score: 0, return stage.ParserResult{
// Comment: fmt.Sprintf( Score: 0,
// "Unexpected executor status: %s.\nStderr: %s", Comment: fmt.Sprintf(
// executorResult.Status, stderr, "Unexpected executor status: %s.\nStderr: %s",
// ), executorResult.Status, stderr,
// } ),
// } }
}
}
return stage.ParserResult{ return stage.ParserResult{
Score: get_score(formatted_messages, conf), Score: get_score(formatted_messages, conf),
Comment: get_comment(formatted_messages), Comment: get_comment(formatted_messages),