repochecker: Check flag's help content through mdTextHooks

This commit is contained in:
nemunaire 2023-11-25 10:32:48 +01:00
parent 9896445e00
commit b52622c772
2 changed files with 8 additions and 3 deletions

View File

@ -351,6 +351,13 @@ func buildExerciceFlag(i Importer, exercice *fic.Exercice, flag ExerciceFlag, nl
}
if len(flag.Help) > 0 {
// Call checks hooks
for _, hk := range hooks.mdTextHooks {
for _, err := range multierr.Errors(hk(flag.Help, exercice.Language, exceptions)) {
errs = multierr.Append(errs, NewFlagError(exercice, &flag, nline+1, err))
}
}
if mdhelp, err := ProcessMarkdown(i, flag.Help, exercice.Path); err != nil {
errs = multierr.Append(errs, NewFlagError(exercice, &flag, nline+1, fmt.Errorf("unable to parse property help as Markdown: %w", err)))
} else {

View File

@ -27,9 +27,7 @@ func GrammalecteCheckKeyFlag(flag *fic.FlagKey, raw string, exercice *fic.Exerci
errs = multierr.Append(errs, err)
}
if len(flag.Help) > 0 {
errs = multierr.Append(errs, grammalecte("help ", flag.Help, -1, exceptions, &CommonOpts))
}
// Flag help are checked through GrammalecteCheckMDText, no need to check them
return
}