Merge pull request #19045 from ivanvc/scripts-simplify-shellws-pass

scripts: fix shellws pass
This commit is contained in:
Benjamin Wang
2024-12-14 08:11:55 +00:00
committed by GitHub

View File

@ -340,24 +340,15 @@ function shellcheck_pass {
} }
function shellws_pass { function shellws_pass {
TAB=$'\t'
log_callout "Ensuring no tab-based indention in shell scripts" log_callout "Ensuring no tab-based indention in shell scripts"
local files local files
files=$(find ./ -name '*.sh' -print0 | xargs -0 ) if files=$(find . -name '*.sh' -print0 | xargs -0 grep -E -n $'^\s*\t'); then
# shellcheck disable=SC2206 log_error "FAIL: found tab-based indention in the following bash scripts. Use ' ' (double space):"
files=( ${files[@]} "./scripts/build-binary.sh" "./scripts/build-docker.sh" "./scripts/release.sh" ) log_error "${files}"
log_cmd "grep -E -n $'^ *${TAB}' ${files[*]}" log_warning "Suggestion: run \"make fix\" to address the issue."
# shellcheck disable=SC2086 return 255
if grep -E -n $'^ *${TAB}' "${files[@]}" | sed $'s|${TAB}|[\\\\tab]|g'; then
log_error "FAIL: found tab-based indention in bash scripts. Use ' ' (double space)."
local files_with_tabs
files_with_tabs=$(grep -E -l $'^ *\\t' "${files[@]}")
log_warning "Try: sed -i 's|\\t| |g' $files_with_tabs"
return 1
else
log_success "SUCCESS: no tabulators found."
return 0
fi fi
log_success "SUCCESS: no tabulators found."
} }
function markdown_marker_pass { function markdown_marker_pass {