mirror of
https://github.com/koalaman/shellcheck
synced 2025-07-13 00:23:20 -07:00
Avoid some awkward parentheses with forM_
This commit is contained in:
parent
64c31d9142
commit
1c6202dba4
1 changed files with 2 additions and 3 deletions
|
@ -128,7 +128,7 @@ outputForFile color sys comments = do
|
||||||
let lineCount = length fileLinesList
|
let lineCount = length fileLinesList
|
||||||
let fileLines = listArray (1, lineCount) fileLinesList
|
let fileLines = listArray (1, lineCount) fileLinesList
|
||||||
let groups = groupWith lineNo comments
|
let groups = groupWith lineNo comments
|
||||||
mapM_ (\commentsForLine -> do
|
forM_ groups $ \commentsForLine -> do
|
||||||
let lineNum = fromIntegral $ lineNo (head commentsForLine)
|
let lineNum = fromIntegral $ lineNo (head commentsForLine)
|
||||||
let line = if lineNum < 1 || lineNum > lineCount
|
let line = if lineNum < 1 || lineNum > lineCount
|
||||||
then ""
|
then ""
|
||||||
|
@ -137,10 +137,9 @@ outputForFile color sys comments = do
|
||||||
putStrLn $ color "message" $
|
putStrLn $ color "message" $
|
||||||
"In " ++ fileName ++" line " ++ show lineNum ++ ":"
|
"In " ++ fileName ++" line " ++ show lineNum ++ ":"
|
||||||
putStrLn (color "source" line)
|
putStrLn (color "source" line)
|
||||||
mapM_ (\c -> putStrLn (color (severityText c) $ cuteIndent c)) commentsForLine
|
forM_ commentsForLine $ \c -> putStrLn $ color (severityText c) $ cuteIndent c
|
||||||
putStrLn ""
|
putStrLn ""
|
||||||
showFixedString color commentsForLine (fromIntegral lineNum) fileLines
|
showFixedString color commentsForLine (fromIntegral lineNum) fileLines
|
||||||
) groups
|
|
||||||
|
|
||||||
-- Pick out only the lines necessary to show a fix in action
|
-- Pick out only the lines necessary to show a fix in action
|
||||||
sliceFile :: Fix -> Array Int String -> (Fix, Array Int String)
|
sliceFile :: Fix -> Array Int String -> (Fix, Array Int String)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue