blob: 6bbbb989f2c60e27fea3d19ff6e5e2fa15560fa1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
#!/usr/bin/env bash
#
# Usage:
# maint/shellcheck-all
#
# Runs "shellcheck" on every shell script
# A shell script is a file which is in git and
# - starts with a `#!` which runs /bin/sh or bash (maybe via env), or
# - ends in .sh
#
# Example yml:
#
# ```
# shell check:
# stage: check
# image: koalaman/shellcheck-alpine
# script:
# - apk add git bash
# - maint/shellcheck-all
# ```
# (except remove the space in `shell check`, which is there
# because shellcheck otherwise thinks it might be a directive!)
set -euo pipefail
# this include stanza is automatically maintained by update-shell-includes
common_dir=$(realpath "$0")
common_dir=$(dirname "$common_dir")
# shellcheck source=maint/common/bash-utils.sh
. "$common_dir"/bash-utils.sh
reject_all_arguments
(
git_grep_for_shell_script_shebangs
) | xargs shellcheck -x
|