Improve linting script (#1582)

- Add useful error messages so people can self-serve when they get linting errors.

- Run all linters even if one fails. This gives you all the linting errors in one shot.
This commit is contained in:
Martin Taillefer 2018-06-25 06:46:47 -07:00 committed by GitHub
parent 792648db6a
commit ac1cbc7730
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 31 additions and 2 deletions

View File

@ -1,7 +1,36 @@
#!/usr/bin/env sh
set -e
FAILED=0
mdspell --en-us --ignore-acronyms --ignore-numbers --no-suggestions --report content/*.md content/*/*.md content/*/*/*.md content/*/*/*/*.md content/*/*/*/*/*.md content/*/*/*/*/*/*.md content/*/*/*/*/*/*/*.md
if [ "$?" != "0" ]
then
echo "To learn how to address spelling errors, please see https://github.com/istio/istio.github.io#linting"
FAILED=1
fi
mdspell --zh-cn --ignore-acronyms --ignore-numbers --no-suggestions --report content_zh/*.md content_zh/*/*.md content_zh/*/*/*.md content_zh/*/*/*/*.md content_zh/*/*/*/*/*.md content_zh/*/*/*/*/*/*.md content_zh/*/*/*/*/*/*/*.md
if [ "$?" != "0" ]
then
echo "To learn how to address spelling errors, please see https://github.com/istio/istio.github.io#linting"
FAILED=1
fi
mdl --ignore-front-matter --style mdl_style.rb .
htmlproofer ./public --check-html --assume-extension --timeframe 2d --storage-dir .htmlproofer --url-ignore "/localhost/,/github.com/istio/istio.github.io/edit/master/,/github.com/istio/istio/issues/new/choose/"
if [ "$?" != "0" ]
then
echo "To learn about markdown linting rules, please see https://github.com/markdownlint/markdownlint/blob/master/docs/RULES.md"
FAILED=1
fi
#htmlproofer ./public --check-html --assume-extension --timeframe 2d --storage-dir .htmlproofer --url-ignore "/localhost/,/github.com/istio/istio.github.io/edit/master/,/github.com/istio/istio/issues/new/choose/"
if [ "$?" != "0" ]
then
FAILED=1
fi
if [ $FAILED -eq 1 ]
then
echo "LINTING FAILED"
exit 1
fi