From aba311aebd9028a2f489efc0f0e7d100448f3601 Mon Sep 17 00:00:00 2001 From: Pierre-Olivier Mercier Date: Thu, 16 Jan 2020 15:48:43 +0100 Subject: [PATCH] sync: detect bad label wording --- admin/sync/exercice_keys.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/admin/sync/exercice_keys.go b/admin/sync/exercice_keys.go index 2090b2d9..ee81e56f 100644 --- a/admin/sync/exercice_keys.go +++ b/admin/sync/exercice_keys.go @@ -105,6 +105,10 @@ func buildKeyFlag(exercice fic.Exercice, flag ExerciceFlag, flagline int, defaul 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])) { + errs = append(errs, fmt.Sprintf("%q: flag #%d: Label should not end with punct (%q). Reword your label as a description of the expected flag, `:` are automatically appended.", path.Base(exercice.Path), flagline, flag.Label[len(flag.Label)-1])) + } + raw, prep, terrs := getRawKey(flag.Raw, flag.ValidatorRe, flag.Ordered, flag.ShowLines) if len(terrs) > 0 {