Skip to content

Commit 83f0605

Browse files
committed
Fix StringsModifyFilterer
1 parent 2d65adf commit 83f0605

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

evaluator.go

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ type Reasons struct {
5656
type StringsModifyFilterer struct{}
5757

5858
func (s StringsModifyFilterer) Filter(file *gitdiff.File) *Reasons {
59+
60+
total := 0
61+
stringModiry := 0
5962
for _, fragments := range file.TextFragments {
6063
for i, line := range fragments.Lines {
6164
if line.Op != gitdiff.OpAdd {
@@ -74,14 +77,18 @@ func (s StringsModifyFilterer) Filter(file *gitdiff.File) *Reasons {
7477
continue
7578
}
7679

80+
total++
7781
if strings.ContainsAny(diffs[0].Text, `"'`) && strings.ContainsAny(diffs[2].Text, `"'`) {
78-
return &Reasons{
79-
File: file.NewName,
80-
Message: "only string modified",
81-
}
82+
stringModiry++
8283
}
8384
}
8485
}
86+
if total != 0 && total == stringModiry {
87+
return &Reasons{
88+
File: file.NewName,
89+
Message: "only string modified",
90+
}
91+
}
8592
return nil
8693
}
8794

0 commit comments

Comments
 (0)