repochecker/grammalecte: Add a custom hook CheckGrammar
This commit is contained in:
parent
5d07634d0d
commit
d7ff10762e
2 changed files with 13 additions and 0 deletions
|
@ -1,6 +1,8 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"log"
|
||||||
|
|
||||||
"srs.epita.fr/fic-server/admin/sync"
|
"srs.epita.fr/fic-server/admin/sync"
|
||||||
"srs.epita.fr/fic-server/libfic"
|
"srs.epita.fr/fic-server/libfic"
|
||||||
)
|
)
|
||||||
|
@ -41,3 +43,12 @@ func GrammalecteCheckMDText(str string, exceptions *sync.CheckExceptions) (errs
|
||||||
|
|
||||||
return
|
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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -96,5 +96,7 @@ func RegisterChecksHooks(h *sync.CheckHooks) {
|
||||||
h.RegisterFlagChoiceHook(GrammalecteCheckFlagChoice)
|
h.RegisterFlagChoiceHook(GrammalecteCheckFlagChoice)
|
||||||
h.RegisterHintHook(GrammalecteCheckHint)
|
h.RegisterHintHook(GrammalecteCheckHint)
|
||||||
h.RegisterMDTextHook(GrammalecteCheckMDText)
|
h.RegisterMDTextHook(GrammalecteCheckMDText)
|
||||||
|
|
||||||
|
h.RegisterCustomHook("CheckGrammar", GrammalecteCheckGrammar)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue