Skip to content

Commit

Permalink
Fix the hunk checking.
Browse files Browse the repository at this point in the history
If the error is on the last line then it won't be registered as actually part of the hunk
  • Loading branch information
owenrumney committed Apr 14, 2021
1 parent f4be1e5 commit 34cabfb
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions commenter/commenter.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ package commenter
import (
"errors"
"fmt"
"github.com/google/go-github/v32/github"
"regexp"
"strconv"
"strings"

"github.com/google/go-github/v32/github"
)

// Commenter is the main commenter struct
Expand Down Expand Up @@ -152,7 +153,7 @@ func (c *Commenter) checkCommentRelevant(filename string, line int) bool {
for _, file := range c.files {
if relevant := func(file *commitFileInfo) bool {
if file.FileName == filename {
if line >= file.hunkStart && line < file.hunkEnd {
if line >= file.hunkStart && line <= file.hunkEnd {
return true
}
}
Expand Down

0 comments on commit 34cabfb

Please sign in to comment.