@@ -39,6 +39,13 @@ func TestSeverityRulesMultiple(t *testing.T) {
39
39
Path : `_test\.go` ,
40
40
},
41
41
},
42
+ {
43
+ Severity : "info" ,
44
+ BaseRule : BaseRule {
45
+ Text : "^nontestonly$" ,
46
+ PathExcept : `_test\.go` ,
47
+ },
48
+ },
42
49
{
43
50
BaseRule : BaseRule {
44
51
Source : "^//go:generate " ,
@@ -72,6 +79,8 @@ func TestSeverityRulesMultiple(t *testing.T) {
72
79
{Path : "ssl.go" , Text : "ssl" , Linter : "gosec" },
73
80
{Path : "e.go" , Text : "some" , Linter : "linter" },
74
81
{Path : "e_test.go" , Text : "testonly" , Linter : "testlinter" },
82
+ {Path : "e.go" , Text : "nontestonly" , Linter : "testlinter" },
83
+ {Path : "e_test.go" , Text : "nontestonly" , Linter : "testlinter" },
75
84
{Path : filepath .Join ("testdata" , "exclude_rules.go" ), Line : 3 , Linter : "lll" },
76
85
{Path : filepath .Join ("testdata" , "severity_rules.go" ), Line : 3 , Linter : "invalidgo" },
77
86
{Path : "someotherlinter.go" , Text : "someotherlinter" , Linter : "someotherlinter" },
@@ -97,6 +106,8 @@ func TestSeverityRulesMultiple(t *testing.T) {
97
106
{Path : "ssl.go" , Text : "ssl" , Linter : "gosec" , Severity : "info" },
98
107
{Path : "e.go" , Text : "some" , Linter : "linter" , Severity : "info" },
99
108
{Path : "e_test.go" , Text : "testonly" , Linter : "testlinter" , Severity : "info" },
109
+ {Path : "e.go" , Text : "nontestonly" , Linter : "testlinter" , Severity : "info" }, // matched
110
+ {Path : "e_test.go" , Text : "nontestonly" , Linter : "testlinter" , Severity : "error" }, // not matched
100
111
{Path : filepath .Join ("testdata" , "exclude_rules.go" ), Line : 3 , Linter : "lll" , Severity : "error" },
101
112
{Path : filepath .Join ("testdata" , "severity_rules.go" ), Line : 3 , Linter : "invalidgo" , Severity : "info" },
102
113
{Path : "someotherlinter.go" , Text : "someotherlinter" , Linter : "someotherlinter" , Severity : "info" },
0 commit comments