preparation to include *.bats into shellcheck

This commit is contained in:
Georg Lauterbach 2020-11-05 12:43:03 +01:00
parent 59c18ede4d
commit 46998dd816
No known key found for this signature in database
GPG Key ID: 386D76E7AD496709
2 changed files with 23 additions and 10 deletions

View File

@ -19,7 +19,7 @@ A fullstack but simple mail server (SMTP, IMAP, Antispam, Antivirus...).
Only configuration files, no SQL database. Keep it simple and versioned. Only configuration files, no SQL database. Keep it simple and versioned.
Easy to deploy and upgrade. Easy to deploy and upgrade.
[Why was this image was created?](http://tvi.al/simple-mail-server-with-docker/) [Why this image was created.](http://tvi.al/simple-mail-server-with-docker/)
1. [Announcements](#announcements) 1. [Announcements](#announcements)
2. [Includes](#includes) 2. [Includes](#includes)

View File

@ -90,9 +90,7 @@ function _eclint
return 102 return 102
fi fi
__log_info \ __log_info 'linter version:' "$(${LINT[0]} --version))"
'type: editorconfig' \
'(linter version:' "$(${LINT[0]} --version))"
if "${LINT[@]}" if "${LINT[@]}"
then then
@ -114,9 +112,8 @@ function _hadolint
return 102 return 102
fi fi
__log_info \ __log_info 'linter version:' \
'type: Dockerfile' \ "$(${LINT[0]} --version | grep -E -o "v[0-9\.]*"))"
'(linter version:' "$(${LINT[0]} --version | grep -E -o "v[0-9\.]*"))"
if git ls-files --exclude='Dockerfile*' --ignored | \ if git ls-files --exclude='Dockerfile*' --ignored | \
xargs --max-lines=1 "${LINT[@]}" xargs --max-lines=1 "${LINT[@]}"
@ -140,8 +137,7 @@ function _shellcheck
return 102 return 102
fi fi
__log_info \ __log_info 'linter version:' \
'type: shellcheck' '(linter version:' \
"$(${LINT[0]} --version | grep -m 2 -o "[0-9.]*"))" "$(${LINT[0]} --version | grep -m 2 -o "[0-9.]*"))"
# an overengineered solution to allow shellcheck -x to # an overengineered solution to allow shellcheck -x to
@ -179,6 +175,23 @@ function _shellcheck
fi fi
done < <(find target/bin -executable -type f) done < <(find target/bin -executable -type f)
# the same for all test files
# while read -r FILE
# do
# if ! (
# cd "$(realpath "$(dirname "$(readlink -f "${FILE}")")")"
# if ! "${LINT[@]}" "$(basename -- "${FILE}")"
# then
# return 1
# fi
# )
# then
# # ! Errors / warnings found here are
# # ! currently NOT accounted for.
# :
# fi
# done < <(find test/ -maxdepth 1 -type f -iname "*.bats")
if [[ ERR -eq 1 ]] if [[ ERR -eq 1 ]]
then then
__log_abort 'errors encountered' __log_abort 'errors encountered'
@ -196,7 +209,7 @@ function _main
'shellcheck' ) _shellcheck ;; 'shellcheck' ) _shellcheck ;;
*) *)
__log_abort \ __log_abort \
"init.sh: '${1}' is not a command nor an option. See 'make help'." "lint.sh: '${1}' is not a command nor an option. See 'make help'."
exit 11 exit 11
;; ;;
esac esac