From 1f27333472babcfcc57f9c678ae5059c4260c610 Mon Sep 17 00:00:00 2001 From: Ben Peachey Date: Mon, 28 Mar 2022 13:19:57 +0200 Subject: [PATCH] Change Shellcheck config - Remove SC1091 "Not following source" as all sources should have a `# shellcheck source=...` directive. - Add `disable=SC2230` to allow non-standard `which` for older shellcheck versions (it is already disabled in newer versions). - Add comments for optional checks we might want to enable in the near future. --- .shellcheckrc | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/.shellcheckrc b/.shellcheckrc index c1aa66b..6cef420 100644 --- a/.shellcheckrc +++ b/.shellcheckrc @@ -1,3 +1,6 @@ +# ============================================================================ # +# Disable specific checks +# ---------------------------------------------------------------------------- # # shellcheck disable=SC2034 ## Allow: To read lines rather than words, pipe/redirect to a 'while read' loop @@ -12,5 +15,22 @@ disable=SC2207 ## Allow: Instead of 'let expr', prefer (( expr )) disable=SC2219 -## Allow: Not following source -disable=SC1091 +#Allow: non-standard `which` in shellcheck < 0.7.1 +disable=SC2230 +# ============================================================================ # + +# ============================================================================ # +# Enable optional checks (since 0.7.0). +# ---------------------------------------------------------------------------- # +## Suggest adding a default case in `case` statements +#enable=add-default-case + +## Suggest explicitly using -n in `[ $var ]` +#enable=avoid-nullary-conditions + +## Suggest quoting variables without metacharacters +#enable=quote-safe-variables + +## Suggest putting braces around all variable references +#enable=require-variable-braces +# ============================================================================ #