mirror of
https://github.com/SCST-project/scst.git
synced 2026-05-23 13:41:27 +00:00
scripts: Fix shellcheck warnings for checkpatch scripts
- Switching from 'set -e' to 'set -euo pipefail' for better error handling.
- Quoting all variable expansions to prevent word splitting and globbing.
- Replacing legacy unquoted $(...) and $@ with quoted forms.
- Using array-safe idioms where necessary (e.g., "${src_files[@]}").
This patch doesn't change any functionality.
This commit is contained in:
@@ -1,21 +1,21 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
set -euo pipefail
|
||||
|
||||
rootdir=$(readlink -f $(dirname $0)/..)
|
||||
scriptsdir=${rootdir}/scripts
|
||||
base_commit=${1:-master}
|
||||
rootdir="$(readlink -f "$(dirname "$0")/..")"
|
||||
scriptsdir="${rootdir}/scripts"
|
||||
base_commit="${1:-master}"
|
||||
|
||||
commits=$(cd ${rootdir} && git log --pretty=format:"%h" ${base_commit}..HEAD)
|
||||
commits=$(cd "${rootdir}" && git log --pretty=format:"%h" "${base_commit}"..HEAD)
|
||||
err=0
|
||||
|
||||
for commit in $commits; do
|
||||
echo "Running checkpatch for commit $commit"
|
||||
for commit in ${commits}; do
|
||||
echo "Running checkpatch for commit ${commit}"
|
||||
echo -e "========================================\n"
|
||||
|
||||
(cd ${rootdir} &&
|
||||
git format-patch -1 --stdout $commit | ${scriptsdir}/checkpatch -) || err=1
|
||||
(cd "${rootdir}" &&
|
||||
git format-patch -1 --stdout "${commit}" | "${scriptsdir}/checkpatch" -) || err=1
|
||||
echo -e "\n"
|
||||
done
|
||||
|
||||
exit $err
|
||||
exit "${err}"
|
||||
|
||||
Reference in New Issue
Block a user