refactor(parser/file): remove
All checks were successful
submodules sync / sync (push) Successful in 1m9s
build / build (push) Successful in 1m21s
build / trigger-build-image (push) Successful in 9s

This commit is contained in:
张泊明518370910136 2024-12-06 10:53:58 -05:00
parent 3b24f4fd79
commit e25cfa78f5
GPG Key ID: D47306D7062CDA9D
3 changed files with 0 additions and 46 deletions

View File

@ -6,7 +6,6 @@ import (
_ "github.com/joint-online-judge/JOJ3/internal/parser/cpplint"
_ "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/file"
_ "github.com/joint-online-judge/JOJ3/internal/parser/healthcheck"
_ "github.com/joint-online-judge/JOJ3/internal/parser/keyword"
_ "github.com/joint-online-judge/JOJ3/internal/parser/resultdetail"

View File

@ -1,9 +0,0 @@
package file
import "github.com/joint-online-judge/JOJ3/internal/stage"
var name = "file"
func init() {
stage.RegisterParser(name, &File{})
}

View File

@ -1,36 +0,0 @@
package file
import (
"strings"
"github.com/joint-online-judge/JOJ3/internal/stage"
)
type Conf struct {
Name string
ForceQuitOnNonEmpty bool
}
type File struct{}
func (*File) 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 {
content := result.Files[conf.Name]
if conf.ForceQuitOnNonEmpty && content != "" {
forceQuit = true
}
if !strings.HasSuffix(content, "\n") {
content += "\n"
}
res = append(res, stage.ParserResult{Score: 0, Comment: content})
}
return res, forceQuit, nil
}