Serenity Operating System
1#!/bin/bash
2set -e pipefail
3
4script_path=$(cd -P -- "$(dirname -- "$0")" && pwd -P)
5cd "$script_path/.."
6
7ERRORS=()
8
9for f in $(find . -path ./Root -prune -o \
10 -path ./Ports -prune -o \
11 -path ./.git -prune -o \
12 -path ./Toolchain -prune -o \
13 -path ./Libraries/LibJS/Tests -prune -o \
14 -type f | sort -u); do
15 if file "$f" | grep --quiet shell; then
16 {
17 shellcheck "$f" && echo -e "[\033[0;32mOK\033[0m]: sucessfully linted $f"
18 } || {
19 ERRORS+=("$f")
20 }
21fi
22done
23
24if (( ${#ERRORS[@]} )); then
25 echo "Files failing shellcheck: ${ERRORS[*]}"
26 exit 1
27fi