fixer: add warning about possible line range issue
This commit is contained in:
parent
3deb9d80ab
commit
56f2b7d59d
@ -223,6 +223,12 @@ func (f Fixer) writeFixedFile(origFileLines [][]byte, issues []result.Issue, tmp
|
|||||||
} else {
|
} else {
|
||||||
nextIssueIndex++
|
nextIssueIndex++
|
||||||
rng := nextIssue.GetLineRange()
|
rng := nextIssue.GetLineRange()
|
||||||
|
if rng.From > rng.To {
|
||||||
|
// Maybe better decision is to skip such issues, re-evaluate if regressed.
|
||||||
|
f.log.Warnf("[fixer]: issue line range is probably invalid, fix can be incorrect (from=%d, to=%d, linter=%s)",
|
||||||
|
rng.From, rng.To, nextIssue.FromLinter,
|
||||||
|
)
|
||||||
|
}
|
||||||
i += rng.To - rng.From
|
i += rng.To - rng.From
|
||||||
if nextIssue.Replacement.NeedOnlyDelete {
|
if nextIssue.Replacement.NeedOnlyDelete {
|
||||||
continue
|
continue
|
||||||
|
Loading…
x
Reference in New Issue
Block a user