admin/sync: Able to filter on the second column
This commit is contained in:
parent
3d35cee67d
commit
7b2603afb0
@ -47,6 +47,28 @@ func (c *CheckExceptions) GetFileExceptions(paths ...string) *CheckExceptions {
|
|||||||
return &ret
|
return &ret
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *CheckExceptions) Filter2ndCol(str string) *CheckExceptions {
|
||||||
|
if c == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
ret := CheckExceptions{}
|
||||||
|
|
||||||
|
for k, v := range *c {
|
||||||
|
cols := strings.SplitN(k, ":", 3)
|
||||||
|
if len(cols) < 2 {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
if eval, err := filepath.Match(cols[1], str); err == nil && eval {
|
||||||
|
ret[k] = v
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return &ret
|
||||||
|
}
|
||||||
|
|
||||||
func (c *CheckExceptions) HasException(ref string) bool {
|
func (c *CheckExceptions) HasException(ref string) bool {
|
||||||
if c == nil {
|
if c == nil {
|
||||||
return false
|
return false
|
||||||
|
@ -118,7 +118,7 @@ func buildLabelFlag(exercice *fic.Exercice, flag ExerciceFlag, flagline int, exc
|
|||||||
|
|
||||||
// Call checks hooks
|
// Call checks hooks
|
||||||
for _, h := range hooks.flagLabelHooks {
|
for _, h := range hooks.flagLabelHooks {
|
||||||
for _, e := range h(f, exceptions) {
|
for _, e := range h(f, exceptions.Filter2ndCol(strconv.Itoa(flagline))) {
|
||||||
errs = append(errs, NewFlagError(exercice, &flag, flagline, e))
|
errs = append(errs, NewFlagError(exercice, &flag, flagline, e))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user