Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 17 additions & 12 deletions src/qa/run-shellcheck.sh
Original file line number Diff line number Diff line change
Expand Up @@ -69,18 +69,23 @@ function runShellcheck() {

local -i fileWithIssuesCounter=0
local -i fileCounter=0
local -i skipped=0
local script
if ! while read -r -d $'\0' script; do
((++fileCounter))
declare output
output=$(shellcheck -C -x -o all -P "$sourcePath" "$script" 2>&1 || true)
if [[ $output != "" ]]; then
printf "%s\n" "$output"
((++fileWithIssuesCounter))
fi
if ((fileWithIssuesCounter >= 5)); then
logInfoWithoutNewline "Already found issues in %s files, going to stop the analysis now in order to keep the output small" "$fileWithIssuesCounter"
break
if [[ -L $script ]]; then
((++skipped))
else
((++fileCounter))
declare output
output=$(shellcheck -C -x -o all -P "$sourcePath" "$script" 2>&1 || true)
if [[ $output != "" ]]; then
printf "%s\n" "$output"
((++fileWithIssuesCounter))
fi
if ((fileWithIssuesCounter >= 5)); then
logInfoWithoutNewline "Already found issues in %s files, going to stop the analysis now in order to keep the output small" "$fileWithIssuesCounter"
break
fi
fi
printf "."
done < <(
Expand All @@ -94,10 +99,10 @@ function runShellcheck() {
printf "\n"

if ((fileWithIssuesCounter > 0)); then
die "found shellcheck issues in %s files" "$fileWithIssuesCounter"
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"
else
logSuccess "no shellcheck issues found, analysed %s files" "$fileCounter"
logSuccess "no shellcheck issues found, analysed %s files (%s symlinks skipped)" "$fileCounter" "$skipped"
fi
}