diff --git a/internal/parser/file/parser.go b/internal/parser/file/parser.go index f225a70..8eda627 100644 --- a/internal/parser/file/parser.go +++ b/internal/parser/file/parser.go @@ -7,7 +7,8 @@ import ( ) type Conf struct { - Name string + Name string + ForceQuitOnNonEmpty bool } type File struct{} @@ -20,12 +21,16 @@ func (*File) Run(results []stage.ExecutorResult, confAny any) ( 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, false, nil + return res, forceQuit, nil }