diff --git a/.travis.yml b/.travis.yml index 2155c272a5..c96f5d3c4f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 diff --git a/Meta/lint-shell-scripts.sh b/Meta/lint-shell-scripts.sh new file mode 100755 index 0000000000..ddb4ccf114 --- /dev/null +++ b/Meta/lint-shell-scripts.sh @@ -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