mirror of
https://github.com/koalaman/shellcheck
synced 2025-07-06 21:11:35 -07:00
Merge pull request #1826 from josephcsible/nofromjust
Use the Identity monad to avoid unnecessary uses of fromJust
This commit is contained in:
commit
d0beac6d0b
5 changed files with 20 additions and 16 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue