Merge pull request #1337 from dimo414/master

Expand "rhs"; this abbreviation seems needlessly obfuscating.
This commit is contained in:
Vidar Holen 2018-09-12 16:01:43 -07:00 committed by GitHub
commit 228af7df54
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -1020,7 +1020,7 @@ checkQuotedCondRegex _ (TC_Binary _ _ "=~" _ rhs) =
error t = error t =
unless (isConstantNonRe t) $ unless (isConstantNonRe t) $
err (getId t) 2076 err (getId t) 2076
"Don't quote rhs of =~, it'll match literally rather than as a regex." "Don't quote right-hand side of =~, it'll match literally rather than as a regex."
re = mkRegex "[][*.+()|]" re = mkRegex "[][*.+()|]"
hasMetachars s = s `matches` re hasMetachars s = s `matches` re
isConstantNonRe t = fromMaybe False $ do isConstantNonRe t = fromMaybe False $ do
@ -1189,7 +1189,7 @@ prop_checkComparisonAgainstGlob4 = verifyNot checkComparisonAgainstGlob "[ $cow
prop_checkComparisonAgainstGlob5 = verify checkComparisonAgainstGlob "[[ $cow != $bar ]]" prop_checkComparisonAgainstGlob5 = verify checkComparisonAgainstGlob "[[ $cow != $bar ]]"
checkComparisonAgainstGlob _ (TC_Binary _ DoubleBracket op _ (T_NormalWord id [T_DollarBraced _ _])) checkComparisonAgainstGlob _ (TC_Binary _ DoubleBracket op _ (T_NormalWord id [T_DollarBraced _ _]))
| op `elem` ["=", "==", "!="] = | op `elem` ["=", "==", "!="] =
warn id 2053 $ "Quote the rhs of " ++ op ++ " in [[ ]] to prevent glob matching." warn id 2053 $ "Quote the right-hand side of " ++ op ++ " in [[ ]] to prevent glob matching."
checkComparisonAgainstGlob _ (TC_Binary _ SingleBracket op _ word) checkComparisonAgainstGlob _ (TC_Binary _ SingleBracket op _ word)
| (op == "=" || op == "==") && isGlob word = | (op == "=" || op == "==") && isGlob word =
err (getId word) 2081 "[ .. ] can't match globs. Use [[ .. ]] or case statement." err (getId word) 2081 "[ .. ] can't match globs. Use [[ .. ]] or case statement."