check_format: add SC2015 to SHCK_EXCLUDE list.

This shellcheck case warns users when they use the pattern A && B || C
so that they don't accidentally try to use it as an if-then-else
statement. However, there is a valid way of using this pattern to
denote, do A, if it succeeds, do B, if either A or B fails, do C.

Change-Id: I283b433c15d07873befd182e8327f2e0602490aa
Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/476960
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
This commit is contained in:
Seth Howell 2019-12-05 16:13:30 -07:00 committed by Tomasz Zawadzki
parent 64569ea5e5
commit fd73cb78d8

View File

@ -250,6 +250,7 @@ if hash shellcheck 2>/dev/null; then
# SC1090: Can't follow non-constant source. Use a directive to specify location.
# SC1091: Not following: (error message here)
# SC2001: See if you can use ${variable//search/replace} instead.
# SC2015: Note that A && B || C is not if-then-else. C may run when A is true.
# SC2016: Expressions don't expand in single quotes, use double quotes for that.
# SC2119: Use foo "$@" if function's $1 should mean script's $1.
# SC2120: foo references arguments, but none are ever passed.
@ -262,7 +263,7 @@ if hash shellcheck 2>/dev/null; then
# or split robustly with mapfile or read -a.
# SC2207: Prefer mapfile or read -a to split command output (or quote to avoid splitting).
# SC2223: This default assignment may cause DoS due to globbing. Quote it.
SHCK_EXCLUDE="$SHCK_EXCLUDE,SC1090,SC1091,SC2016,SC2119,SC2120,SC2148,SC2153,SC2154,SC2164,\
SHCK_EXCLUDE="$SHCK_EXCLUDE,SC1090,SC1091,SC2015,SC2016,SC2119,SC2120,SC2148,SC2153,SC2154,SC2164,\
SC2174,SC2001,SC2206,SC2207,SC2223"
SHCK_FORMAT="diff"