sync: Better perform exception in exercices
This commit is contained in:
parent
edbb867f62
commit
dc83efa868
8 changed files with 45 additions and 34 deletions
|
|
@ -87,12 +87,21 @@ func (c *CheckExceptions) HasException(ref string) bool {
|
|||
return false
|
||||
}
|
||||
|
||||
func ParseExceptionString(fexcept string, exceptions *CheckExceptions) *CheckExceptions {
|
||||
if exceptions == nil {
|
||||
exceptions = &CheckExceptions{}
|
||||
}
|
||||
|
||||
for n, line := range strings.Split(fexcept, "\n") {
|
||||
(*exceptions)[strings.TrimSpace(line)] = fmt.Sprintf("repochecker-ack.txt:%d", n+1)
|
||||
}
|
||||
|
||||
return exceptions
|
||||
}
|
||||
|
||||
func LoadThemeException(i Importer, th *fic.Theme) (exceptions *CheckExceptions) {
|
||||
if fexcept, err := GetFileContent(i, filepath.Join(th.Path, "repochecker-ack.txt")); err == nil {
|
||||
exceptions = &CheckExceptions{}
|
||||
for n, line := range strings.Split(fexcept, "\n") {
|
||||
(*exceptions)[strings.TrimSpace(line)] = fmt.Sprintf("repochecker-ack.txt:%d", n+1)
|
||||
}
|
||||
return ParseExceptionString(fexcept, nil)
|
||||
}
|
||||
|
||||
return
|
||||
|
|
@ -106,9 +115,7 @@ func LoadExerciceException(i Importer, th *fic.Theme, e *fic.Exercice, th_except
|
|||
exceptions = th_exceptions.GetExerciceExceptions(e)
|
||||
|
||||
if fexcept, err := GetFileContent(i, filepath.Join(e.Path, "repochecker-ack.txt")); err == nil {
|
||||
for n, line := range strings.Split(fexcept, "\n") {
|
||||
(*exceptions)[strings.TrimSpace(line)] = fmt.Sprintf("repochecker-ack.txt:%d", n+1)
|
||||
}
|
||||
return ParseExceptionString(fexcept, exceptions)
|
||||
}
|
||||
|
||||
return
|
||||
|
|
|
|||
Reference in a new issue