repochecker/grammalecte: Allow redondances in resolution.md

This commit is contained in:
nemunaire 2022-12-02 15:27:43 +01:00
parent f087213f0a
commit f079ecd9e3

View file

@ -15,35 +15,38 @@ func (c *CheckExceptions) GetExerciceExceptions(e *fic.Exercice) *CheckException
}
func (c *CheckExceptions) GetFileExceptions(paths ...string) *CheckExceptions {
if c == nil {
return nil
}
ret := CheckExceptions{}
for k, v := range *c {
cols := strings.SplitN(k, ":", 2)
if len(cols) < 2 {
continue
}
if c != nil {
for k, v := range *c {
cols := strings.SplitN(k, ":", 2)
if len(cols) < 2 {
continue
}
for _, path := range paths {
if strings.HasPrefix(cols[0], path) {
k = strings.TrimPrefix(k, path)
for _, path := range paths {
if strings.HasPrefix(cols[0], path) {
k = strings.TrimPrefix(k, path)
if strings.HasPrefix(k, "/") {
k = strings.TrimPrefix(k, "/")
if strings.HasPrefix(k, "/") {
k = strings.TrimPrefix(k, "/")
}
ret[k] = v
break
} else if eval, err := filepath.Match(cols[0], path); err == nil && eval {
ret[k] = v
break
}
ret[k] = v
break
} else if eval, err := filepath.Match(cols[0], path); err == nil && eval {
ret[k] = v
break
}
}
}
// Ignore redondances in resolution.md
if len(paths) > 0 && paths[0] == "resolution.md" {
ret["resolution.md:*:redondances_paragraphe"] = "automatic"
}
return &ret
}