Riyyis Utilities for C++
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
672 B

#!/bin/sh
# Run shellcheck across the codebase
# Depends: git, shellcheck
# ------------------------------------------
b="$(tput bold)"
red="$(tput setf 4)"
n="$(tput sgr0)"
if [ ! -d ".git" ]; then
echo "${b}${red}Error:${n} please run this script from the project root" >&2
exit 1
fi
if ! command -v shellcheck > /dev/null 2>&1; then
echo "shellcheck is not available, but shell script files need linting!"
echo "Either skip this script, or install shellcheck."
exit 1
fi
files="${1:-$(git --no-pager diff --cached --name-only)}"
files="$(echo "$files" | grep -E '\.sh$')"
if [ -z "$files" ]; then
exit
fi
# shellcheck disable=SC2086
shellcheck $files