ShellCheck raising warnings
Fdawgs opened this issue · 4 comments
Fdawgs commented
Hi there,
ShellCheck appears to be throwing some new warnings with release.sh
, are they anything to worry about?
I notice you've already made some changes due to ShellCheck in the past:
af82e28
e605a2c
p3lim commented
Current master:
In release.sh line 96:
[ -n "$skip_invalid" ] && invalid="&"
^-----------^ SC2154: skip_invalid is referenced but not assigned.
In release.sh line 545:
_si_tag_from_revision=$( echo "$_si_tag_line" | sed -e 's/^.*:\([0-9]\{1,\}\)).*$/\1/' ) # (from /project/trunk:N)
^-- SC2001: See if you can use ${variable//search/replace} instead.
In release.sh line 997:
for _vcs_ignore in $( cd "$topdir" && svn status --no-ignore --ignore-externals | awk '/^[?IX]/' | cut -c9- | tr '\\' '/' ); do
^-- SC1003: Want to escape a single quote? echo 'This is how it'\''s done'.
In release.sh line 1175:
package=$( cd "$topdir" && find *.toc -maxdepth 0 2>/dev/null | sort -dr | head -n1 )
^-- SC2035: Use ./*glob* or -- *glob* so names with dashes won't become options.
In release.sh line 1377:
set -- ${_ul_params}
^-----------^ SC2086: Double quote to prevent globbing and word splitting.
Did you mean:
set -- "${_ul_params}"
In release.sh line 1518:
sed -e $'1s/^\xEF\xBB\xBF//' -e '1i\
^-- SC1004: This backslash+linefeed is literal. Break outside single quotes if you just want to break the line.
In release.sh line 1912:
slug= #$_external_slug
^--^ SC2030: Modification of slug is local (to subshell caused by (..) group).
In release.sh line 1913:
project_site=
^----------^ SC2030: Modification of project_site is local (to subshell caused by (..) group).
In release.sh line 1914:
package=
^-----^ SC2030: Modification of package is local (to subshell caused by (..) group).
In release.sh line 2123:
project="$package"
^------^ SC2031: package was modified in a subshell. That change might be lost.
In release.sh line 2446:
( cd "$releasedir" && zip -X -r "$archive" $contents )
^-------^ SC2086: Double quote to prevent globbing and word splitting.
Did you mean:
( cd "$releasedir" && zip -X -r "$archive" "$contents" )
In release.sh line 2472:
( set -f; cd "$releasedir" && zip -X -r -q "$nolib_archive" $contents -x $nolib_exclude )
^-------^ SC2086: Double quote to prevent globbing and word splitting.
^------------^ SC2086: Double quote to prevent globbing and word splitting.
Did you mean:
( set -f; cd "$releasedir" && zip -X -r -q "$nolib_archive" "$contents" -x "$nolib_exclude" )
In release.sh line 2487:
if [[ -n "$skip_cf_upload" || -z "$slug" || -z "$cf_token" || -z "$project_site" ]]; then
^---^ SC2031: slug was modified in a subshell. That change might be lost.
^-----------^ SC2031: project_site was modified in a subshell. That change might be lost.
In release.sh line 2492:
_cf_versions=$( curl -s -H "x-api-token: $cf_token" $project_site/api/game/versions )
^-----------^ SC2031: project_site was modified in a subshell. That change might be lost.
In release.sh line 2516:
echo "Error fetching game version info from $project_site/api/game/versions"
^-----------^ SC2031: project_site was modified in a subshell. That change might be lost.
In release.sh line 2547:
echo "Uploading $archive_name ($_cf_game_version $file_type) to $project_site/projects/$slug"
^-----------^ SC2031: project_site was modified in a subshell. That change might be lost.
^---^ SC2031: slug was modified in a subshell. That change might be lost.
In release.sh line 2554:
"$project_site/api/projects/$slug/upload-file"
^-----------^ SC2031: project_site was modified in a subshell. That change might be lost.
^---^ SC2031: slug was modified in a subshell. That change might be lost.
In release.sh line 2564:
echo "Error! No project for \"$slug\" found."
^---^ SC2031: slug was modified in a subshell. That change might be lost.
For more information:
https://www.shellcheck.net/wiki/SC2154 -- skip_invalid is referenced but no...
https://www.shellcheck.net/wiki/SC1003 -- Want to escape a single quote? ec...
https://www.shellcheck.net/wiki/SC1004 -- This backslash+linefeed is litera...
Fdawgs commented
Cheers @p3lim,
The site itself also highlights a few additional ones, i.e.:
Line 534:
case ${_si_url#${_si_root}/} in
^-- SC2295 (info): Expansions inside ${..} need to be quoted separately, otherwise they match as patterns.
nebularg commented
i use project settings for most things, the things here are not an issue
"shellcheck.customArgs": [
"--severity=warning",
],
"shellcheck.exclude": [
"2295",
"2015",
"2030",
"2031",
"2001",
"1003"
],