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:
parent
ae6c1e9a89
commit
2b386fbf52
2 changed files with 21 additions and 10 deletions
|
@ -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 "$@"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue