rwx/sh/lint/shellcheck.sh

35 lines
602 B
Bash
Raw Normal View History

2024-11-29 21:57:21 +00:00
rwx_shellcheck() {
2024-11-25 17:39:25 +00:00
local root="${1}"
2024-11-29 11:17:39 +00:00
local file module modules path
2024-11-25 17:39:25 +00:00
file="$(mktemp)"
2024-11-29 22:59:06 +00:00
modules="$(rwx_find_shell "${root}")"
2024-11-29 18:43:06 +00:00
rwx_ifs_set
2024-11-25 17:39:25 +00:00
for module in ${modules}; do
2024-11-29 11:17:39 +00:00
path="${root}/${module}"
echo ". \"${path}\"" >>"${file}"
2024-11-25 17:39:25 +00:00
done
2024-11-29 18:43:06 +00:00
rwx_ifs_unset
2024-12-01 23:46:30 +00:00
rwx_shellcheck_file "${file}"
rwx_remove "${file}"
}
rwx_shellcheck_file() {
local file="${1}"
2024-11-25 17:39:25 +00:00
shellcheck \
--check-sourced \
--enable "all" \
--exclude "3043" \
--external-sources \
--shell "dash" \
"${file}"
}
2024-12-01 15:41:48 +00:00
rwx_shellcheck_write() {
rwx_file_write ".shellcheckrc" "\
disable=3043
enable=all
external-sources=true
shell=sh
"
}