File tree Expand file tree Collapse file tree 12 files changed +39
-38
lines changed Expand file tree Collapse file tree 12 files changed +39
-38
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ disable=SC1090 # not really fixable usually (ever?)
5
5
disable =SC2034 # for localizing variables set in called functions
6
6
disable =SC2128 # intentional style choice
7
7
disable =SC2206 # suggested alternatives fail in posix mode or use temp files
8
+ disable =SC2209 # interferes with our `set` (literal) vs empty booleans
8
9
disable =SC2207 # suggested alternatives fail in posix mode or use temp files
9
10
10
11
# These disables are to be investigated and decided
Original file line number Diff line number Diff line change @@ -859,16 +859,16 @@ _variables()
859
859
# -k: do not filter out already present tokens in value
860
860
_comp_delimited ()
861
861
{
862
- local prefix=" " delimiter=$1 deduplicate=true
862
+ local prefix=" " delimiter=$1 deduplicate=set
863
863
shift
864
864
if [[ $delimiter == -k ]]; then
865
- deduplicate=false
865
+ deduplicate=" "
866
866
delimiter=$1
867
867
shift
868
868
fi
869
869
[[ $cur == * $delimiter * ]] && prefix=${cur% " $delimiter " * } $delimiter
870
870
871
- if $deduplicate ; then
871
+ if [[ $deduplicate ]] ; then
872
872
# We could construct a -X pattern to feed to compgen, but that'd
873
873
# conflict with possibly already set -X in $@, as well as have
874
874
# glob char escaping issues to deal with. Do removals by hand instead.
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ _comp_cmd_export()
5
5
local cur prev words cword comp_args
6
6
_comp_initialize -n := -- " $@ " || return
7
7
8
- local i action=variable remove=false
8
+ local i action=variable remove=" "
9
9
for (( i = 1 ; i < cword; i++ )) ; do
10
10
case ${words[i]} in
11
11
-p)
@@ -15,7 +15,7 @@ _comp_cmd_export()
15
15
action=function
16
16
;;&
17
17
-* n* )
18
- remove=true
18
+ remove=set
19
19
;;
20
20
-* )
21
21
continue
@@ -52,7 +52,7 @@ _comp_cmd_export()
52
52
return
53
53
fi
54
54
local suffix=" "
55
- if ! $remove && [[ $action != function ]]; then
55
+ if [[ ! $remove && $action != function ]]; then
56
56
suffix= " ="
57
57
compopt -o nospace
58
58
fi
Original file line number Diff line number Diff line change @@ -64,14 +64,14 @@ _comp_cmd_find()
64
64
;;
65
65
esac
66
66
67
- local i exprfound=false
67
+ local i exprfound=" "
68
68
# set exprfound to true if there is already an expression present
69
69
for i in " ${words[@]} " ; do
70
- [[ $i == [-\(\) ,\! ]* ]] && exprfound=true && break
70
+ [[ $i == [-\(\) ,\! ]* ]] && exprfound=set && break
71
71
done
72
72
73
73
# handle case where first parameter is not a dash option
74
- if ! $exprfound && [[ $cur != [-\(\) ,\! ]* ]]; then
74
+ if [[ ! $exprfound && $cur != [-\(\) ,\! ]* ]]; then
75
75
_filedir -d
76
76
return
77
77
fi
Original file line number Diff line number Diff line change @@ -115,17 +115,17 @@ _comp_cmd_fio()
115
115
# For example, for --kb_base=:
116
116
# valid values: 1024 [...]
117
117
# : 1000 [...]
118
- local line=" " in_values=false
118
+ local line=" " in_values=" "
119
119
ret=()
120
120
for line in " ${cmdhelp[@]} " ; do
121
- if $in_values ; then
121
+ if [[ $in_values ]] ; then
122
122
if [[ $line =~ ^[[:space:]]* :[[:space:]]* ([^[:space:]]+) ]]; then
123
123
ret+=(" ${BASH_REMATCH[1]} " )
124
124
else
125
125
break
126
126
fi
127
127
elif [[ $line =~ ^[[:space:]]* valid\ values:[[:space:]]* ([^[:space:]]+) ]]; then
128
- in_values=true
128
+ in_values=set
129
129
ret+=(" ${BASH_REMATCH[1]} " )
130
130
fi
131
131
done
Original file line number Diff line number Diff line change @@ -31,16 +31,16 @@ _jarsigner()
31
31
esac
32
32
33
33
# Check if a jar was already given.
34
- local i jar=false
34
+ local i jar=" "
35
35
for (( i = 1 ; i < ${# words[@]} - 1 ; i++ )) ; do
36
36
if [[ ${words[i]} == * .@ (jar| apk) &&
37
37
${words[i - 1]} != -s ignedjar ]]; then
38
- jar=true
38
+ jar=set
39
39
break
40
40
fi
41
41
done
42
42
43
- if ! $jar ; then
43
+ if [[ ! $jar ]] ; then
44
44
if [[ $cur == -* ]]; then
45
45
# Documented as "should not be used": -internalsf, -sectionsonly
46
46
COMPREPLY=($( compgen -W ' -keystore -storepass -storetype
Original file line number Diff line number Diff line change 5
5
local cur prev words cword split comp_args
6
6
_comp_initialize -s -- " $@ " || return
7
7
8
- local decompress=false
8
+ local decompress=" "
9
9
10
10
local noargopts=' !(-*|*[bmsSBdno]*)'
11
11
# shellcheck disable=SC2254
@@ -15,7 +15,7 @@ _lzip()
15
15
return
16
16
;;
17
17
--decompress | -${noargopts} d)
18
- decompress=true
18
+ decompress=set
19
19
;;
20
20
--threads | -${noargopts} n)
21
21
COMPREPLY=($( compgen -W " {1..$( _ncpus) }" -- " $cur " ) )
@@ -35,7 +35,7 @@ _lzip()
35
35
return
36
36
fi
37
37
38
- if $decompress ; then
38
+ if [[ $decompress ]] ; then
39
39
_filedir lz
40
40
return
41
41
fi
Original file line number Diff line number Diff line change @@ -45,15 +45,15 @@ _pack200()
45
45
$split && return
46
46
47
47
# Check if a pack or a jar was already given.
48
- local i pack=false jar=false
48
+ local i pack=" " jar=" "
49
49
for (( i = 1 ; i < ${# words[@]} - 1 ; i++ )) ; do
50
50
case ${words[i]} in
51
- * .pack | * .pack.gz) pack=true ;;
52
- * .jar) jar=true ;;
51
+ * .pack | * .pack.gz) pack=set ;;
52
+ * .jar) jar=set ;;
53
53
esac
54
54
done
55
55
56
- if ! $pack ; then
56
+ if [[ ! $pack ]] ; then
57
57
if [[ $cur == -* ]]; then
58
58
COMPREPLY=($( compgen -W ' --no-gzip --gzip --strip-debug
59
59
--no-keep-file-order --segment-limit= --effort= --deflate-hint=
@@ -65,7 +65,7 @@ _pack200()
65
65
else
66
66
_filedir ' pack?(.gz)'
67
67
fi
68
- elif ! $jar ; then
68
+ elif [[ ! $jar ]] ; then
69
69
_filedir jar
70
70
fi
71
71
} &&
Original file line number Diff line number Diff line change @@ -103,16 +103,16 @@ _pytest()
103
103
104
104
if [[ $cur == * .py::* :* ]]; then
105
105
local file=${cur/ .py:*/ .py}
106
- local class=${cur#* .py:: } in_class=false
106
+ local class=${cur#* .py:: } in_class=" "
107
107
local line
108
108
class=${class%%:* }
109
109
while IFS= read -r line; do
110
110
if [[ $line =~ ^class[[:space:]]+${class} [[:space:]:\( ] ]]; then
111
- in_class=true
111
+ in_class=set
112
112
elif [[ $line =~ ^class[[:space:]] ]]; then
113
- in_class=false
113
+ in_class=" "
114
114
fi
115
- if $in_class && [[ $line =~ ^[[:space:]]+ (async[[:space:]]+)? def[[:space:]]+ (test_[A-Za-z0-9_]+) ]]; then
115
+ if [[ $in_class && $line =~ ^[[:space:]]+ (async[[:space:]]+)? def[[:space:]]+ (test_[A-Za-z0-9_]+) ]]; then
116
116
COMPREPLY+=(${BASH_REMATCH[2]} )
117
117
fi
118
118
done 2> /dev/null < " $file "
Original file line number Diff line number Diff line change @@ -480,16 +480,16 @@ _comp_xfunc_ssh_scp_local_files()
480
480
{
481
481
local IFS=$' \n '
482
482
483
- local dirsonly=false
483
+ local dirsonly=" "
484
484
if [[ ${1-} == -d ]]; then
485
- dirsonly=true
485
+ dirsonly=set
486
486
shift
487
487
fi
488
488
489
489
local files
490
490
_comp_expand_glob files ' "$cur"*'
491
491
(( ${# files[@]} )) || return 0
492
- if $dirsonly ; then
492
+ if [[ $dirsonly ]] ; then
493
493
COMPREPLY+=($( command ls -aF1dL " ${files[@]} " 2> /dev/null |
494
494
command sed -e " s/$_comp_cmd_scp__path_esc /\\\\ &/g" -e ' /[^\/]$/d' \
495
495
-e " s/^/${1-} /" ) )
You can’t perform that action at this time.
0 commit comments