feat(parser): make stdout & stderr file in conf
This commit is contained in:
parent
d56e3e5ebc
commit
cda3faeb9a
|
@ -17,13 +17,15 @@ type Conf struct {
|
|||
Score int `default:"100"`
|
||||
RootDir string `default:"/w"`
|
||||
Matches []Match
|
||||
Stdout string `default:"stdout"`
|
||||
Stderr string `default:"stderr"`
|
||||
}
|
||||
|
||||
type ClangTidy struct{}
|
||||
|
||||
func Parse(executorResult stage.ExecutorResult, conf Conf) stage.ParserResult {
|
||||
stdout := executorResult.Files["stdout"]
|
||||
stderr := executorResult.Files["stderr"]
|
||||
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)) {
|
||||
|
|
|
@ -19,6 +19,8 @@ type Match struct {
|
|||
type Conf struct {
|
||||
Score int `default:"100"`
|
||||
Matches []Match
|
||||
Stdout string `default:"stdout"`
|
||||
Stderr string `default:"stderr"`
|
||||
}
|
||||
|
||||
type Record struct {
|
||||
|
@ -31,8 +33,8 @@ type Record struct {
|
|||
}
|
||||
|
||||
func Parse(executorResult stage.ExecutorResult, conf Conf) stage.ParserResult {
|
||||
// stdout := executorResult.Files["stdout"]
|
||||
stderr := executorResult.Files["stderr"]
|
||||
// stdout := executorResult.Files[conf.Stdout]
|
||||
stderr := executorResult.Files[conf.Stderr]
|
||||
|
||||
if executorResult.Status != stage.Status(envexec.StatusAccepted) {
|
||||
return stage.ParserResult{
|
||||
|
|
|
@ -9,9 +9,14 @@ import (
|
|||
|
||||
type Healthcheck struct{}
|
||||
|
||||
func Parse(executorResult stage.ExecutorResult) (stage.ParserResult, bool) {
|
||||
stdout := executorResult.Files["stdout"]
|
||||
stderr := executorResult.Files["stderr"]
|
||||
type Conf struct {
|
||||
Stdout string `default:"stdout"`
|
||||
Stderr string `default:"stderr"`
|
||||
}
|
||||
|
||||
func Parse(executorResult stage.ExecutorResult, conf Conf) (stage.ParserResult, bool) {
|
||||
stdout := executorResult.Files[conf.Stdout]
|
||||
stderr := executorResult.Files[conf.Stderr]
|
||||
if executorResult.Status != stage.Status(envexec.StatusAccepted) {
|
||||
return stage.ParserResult{
|
||||
Score: 0,
|
||||
|
@ -30,10 +35,14 @@ func Parse(executorResult stage.ExecutorResult) (stage.ParserResult, bool) {
|
|||
func (*Healthcheck) Run(results []stage.ExecutorResult, confAny any) (
|
||||
[]stage.ParserResult, bool, error,
|
||||
) {
|
||||
conf, err := stage.DecodeConf[Conf](confAny)
|
||||
if err != nil {
|
||||
return nil, true, err
|
||||
}
|
||||
var res []stage.ParserResult
|
||||
forceQuit := false
|
||||
for _, result := range results {
|
||||
parserResult, forceQuitResult := Parse(result)
|
||||
parserResult, forceQuitResult := Parse(result, *conf)
|
||||
res = append(res, parserResult)
|
||||
forceQuit = forceQuit || forceQuitResult
|
||||
}
|
||||
|
|
|
@ -12,13 +12,15 @@ import (
|
|||
type Conf struct {
|
||||
Score int
|
||||
Comment string
|
||||
Stdout string `default:"stdout"`
|
||||
Stderr string `default:"stderr"`
|
||||
}
|
||||
|
||||
type Sample struct{}
|
||||
|
||||
func Parse(executorResult stage.ExecutorResult, conf Conf) stage.ParserResult {
|
||||
stdout := executorResult.Files["stdout"]
|
||||
stderr := executorResult.Files["stderr"]
|
||||
stdout := executorResult.Files[conf.Stdout]
|
||||
stderr := executorResult.Files[conf.Stderr]
|
||||
if executorResult.Status != stage.Status(envexec.StatusAccepted) {
|
||||
return stage.ParserResult{
|
||||
Score: 0,
|
||||
|
|
Loading…
Reference in New Issue
Block a user