mirror of
https://github.com/koalaman/shellcheck
synced 2025-08-20 21:33:50 -07:00
Gave Parsec errors proper positioning info
This commit is contained in:
parent
d5587dd104
commit
22ae83e372
3 changed files with 25 additions and 5 deletions
|
@ -32,13 +32,17 @@ doFile path colorFunc = do
|
|||
|
||||
doInput filename contents colorFunc = do
|
||||
let fileLines = lines contents
|
||||
let lineCount = length fileLines
|
||||
let comments = shpellCheck contents
|
||||
let groups = groupWith shpellLine comments
|
||||
if not $ null comments then do
|
||||
mapM_ (\x -> do
|
||||
let line = fileLines !! (shpellLine (head x) - 1)
|
||||
let lineNum = shpellLine (head x)
|
||||
let line = if lineNum < 1 || lineNum >= lineCount
|
||||
then ""
|
||||
else fileLines !! (lineNum - 1)
|
||||
putStrLn ""
|
||||
putStrLn $ colorFunc "message" ("In " ++ filename ++" line " ++ (show $ shpellLine (head x)) ++ ":")
|
||||
putStrLn $ colorFunc "message" ("In " ++ filename ++" line " ++ (show $ lineNum) ++ ":")
|
||||
putStrLn (colorFunc "source" line)
|
||||
mapM (\c -> putStrLn (colorFunc (shpellSeverity c) $ cuteIndent c)) x
|
||||
putStrLn ""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue