Skip to content
This repository has been archived by the owner on May 19, 2024. It is now read-only.

Commit

Permalink
update relevance check
Browse files Browse the repository at this point in the history
  • Loading branch information
owenrumney authored Nov 7, 2020
1 parent 29a794a commit c68e9cf
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions commenter.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,15 +149,19 @@ func (c *commenter) loadPr() error {

func (c *commenter) checkCommentRelevant(filename string, line int) bool {
for _, file := range c.files {
if file.FileName == filename {
if line >= file.hunkStart && line < file.hunkEnd {
return true
if relevant := func(file *CommitFileInfo) bool {
if file.FileName == filename {
if line >= file.hunkStart && line < file.hunkEnd {
return true
}
}
return false
}(file); relevant {
return true
}
}
return false
}

func (c *commenter) getFileInfo(file string, line int) (*CommitFileInfo, error) {
for _, info := range c.files {
if info.FileName == file {
Expand Down

0 comments on commit c68e9cf

Please sign in to comment.