repochecker/grammalecte: Extract struct in a dedicated lib

This commit is contained in:
nemunaire 2022-10-31 17:00:09 +01:00
commit acdf0a6261
3 changed files with 7 additions and 5 deletions

View file

@ -6,12 +6,13 @@ import (
"srs.epita.fr/fic-server/admin/sync"
"srs.epita.fr/fic-server/libfic"
lib "srs.epita.fr/fic-server/repochecker/grammalecte/lib"
)
func GrammalecteCheckKeyFlag(flag *fic.FlagKey, raw string, exceptions *sync.CheckExceptions) (errs []error) {
label, _, _, _ := flag.AnalyzeFlagLabel()
for _, err := range grammalecte("label ", label, exceptions, &CommonOpts) {
if e, ok := err.(GrammarError); ok && e.RuleId == "poncfin_règle1" {
if e, ok := err.(lib.GrammarError); ok && e.RuleId == "poncfin_règle1" {
continue
}
@ -56,7 +57,7 @@ func GrammalecteCheckMDText(str string, exceptions *sync.CheckExceptions) (errs
return
}
func GrammalecteCheckGrammar(data interface{}, exceptions *sync.CheckExceptions) (errs []error) {
func GrammalecteCheckGrammar(data interface{}, exceptions *sync.CheckExceptions) []error {
if s, ok := data.(string); ok {
return grammalecte("", s, exceptions, &CommonOpts)
} else {