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