rwx/sh/lint/shellcheck.sh

35 lines
596 B
Bash
Raw Permalink Normal View History

rwx_shellcheck() {
local root="${1}"
local file module modules path
file="$(mktemp)"
modules="$(rwx_find_shell "${root}")"
2025-07-04 07:56:32 +02:00
while IFS= read -r module; do
path="${root}/${module}"
echo ". \"${path}\"" >>"${file}"
2025-07-04 07:56:32 +02:00
done <<EOF
${modules}
EOF
rwx_shellcheck_file "${file}"
rwx_remove "${file}"
}
rwx_shellcheck_file() {
local file="${1}"
shellcheck \
--check-sourced \
--enable "all" \
--exclude "3043" \
--external-sources \
--shell "dash" \
"${file}"
}
rwx_shellcheck_write() {
rwx_file_write ".shellcheckrc" "\
disable=3043
enable=all
external-sources=true
shell=sh
"
}