Skip to content

Commit

Permalink
fix issue #540 (#543)
Browse files Browse the repository at this point in the history
  • Loading branch information
chavacava committed Jul 12, 2021
1 parent 1acbe6b commit 89f108c
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lint/file.go
Expand Up @@ -207,7 +207,7 @@ func (f *File) disabledIntervals(rules []Rule, mustSpecifyDisableReason bool, fa
for _, c := range comments {
match := re.FindStringSubmatch(c.Text)
if len(match) == 0 {
return
continue
}

ruleNames := []string{}
Expand Down
4 changes: 4 additions & 0 deletions test/disable-annotations_test.go
Expand Up @@ -14,3 +14,7 @@ func TestDisabledAnnotations(t *testing.T) {
func TestModifiedAnnotations(t *testing.T) {
testRule(t, "disable-annotations2", &rule.VarNamingRule{}, &lint.RuleConfig{})
}

func TestDisableNextLineAnnotations(t *testing.T) {
testRule(t, "disable-annotations3", &rule.VarNamingRule{}, &lint.RuleConfig{})
}
14 changes: 14 additions & 0 deletions testdata/disable-annotations3.go
@@ -0,0 +1,14 @@
// Package fix_tures is a testing package
// tests for issue #540
//revive:disable-next-line:var-naming
package fix_tures

func foo1() {
// something before the annotation
//revive:disable-next-line:var-naming
// something after
var invalid_name = 0
}

//revive:disable-next-line:var-naming
func (source Source) BaseApiURL() string {}

0 comments on commit 89f108c

Please sign in to comment.