ladybird/Meta/lint-shell-scripts.sh
Shannon Booth 084e67f267 Meta: Integrate Shellcheck into Travis
lint-shell-scripts searches over the repository looking for shell
scripts. On those found, shellcheck is run against them. If any linting
fails print those warnings and exit with a non-zero exit code.

Run this script automatically in Travis.
2020-02-10 10:46:25 +01:00

27 lines
574 B
Bash
Executable File

#!/bin/bash
set -e pipefail
script_path=$(cd -P -- "$(dirname -- "$0")" && pwd -P)
cd "$script_path/.."
ERRORS=()
for f in $(find . -path ./Root -prune -o \
-path ./Ports -prune -o \
-path ./.git -prune -o \
-path ./Toolchain -prune -o \
-type f | sort -u); do
if file "$f" | grep --quiet shell; then
{
shellcheck "$f" && echo -e "[\033[0;32mOK\033[0m]: sucessfully linted $f"
} || {
ERRORS+=("$f")
}
fi
done
if (( ${#ERRORS[@]} )); then
echo "Files failing shellcheck: ${ERRORS[*]}"
exit 1
fi