repochecker/epita: Treat labels as []rune

This commit is contained in:
nemunaire 2023-12-16 01:16:07 +01:00
parent 75bf99ed7b
commit 631b2ff990
1 changed files with 2 additions and 1 deletions

View File

@ -19,7 +19,8 @@ func EPITACheckKeyFlag(flag *fic.FlagKey, raw string, _ *fic.Exercice, exception
flag.Label = flag.Label[1:]
}
if flag.Label[len(flag.Label)-1] != ')' && flag.Label[len(flag.Label)-1] != '©' && !unicode.IsLetter(rune(flag.Label[len(flag.Label)-1])) && !unicode.IsDigit(rune(flag.Label[len(flag.Label)-1])) {
label := []rune(flag.Label)
if flag.Label[len(flag.Label)-1] != ')' && flag.Label[len(flag.Label)-1] != '©' && !unicode.IsLetter(label[len(label)-1]) && !unicode.IsDigit(label[len(label)-1]) {
errs = multierr.Append(errs, fmt.Errorf("Label should not end with punct (%q). Reword your label as a description of the expected flag, `:` are automatically appended.", flag.Label[len(flag.Label)-1]))
}