From 2b386fbf52c1c94254a0a146d1548eabba558d7b Mon Sep 17 00:00:00 2001 From: Patryk Obara Date: Fri, 15 Nov 2019 00:32:02 +0100 Subject: [PATCH] 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. --- scripts/verify-bash.sh | 15 ++++++++++----- scripts/verify-python.sh | 16 +++++++++++----- 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/scripts/verify-bash.sh b/scripts/verify-bash.sh index 9473222a..af014992 100755 --- a/scripts/verify-bash.sh +++ b/scripts/verify-bash.sh @@ -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 "$@" diff --git a/scripts/verify-python.sh b/scripts/verify-python.sh index a9a307ab..5b5b26b6 100755 --- a/scripts/verify-python.sh +++ b/scripts/verify-python.sh @@ -8,13 +8,19 @@ # # $ ./verify-python.sh --disable= -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 "$@"