1
0
mirror of https://github.com/mgechev/revive.git synced 2025-01-22 03:38:47 +02:00

fix off by one issue in line and colums (#773)

This commit is contained in:
Reza Nikoopour 2022-11-11 01:47:58 -05:00 committed by GitHub
parent 7b1458a9cb
commit ae282a54c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -81,8 +81,8 @@ func (l *reviveRunLog) AddResult(failure lint.Failure) {
}
position := failure.Position
filename := position.Start.Filename
line := positiveOrZero(position.Start.Line - 1) // https://docs.oasis-open.org/sarif/sarif/v2.1.0/csprd01/sarif-v2.1.0-csprd01.html#def_line
column := positiveOrZero(position.Start.Column - 1) // https://docs.oasis-open.org/sarif/sarif/v2.1.0/csprd01/sarif-v2.1.0-csprd01.html#def_column
line := positiveOrZero(position.Start.Line) // https://docs.oasis-open.org/sarif/sarif/v2.1.0/csprd01/sarif-v2.1.0-csprd01.html#def_line
column := positiveOrZero(position.Start.Column) // https://docs.oasis-open.org/sarif/sarif/v2.1.0/csprd01/sarif-v2.1.0-csprd01.html#def_column
result := garif.NewResult(garif.NewMessageFromText(failure.Failure))
location := garif.NewLocation().WithURI(filename).WithLineColumn(line, column)