Skip to content

Commit

Permalink
Remove unnecessary partiality from check
Browse files Browse the repository at this point in the history
  • Loading branch information
josephcsible committed Dec 19, 2023
1 parent a47a42c commit bfe4342
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/ShellCheck/Checks/Commands.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1006,7 +1006,7 @@ checkWhileGetoptsCase = CommandCheck (Exactly "getopts") f
options <- getLiteralString arg1
getoptsVar <- getLiteralString name
(T_WhileExpression _ _ body) <- findFirst whileLoop path
caseCmd@(T_CaseExpression _ var _) <- mapMaybe findCase body !!! 0
T_CaseExpression id var list <- mapMaybe findCase body !!! 0

-- Make sure getopts name and case variable matches
[T_DollarBraced _ _ bracedWord] <- return $ getWordParts var
Expand All @@ -1016,11 +1016,11 @@ checkWhileGetoptsCase = CommandCheck (Exactly "getopts") f
-- Make sure the variable isn't modified
guard . not $ modifiesVariable params (T_BraceGroup (Id 0) body) getoptsVar

return $ check (getId arg1) (map (:[]) $ filter (/= ':') options) caseCmd
return $ check (getId arg1) (map (:[]) $ filter (/= ':') options) id list
f _ = return ()

check :: Id -> [String] -> Token -> Analysis
check optId opts (T_CaseExpression id _ list) = do
check :: Id -> [String] -> Id -> [(CaseType, [Token], [Token])] -> Analysis
check optId opts id list = do
unless (Nothing `M.member` handledMap) $ do
mapM_ (warnUnhandled optId id) $ catMaybes $ M.keys notHandled

Expand Down

0 comments on commit bfe4342

Please sign in to comment.