This commit is contained in:
Ben Grande 2023-11-06 16:26:00 +00:00
parent 6fb526768f
commit fd1e064178
No known key found for this signature in database
GPG key ID: 00C64E14F51F9E56
6 changed files with 51 additions and 12 deletions

View file

@ -24,9 +24,23 @@ elif command -v fdfind >/dev/null; then
find_tool="fdfind"
fi
if test -n "${1-}"; then
files=""
for f in "$@"; do
test -f "$f" || continue
extension="$(echo "$f" | awk -F '.' '{print $NF}')"
case "$extension" in
top|sls) files="$files $f";;
*) continue;;
esac
done
test -n "$files" || exit 0
exec salt-lint ${conf} ${files}
fi
case "${find_tool}" in
fd|fdfind) files="minion.d/qusal.conf $(${find_tool} . qusal/ --max-depth=2 --type=f --extension=sls --extension=top)";;
find) files="minion.d/qusal.conf $(find qusal/* -maxdepth 2 -type f \( -name '*.sls' -o -name '*.top' \))";;
esac
salt-lint ${conf} ${files}
exec salt-lint ${conf} ${files}

View file

@ -26,6 +26,27 @@ elif command -v fdfind >/dev/null; then
find_tool="fdfind"
fi
if test -n "${1-}"; then
files=""
sh_files=""
for f in "$@"; do
test -f "$f" || continue
if test "${f##*/}" = "rc.local"; then
sh_files="$sh_files $f"
continue
fi
case $( file -bi "$f" ) in
(*/x-shellscript*) files="$files $f";;
esac
done
if test -n "$files" || test -n "$sh_files"; then
exit 0
fi
test -z "$files" || shellcheck ${files}
test -z "$sh_files" || shellcheck -s sh ${sh_files}
exit
fi
case "${find_tool}" in
fd|fdfind)
# shellcheck disable=2016,2215