1
0
mirror of https://github.com/ru-de/faq.git synced 2024-11-23 19:02:19 +00:00

add commit id

This commit is contained in:
Evgeniy Sokolov 2018-05-05 00:36:18 +02:00
parent 9d53db7138
commit c6abf30250
3 changed files with 9 additions and 8 deletions

View File

@ -22,15 +22,16 @@ rm -f /tmp/comments.json
touch /tmp/comments.json
while read FILE; do
COMMIT=$(git log --pretty=format:"%H" -1 "$FILE");
echo -n "Проверка изменений в файле $FILE на опечатки... ";
cat "$FILE" | sed 's/https\?:[^ ]*//g' | sed "s/[(][^)]*\.md[)]//g" | sed "s/[(]files[^)]*[)]//g" | hunspell -d dictionary,russian-aot-utf8,ru_RU,de_DE-utf8,en_US-utf8 > /tmp/hunspell.out
cat /tmp/hunspell.out | hunspell_parser > /tmp/hunspell_parsed.json
/tmp/check_spell -file "$FILE" -pr-liner /tmp/pr_liner.json -hunspell-parsed-file /tmp/hunspell_parsed.json >> /tmp/comments.json
/tmp/check_spell -file "$FILE" -commit=$COMMIT -pr-liner /tmp/pr_liner.json -hunspell-parsed-file /tmp/hunspell_parsed.json >> /tmp/comments.json
echo -n "Проверка изменений в файле $FILE на недоступные ссылки... ";
/tmp/check_links -file "$FILE" -pr-liner /tmp/pr_liner.json -expected-codes files/expected_codes.csv >> /tmp/comments.json
/tmp/check_links -file "$FILE" -commit=$COMMIT -pr-liner /tmp/pr_liner.json -expected-codes files/expected_codes.csv >> /tmp/comments.json
echo
done < /tmp/changed_files

View File

@ -16,10 +16,11 @@ import (
func main() {
prLiner := flag.String("pr-liner", "", "Pull request liner")
fileName := flag.String("file", "", "Hunspell parsed file name")
commit := flag.String("commit", "", "Commit")
expectedCodesFile := flag.String("expected-codes", "", "Expected codes file name")
flag.Parse()
if *prLiner == "" || *fileName == "" || *expectedCodesFile == "" {
if *prLiner == "" || *fileName == "" || *commit == "" || *expectedCodesFile == "" {
flag.Usage()
os.Exit(1)
}
@ -63,11 +64,10 @@ func main() {
}
body := fmt.Sprintf("Ссылка %s ... недоступна с кодом %v, ожидается %v. Если это ожидаемый ответ, внесите \"%v,%s\" в files/expected_codes.csv", link, respCode, expectedCodes, respCode, link)
commitID := "FIXME XXX"
comment := &github.PullRequestComment{
Body: &body,
CommitID: &commitID,
CommitID: commit,
Path: fileName,
Position: &prLine,
}

View File

@ -14,9 +14,10 @@ func main() {
prLiner := flag.String("pr-liner", "", "Pull request liner")
hunspellParsedFile := flag.String("hunspell-parsed-file", "", "Hunspell parsed file name")
file := flag.String("file", "", "Hunspell parsed file name")
commit := flag.String("commit", "", "Commit")
flag.Parse()
if *prLiner == "" || *hunspellParsedFile == "" || *file == "" {
if *prLiner == "" || *hunspellParsedFile == "" || *file == "" || *commit == "" {
flag.Usage()
os.Exit(1)
}
@ -33,11 +34,10 @@ func main() {
}
body := fmt.Sprintf("Возможная ошибка в слове \"%s\", варианты правильного написания \"%s\". Если слово \"%s\" является правильным, добавьте его в files/dictionary.dic", resp.Word, resp.Alternative, resp.Word)
commitID := "FIXME XXX"
comment := &github.PullRequestComment{
Body: &body,
CommitID: &commitID,
CommitID: commit,
Path: file,
Position: &prLine,
}