@@ -132,6 +132,37 @@ func TestSeverityRulesText(t *testing.T) {
132
132
assert .Equal (t , texts , processedTexts )
133
133
}
134
134
135
+ func TestSeverityRulesOnlyDefault (t * testing.T ) {
136
+ lineCache := fsutils .NewLineCache (fsutils .NewFileCache ())
137
+ log := report .NewLogWrapper (logutils .NewStderrLog ("" ), & report.Data {})
138
+ p := NewSeverityRules ("info" , []SeverityRule {}, lineCache , log )
139
+
140
+ cases := []issueTestCase {
141
+ {Path : "ssl.go" , Text : "ssl" , Linter : "gosec" },
142
+ {Path : "empty.go" , Text : "empty" , Linter : "empty" },
143
+ }
144
+ var issues []result.Issue
145
+ for _ , c := range cases {
146
+ issues = append (issues , newIssueFromIssueTestCase (c ))
147
+ }
148
+ processedIssues := process (t , p , issues ... )
149
+ var resultingCases []issueTestCase
150
+ for _ , i := range processedIssues {
151
+ resultingCases = append (resultingCases , issueTestCase {
152
+ Path : i .FilePath (),
153
+ Linter : i .FromLinter ,
154
+ Text : i .Text ,
155
+ Line : i .Line (),
156
+ Severity : i .Severity ,
157
+ })
158
+ }
159
+ expectedCases := []issueTestCase {
160
+ {Path : "ssl.go" , Text : "ssl" , Linter : "gosec" , Severity : "info" },
161
+ {Path : "empty.go" , Text : "empty" , Linter : "empty" , Severity : "info" },
162
+ }
163
+ assert .Equal (t , expectedCases , resultingCases )
164
+ }
165
+
135
166
func TestSeverityRulesEmpty (t * testing.T ) {
136
167
processAssertSame (t , NewSeverityRules ("" , nil , nil , nil ), newIssueFromTextTestCase ("test" ))
137
168
}
0 commit comments