Merge pull request #15350 from bergzand/pr/whitespacecheck/resolve_shellcheck
whitespacecheck: Resolve most shellcheck issues
This commit is contained in:
commit
a42a3fadd1
13
dist/tools/whitespacecheck/check.sh
vendored
13
dist/tools/whitespacecheck/check.sh
vendored
@ -6,13 +6,13 @@
|
|||||||
# General Public License v2.1. See the file LICENSE in the top level
|
# General Public License v2.1. See the file LICENSE in the top level
|
||||||
# directory for more details.
|
# directory for more details.
|
||||||
|
|
||||||
IGNORE=`awk '{ printf ":!%s ", $0 }' $(dirname "$0")/ignore_list.txt`
|
IGNORE=$(awk '{ printf ":!%s ", $0 }' "$(dirname "$0")/ignore_list.txt")
|
||||||
|
|
||||||
# If no branch but an option is given, unset BRANCH.
|
# If no branch but an option is given, unset BRANCH.
|
||||||
# Otherwise, consume this parameter.
|
# Otherwise, consume this parameter.
|
||||||
BRANCH="${1}"
|
BRANCH="${1}"
|
||||||
if echo "${BRANCH}" | grep -q '^-'; then
|
if echo "${BRANCH}" | grep -q '^-'; then
|
||||||
if [ $(git rev-parse --abbrev-ref HEAD) != "master" ]; then
|
if [ "$(git rev-parse --abbrev-ref HEAD)" != "master" ]; then
|
||||||
BRANCH="master"
|
BRANCH="master"
|
||||||
else
|
else
|
||||||
BRANCH=""
|
BRANCH=""
|
||||||
@ -30,15 +30,18 @@ if [ -z "${BRANCH}" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
git -c core.whitespace="tab-in-indent,tabwidth=4" \
|
git -c core.whitespace="tab-in-indent,tabwidth=4" \
|
||||||
diff --check $(git merge-base ${BRANCH} HEAD) -- *.[ch] ${IGNORE}
|
diff --check "$(git merge-base "${BRANCH}" HEAD)" -- *.[ch] ${IGNORE}
|
||||||
|
|
||||||
RESULT=$?
|
RESULT=$?
|
||||||
|
|
||||||
# Git regards any trailing white space except `\n` as an error so `\r` is
|
# Git regards any trailing white space except `\n` as an error so `\r` is
|
||||||
# checked here, too
|
# checked here, too
|
||||||
git -c core.whitespace="trailing-space" \
|
git -c core.whitespace="trailing-space" \
|
||||||
diff --check $(git merge-base ${BRANCH} HEAD) -- . ${IGNORE}
|
diff --check "$(git merge-base "${BRANCH}" HEAD)" -- . ${IGNORE}
|
||||||
if [ $? -ne 0 ] || [ $RESULT -ne 0 ]
|
|
||||||
|
TRAILING_RESULT=$?
|
||||||
|
|
||||||
|
if [ ${TRAILING_RESULT} -ne 0 ] || [ ${RESULT} -ne 0 ]
|
||||||
then
|
then
|
||||||
echo "ERROR: This change introduces new whitespace errors"
|
echo "ERROR: This change introduces new whitespace errors"
|
||||||
exit 1
|
exit 1
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user