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

empty json

This commit is contained in:
Evgeniy Sokolov 2018-05-05 21:46:04 +02:00
parent 277c49d34c
commit 619634698e
3 changed files with 16 additions and 12 deletions

View File

@ -14,13 +14,13 @@ touch /tmp/comments.json
while read FILE; do while read FILE; do
COMMIT=$(git log --pretty=format:"%H" -1 "$FILE"); COMMIT=$(git log --pretty=format:"%H" -1 "$FILE");
echo -n "Проверка изменений в файле $FILE на опечатки... "; echo "Проверка изменений в файле $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 "$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 cat /tmp/hunspell.out | hunspell_parser > /tmp/hunspell_parsed.json
/tmp/check_spell -file "$FILE" -commit=$COMMIT -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 на недоступные ссылки... "; echo "Проверка изменений в файле $FILE на недоступные ссылки... ";
/tmp/check_links -file "$FILE" -commit=$COMMIT -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

View File

@ -81,11 +81,13 @@ func main() {
} }
jsonData, err := json.Marshal(comments) if len(comments) > 0 {
jsonData, err := json.Marshal(comments)
if err != nil { if err != nil {
panic(err) panic(err)
}
fmt.Println(string(jsonData))
} }
fmt.Println(string(jsonData))
} }

View File

@ -45,11 +45,13 @@ func main() {
}) })
} }
jsonData, err := json.Marshal(comments) if len(comments) > 0 {
jsonData, err := json.Marshal(comments)
if err != nil { if err != nil {
panic(err) panic(err)
}
fmt.Println(string(jsonData))
} }
fmt.Println(string(jsonData))
} }