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 -type f | sort -u); do
14 if file "$f" | grep --quiet shell; then
15 {
16 shellcheck "$f" && echo -e "[\033[0;32mOK\033[0m]: sucessfully linted $f"
17 } || {
18 ERRORS+=("$f")
19 }
20fi
21done
22
23if (( ${#ERRORS[@]} )); then
24 echo "Files failing shellcheck: ${ERRORS[*]}"
25 exit 1
26fi