sync: Introduce repochecker-ack.txt to support check exceptions

This commit is contained in:
nemunaire 2022-10-29 17:03:57 +02:00
commit fb368d79d1
17 changed files with 283 additions and 106 deletions

View file

@ -97,7 +97,7 @@ func CheckExerciceFilesPresence(i Importer, exercice *fic.Exercice) (files []str
}
// CheckExerciceFiles checks that remote files have the right digest.
func CheckExerciceFiles(i Importer, exercice *fic.Exercice) (files []string, errs []error) {
func CheckExerciceFiles(i Importer, exercice *fic.Exercice, exceptions *CheckExceptions) (files []string, errs []error) {
flist, digests, berrs := BuildFilesListInto(i, exercice, "files")
errs = append(errs, berrs...)
@ -116,7 +116,7 @@ func CheckExerciceFiles(i Importer, exercice *fic.Exercice) (files []string, err
// Call checks hooks
for _, h := range hooks.fileHooks {
for _, e := range h(file) {
for _, e := range h(file, exceptions) {
errs = append(errs, NewFileError(exercice, fname, e))
}
}
@ -129,7 +129,7 @@ func CheckExerciceFiles(i Importer, exercice *fic.Exercice) (files []string, err
// SyncExerciceFiles reads the content of files/ directory and import it as EFile for the given challenge.
// It takes care of DIGESTS.txt and ensure imported files match.
func SyncExerciceFiles(i Importer, exercice *fic.Exercice) (errs []error) {
func SyncExerciceFiles(i Importer, exercice *fic.Exercice, exceptions *CheckExceptions) (errs []error) {
if _, err := exercice.WipeFiles(); err != nil {
errs = append(errs, err)
}
@ -150,7 +150,7 @@ func SyncExerciceFiles(i Importer, exercice *fic.Exercice) (errs []error) {
} else {
// Call checks hooks
for _, h := range hooks.fileHooks {
for _, e := range h(f.(*fic.EFile)) {
for _, e := range h(f.(*fic.EFile), exceptions) {
errs = append(errs, NewFileError(exercice, fname, e))
}
}
@ -161,9 +161,9 @@ func SyncExerciceFiles(i Importer, exercice *fic.Exercice) (errs []error) {
// ApiGetRemoteExerciceFiles is an accessor to remote exercice files list.
func ApiGetRemoteExerciceFiles(c *gin.Context) {
theme, errs := BuildTheme(GlobalImporter, c.Params.ByName("thid"))
theme, exceptions, errs := BuildTheme(GlobalImporter, c.Params.ByName("thid"))
if theme != nil {
exercice, _, _, _, errs := BuildExercice(GlobalImporter, theme, path.Join(theme.Path, c.Params.ByName("exid")), nil)
exercice, _, _, _, errs := BuildExercice(GlobalImporter, theme, path.Join(theme.Path, c.Params.ByName("exid")), nil, exceptions)
if exercice != nil {
files, digests, errs := BuildFilesListInto(GlobalImporter, exercice, "files")
if files != nil {