repochecker/grammalecte: Allow redondances in resolution.md

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

View file

@ -15,35 +15,38 @@ func (c *CheckExceptions) GetExerciceExceptions(e *fic.Exercice) *CheckException
} }
func (c *CheckExceptions) GetFileExceptions(paths ...string) *CheckExceptions { func (c *CheckExceptions) GetFileExceptions(paths ...string) *CheckExceptions {
if c == nil {
return nil
}
ret := CheckExceptions{} ret := CheckExceptions{}
for k, v := range *c { if c != nil {
cols := strings.SplitN(k, ":", 2) for k, v := range *c {
if len(cols) < 2 { cols := strings.SplitN(k, ":", 2)
continue if len(cols) < 2 {
} continue
}
for _, path := range paths { for _, path := range paths {
if strings.HasPrefix(cols[0], path) { if strings.HasPrefix(cols[0], path) {
k = strings.TrimPrefix(k, path) k = strings.TrimPrefix(k, path)
if strings.HasPrefix(k, "/") { if strings.HasPrefix(k, "/") {
k = strings.TrimPrefix(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 return &ret
} }