mirror of
https://github.com/koalaman/shellcheck
synced 2025-07-13 00:23:20 -07:00
Use mapM_ and sequence_ instead of reimplementing them
This commit is contained in:
parent
cc424bac11
commit
ffbbfcfe25
4 changed files with 10 additions and 12 deletions
|
@ -122,7 +122,7 @@ buildCommandMap = foldl' addCheck Map.empty
|
|||
|
||||
|
||||
checkCommand :: Map.Map CommandName (Token -> Analysis) -> Token -> Analysis
|
||||
checkCommand map t@(T_SimpleCommand id cmdPrefix (cmd:rest)) = fromMaybe (return ()) $ do
|
||||
checkCommand map t@(T_SimpleCommand id cmdPrefix (cmd:rest)) = sequence_ $ do
|
||||
name <- getLiteralString cmd
|
||||
return $
|
||||
if '/' `elem` name
|
||||
|
@ -575,7 +575,7 @@ checkPrintfVar = CommandCheck (Exactly "printf") (f . arguments) where
|
|||
f _ = return ()
|
||||
|
||||
check format more = do
|
||||
fromMaybe (return ()) $ do
|
||||
sequence_ $ do
|
||||
string <- getLiteralString format
|
||||
let formats = getPrintfFormats string
|
||||
let formatCount = length formats
|
||||
|
@ -945,7 +945,7 @@ checkCatastrophicRm = CommandCheck (Basename "rm") $ \t ->
|
|||
Nothing ->
|
||||
checkWord' token
|
||||
|
||||
checkWord' token = fromMaybe (return ()) $ do
|
||||
checkWord' token = sequence_ $ do
|
||||
filename <- getPotentialPath token
|
||||
let path = fixPath filename
|
||||
return . when (path `elem` importantPaths) $
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue