feat(parser): only check result status in resultstatus and healthcheck parser
This commit is contained in:
parent
3eab0e732b
commit
e68de4fcc5
|
@ -1,10 +1,8 @@
|
|||
package clangtidy
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/criyle/go-judge/envexec"
|
||||
"github.com/joint-online-judge/JOJ3/internal/stage"
|
||||
)
|
||||
|
||||
|
@ -26,19 +24,7 @@ type ClangTidy struct{}
|
|||
|
||||
func Parse(executorResult stage.ExecutorResult, conf Conf) stage.ParserResult {
|
||||
stdout := executorResult.Files[conf.Stdout]
|
||||
stderr := executorResult.Files[conf.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,
|
||||
),
|
||||
}
|
||||
}
|
||||
}
|
||||
// stderr := executorResult.Files[conf.Stderr]
|
||||
lines := strings.SplitAfter(stdout, "\n")
|
||||
messages := ParseLines(lines, conf)
|
||||
formattedMessages := Format(messages)
|
||||
|
|
|
@ -5,7 +5,6 @@ import (
|
|||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/criyle/go-judge/envexec"
|
||||
"github.com/joint-online-judge/JOJ3/internal/stage"
|
||||
)
|
||||
|
||||
|
@ -37,16 +36,6 @@ type CppCheck struct{}
|
|||
func Parse(executorResult stage.ExecutorResult, conf Conf) stage.ParserResult {
|
||||
// stdout := executorResult.Files[conf.Stdout]
|
||||
stderr := executorResult.Files[conf.Stderr]
|
||||
|
||||
if executorResult.Status != stage.Status(envexec.StatusAccepted) {
|
||||
return stage.ParserResult{
|
||||
Score: 0,
|
||||
Comment: fmt.Sprintf(
|
||||
"Unexpected executor status: %s.\nStderr: %s",
|
||||
executorResult.Status, stderr,
|
||||
),
|
||||
}
|
||||
}
|
||||
records := make([]Record, 0)
|
||||
lines := strings.Split(stderr, "\n")
|
||||
for _, line := range lines {
|
||||
|
|
|
@ -21,7 +21,7 @@ func Parse(executorResult stage.ExecutorResult, conf Conf) (stage.ParserResult,
|
|||
return stage.ParserResult{
|
||||
Score: 0,
|
||||
Comment: fmt.Sprintf(
|
||||
"Unexpected executor status: %s.\n`stdout`: ```%s\n```\n`stderr`: ```%s\n```",
|
||||
"Unexpected executor status: %s.\n`stdout`:\n```%s\n```\n`stderr`:\n```%s\n```",
|
||||
executorResult.Status, stdout, stderr,
|
||||
),
|
||||
}, true
|
||||
|
|
|
@ -4,7 +4,6 @@ import (
|
|||
"encoding/json"
|
||||
"fmt"
|
||||
|
||||
"github.com/criyle/go-judge/envexec"
|
||||
"github.com/joint-online-judge/JOJ3/internal/stage"
|
||||
"github.com/joint-online-judge/JOJ3/pkg/sample"
|
||||
)
|
||||
|
@ -20,16 +19,7 @@ type Sample struct{}
|
|||
|
||||
func Parse(executorResult stage.ExecutorResult, conf Conf) stage.ParserResult {
|
||||
stdout := executorResult.Files[conf.Stdout]
|
||||
stderr := executorResult.Files[conf.Stderr]
|
||||
if executorResult.Status != stage.Status(envexec.StatusAccepted) {
|
||||
return stage.ParserResult{
|
||||
Score: 0,
|
||||
Comment: fmt.Sprintf(
|
||||
"Unexpected executor status: %s.\nStderr: %s",
|
||||
executorResult.Status, stderr,
|
||||
),
|
||||
}
|
||||
}
|
||||
// stderr := executorResult.Files[conf.Stderr]
|
||||
var sampleResult sample.Result
|
||||
err := json.Unmarshal([]byte(stdout), &sampleResult)
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in New Issue
Block a user