mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-21 23:20:20 +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:
parent
fe668db999
commit
084e67f267
Notes:
sideshowbarker
2024-07-19 09:29:30 +09:00
Author: https://github.com/shannonbooth Commit: https://github.com/SerenityOS/serenity/commit/084e67f267d Pull-request: https://github.com/SerenityOS/serenity/pull/1195
2 changed files with 28 additions and 1 deletions
|
@ -22,7 +22,7 @@ notifications:
|
|||
before_install:
|
||||
- sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
|
||||
- sudo apt-get update -qq
|
||||
- sudo apt-get install g++-8 libstdc++-8-dev
|
||||
- sudo apt-get install g++-8 libstdc++-8-dev shellcheck
|
||||
- sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-8 90
|
||||
- sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 90
|
||||
- sudo apt-get install -y libmpfr-dev libmpc-dev libgmp-dev
|
||||
|
@ -33,3 +33,4 @@ script:
|
|||
- ./BuildIt.sh
|
||||
- cd ../Kernel
|
||||
- ./makeall.sh
|
||||
- ../Meta/lint-shell-scripts.sh
|
||||
|
|
26
Meta/lint-shell-scripts.sh
Executable file
26
Meta/lint-shell-scripts.sh
Executable 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
|
Loading…
Reference in a new issue