Repository: mgechev/revive (go)

Issue:
revive:disable-next-line isn't working
Using macOS and golangci-lint v1.41.1 (a207480, 2021-06-19), I expected this to work, and not give me a linter failure:
```go
//revive:disable-next-line:var-naming
func (source Source) BaseApiURL() string {
```

But actually I get this error when linting:
```
source.go:99:22: var-naming: method BaseApiURL should be BaseAPIURL (revive)
func (source Source) BaseApiURL() string {
                     ^
make: *** [lint] Error 1
```

To work around, I can use this:
```go
func (source Source) BaseApiURL() string { //revive:disable-line:var-naming
```

But from how `disable-next-line` is described in the README, I think I've seen a bug.

Pull request:
fix issue #540
Closes #540 


Patch:
diff --git a/lint/file.go b/lint/file.go
index 8bef9c2..ee29c1d 100644
--- a/lint/file.go
+++ b/lint/file.go
@@ -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{}


Test patch:
diff --git a/test/disable-annotations_test.go b/test/disable-annotations_test.go
index b716734..afb88ef 100644
--- a/test/disable-annotations_test.go
+++ b/test/disable-annotations_test.go
@@ -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{})
+}
\ No newline at end of file
diff --git a/testdata/disable-annotations3.go b/testdata/disable-annotations3.go
new file mode 100644
index 0000000..95f239c
--- /dev/null
+++ b/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 {}