mirror of https://github.com/koreader/koreader
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
962 B
Bash
21 lines
962 B
Bash
7 years ago
|
#!/usr/bin/env bash
|
||
|
|
||
|
CI_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||
|
# shellcheck source=/dev/null
|
||
|
source "${CI_DIR}/common.sh"
|
||
|
|
||
|
# shellcheck disable=2016
|
||
|
mapfile -t shellscript_locations < <( { git grep -lE '^#!(/usr)?/bin/(env )?(bash|sh)' && git submodule --quiet foreach '[ "$path" = "base" ] || git grep -lE "^#!(/usr)?/bin/(env )?(bash|sh)" | sed "s|^|$path/|"' && git ls-files ./*.sh ; } | sort | uniq )
|
||
|
|
||
|
SHELLSCRIPT_ERROR=0
|
||
|
|
||
|
for shellscript in "${shellscript_locations[@]}"; do
|
||
|
echo -e "${ANSI_GREEN}Running shellcheck on ${shellscript}"
|
||
|
shellcheck "${shellscript}" || SHELLSCRIPT_ERROR=1
|
||
|
echo -e "${ANSI_GREEN}Running shfmt on ${shellscript}"
|
||
|
[ "$(cat "${shellscript}" )" != "$(shfmt -i 4 "${shellscript}")" ] && echo -e "${ANSI_RED}Warning: ${shellscript} does not abide by coding style"
|
||
|
# @TODO add error handling with something like && shfmt -i 4 "${shellscript}" | diff "${shellscript}"
|
||
|
done
|
||
|
|
||
|
exit "${SHELLSCRIPT_ERROR}"
|