-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.shellcheckrc
executable file
·77 lines (60 loc) · 2.45 KB
/
.shellcheckrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
shell="/usr/bin/env bash"
source-path=SCRIPTDIR
external-sources=true
# enable options:
# after running shellcheck --list-optional
# command executed on 2023-08-05
# all of the options below were found to be useful
# all are now enabled.
# if new options are added to shellcheck
# one should update this list and note the date.
# even without code change,
# we will include them by default
# by choosing 'all' as the enable option.
# if one reduces enabled options,
# one should at least include all of these,
# along with an updated list including
# the option which isn't wanted
# and a description of why it isn't wanted
#
# [nix-shell:~/code]$ shellcheck --list-optional
# name: add-default-case
# desc: Suggest adding a default case in `case` statements
# example: case $? in 0) echo 'Success';; esac
# fix: case $? in 0) echo 'Success';; *) echo 'Fail' ;; esac
# name: avoid-nullary-conditions
# desc: Suggest explicitly using -n in `[ $var ]`
# example: [ "$var" ]
# fix: [ -n "$var" ]
# name: check-extra-masked-returns
# desc: Check for additional cases where exit codes are masked
# example: rm -r "$(get_chroot_dir)/home"
# fix: set -e; dir="$(get_chroot_dir)"; rm -r "$dir/home"
# name: check-set-e-suppressed
# desc: Notify when set -e is suppressed during function invocation
# example: set -e; func() { cp *.txt ~/backup; rm *.txt; }; func && echo ok
# fix: set -e; func() { cp *.txt ~/backup; rm *.txt; }; func; echo ok
# name: check-unassigned-uppercase
# desc: Warn when uppercase variables are unassigned
# example: echo $VAR
# fix: VAR=hello; echo $VAR
# name: deprecate-which
# desc: Suggest 'command -v' instead of 'which'
# example: which javac
# fix: command -v javac
# name: quote-safe-variables
# desc: Suggest quoting variables without metacharacters
# example: var=hello; echo $var
# fix: var=hello; echo "$var"
# name: require-double-brackets
# desc: Require [[ and warn about [ in Bash/Ksh
# example: [ -e /etc/issue ]
# fix: [[ -e /etc/issue ]]
# name: require-variable-braces
# desc: Suggest putting braces around all variable references
# example: var=hello; echo $var
# fix: var=hello; echo ${var}
# enable:
# enable=add-default-case,avoid-nullary-conditions,check-extra-masked-returns,check-set-e-suppressed,check-unassigned-uppercase,deprecate-which,quote-safe-variables,require-double-brackets,require-variable-braces
enable: all
disable: require-variable-braces