Skip to content

Commit 559f587

Browse files
committed
Fix/silence shellcheck warnings.
1 parent e0198d2 commit 559f587

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

submit_coverity_scan.sh

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ while getopts ':c:dn:u:q' OPT ; do
3838
echo "Error: cannot read '$OPTARG'."
3939
exit 1
4040
fi
41+
# shellcheck source=/dev/null
4142
. "$OPTARG"
4243
;;
4344
d) DEBUG=1 ;;
@@ -70,6 +71,7 @@ if [ -z "$READCONFIG" ]; then
7071
for i in ./cov-submit-data*.sh ; do
7172
# Check if the file exists in case the globbing returned nothing:
7273
[ -r "$i" ] || continue
74+
# shellcheck source=/dev/null
7375
. "$i"
7476
done
7577
fi
@@ -78,7 +80,7 @@ export PATH="$PATH:$COVTOOL/bin"
7880

7981
git_dirty()
8082
{
81-
git diff --quiet --exit-code || echo -n '*'
83+
git diff --quiet --exit-code || printf '*'
8284
}
8385
git_branch()
8486
{
@@ -99,9 +101,9 @@ quietfilter()
99101
}
100102

101103
if [ -n "$GITURL" ]; then
102-
TEMPDIR=`mktemp -d /tmp/cov-scan-XXXXXX`
103-
git clone $QUIETOPT "$GITURL" $TEMPDIR
104-
cd $TEMPDIR
104+
TEMPDIR=$(mktemp -d /tmp/cov-scan-XXXXXX)
105+
git clone $QUIETOPT "$GITURL" "$TEMPDIR"
106+
cd "$TEMPDIR"
105107
make $QUIETMAKE coverity-conf
106108
fi
107109

@@ -113,6 +115,7 @@ if [ -n "$NEWERTHAN" ]; then
113115
fi
114116

115117
COVOPTS='--dir cov-int --fs-capture-search ./'
118+
# shellcheck disable=SC2086
116119
cov-build $COVOPTS make $QUIETMAKE coverity-build 2>&1 | quietfilter
117120

118121
VERSION=$(grep '^VERSION' paths.mk | sed 's/.*= *//')
@@ -121,11 +124,12 @@ DESC="git: $(git_branch)$(git_dirty) $(git_commit)"
121124
for i in ./cov-submit-data*.sh ; do
122125
# Check if the file exists in case the globbing returned nothing:
123126
[ -r "$i" ] || continue
127+
# shellcheck source=/dev/null
124128
. "$i"
125129
done
126130

127131
# Check if we have all submission data:
128-
if [ -z "$PROJECT" -o -z "$EMAIL" -o -z "$TOKEN" ]; then
132+
if [ -z "$PROJECT" ] || [ -z "$EMAIL" ] || [ -z "$TOKEN" ]; then
129133
echo "Error: missing submission data: PROJECT, EMAIL or TOKEN not specified."
130134
echo "PROJECT=$PROJECT"
131135
echo "EMAIL=$EMAIL"
@@ -139,19 +143,19 @@ tar caf "$ARCHIVE" cov-int
139143

140144
[ -n "$QUIET" ] || echo "Submitting '$VERSION' '$DESC'"
141145

142-
TMP=`mktemp --tmpdir curl-cov-submit-XXXXXX.html`
146+
TMP=$(mktemp --tmpdir curl-cov-submit-XXXXXX.html)
143147

144148
${DEBUG:+echo} \
145149
curl --form token="$TOKEN" --form email="$EMAIL" --form file=@"$ARCHIVE" \
146150
--form version="$VERSION" --form description="$VERSION - $DESC" \
147-
-o $TMP ${QUIET:+-s} https://scan.coverity.com/builds?project="$PROJECT" 2>&1 \
151+
-o "$TMP" ${QUIET:+-s} https://scan.coverity.com/builds?project="$PROJECT" 2>&1 \
148152
| quietfilter
149153

150-
[ -n "$QUIET" ] || grep -vE '^[[:space:]]*$' $TMP
154+
[ -n "$QUIET" ] || grep -vE '^[[:space:]]*$' "$TMP"
151155

152-
rm -f $TMP
156+
rm -f "$TMP"
153157

154-
if [ -n "$GITURL" -a -z "$DEBUG" ]; then
158+
if [ -n "$GITURL" ] && [ -z "$DEBUG" ]; then
155159
rm -rf "$TEMPDIR"
156160
fi
157161

0 commit comments

Comments
 (0)