mirror of
https://github.com/koalaman/shellcheck.git
synced 2025-08-09 05:53:06 +08:00
Merge pull request #1826 from josephcsible/nofromjust
Use the Identity monad to avoid unnecessary uses of fromJust
This commit is contained in:
@@ -1057,9 +1057,7 @@ checkNumberComparisons params (TC_Binary id typ op lhs rhs) = do
|
||||
checkStrings =
|
||||
mapM_ stringError . find isNonNum
|
||||
|
||||
isNonNum t = fromMaybe False $ do
|
||||
s <- getLiteralStringExt (const $ return "") t
|
||||
return . not . all numChar $ s
|
||||
isNonNum t = not . all numChar $ onlyLiteralString t
|
||||
numChar x = isDigit x || x `elem` "+-. "
|
||||
|
||||
stringError t = err (getId t) 2170 $
|
||||
@@ -2578,7 +2576,7 @@ checkTildeInPath _ (T_SimpleCommand _ vars _) =
|
||||
warn id 2147 "Literal tilde in PATH works poorly across programs."
|
||||
checkVar _ = return ()
|
||||
|
||||
hasTilde t = fromMaybe False (liftM2 elem (return '~') (getLiteralStringExt (const $ return "") t))
|
||||
hasTilde t = '~' `elem` onlyLiteralString t
|
||||
isQuoted T_DoubleQuoted {} = True
|
||||
isQuoted T_SingleQuoted {} = True
|
||||
isQuoted _ = False
|
||||
|
Reference in New Issue
Block a user