mirror of
https://github.com/koalaman/shellcheck
synced 2025-07-07 21:41:34 -07:00
parent
08ca1ee6e9
commit
0636e7023c
3 changed files with 48 additions and 17 deletions
|
@ -14,18 +14,9 @@ applyFix fix fileLines =
|
|||
-- prereq: list is already sorted by start position
|
||||
removeOverlap [] = []
|
||||
removeOverlap (x:xs) = checkoverlap x xs
|
||||
checkoverlap :: Replacement -> [Replacement] -> [Replacement]
|
||||
checkoverlap x [] = x:[]
|
||||
checkoverlap x (y:ys) =
|
||||
if overlap x y then x:(removeOverlap ys) else x:y:(removeOverlap ys)
|
||||
-- two position overlaps when
|
||||
overlap x y =
|
||||
(yStart >= xStart && yStart < xEnd) || (yStart < xStart && yEnd > xStart)
|
||||
where
|
||||
yStart = repStartPos y
|
||||
yEnd = repEndPos y
|
||||
xStart = repStartPos x
|
||||
xEnd = repEndPos x
|
||||
|
||||
|
||||
-- A replacement that spans multiple line is applied by:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue