Remove unnecessary fromMaybe and when from bashism

This commit is contained in:
Joseph C. Sible 2020-04-05 22:03:50 -04:00
parent facf0d1e27
commit 8a6679fd8a
1 changed files with 4 additions and 5 deletions

View File

@ -391,11 +391,10 @@ checkBashisms = ForShell [Sh, Dash] $ \t -> do
("unset", Just ["f", "v"]),
("wait", Just [])
]
bashism t@(T_SourceCommand id src _) =
let name = fromMaybe "" $ getCommandName src
in when (name == "source") $ warnMsg id "'source' in place of '.' is"
bashism (TA_Expansion _ (T_Literal id str : _)) | str `matches` radix =
when (str `matches` radix) $ warnMsg id "arithmetic base conversion is"
bashism t@(T_SourceCommand id src _)
| getCommandName src == Just "source" = warnMsg id "'source' in place of '.' is"
bashism (TA_Expansion _ (T_Literal id str : _))
| str `matches` radix = warnMsg id "arithmetic base conversion is"
where
radix = mkRegex "^[0-9]+#"
bashism _ = return ()