diff --git a/evaluator.go b/evaluator.go index 3a714b4..4db738c 100644 --- a/evaluator.go +++ b/evaluator.go @@ -56,6 +56,9 @@ type Reasons struct { type StringsModifyFilterer struct{} func (s StringsModifyFilterer) Filter(file *gitdiff.File) *Reasons { + + total := 0 + stringModiry := 0 for _, fragments := range file.TextFragments { for i, line := range fragments.Lines { if line.Op != gitdiff.OpAdd { @@ -74,14 +77,18 @@ func (s StringsModifyFilterer) Filter(file *gitdiff.File) *Reasons { continue } + total++ if strings.ContainsAny(diffs[0].Text, `"'`) && strings.ContainsAny(diffs[2].Text, `"'`) { - return &Reasons{ - File: file.NewName, - Message: "only string modified", - } + stringModiry++ } } } + if total != 0 && total == stringModiry { + return &Reasons{ + File: file.NewName, + Message: "only string modified", + } + } return nil }