From f079ecd9e3156f234a05a0faf36c529ee26e314a Mon Sep 17 00:00:00 2001 From: Pierre-Olivier Mercier Date: Fri, 2 Dec 2022 15:27:43 +0100 Subject: [PATCH] repochecker/grammalecte: Allow redondances in resolution.md --- admin/sync/exceptions.go | 43 +++++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 20 deletions(-) diff --git a/admin/sync/exceptions.go b/admin/sync/exceptions.go index a8590550..31d3f07e 100644 --- a/admin/sync/exceptions.go +++ b/admin/sync/exceptions.go @@ -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 }