From a07800fbc33b9e282bd83f43c961d4b71b9c00be Mon Sep 17 00:00:00 2001 From: Konstantin Nekrasov Date: Sun, 27 Jun 2021 19:05:08 +0300 Subject: [PATCH] Problem: then word in pcs scripts confuse ShellCheck Pacemaker-related scripts often use 'then' word unquoted and it does work in bash. Example: ``` pcs constraint order VirtualIP then dummy_resource kind=Optional ``` This instruction causes SC1010 warning which seems to be a false-positive. It seems like 'then' word itself is not a keyword in bash. I guess that it is understood as a keyword only in context of `if` clause. Solution: Exclude 'then' from the list of terminal tokens in `readNormalWord` function. --- src/ShellCheck/Parser.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ShellCheck/Parser.hs b/src/ShellCheck/Parser.hs index 3c16d5d..df0859b 100644 --- a/src/ShellCheck/Parser.hs +++ b/src/ShellCheck/Parser.hs @@ -1068,7 +1068,7 @@ prop_readNormalWord9 = isOk readSubshell "(foo\\ ;\nbar)" prop_readNormalWord10 = isWarning readNormalWord "\x201Chello\x201D" prop_readNormalWord11 = isWarning readNormalWord "\x2018hello\x2019" prop_readNormalWord12 = isWarning readNormalWord "hello\x2018" -readNormalWord = readNormalishWord "" ["do", "done", "then", "fi", "esac"] +readNormalWord = readNormalishWord "" ["do", "done", "fi", "esac"] readPatternWord = readNormalishWord "" ["esac"]