Skip to content

Commit c980b58

Browse files
committed
refactor: normalize from var='' to var=""
shellcheck requires us putting '' or "" on the right-hand sides of variable assignments unless `=' is at the end of line. In the current codebase, there are variations on var='' and var="", where most instances are latter. In this commit, I rewrite all var='' to match the majority var="".
1 parent 9d0e600 commit c980b58

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

bash_completion

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ _comp_split()
346346
{
347347
local _assign='=' IFS=$' \t\n'
348348

349-
local OPTIND=1 OPTARG='' OPTERR=0 _opt
349+
local OPTIND=1 OPTARG="" OPTERR=0 _opt
350350
while getopts ':alF:' _opt "$@"; do
351351
case $_opt in
352352
a) _assign='+=' ;;
@@ -936,7 +936,7 @@ _comp_initialize()
936936
{
937937
local exclude="" outx errx inx
938938

939-
local flag OPTIND=1 OPTARG='' OPTERR=0
939+
local flag OPTIND=1 OPTARG="" OPTERR=0
940940
while getopts "n:e:o:i:s" flag "$@"; do
941941
case $flag in
942942
n) exclude+=$OPTARG ;;
@@ -2115,7 +2115,7 @@ _cd()
21152115
return
21162116
fi
21172117

2118-
local mark_dirs='' mark_symdirs=''
2118+
local mark_dirs="" mark_symdirs=""
21192119
_comp_readline_variable_on mark-directories && mark_dirs=y
21202120
_comp_readline_variable_on mark-symlinked-directories && mark_symdirs=y
21212121

completions/dpkg

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ if _comp_have_command grep-status; then
1313
else
1414
_comp_xfunc_dpkg_installed_packages()
1515
{
16-
command awk -F '\n' -v RS='' "
16+
command awk -F '\n' -v RS="" "
1717
index(\$1, \"Package: ${1-}\") == 1 &&
1818
\$2 ~ /ok installed|half-installed|unpacked|half-configured|^Essential: yes/ {
1919
print(substr(\$1, 10));
@@ -22,7 +22,7 @@ else
2222

2323
_comp_xfunc_dpkg_purgeable_packages()
2424
{
25-
command awk -F '\n' -v RS='' "
25+
command awk -F '\n' -v RS="" "
2626
index(\$1, \"Package: ${1-}\") == 1 &&
2727
\$2 ~ /ok installed|half-installed|unpacked|half-configured|config-files|^Essential: yes/ {
2828
print(substr(\$1, 10));

test/t/unit/test_unit_variables.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ def functions(self, request, bash):
1111
assert_bash_exec(
1212
bash, "unset assoc2 && declare -A assoc2=([idx1]=1 [idx2]=2)"
1313
)
14-
assert_bash_exec(bash, "unset ${!___v*} && declare ___var=''")
14+
assert_bash_exec(bash, 'unset ${!___v*} && declare ___var=""')
1515
request.addfinalizer(
1616
lambda: assert_bash_exec(bash, "unset ___var assoc1 assoc2")
1717
)

0 commit comments

Comments
 (0)