test: Detect indention done using tab (\t) in *.sh

This commit is contained in:
Piotr Tabor
2020-10-26 10:15:57 +01:00
parent 97354af44b
commit c035df5317
2 changed files with 25 additions and 0 deletions

17
test
View File

@@ -306,6 +306,8 @@ function fmt_pass {
commit_title \
mod_tidy \
dep \
shellcheck \
shellws \
; do
run_pass "${p}" "${@}"
done
@@ -317,6 +319,21 @@ function shellcheck_pass {
fi
}
function shellws_pass {
log_callout "Ensuring no tab-based indention in shell scripts"
local files
files=$(find ./ -name '*.sh' -print0 | xargs -0 )
log_cmd "grep -E -n $'^ *\t' ${files}"
# shellcheck disable=SC2086
if grep -E -n $'^ *\t' ${files} | sed -s $'s|\t|[\\\\tab]|g'; then
log_error "FAIL: found tab-based indention in bash scripts. Use ' ' (double space)."
return 1
else
log_success "SUCCESS: no tabulators found."
return 0
fi
}
function markdown_you_find_eschew_you {
find . -name \*.md ! -path '*/vendor/*' ! -path './Documentation/*' ! -path './gopath.proto/*' -exec grep -E --color "[Yy]ou[r]?[ '.,;]" {} + || true
}