Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit7dd8add

Browse files
committed
Suppress SC2086 where word splitting is intended
This suppresses ShellCheck SC2016, "Double quote to preventglobbing and word splitting," on the command in the version checkscript that expands $config_opts to build the "-c ..." arguments.It also moves the code repsonsible for getting the latest tag,which this is part of, into a function for that purpose, so it'sclear that building config_opts is specifically for that, and sothat the code is not made harder to read by adding the ShellChecksuppression comment.(The suppression applies only to the immediate next command.)
1 parentf3be76f commit7dd8add

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

‎check-version.sh

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,13 @@ trap 'echo "$0: Check failed. Stopping." >&2' ERR
1010
readonly version_path='VERSION'
1111
readonly changes_path='doc/source/changes.rst'
1212

13+
functionget_latest_tag() {
14+
local config_opts
15+
config_opts="$(printf' -c versionsort.suffix=-%s' alpha beta pre rc RC)"
16+
# shellcheck disable=SC2086 # Deliberately word-splitting the arguments.
17+
git$config_opts tag -l'[0-9]*' --sort=-v:refname| head -n1
18+
}
19+
1320
echo'Checking current directory.'
1421
test"$(cd --"$(dirname --"$0")"&& pwd)" ="$(pwd)"# Ugly, but portable.
1522

@@ -26,8 +33,7 @@ test -z "$(git status -s --ignore-submodules)"
2633

2734
version_version="$(cat"$version_path")"
2835
changes_version="$(awk'/^[0-9]/ {print $0; exit}'"$changes_path")"
29-
config_opts="$(printf' -c versionsort.suffix=-%s' alpha beta pre rc RC)"
30-
latest_tag="$(git$config_opts tag -l'[0-9]*' --sort=-v:refname| head -n1)"
36+
latest_tag="$(get_latest_tag)"
3137
head_sha="$(git rev-parse HEAD)"
3238
latest_tag_sha="$(git rev-parse"${latest_tag}^{commit}")"
3339

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp