repochecker: fix numerous general issues with exception inheritance

This commit is contained in:
nemunaire 2022-11-03 17:49:06 +01:00
parent 057ce22fb9
commit f9e9bfcb75
4 changed files with 15 additions and 4 deletions

View File

@ -60,9 +60,10 @@ func (c *CheckExceptions) Filter2ndCol(str string) *CheckExceptions {
continue
}
if eval, err := filepath.Match(cols[1], str); err == nil && eval {
if cols[1] == "spelling" {
ret[k] = v
} else if eval, err := filepath.Match(cols[1], str); err == nil && eval {
ret[k] = v
break
}
}

View File

@ -85,7 +85,7 @@ func buildExerciceHints(i Importer, exercice *fic.Exercice, exceptions *CheckExc
} else {
// Call checks hooks
for _, hk := range hooks.mdTextHooks {
for _, err := range hk(h.Content, exceptions.GetFileExceptions("challenge.txt")) {
for _, err := range hk(h.Content, exceptions) {
errs = append(errs, NewHintError(exercice, h, n, err))
}
}
@ -97,7 +97,7 @@ func buildExerciceHints(i Importer, exercice *fic.Exercice, exceptions *CheckExc
// Call checks hooks
for _, hook := range hooks.hintHooks {
for _, e := range hook(h, exceptions.GetFileExceptions("challenge.txt")) {
for _, e := range hook(h, exceptions) {
errs = append(errs, NewHintError(exercice, h, n, e))
}
}
@ -120,6 +120,8 @@ func buildExerciceHints(i Importer, exercice *fic.Exercice, exceptions *CheckExc
// CheckExerciceHints checks if all hints are corrects..
func CheckExerciceHints(i Importer, exercice *fic.Exercice, exceptions *CheckExceptions) ([]importHint, []error) {
exceptions = exceptions.GetFileExceptions("challenge.txt")
return buildExerciceHints(i, exercice, exceptions)
}
@ -128,6 +130,8 @@ func SyncExerciceHints(i Importer, exercice *fic.Exercice, flagsBindings map[int
if _, err := exercice.WipeHints(); err != nil {
errs = append(errs, err)
} else {
exceptions = exceptions.GetFileExceptions("challenge.txt")
hints, berrs := buildExerciceHints(i, exercice, exceptions)
errs = append(errs, berrs...)

View File

@ -492,6 +492,8 @@ func buildExerciceFlags(i Importer, exercice *fic.Exercice, exceptions *CheckExc
// CheckExerciceFlags checks if all flags for the given challenge are correct.
func CheckExerciceFlags(i Importer, exercice *fic.Exercice, files []string, exceptions *CheckExceptions) (rf []fic.Flag, errs []error) {
exceptions = exceptions.GetFileExceptions("challenge.txt")
flags, flagsids, berrs := buildExerciceFlags(i, exercice, exceptions)
errs = append(errs, berrs...)
@ -549,6 +551,8 @@ func SyncExerciceFlags(i Importer, exercice *fic.Exercice, exceptions *CheckExce
} else if _, err := exercice.WipeMCQs(); err != nil {
errs = append(errs, err)
} else {
exceptions = exceptions.GetFileExceptions("challenge.txt")
flags, flagids, berrs := buildExerciceFlags(i, exercice, exceptions)
errs = append(errs, berrs...)

View File

@ -113,6 +113,8 @@ func checkExercice(theme *fic.Theme, edir string, dmap *map[int64]*fic.Exercice,
errs = append(errs, berrs...)
if e != nil {
exceptions = exceptions.GetExerciceExceptions(e)
// Files
var files []string
var cerrs []error