repochecker/grammalecte: Add a custom hook CheckGrammar

This commit is contained in:
nemunaire 2022-10-31 15:52:11 +01:00
parent 5d07634d0d
commit d7ff10762e
2 changed files with 13 additions and 0 deletions

View File

@ -1,6 +1,8 @@
package main
import (
"log"
"srs.epita.fr/fic-server/admin/sync"
"srs.epita.fr/fic-server/libfic"
)
@ -41,3 +43,12 @@ func GrammalecteCheckMDText(str string, exceptions *sync.CheckExceptions) (errs
return
}
func GrammalecteCheckGrammar(data interface{}, exceptions *sync.CheckExceptions) (errs []error) {
if s, ok := data.(string); ok {
return grammalecte("", s, exceptions, &CommonOpts)
} else {
log.Printf("Unknown data given to GrammalecteCheckGrammar: %T", data)
return nil
}
}

View File

@ -96,5 +96,7 @@ func RegisterChecksHooks(h *sync.CheckHooks) {
h.RegisterFlagChoiceHook(GrammalecteCheckFlagChoice)
h.RegisterHintHook(GrammalecteCheckHint)
h.RegisterMDTextHook(GrammalecteCheckMDText)
h.RegisterCustomHook("CheckGrammar", GrammalecteCheckGrammar)
}
}