Skip to content

Commit b438707

Browse files
committed
Clean up lint errors in shell scripts
1 parent 1ab610c commit b438707

7 files changed

+34
-34
lines changed

bin/release

+26-26
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ setup() {
3939
else
4040
echo "Cannot determine version - multiple tags point at HEAD:" >&2
4141
for TAG in $HEAD_TAGS; do
42-
echo -e "\t$TAG" >&2
42+
echo -e "\\t$TAG" >&2
4343
done
4444
exit 1
4545
fi
@@ -65,8 +65,8 @@ build() {
6565

6666
echo "== Clone repo at $LATEST_TAG for version $VERSION"
6767
if [ -d "$RELEASE_DIR" ]; then
68-
echo -e "\u2757 Release directory $RELEASE_DIR already exists, you may want to" >&2
69-
echo -e "\trm -rf $RELEASE_DIR" >&2
68+
echo -e "\\u2757 Release directory $RELEASE_DIR already exists, you may want to" >&2
69+
echo -e "\\trm -rf $RELEASE_DIR" >&2
7070
exit 1
7171
fi
7272

@@ -78,7 +78,7 @@ build() {
7878
## Check that the top changelog entry is this version
7979
if ! latest_changelog=$(perl -nle'print $& if m{(?<=^## Release ).*}' ./CHANGELOG.md | head -1) \
8080
|| ! [ "$latest_changelog" = "$VERSION" ]; then
81-
echo -e "\u2757 Latest changelog entry \"$latest_changelog\" does not match the release version $VERSION" >&2
81+
echo -e "\\u2757 Latest changelog entry \"$latest_changelog\" does not match the release version $VERSION" >&2
8282
exit 1
8383
fi
8484

@@ -93,7 +93,7 @@ build() {
9393
if make tests SUDO="$SUDO"; then
9494
echo -e '\u2713 Tests pass'
9595
else
96-
echo -e "\u2757 Tests failed, probably best not publish this one" >&2
96+
echo -e "\\u2757 Tests failed, probably best not publish this one" >&2
9797
exit 1
9898
fi
9999

@@ -119,20 +119,20 @@ draft() {
119119

120120
## Check that the tag exists by looking at github
121121
if ! curl -sSf "https://api.github.com/repos/$GITHUB_USER/scope/git/tags/$LATEST_TAG_SHA" >/dev/null 2>&1; then
122-
echo -e "\u2757 Tag $LATEST_TAG is not on GitHub, or is not the same as the local tag" >&2
123-
echo -e "\thttps://github.com/$GITHUB_USER/scope/tags" >&2
122+
echo -e "\\u2757 Tag $LATEST_TAG is not on GitHub, or is not the same as the local tag" >&2
123+
echo -e "\\thttps://github.com/$GITHUB_USER/scope/tags" >&2
124124
echo "You may need to" >&2
125-
echo -e "\tgit push [email protected]:$GITHUB_USER/scope $LATEST_TAG"
125+
echo -e "\\tgit push [email protected]:$GITHUB_USER/scope $LATEST_TAG"
126126
exit 1
127127
fi
128128

129-
echo -e "\u2713 Tag $LATEST_TAG exists in GitHub repo $GITHUB_USER/scope"
129+
echo -e "\\u2713 Tag $LATEST_TAG exists in GitHub repo $GITHUB_USER/scope"
130130

131131
## Check that the version does not already exist by looking at github
132132
## releases
133133
if github-release info --user "$GITHUB_USER" --repo scope --tag "$LATEST_TAG" >/dev/null 2>&1; then
134-
echo -e "\u2757 Release $LATEST_TAG already exists on GitHub" >&2
135-
echo -e "\thttps://github.com/$GITHUB_USER/scope/releases/$LATEST_TAG" >&2
134+
echo -e "\\u2757 Release $LATEST_TAG already exists on GitHub" >&2
135+
echo -e "\\thttps://github.com/$GITHUB_USER/scope/releases/$LATEST_TAG" >&2
136136
exit 1
137137
fi
138138

@@ -144,7 +144,7 @@ draft() {
144144
fi
145145

146146
echo "== Creating GitHub release $RELEASE_ARGS $RELEASE_NAME $VERSION"
147-
github-release release $RELEASE_ARGS \
147+
github-release release "$RELEASE_ARGS" \
148148
--user "$GITHUB_USER" \
149149
--repo scope \
150150
--tag "$LATEST_TAG" \
@@ -159,7 +159,7 @@ draft() {
159159
--file "./scope"
160160

161161
echo "** Draft $TYPE $RELEASE_NAME $VERSION created at"
162-
echo -e "\thttps://github.com/$GITHUB_USER/scope/releases/$LATEST_TAG"
162+
echo -e "\\thttps://github.com/$GITHUB_USER/scope/releases/$LATEST_TAG"
163163
}
164164

165165
publish() {
@@ -177,22 +177,22 @@ publish() {
177177
--tag "$LATEST_TAG"
178178

179179
echo "** Pre-release $RELEASE_NAME $VERSION published at"
180-
echo -e "\thttps://github.com/$GITHUB_USER/scope/releases/$LATEST_TAG"
180+
echo -e "\\thttps://github.com/$GITHUB_USER/scope/releases/$LATEST_TAG"
181181
else
182182
echo "== Sanity checks"
183183
if ! [ "$LATEST_TAG_COMMIT_SHA" == "$LATEST_RELEASE_COMMIT_SHA" ]; then
184-
echo -e "\u2757 The tag latest_release does not point to the same commit as $LATEST_TAG" >&2
184+
echo -e "\\u2757 The tag latest_release does not point to the same commit as $LATEST_TAG" >&2
185185
echo "You may need to" >&2
186-
echo -e "\tgit tag -af latest_release $LATEST_TAG" >&2
186+
echo -e "\\tgit tag -af latest_release $LATEST_TAG" >&2
187187
exit 1
188188
fi
189189

190190
## Check that the 'latest_release' tag exists by looking at github
191191
if ! curl -sSf "https://api.github.com/repos/$GITHUB_USER/scope/git/tags/$LATEST_RELEASE_SHA" >/dev/null 2>&1; then
192-
echo -e "\u2757 Tag latest_release is not on GitHub, or is not the same as the local tag" >&2
193-
echo -e "\thttps://github.com/$GITHUB_USER/scope/tags" >&2
192+
echo -e "\\u2757 Tag latest_release is not on GitHub, or is not the same as the local tag" >&2
193+
echo -e "\\thttps://github.com/$GITHUB_USER/scope/tags" >&2
194194
echo "You may need to" >&2
195-
echo -e "\tgit push -f [email protected]:$GITHUB_USER/scope latest_release" >&2
195+
echo -e "\\tgit push -f [email protected]:$GITHUB_USER/scope latest_release" >&2
196196
exit 1
197197
fi
198198
echo '** Sanity checks OK for publishing tag' "$LATEST_TAG" as "$DOCKERHUB_USER/scope:$VERSION"
@@ -229,8 +229,8 @@ publish() {
229229
--file "./scope"
230230

231231
echo "** Release $RELEASE_NAME $VERSION published at"
232-
echo -e "\thttps://github.com/$GITHUB_USER/scope/releases/$LATEST_TAG"
233-
echo -e "\thttps://github.com/$GITHUB_USER/scope/releases/latest_release"
232+
echo -e "\\thttps://github.com/$GITHUB_USER/scope/releases/$LATEST_TAG"
233+
echo -e "\\thttps://github.com/$GITHUB_USER/scope/releases/latest_release"
234234
fi
235235
}
236236

@@ -254,19 +254,19 @@ push_images() {
254254

255255
usage() {
256256
echo "Usage:"
257-
echo -e "\t./bin/release build"
257+
echo -e "\\t./bin/release build"
258258
echo "-- Build artefacts for the latest version tag"
259-
echo -e "\t./bin/release draft"
259+
echo -e "\\t./bin/release draft"
260260
echo "-- Create draft release with artefacts in GitHub"
261-
echo -e "\t./bin/release publish"
261+
echo -e "\\t./bin/release publish"
262262
echo "-- Publish the GitHub release and update DockerHub"
263263
exit 1
264264
}
265265

266266
# Ensure required tooling is installed
267-
if ! which github-release >/dev/null; then
267+
if ! command -v github-release >/dev/null; then
268268
echo "Please install git-release:" >&2
269-
echo -e "\tgo get github.com/weaveworks/github-release" >&2
269+
echo -e "\\tgo get github.com/weaveworks/github-release" >&2
270270
echo "and create a git token per https://github.com/weaveworks/github-release" >&2
271271
exit 1
272272
fi

extras/build_on_circle.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
set -e
44

5-
./in_parallel.sh "make RM=" "$(find . -maxdepth 2 -name "*.go" -printf "%h\n" | sort -u | sed -n 's/\.\/\(.*\)/\1\/\1/p')"
5+
./in_parallel.sh "make RM=" "$(find . -maxdepth 2 -name "*.go" -printf "%h\\n" | sort -u | sed -n 's/\.\/\(.*\)/\1\/\1/p')"

extras/dialer/dialer

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ while true; do
2323
rand=$(((RANDOM % max_dialer) + 1))
2424
container=${dialer[$rand]}
2525
docker rm -f "$container" >/dev/null &
26-
unset dialer[$rand]
26+
unset "dialer[$rand]"
2727
dialer=("${dialer[@]}")
2828
fi
2929

extras/generate_latest_map

+1-1
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ function generate_latest_map() {
211211
func (m ${latest_map_type}) String() string {
212212
buf := bytes.NewBufferString("{")
213213
for _, val := range m {
214-
fmt.Fprintf(buf, "%s: %s,\n", val.key, val.String())
214+
fmt.Fprintf(buf, "%s: %s,\\n", val.key, val.String())
215215
}
216216
fmt.Fprintf(buf, "}")
217217
return buf.String()

integration/410_container_control_test.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ PROBEID=$(docker_on "$HOST1" logs weavescope 2>&1 | grep "probe starting" | sed
2020
# container's PATH settings are respected, which isn't the case for
2121
# login shells.
2222
PIPEID=$(curl -s -f -X POST "http://$HOST1:4040/api/control/$PROBEID/$CID;<container>/docker_exec_container" | jq -r '.pipe')
23-
assert "(sleep 1 && echo 'echo \$PATH' && sleep 1) | wscat -b 'ws://$HOST1:4040/api/pipe/$PIPEID' | col -pb" "/ # 6necho \$PATH\n/home:/usr/bin\n/ # 6n"
23+
assert "(sleep 1 && echo 'echo \$PATH' && sleep 1) | wscat -b 'ws://$HOST1:4040/api/pipe/$PIPEID' | col -pb" "/ # 6necho \$PATH\\n/home:/usr/bin\\n/ # 6n"
2424

2525
assert_raises "curl -f -X POST 'http://$HOST1:4040/api/control/$PROBEID/$CID;<container>/docker_stop_container'"
2626

integration/420_host_control_test.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@ HOSTID=$($SSH "$HOST1" hostname)
1515

1616
# Execute 'echo foo' in the host tty and check its output
1717
PIPEID=$(curl -s -f -X POST "http://$HOST1:4040/api/control/$PROBEID/$HOSTID;<host>/host_exec" | jq -r '.pipe')
18-
assert "(sleep 1 && echo \"PS1=''; echo foo\" && sleep 1) | wscat -b 'ws://$HOST1:4040/api/pipe/$PIPEID' | col -pb | tail -n 1" "foo\n"
18+
assert "(sleep 1 && echo \"PS1=''; echo foo\" && sleep 1) | wscat -b 'ws://$HOST1:4040/api/pipe/$PIPEID' | col -pb | tail -n 1" "foo\\n"
1919

2020
scope_end_suite

scope

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ SCOPE_IMAGE="$SCOPE_IMAGE_NAME:$IMAGE_VERSION"
1818
# with care.
1919
SCOPE_CONTAINER_NAME="${SCOPE_CONTAINER_NAME:-weavescope}"
2020
SCOPE_APP_CONTAINER_NAME="${SCOPE_APP_CONTAINER_NAME:-weavescope-app}"
21-
IP_REGEXP="[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}"
21+
IP_REGEXP="[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}"
2222
IP_ADDR_CMD="find /sys/class/net -type l | xargs -n1 basename | grep -vE 'docker|veth|lo' | \
2323
xargs -n1 ip addr show | grep inet | awk '{ print \$2 }' | grep -oE '$IP_REGEXP'"
2424
LISTENING_IP_ADDR_CMD="for I in \$( $IP_ADDR_CMD ); do if curl -m 1 -s \${I}:4040 > /dev/null ; then echo \${I}; fi; done"
@@ -112,11 +112,11 @@ check_docker_version() {
112112
}
113113

114114
check_probe_only() {
115-
echo "${ARGS}" | grep -q -E "\-\-no\-app|\-\-service\-token|\-\-probe\-only"
115+
echo "${ARGS}" | grep -q -E -e "--no-app|--service-token|--probe-only"
116116
}
117117

118118
check_listen_address_arg() {
119-
echo "${ARGS}" | grep -q -E "\-\-app\.http\.address"
119+
echo "${ARGS}" | grep -q -E -e "--app\\.http\\.address"
120120
}
121121

122122
check_docker_for_mac() {

0 commit comments

Comments
 (0)