mirror of
https://github.com/koalaman/shellcheck.git
synced 2025-08-08 22:35:54 +08:00
Simplify warnRedundant
This commit is contained in:
@@ -878,10 +878,10 @@ checkWhileGetoptsCase = CommandCheck (Exactly "getopts") f
|
|||||||
warnUnhandled optId caseId str =
|
warnUnhandled optId caseId str =
|
||||||
warn caseId 2213 $ "getopts specified -" ++ str ++ ", but it's not handled by this 'case'."
|
warn caseId 2213 $ "getopts specified -" ++ str ++ ", but it's not handled by this 'case'."
|
||||||
|
|
||||||
warnRedundant (key, expr) = sequence_ $ do
|
warnRedundant (Just str, expr)
|
||||||
str <- key
|
| str `notElem` ["*", ":", "?"] =
|
||||||
guard $ str `notElem` ["*", ":", "?"]
|
warn (getId expr) 2214 "This case is not specified by getopts."
|
||||||
return $ warn (getId expr) 2214 "This case is not specified by getopts."
|
warnRedundant _ = return ()
|
||||||
|
|
||||||
getHandledStrings (_, globs, _) =
|
getHandledStrings (_, globs, _) =
|
||||||
map (\x -> (literal x, x)) globs
|
map (\x -> (literal x, x)) globs
|
||||||
|
Reference in New Issue
Block a user