1
0
mirror of https://github.com/mgechev/revive.git synced 2025-01-06 03:04:06 +02:00
This commit is contained in:
SalvadorC 2021-07-12 06:31:46 +02:00 committed by GitHub
parent 1acbe6b30e
commit 89f108c22a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 1 deletions

View File

@ -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{}

View File

@ -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
testdata/disable-annotations3.go vendored Normal file
View File

@ -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 {}