From fd73cb78d8c00aab3893d0709c104ee734949007 Mon Sep 17 00:00:00 2001 From: Seth Howell Date: Thu, 5 Dec 2019 16:13:30 -0700 Subject: [PATCH] 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 Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/476960 Community-CI: SPDK CI Jenkins Tested-by: SPDK CI Jenkins Reviewed-by: Ben Walker Reviewed-by: Jim Harris Reviewed-by: Paul Luse Reviewed-by: Shuhei Matsumoto Reviewed-by: Karol Latecki --- scripts/check_format.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/check_format.sh b/scripts/check_format.sh index 9ffc079e0..19265039f 100755 --- a/scripts/check_format.sh +++ b/scripts/check_format.sh @@ -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"