repochecker/grammalecte: Check labels and titles have upper case
This commit is contained in:
parent
960122dfb6
commit
98939e9d61
|
@ -1,8 +1,11 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"log"
|
||||
"strings"
|
||||
"unicode"
|
||||
|
||||
"srs.epita.fr/fic-server/admin/sync"
|
||||
"srs.epita.fr/fic-server/libfic"
|
||||
|
@ -29,12 +32,19 @@ func GrammalecteCheckKeyFlag(flag *fic.FlagKey, raw string, exceptions *sync.Che
|
|||
func GrammalecteCheckFlagChoice(choice *fic.FlagChoice, exceptions *sync.CheckExceptions) (errs []error) {
|
||||
errs = append(errs, grammalecte("label ", choice.Label, exceptions, &CommonOpts)...)
|
||||
|
||||
if len(errs) == 0 && !unicode.IsUpper(bytes.Runes([]byte(choice.Label))[0]) && !exceptions.HasException(":1:label_majuscule") {
|
||||
errs = append(errs, fmt.Errorf("%q nécessite une majuscule (:1:label_majuscule)", choice.Label))
|
||||
}
|
||||
|
||||
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)...)
|
||||
if len(errs) == 0 && !unicode.IsUpper(bytes.Runes([]byte(hint.Title))[0]) && !exceptions.HasException(":1:title_majuscule") {
|
||||
errs = append(errs, fmt.Errorf("%q nécessite une majuscule (:1:label_majuscule)", hint.Title))
|
||||
}
|
||||
}
|
||||
|
||||
// Hint content are checked through GrammalecteCheckMDText, no need to check them
|
||||
|
|
Loading…
Reference in New Issue