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

@ -2,11 +2,14 @@ package main
import (
"encoding/json"
"fmt"
"log"
"net/http"
"net/url"
"regexp"
"strings"
"srs.epita.fr/fic-server/admin/sync"
)
type GrammalecteOptions struct {
@ -115,7 +118,7 @@ var (
mdimg = regexp.MustCompile(`!\[([^\]]+)\]\([^)]+\)`)
)
func grammalecte(name string, text string, options *GrammalecteOptions) (errs []error) {
func grammalecte(name string, text string, exceptions *sync.CheckExceptions, options *GrammalecteOptions) (errs []error) {
// Remove Markdown elements
text = mdimg.ReplaceAllString(text, "Image : ${1}")
@ -161,7 +164,7 @@ func grammalecte(name string, text string, options *GrammalecteOptions) (errs []
break
}
}
if allowed {
if allowed || exceptions.HasException(":spelling:"+serror.Value) {
continue
}
@ -183,6 +186,10 @@ func grammalecte(name string, text string, options *GrammalecteOptions) (errs []
continue
}
if exceptions.HasException(fmt.Sprintf(":%d:%s", data.Paragraph, gerror.RuleId)) {
continue
}
errs = append(errs, GrammarError{
Prefix: name,
Source: data.Text,