From 7f307c5775e43c79e5de2850049df2cac954235b Mon Sep 17 00:00:00 2001 From: Vidar Holen Date: Thu, 12 Jan 2017 19:02:46 -0800 Subject: [PATCH] Count | as a regex metacharacter for 2076. --- ShellCheck/Analytics.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ShellCheck/Analytics.hs b/ShellCheck/Analytics.hs index e6fcd8b..d4d3af8 100644 --- a/ShellCheck/Analytics.hs +++ b/ShellCheck/Analytics.hs @@ -973,6 +973,7 @@ prop_checkQuotedCondRegex2 = verify checkQuotedCondRegex "[[ $foo =~ '(cow|bar)' prop_checkQuotedCondRegex3 = verifyNot checkQuotedCondRegex "[[ $foo =~ $foo ]]" prop_checkQuotedCondRegex4 = verifyNot checkQuotedCondRegex "[[ $foo =~ \"bar\" ]]" prop_checkQuotedCondRegex5 = verifyNot checkQuotedCondRegex "[[ $foo =~ 'cow bar' ]]" +prop_checkQuotedCondRegex6 = verify checkQuotedCondRegex "[[ $foo =~ 'cow|bar' ]]" checkQuotedCondRegex _ (TC_Binary _ _ "=~" _ rhs) = case rhs of T_NormalWord id [T_DoubleQuoted _ _] -> error rhs @@ -983,7 +984,7 @@ checkQuotedCondRegex _ (TC_Binary _ _ "=~" _ rhs) = unless (isConstantNonRe t) $ err (getId t) 2076 "Don't quote rhs of =~, it'll match literally rather than as a regex." - re = mkRegex "[][*.+()]" + re = mkRegex "[][*.+()|]" hasMetachars s = s `matches` re isConstantNonRe t = fromMaybe False $ do s <- getLiteralString t