Skip to content

Commit cbd9091

Browse files
committed
refactor/lint: Add ignored suggestions to an array
This avoids duplicating the codes between command and comments.
1 parent cf0c67b commit cbd9091

File tree

1 file changed

+25
-23
lines changed

1 file changed

+25
-23
lines changed

test/lint/lint-shell.sh

Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -22,27 +22,29 @@ if ! command -v shellcheck > /dev/null; then
2222
fi
2323

2424
# Disabled warnings:
25-
# SC1087: Use braces when expanding arrays, e.g. ${array[idx]} (or ${var}[.. to quiet).
26-
# SC1117: Backslash is literal in "\.". Prefer explicit escaping: "\\.".
27-
# SC2001: See if you can use ${variable//search/replace} instead.
28-
# SC2004: $/${} is unnecessary on arithmetic variables.
29-
# SC2005: Useless echo? Instead of 'echo $(cmd)', just use 'cmd'.
30-
# SC2006: Use $(..) instead of legacy `..`.
31-
# SC2016: Expressions don't expand in single quotes, use double quotes for that.
32-
# SC2028: echo won't expand escape sequences. Consider printf.
33-
# SC2046: Quote this to prevent word splitting.
34-
# SC2048: Use "$@" (with quotes) to prevent whitespace problems.
35-
# SC2066: Since you double quoted this, it will not word split, and the loop will only run once.
36-
# SC2086: Double quote to prevent globbing and word splitting.
37-
# SC2116: Useless echo? Instead of 'cmd $(echo foo)', just use 'cmd foo'.
38-
# SC2148: Tips depend on target shell and yours is unknown. Add a shebang.
39-
# SC2162: read without -r will mangle backslashes.
40-
# SC2166: Prefer [ p ] && [ q ] as [ p -a q ] is not well defined.
41-
# SC2166: Prefer [ p ] || [ q ] as [ p -o q ] is not well defined.
42-
# SC2181: Check exit code directly with e.g. 'if mycmd;', not indirectly with $?.
43-
# SC2206: Quote to prevent word splitting, or split robustly with mapfile or read -a.
44-
# SC2207: Prefer mapfile or read -a to split command output (or quote to avoid splitting).
45-
# SC2230: which is non-standard. Use builtin 'command -v' instead.
46-
# SC2236: Don't force -n instead of ! -z.
47-
shellcheck -e SC1087,SC1117,SC2001,SC2004,SC2005,SC2006,SC2016,SC2028,SC2046,SC2048,SC2066,SC2086,SC2116,SC2148,SC2162,SC2166,SC2181,SC2206,SC2207,SC2230,SC2236 \
25+
disabled=(
26+
SC1087 # Use braces when expanding arrays, e.g. ${array[idx]} (or ${var}[.. to quiet).
27+
SC1117 # Backslash is literal in "\.". Prefer explicit escaping: "\\.".
28+
SC2001 # See if you can use ${variable//search/replace} instead.
29+
SC2004 # $/${} is unnecessary on arithmetic variables.
30+
SC2005 # Useless echo? Instead of 'echo $(cmd)', just use 'cmd'.
31+
SC2006 # Use $(..) instead of legacy `..`.
32+
SC2016 # Expressions don't expand in single quotes, use double quotes for that.
33+
SC2028 # echo won't expand escape sequences. Consider printf.
34+
SC2046 # Quote this to prevent word splitting.
35+
SC2048 # Use "$@" (with quotes) to prevent whitespace problems.
36+
SC2066 # Since you double quoted this, it will not word split, and the loop will only run once.
37+
SC2086 # Double quote to prevent globbing and word splitting.
38+
SC2116 # Useless echo? Instead of 'cmd $(echo foo)', just use 'cmd foo'.
39+
SC2148 # Tips depend on target shell and yours is unknown. Add a shebang.
40+
SC2162 # read without -r will mangle backslashes.
41+
SC2166 # Prefer [ p ] && [ q ] as [ p -a q ] is not well defined.
42+
SC2166 # Prefer [ p ] || [ q ] as [ p -o q ] is not well defined.
43+
SC2181 # Check exit code directly with e.g. 'if mycmd;', not indirectly with $?.
44+
SC2206 # Quote to prevent word splitting, or split robustly with mapfile or read -a.
45+
SC2207 # Prefer mapfile or read -a to split command output (or quote to avoid splitting).
46+
SC2230 # which is non-standard. Use builtin 'command -v' instead.
47+
SC2236 # Don't force -n instead of ! -z.
48+
)
49+
shellcheck -e "$(IFS=","; echo "${disabled[*]}")" \
4850
$(git ls-files -- "*.sh" | grep -vE 'src/(secp256k1|univalue)/')

0 commit comments

Comments
 (0)