Skip to content

Commit

Permalink
fix off by one issue in line and colums (#773)
Browse files Browse the repository at this point in the history
  • Loading branch information
rnikoopour authored Nov 11, 2022
1 parent 7b1458a commit ae282a5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions formatter/sarif.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit ae282a5

Please sign in to comment.