server/repochecker/grammalecte/flags.go

44 lines
1.1 KiB
Go

package main
import (
"srs.epita.fr/fic-server/admin/sync"
"srs.epita.fr/fic-server/libfic"
)
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" {
continue
}
errs = append(errs, err)
}
if len(flag.Help) > 0 {
errs = append(errs, grammalecte("help ", flag.Help, exceptions, &CommonOpts)...)
}
return
}
func GrammalecteCheckFlagChoice(choice *fic.FlagChoice, exceptions *sync.CheckExceptions) (errs []error) {
errs = append(errs, grammalecte("label ", choice.Label, exceptions, &CommonOpts)...)
return
}
func GrammalecteCheckHint(hint *fic.EHint, exceptions *sync.CheckExceptions) (errs []error) {
if len(hint.Title) > 0 {
errs = append(errs, grammalecte("title ", hint.Title, exceptions, &CommonOpts)...)
}
return
}
func GrammalecteCheckMDText(str string, exceptions *sync.CheckExceptions) (errs []error) {
errs = append(errs, grammalecte("", str, exceptions, &CommonOpts)...)
return
}