mirror of
https://github.com/koalaman/shellcheck.git
synced 2025-08-28 14:49:51 +08:00
Remove unnecessary fromMaybe and when from bashism
This commit is contained in:
@@ -391,11 +391,10 @@ checkBashisms = ForShell [Sh, Dash] $ \t -> do
|
|||||||
("unset", Just ["f", "v"]),
|
("unset", Just ["f", "v"]),
|
||||||
("wait", Just [])
|
("wait", Just [])
|
||||||
]
|
]
|
||||||
bashism t@(T_SourceCommand id src _) =
|
bashism t@(T_SourceCommand id src _)
|
||||||
let name = fromMaybe "" $ getCommandName src
|
| getCommandName src == Just "source" = warnMsg id "'source' in place of '.' is"
|
||||||
in when (name == "source") $ warnMsg id "'source' in place of '.' is"
|
bashism (TA_Expansion _ (T_Literal id str : _))
|
||||||
bashism (TA_Expansion _ (T_Literal id str : _)) | str `matches` radix =
|
| str `matches` radix = warnMsg id "arithmetic base conversion is"
|
||||||
when (str `matches` radix) $ warnMsg id "arithmetic base conversion is"
|
|
||||||
where
|
where
|
||||||
radix = mkRegex "^[0-9]+#"
|
radix = mkRegex "^[0-9]+#"
|
||||||
bashism _ = return ()
|
bashism _ = return ()
|
||||||
|
Reference in New Issue
Block a user