shellcheck

This commit is contained in:
Marc Beninca 2024-11-25 18:39:25 +01:00
parent 839c8fa069
commit 0e8cab41f6
Signed by: marc.beninca
GPG key ID: 9C7613450C80C24F
2 changed files with 25 additions and 22 deletions

View file

@ -38,27 +38,7 @@ _sh_main_log() {
esac
}
#
sh_source_check() {
local root="${1}"
local file module modules
file="$(mktemp)"
modules="$(sh_source_find "${root}")"
_sh_ifs_new
for module in ${modules}; do
echo ". \"${root}/${module}\"" >>"${file}"
done
_sh_ifs_pop
shellcheck \
--check-sourced \
--enable "all" \
--exclude "3043" \
--external-sources \
--shell "dash" \
"${file}"
rm "${file}"
}
# sort
sh_source_find() {
local root="${1}"
@ -120,6 +100,8 @@ main_source_file() {
fi
}
# public
sh_help() {
sh_log \
"sh_… = shell functions" \
@ -131,9 +113,11 @@ sh_main() {
main_source_file "${ENV}"
main_source_directory "${SH_USER}"
sh_log
sh_source_check "$(dirname "${ENV}")"
sh_shellcheck "$(dirname "${ENV}")"
sh_log
sh_help
}
# main
sh_main

19
sh/shellcheck.sh Normal file
View file

@ -0,0 +1,19 @@
sh_shellcheck() {
local root="${1}"
local file module modules
file="$(mktemp)"
modules="$(sh_source_find "${root}")"
_sh_ifs_new
for module in ${modules}; do
echo ". \"${root}/${module}\"" >>"${file}"
done
_sh_ifs_pop
shellcheck \
--check-sourced \
--enable "all" \
--exclude "3043" \
--external-sources \
--shell "dash" \
"${file}"
rm "${file}"
}