Skip to content
This repository has been archived by the owner on Apr 20, 2021. It is now read-only.

Commit

Permalink
shell-lint: Don't fail if no shell scripts found
Browse files Browse the repository at this point in the history
This fixes the case where the provided paths do not contain any shell scripts,
ie. xargs is passed no values.
In this case by default, xargs invokes the command once with no args.
This causes shellcheck to print usage and exit failure.
The GNU-specific --no-run-if-empty changes the behaviour so that in this case,
shellcheck is simply never run.

This allows us to use this script as a general lint even in contexts where
no shell scripts are present, or none of the files passed are shell scripts.
  • Loading branch information
ekimekim committed Aug 17, 2016
1 parent db5efc0 commit a781575
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion shell-lint
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@
# - files-with-type
# - file >= 5.22

"$(dirname "${BASH_SOURCE[0]}")/files-with-type" text/x-shellscript "$@" | xargs shellcheck
"$(dirname "${BASH_SOURCE[0]}")/files-with-type" text/x-shellscript "$@" | xargs --no-run-if-empty shellcheck

0 comments on commit a781575

Please sign in to comment.