From c68e9cf2c62946dfb5692d6017197382f7dc5c6d Mon Sep 17 00:00:00 2001 From: Owen Rumney Date: Sat, 7 Nov 2020 17:51:28 +0000 Subject: [PATCH] update relevance check --- commenter.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/commenter.go b/commenter.go index a7a3e99..a837fbd 100644 --- a/commenter.go +++ b/commenter.go @@ -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 {