mirror of
https://github.com/koalaman/shellcheck
synced 2025-08-14 02:27:30 -07:00
Merge end pos map into start pos map
This commit is contained in:
parent
4470fe715c
commit
48ac654a93
3 changed files with 26 additions and 33 deletions
|
@ -38,14 +38,14 @@ import Control.Monad
|
|||
|
||||
import Test.QuickCheck.All
|
||||
|
||||
tokenToPosition startMap endMap (TokenComment id c) = fromMaybe fail $ do
|
||||
tokenToPosition startMap (TokenComment id c) = fromMaybe fail $ do
|
||||
position <- maybePosition
|
||||
endPosition <- maybeEndPosition <|> maybePosition
|
||||
return $ PositionedComment position endPosition c
|
||||
where
|
||||
fail = error "Internal shellcheck error: id doesn't exist. Please report!"
|
||||
maybeEndPosition = Map.lookup id endMap
|
||||
maybePosition = Map.lookup id startMap
|
||||
maybePosition = fmap fst $ Map.lookup id startMap
|
||||
maybeEndPosition = join $ fmap snd $ Map.lookup id startMap
|
||||
|
||||
checkScript :: Monad m => SystemInterface m -> CheckSpec -> m CheckResult
|
||||
checkScript sys spec = do
|
||||
|
@ -66,7 +66,7 @@ checkScript sys spec = do
|
|||
fromMaybe [] $
|
||||
(arComments . analyzeScript . analysisSpec)
|
||||
<$> prRoot result
|
||||
let translator = tokenToPosition (prTokenPositions result) (prTokenEndPositions result)
|
||||
let translator = tokenToPosition (prTokenPositions result)
|
||||
return . nub . sortMessages . filter shouldInclude $
|
||||
(parseMessages ++ map translator analysisMessages)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue