chore(parser): move Conf struct to meta.go
This commit is contained in:
parent
61c9dcebb7
commit
49b7c7c5db
|
@ -4,6 +4,22 @@ import "github.com/joint-online-judge/JOJ3/internal/stage"
|
|||
|
||||
var name = "clangtidy"
|
||||
|
||||
type Match struct {
|
||||
Keywords []string
|
||||
Score int
|
||||
}
|
||||
|
||||
type Conf struct {
|
||||
Score int
|
||||
RootDir string `default:"/w"`
|
||||
Matches []Match
|
||||
Stdout string `default:"stdout"`
|
||||
Stderr string `default:"stderr"`
|
||||
ForceQuitOnDeduct bool `default:"false"`
|
||||
}
|
||||
|
||||
type ClangTidy struct{}
|
||||
|
||||
func init() {
|
||||
stage.RegisterParser(name, &ClangTidy{})
|
||||
}
|
||||
|
|
|
@ -6,22 +6,6 @@ import (
|
|||
"github.com/joint-online-judge/JOJ3/internal/stage"
|
||||
)
|
||||
|
||||
type Match struct {
|
||||
Keywords []string
|
||||
Score int
|
||||
}
|
||||
|
||||
type Conf struct {
|
||||
Score int
|
||||
RootDir string `default:"/w"`
|
||||
Matches []Match
|
||||
Stdout string `default:"stdout"`
|
||||
Stderr string `default:"stderr"`
|
||||
ForceQuitOnDeduct bool `default:"false"`
|
||||
}
|
||||
|
||||
type ClangTidy struct{}
|
||||
|
||||
func Parse(executorResult stage.ExecutorResult, conf Conf) stage.ParserResult {
|
||||
stdout := executorResult.Files[conf.Stdout]
|
||||
// stderr := executorResult.Files[conf.Stderr]
|
||||
|
|
|
@ -4,6 +4,21 @@ import "github.com/joint-online-judge/JOJ3/internal/stage"
|
|||
|
||||
var name = "cppcheck"
|
||||
|
||||
type Match struct {
|
||||
Keywords []string
|
||||
Score int
|
||||
}
|
||||
|
||||
type Conf struct {
|
||||
Score int
|
||||
Matches []Match
|
||||
Stdout string `default:"stdout"`
|
||||
Stderr string `default:"stderr"`
|
||||
ForceQuitOnDeduct bool `default:"false"`
|
||||
}
|
||||
|
||||
type CppCheck struct{}
|
||||
|
||||
func init() {
|
||||
stage.RegisterParser(name, &CppCheck{})
|
||||
}
|
||||
|
|
|
@ -8,19 +8,6 @@ import (
|
|||
"github.com/joint-online-judge/JOJ3/internal/stage"
|
||||
)
|
||||
|
||||
type Match struct {
|
||||
Keywords []string
|
||||
Score int
|
||||
}
|
||||
|
||||
type Conf struct {
|
||||
Score int
|
||||
Matches []Match
|
||||
Stdout string `default:"stdout"`
|
||||
Stderr string `default:"stderr"`
|
||||
ForceQuitOnDeduct bool `default:"false"`
|
||||
}
|
||||
|
||||
type Record struct {
|
||||
File string `json:"file"`
|
||||
Line int `json:"line"`
|
||||
|
@ -30,8 +17,6 @@ type Record struct {
|
|||
Id string `json:"id"`
|
||||
}
|
||||
|
||||
type CppCheck struct{}
|
||||
|
||||
func Parse(executorResult stage.ExecutorResult, conf Conf) stage.ParserResult {
|
||||
// stdout := executorResult.Files[conf.Stdout]
|
||||
stderr := executorResult.Files[conf.Stderr]
|
||||
|
|
|
@ -4,6 +4,21 @@ import "github.com/joint-online-judge/JOJ3/internal/stage"
|
|||
|
||||
var name = "cpplint"
|
||||
|
||||
type Match struct {
|
||||
Keywords []string
|
||||
Score int
|
||||
}
|
||||
|
||||
type Conf struct {
|
||||
Score int
|
||||
Matches []Match
|
||||
Stdout string `default:"stdout"`
|
||||
Stderr string `default:"stderr"`
|
||||
ForceQuitOnDeduct bool `default:"false"`
|
||||
}
|
||||
|
||||
type Cpplint struct{}
|
||||
|
||||
func init() {
|
||||
stage.RegisterParser(name, &Cpplint{})
|
||||
}
|
||||
|
|
|
@ -9,21 +9,6 @@ import (
|
|||
"github.com/joint-online-judge/JOJ3/internal/stage"
|
||||
)
|
||||
|
||||
type Match struct {
|
||||
Keywords []string
|
||||
Score int
|
||||
}
|
||||
|
||||
type Conf struct {
|
||||
Score int
|
||||
Matches []Match
|
||||
Stdout string `default:"stdout"`
|
||||
Stderr string `default:"stderr"`
|
||||
ForceQuitOnDeduct bool `default:"false"`
|
||||
}
|
||||
|
||||
type Cpplint struct{}
|
||||
|
||||
func Parse(executorResult stage.ExecutorResult, conf Conf) stage.ParserResult {
|
||||
stderr := executorResult.Files[conf.Stderr]
|
||||
pattern := `(.+):(\d+): (.+) \[(.+)\] \[(\d)]\n`
|
||||
|
|
|
@ -4,6 +4,10 @@ import "github.com/joint-online-judge/JOJ3/internal/stage"
|
|||
|
||||
var name = "debug"
|
||||
|
||||
type Conf struct{}
|
||||
|
||||
type Debug struct{}
|
||||
|
||||
func init() {
|
||||
stage.RegisterParser(name, &Debug{})
|
||||
}
|
||||
|
|
|
@ -6,10 +6,6 @@ import (
|
|||
"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 {
|
||||
|
|
|
@ -4,6 +4,26 @@ import "github.com/joint-online-judge/JOJ3/internal/stage"
|
|||
|
||||
var name = "diff"
|
||||
|
||||
type Conf struct {
|
||||
PassComment string `default:"🥳Passed!\n"`
|
||||
FailComment string `default:"🧐Failed...\n"`
|
||||
FailOnNotAccepted bool `default:"true"`
|
||||
ForceQuitOnFailed bool `default:"false"`
|
||||
Cases []struct {
|
||||
Outputs []struct {
|
||||
Score int
|
||||
FileName string
|
||||
AnswerPath string
|
||||
CompareSpace bool
|
||||
AlwaysHide bool
|
||||
ForceQuitOnDiff bool
|
||||
MaxDiffLength int `default:"2048"` // just for reference
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
type Diff struct{}
|
||||
|
||||
func init() {
|
||||
stage.RegisterParser(name, &Diff{})
|
||||
}
|
||||
|
|
|
@ -19,26 +19,6 @@ const (
|
|||
MOVE
|
||||
)
|
||||
|
||||
type Conf struct {
|
||||
PassComment string `default:"🥳Passed!\n"`
|
||||
FailComment string `default:"🧐Failed...\n"`
|
||||
FailOnNotAccepted bool `default:"true"`
|
||||
ForceQuitOnFailed bool `default:"false"`
|
||||
Cases []struct {
|
||||
Outputs []struct {
|
||||
Score int
|
||||
FileName string
|
||||
AnswerPath string
|
||||
CompareSpace bool
|
||||
AlwaysHide bool
|
||||
ForceQuitOnDiff bool
|
||||
MaxDiffLength int `default:"2048"` // just for reference
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
type Diff struct{}
|
||||
|
||||
func (*Diff) Run(results []stage.ExecutorResult, confAny any) (
|
||||
[]stage.ParserResult, bool, error,
|
||||
) {
|
||||
|
|
|
@ -4,6 +4,14 @@ import "github.com/joint-online-judge/JOJ3/internal/stage"
|
|||
|
||||
var name = "dummy"
|
||||
|
||||
type Conf struct {
|
||||
Score int
|
||||
Comment string
|
||||
ForceQuit bool
|
||||
}
|
||||
|
||||
type Dummy struct{}
|
||||
|
||||
func init() {
|
||||
stage.RegisterParser(name, &Dummy{})
|
||||
}
|
||||
|
|
|
@ -4,14 +4,6 @@ import (
|
|||
"github.com/joint-online-judge/JOJ3/internal/stage"
|
||||
)
|
||||
|
||||
type Conf struct {
|
||||
Score int
|
||||
Comment string
|
||||
ForceQuit bool
|
||||
}
|
||||
|
||||
type Dummy struct{}
|
||||
|
||||
func (*Dummy) Run(results []stage.ExecutorResult, confAny any) (
|
||||
[]stage.ParserResult, bool, error,
|
||||
) {
|
||||
|
|
|
@ -4,6 +4,13 @@ import "github.com/joint-online-judge/JOJ3/internal/stage"
|
|||
|
||||
var name = "healthcheck"
|
||||
|
||||
type Healthcheck struct{}
|
||||
|
||||
type Conf struct {
|
||||
Stdout string `default:"stdout"`
|
||||
Stderr string `default:"stderr"`
|
||||
}
|
||||
|
||||
func init() {
|
||||
stage.RegisterParser(name, &Healthcheck{})
|
||||
}
|
||||
|
|
|
@ -10,13 +10,6 @@ import (
|
|||
"github.com/joint-online-judge/JOJ3/pkg/healthcheck"
|
||||
)
|
||||
|
||||
type Healthcheck struct{}
|
||||
|
||||
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]
|
||||
|
|
|
@ -4,6 +4,21 @@ import "github.com/joint-online-judge/JOJ3/internal/stage"
|
|||
|
||||
var name = "keyword"
|
||||
|
||||
type Match struct {
|
||||
Keywords []string
|
||||
Score int
|
||||
MaxMatchCount int
|
||||
}
|
||||
|
||||
type Conf struct {
|
||||
Score int
|
||||
Files []string
|
||||
ForceQuitOnDeduct bool `default:"false"`
|
||||
Matches []Match
|
||||
}
|
||||
|
||||
type Keyword struct{}
|
||||
|
||||
func init() {
|
||||
stage.RegisterParser(name, &Keyword{})
|
||||
}
|
||||
|
|
|
@ -8,21 +8,6 @@ import (
|
|||
"github.com/joint-online-judge/JOJ3/internal/stage"
|
||||
)
|
||||
|
||||
type Match struct {
|
||||
Keywords []string
|
||||
Score int
|
||||
MaxMatchCount int
|
||||
}
|
||||
|
||||
type Conf struct {
|
||||
Score int
|
||||
Files []string
|
||||
ForceQuitOnDeduct bool `default:"false"`
|
||||
Matches []Match
|
||||
}
|
||||
|
||||
type Keyword struct{}
|
||||
|
||||
func Parse(executorResult stage.ExecutorResult, conf Conf) stage.ParserResult {
|
||||
score := conf.Score
|
||||
comment := ""
|
||||
|
|
|
@ -4,6 +4,14 @@ import "github.com/joint-online-judge/JOJ3/internal/stage"
|
|||
|
||||
var name = "log"
|
||||
|
||||
type Conf struct {
|
||||
FileName string `default:"stdout"`
|
||||
Msg string `default:"log msg"`
|
||||
Level int `default:"0"`
|
||||
}
|
||||
|
||||
type Log struct{}
|
||||
|
||||
func init() {
|
||||
stage.RegisterParser(name, &Log{})
|
||||
}
|
||||
|
|
|
@ -9,14 +9,6 @@ import (
|
|||
"github.com/joint-online-judge/JOJ3/internal/stage"
|
||||
)
|
||||
|
||||
type Conf struct {
|
||||
FileName string `default:"stdout"`
|
||||
Msg string `default:"log msg"`
|
||||
Level int `default:"0"`
|
||||
}
|
||||
|
||||
type Log struct{}
|
||||
|
||||
func Parse(executorResult stage.ExecutorResult, conf Conf) stage.ParserResult {
|
||||
content := executorResult.Files[conf.FileName]
|
||||
var data map[string]any
|
||||
|
|
|
@ -4,6 +4,21 @@ import "github.com/joint-online-judge/JOJ3/internal/stage"
|
|||
|
||||
var name = "result-detail"
|
||||
|
||||
type Conf struct {
|
||||
Score int
|
||||
ShowExecutorStatus bool `default:"true"`
|
||||
ShowExitStatus bool `default:"false"`
|
||||
ShowError bool `default:"false"`
|
||||
ShowTime bool `default:"true"`
|
||||
ShowMemory bool `default:"true"`
|
||||
ShowRunTime bool `default:"false"`
|
||||
ShowFiles []string
|
||||
FilesInCodeBlock bool `default:"true"`
|
||||
MaxFileLength int `default:"65536"`
|
||||
}
|
||||
|
||||
type ResultDetail struct{}
|
||||
|
||||
func init() {
|
||||
stage.RegisterParser(name, &ResultDetail{})
|
||||
}
|
||||
|
|
|
@ -6,21 +6,6 @@ import (
|
|||
"github.com/joint-online-judge/JOJ3/internal/stage"
|
||||
)
|
||||
|
||||
type Conf struct {
|
||||
Score int
|
||||
ShowExecutorStatus bool `default:"true"`
|
||||
ShowExitStatus bool `default:"false"`
|
||||
ShowError bool `default:"false"`
|
||||
ShowTime bool `default:"true"`
|
||||
ShowMemory bool `default:"true"`
|
||||
ShowRunTime bool `default:"false"`
|
||||
ShowFiles []string
|
||||
FilesInCodeBlock bool `default:"true"`
|
||||
MaxFileLength int `default:"65536"`
|
||||
}
|
||||
|
||||
type ResultDetail struct{}
|
||||
|
||||
func (*ResultDetail) Run(results []stage.ExecutorResult, confAny any) (
|
||||
[]stage.ParserResult, bool, error,
|
||||
) {
|
||||
|
|
|
@ -4,6 +4,14 @@ import "github.com/joint-online-judge/JOJ3/internal/stage"
|
|||
|
||||
var name = "result-status"
|
||||
|
||||
type Conf struct {
|
||||
Score int
|
||||
Comment string
|
||||
ForceQuitOnNotAccepted bool `default:"true"`
|
||||
}
|
||||
|
||||
type ResultStatus struct{}
|
||||
|
||||
func init() {
|
||||
stage.RegisterParser(name, &ResultStatus{})
|
||||
}
|
||||
|
|
|
@ -7,14 +7,6 @@ import (
|
|||
"github.com/joint-online-judge/JOJ3/internal/stage"
|
||||
)
|
||||
|
||||
type Conf struct {
|
||||
Score int
|
||||
Comment string
|
||||
ForceQuitOnNotAccepted bool `default:"true"`
|
||||
}
|
||||
|
||||
type ResultStatus struct{}
|
||||
|
||||
func (*ResultStatus) Run(results []stage.ExecutorResult, confAny any) (
|
||||
[]stage.ParserResult, bool, error,
|
||||
) {
|
||||
|
|
|
@ -4,6 +4,15 @@ import "github.com/joint-online-judge/JOJ3/internal/stage"
|
|||
|
||||
var name = "sample"
|
||||
|
||||
type Conf struct {
|
||||
Score int
|
||||
Comment string
|
||||
Stdout string `default:"stdout"`
|
||||
Stderr string `default:"stderr"`
|
||||
}
|
||||
|
||||
type Sample struct{}
|
||||
|
||||
func init() {
|
||||
stage.RegisterParser(name, &Sample{})
|
||||
}
|
||||
|
|
|
@ -8,15 +8,6 @@ import (
|
|||
"github.com/joint-online-judge/JOJ3/pkg/sample"
|
||||
)
|
||||
|
||||
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[conf.Stdout]
|
||||
// stderr := executorResult.Files[conf.Stderr]
|
||||
|
|
Loading…
Reference in New Issue
Block a user