check_format: Include all potential bash scripts from the repo
Checking only the .sh suffix was omitting ./configure and potentially other bash scripts which don't necessarily have to include said suffix in their name. Signed-off-by: Michal Berger <michalx.berger@intel.com> Change-Id: I6196559e8875de46f80d9c8426577a1a79b5996d Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6026 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Paul Luse <paul.e.luse@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Karol Latecki <karol.latecki@intel.com> Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
This commit is contained in:
parent
bb0f78a278
commit
e7ab45baf7
@ -374,6 +374,15 @@ function check_python_style() {
|
||||
return $rc
|
||||
}
|
||||
|
||||
function get_bash_files() {
|
||||
local sh shebang
|
||||
|
||||
mapfile -t sh < <(git ls-files '*.sh')
|
||||
mapfile -t shebang < <(git grep -l '^#!.*bash')
|
||||
|
||||
printf '%s\n' "${sh[@]}" "${shebang[@]}" | sort -u
|
||||
}
|
||||
|
||||
function check_bash_style() {
|
||||
local rc=0
|
||||
|
||||
@ -392,8 +401,7 @@ function check_bash_style() {
|
||||
silly_plural[1]="s"
|
||||
|
||||
commits=() sh_files=() sh_files_repo=() sh_files_staged=()
|
||||
|
||||
mapfile -t sh_files_repo < <(git ls-files '*.sh')
|
||||
mapfile -t sh_files_repo < <(get_bash_files)
|
||||
# Fetch .sh files only from the commits that are targeted for merge
|
||||
while read -r _ commit; do
|
||||
commits+=("$commit")
|
||||
@ -504,7 +512,7 @@ SC2119,SC2120,SC2148,SC2153,SC2154,SC2164,SC2174,SC2001,SC2206,SC2207,SC2223"
|
||||
SHCK_APPLY=false
|
||||
SHCH_ARGS=" -x -e $SHCK_EXCLUDE -f $SHCK_FORMAT"
|
||||
|
||||
git ls-files '*.sh' | xargs -P$(nproc) -n1 shellcheck $SHCH_ARGS &> shellcheck.log
|
||||
get_bash_files | xargs -P$(nproc) -n1 shellcheck $SHCH_ARGS &> shellcheck.log
|
||||
if [[ -s shellcheck.log ]]; then
|
||||
echo " Bash formatting errors detected!"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user