1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-14 08:54:58 +00:00

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.
This commit is contained in:
Shannon Booth 2020-02-10 19:39:30 +13:00 committed by Andreas Kling
parent fe668db999
commit 084e67f267
2 changed files with 28 additions and 1 deletions

26
Meta/lint-shell-scripts.sh Executable file
View file

@ -0,0 +1,26 @@
#!/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