Skip to content

Commit

Permalink
Merge pull request #158 from tegonal/improve/run-shellcheck
Browse files Browse the repository at this point in the history
report in which paths we analysed files
  • Loading branch information
robstoll authored Mar 7, 2024
2 parents 35204e2 + b9f9810 commit 413277e
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/qa/run-shellcheck.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ if ! [[ -v dir_of_tegonal_scripts ]]; then
fi
sourceOnce "$dir_of_tegonal_scripts/utility/checks.sh"
sourceOnce "$dir_of_tegonal_scripts/utility/recursive-declare-p.sh"
sourceOnce "$dir_of_tegonal_scripts/utility/array-utils.sh"

function runShellcheck() {
exitIfCommandDoesNotExist "shellcheck" "see https://github.com/koalaman/shellcheck#installing"
Expand All @@ -59,7 +60,7 @@ function runShellcheck() {
local -r sourcePath=$2
shift 2 || die "could not shift by 2"

exitIfArgIsNotArray runShellcheck_paths 1
exitIfArgIsNotArrayOrIsEmpty runShellcheck_paths 1

local path
for path in "${runShellcheck_paths[@]}"; do
Expand Down Expand Up @@ -104,8 +105,10 @@ function runShellcheck() {
if ((fileWithIssuesCounter > 0)); then
die "found shellcheck issues in %s files (%s symlinks skipped)" "$fileWithIssuesCounter" "$skipped"
elif ((fileCounter == 0)); then
die "looks suspicious, no files where analysed, watch out for errors above"
die "looks suspicious, no files where analysed (%s symlinks skipped), watch out for errors above" "$skipped"
else
logSuccess "no shellcheck issues found, analysed %s files (%s symlinks skipped)" "$fileCounter" "$skipped"
local runShellcheck_paths_as_string
runShellcheck_paths_as_string=$(joinByChar $'\n' "${runShellcheck_paths[@]}")
logSuccess "no shellcheck issues found, analysed %s files (%s symlinks skipped) in paths:\n%s" "$fileCounter" "$skipped" "$runShellcheck_paths_as_string"
fi
}

0 comments on commit 413277e

Please sign in to comment.