feat(parser/debug): debug parser
This commit is contained in:
parent
8d5a08fd35
commit
58c6d5607f
|
@ -4,6 +4,7 @@ import (
|
||||||
_ "github.com/joint-online-judge/JOJ3/internal/parser/clangtidy"
|
_ "github.com/joint-online-judge/JOJ3/internal/parser/clangtidy"
|
||||||
_ "github.com/joint-online-judge/JOJ3/internal/parser/cppcheck"
|
_ "github.com/joint-online-judge/JOJ3/internal/parser/cppcheck"
|
||||||
_ "github.com/joint-online-judge/JOJ3/internal/parser/cpplint"
|
_ "github.com/joint-online-judge/JOJ3/internal/parser/cpplint"
|
||||||
|
_ "github.com/joint-online-judge/JOJ3/internal/parser/debug"
|
||||||
_ "github.com/joint-online-judge/JOJ3/internal/parser/diff"
|
_ "github.com/joint-online-judge/JOJ3/internal/parser/diff"
|
||||||
_ "github.com/joint-online-judge/JOJ3/internal/parser/dummy"
|
_ "github.com/joint-online-judge/JOJ3/internal/parser/dummy"
|
||||||
_ "github.com/joint-online-judge/JOJ3/internal/parser/healthcheck"
|
_ "github.com/joint-online-judge/JOJ3/internal/parser/healthcheck"
|
||||||
|
|
9
internal/parser/debug/meta.go
Normal file
9
internal/parser/debug/meta.go
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
package debug
|
||||||
|
|
||||||
|
import "github.com/joint-online-judge/JOJ3/internal/stage"
|
||||||
|
|
||||||
|
var name = "debug"
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
stage.RegisterParser(name, &Debug{})
|
||||||
|
}
|
36
internal/parser/debug/parser.go
Normal file
36
internal/parser/debug/parser.go
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
package debug
|
||||||
|
|
||||||
|
import (
|
||||||
|
"log/slog"
|
||||||
|
|
||||||
|
"github.com/joint-online-judge/JOJ3/internal/stage"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Conf struct{}
|
||||||
|
|
||||||
|
type Debug struct{}
|
||||||
|
|
||||||
|
func Parse(executorResult stage.ExecutorResult, conf Conf) stage.ParserResult {
|
||||||
|
slog.Debug("debug parser", "executorResult", executorResult)
|
||||||
|
for name, content := range executorResult.Files {
|
||||||
|
slog.Debug("debug parser file", "name", name, "content", content)
|
||||||
|
}
|
||||||
|
return stage.ParserResult{
|
||||||
|
Score: 0,
|
||||||
|
Comment: "",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*Debug) 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
|
||||||
|
for _, result := range results {
|
||||||
|
res = append(res, Parse(result, *conf))
|
||||||
|
}
|
||||||
|
return res, false, nil
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user