Skip to content

Commit b98891e

Browse files
committed
Fix shellcheck issues in soundness.sh
1 parent a773fc6 commit b98891e

File tree

4 files changed

+52
-12
lines changed

4 files changed

+52
-12
lines changed

assets/test/sleep.sh

+14
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
11
#!/bin/bash
2+
##===----------------------------------------------------------------------===##
3+
##
4+
## This source file is part of the VS Code Swift open source project
5+
##
6+
## Copyright (c) 2021 the VS Code Swift project authors
7+
## Licensed under Apache License v2.0
8+
##
9+
## See LICENSE.txt for license information
10+
## See CONTRIBUTORS.txt for the list of VS Code Swift project authors
11+
##
12+
## SPDX-License-Identifier: Apache-2.0
13+
##
14+
##===----------------------------------------------------------------------===##
15+
216
sleep "$1"
317
exit "$2"

docker/test-ci.sh

+13
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,17 @@
11
#!/bin/bash
2+
##===----------------------------------------------------------------------===##
3+
##
4+
## This source file is part of the VS Code Swift open source project
5+
##
6+
## Copyright (c) 2021 the VS Code Swift project authors
7+
## Licensed under Apache License v2.0
8+
##
9+
## See LICENSE.txt for license information
10+
## See CONTRIBUTORS.txt for the list of VS Code Swift project authors
11+
##
12+
## SPDX-License-Identifier: Apache-2.0
13+
##
14+
##===----------------------------------------------------------------------===##
215

316
node << 'EOF'
417
const { execSync } = require('child_process');

docker/test.sh

+14
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,18 @@
11
#!/bin/bash
2+
##===----------------------------------------------------------------------===##
3+
##
4+
## This source file is part of the VS Code Swift open source project
5+
##
6+
## Copyright (c) 2021 the VS Code Swift project authors
7+
## Licensed under Apache License v2.0
8+
##
9+
## See LICENSE.txt for license information
10+
## See CONTRIBUTORS.txt for the list of VS Code Swift project authors
11+
##
12+
## SPDX-License-Identifier: Apache-2.0
13+
##
14+
##===----------------------------------------------------------------------===##
15+
216
set -ex
317

418
current_directory=$(pwd)

scripts/soundness.sh

+11-12
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ if [[ "$1" != "--force-run" ]]; then
2525
fi
2626

2727
set -eu
28+
29+
original_dir=$(pwd)
30+
cd "$(dirname "$0")/.."
31+
2832
here="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
2933

3034
function replace_acceptable_years() {
@@ -81,8 +85,8 @@ EOF
8185
;;
8286
esac
8387

84-
expected_lines=$(cat "$tmp" | wc -l)
85-
expected_sha=$(cat "$tmp" | shasum)
88+
expected_lines=$(wc -l < "$tmp")
89+
expected_sha=$(shasum < "$tmp")
8690

8791
(
8892
cd "$here/.."
@@ -98,16 +102,10 @@ EOF
98102
\( \! -path './coverage/*' -a \
99103
\( "${matching_files[@]}" \) \
100104
\) \) \) \) \) \) \) \)
101-
102-
if [[ "$language" = bash ]]; then
103-
# add everything with a shell shebang too
104-
git grep --full-name -l '#!/bin/bash'
105-
git grep --full-name -l '#!/bin/sh'
106-
fi
107-
} | while read line; do
108-
if [[ "$(cat "$line" | replace_acceptable_years | head -n $expected_lines | shasum)" != "$expected_sha" ]]; then
109-
printf "\033[0;31mmissing headers in file '$line'!\033[0m\n"
110-
diff -u <(cat "$line" | replace_acceptable_years | head -n $expected_lines) "$tmp"
105+
} | while read -r line; do
106+
if [[ "$(replace_acceptable_years < "$line" | head -n "$expected_lines" | shasum)" != "$expected_sha" ]]; then
107+
printf "\033[0;31mmissing headers in file '%s'!\033[0m\n" "$line"
108+
diff -u <(replace_acceptable_years < "$line" | head -n "$expected_lines") "$tmp"
111109
exit 1
112110
fi
113111
done
@@ -116,6 +114,7 @@ EOF
116114
done
117115

118116
rm "$tmp"
117+
cd "$original_dir"
119118

120119
# printf "=> Checking for broken links in documentation... "
121120
# find . -name node_modules -prune -o -name \*.md -print0 | xargs -0 -n1 npx markdown-link-check

0 commit comments

Comments
 (0)