1
0
Fork 0

List files before running linters

Makes it more readable for human consumption. Also, redirect initial
output to stderr to fix e.g. output to json file.
This commit is contained in:
Patryk Obara 2019-11-15 00:32:02 +01:00 committed by Patryk Obara
parent ae6c1e9a89
commit 2b386fbf52
2 changed files with 21 additions and 10 deletions

View file

@ -8,13 +8,18 @@
#
# $ ./verify-bash.sh --format=json
run_shellcheck () {
list_bash_files () {
git ls-files \
| xargs file \
| grep "Bourne-Again shell script" \
| cut -d ':' -f 1 \
| xargs -L 1000 shellcheck "$@"
| cut -d ':' -f 1
}
shellcheck --version
run_shellcheck "$@"
main () {
shellcheck --version >&2
echo "Checking files:" >&2
list_bash_files >&2
list_bash_files | xargs -L 1000 shellcheck "$@"
}
main "$@"

View file

@ -8,13 +8,19 @@
#
# $ ./verify-python.sh --disable=<msg_ids>
run_pylint () {
list_python_files () {
git ls-files \
| xargs file \
| grep "Python script" \
| cut -d ':' -f 1 \
| xargs -L 1000 pylint "$@"
| cut -d ':' -f 1
}
pylint --version
run_pylint --rcfile="$(git rev-parse --show-toplevel)/.pylint" "$@"
main () {
pylint --version >&2
echo "Checking files:" >&2
list_python_files >&2
local -r rc="$(git rev-parse --show-toplevel)/.pylint"
list_python_files | xargs -L 1000 pylint --rcfile="$rc" "$@"
}
main "$@"