Skip to content

Commit

Permalink
Use a list comprehension to remove partiality from notesForContext
Browse files Browse the repository at this point in the history
  • Loading branch information
josephcsible committed Dec 19, 2023
1 parent c1452e0 commit 208e383
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/ShellCheck/Parser.hs
Original file line number Diff line number Diff line change
Expand Up @@ -3507,13 +3507,11 @@ parseShell env name contents = do
-- A final pass for ignoring parse errors after failed parsing
isIgnored stack note = any (contextItemDisablesCode False (codeForParseNote note)) stack

notesForContext list = zipWith ($) [first, second] $ filter isName list
notesForContext list = zipWith ($) [first, second] [(pos, str) | ContextName pos str <- list]
where
isName (ContextName _ _) = True
isName _ = False
first (ContextName pos str) = ParseNote pos pos ErrorC 1073 $
first (pos, str) = ParseNote pos pos ErrorC 1073 $
"Couldn't parse this " ++ str ++ ". Fix to allow more checks."
second (ContextName pos str) = ParseNote pos pos InfoC 1009 $
second (pos, str) = ParseNote pos pos InfoC 1009 $
"The mentioned syntax error was in this " ++ str ++ "."

-- Go over all T_UnparsedIndex and reparse them as either arithmetic or text
Expand Down

0 comments on commit 208e383

Please sign in to comment.