@@ -36,7 +36,7 @@ module CC::Engine::Analyzers
36
36
"path" => "foo.go" ,
37
37
"lines" => { "begin" => 6 , "end" => 6 } ,
38
38
} )
39
- expect ( json [ "remediation_points" ] ) . to eq ( 500_000 )
39
+ expect ( json [ "remediation_points" ] ) . to eq ( 540_000 )
40
40
expect ( json [ "other_locations" ] ) . to eq ( [
41
41
{ "path" => "foo.go" , "lines" => { "begin" => 7 , "end" => 7 } } ,
42
42
] )
@@ -82,7 +82,7 @@ module CC::Engine::Analyzers
82
82
"path" => "foo.go" ,
83
83
"lines" => { "begin" => 5 , "end" => 7 } ,
84
84
} )
85
- expect ( json [ "remediation_points" ] ) . to eq ( 1_220_000 )
85
+ expect ( json [ "remediation_points" ] ) . to eq ( 1_260_000 )
86
86
expect ( json [ "other_locations" ] ) . to eq ( [
87
87
{ "path" => "foo.go" , "lines" => { "begin" => 9 , "end" => 11 } } ,
88
88
{ "path" => "foo.go" , "lines" => { "begin" => 13 , "end" => 15 } } ,
@@ -127,6 +127,15 @@ module CC::Engine::Analyzers
127
127
expect ( issues ) . to be_empty
128
128
end
129
129
130
+ it "does not flag entire file as issue" do
131
+ create_source_file ( "foo.go" , File . read ( fixture_path ( "issue_6609_1.go" ) ) )
132
+ create_source_file ( "bar.go" , File . read ( fixture_path ( "issue_6609_2.go" ) ) )
133
+ issues = run_engine ( engine_conf ) . strip . split ( "\0 " )
134
+ issues . map! { |issue | JSON . parse issue }
135
+ invalid_issues = issues . find_all { |issue | issue [ "location" ] [ "lines" ] [ "begin" ] == 1 }
136
+ expect ( invalid_issues ) . to be_empty , invalid_issues . map { |issue | issue [ "location" ] } . join ( "\n " )
137
+ end
138
+
130
139
it "does not flag duplicate comments" do
131
140
create_source_file ( "foo.go" , <<-EOGO )
132
141
// This is a comment.
@@ -137,7 +146,10 @@ module CC::Engine::Analyzers
137
146
138
147
package main
139
148
149
+ // import "fmt"
150
+
140
151
func main() {
152
+ fmt.Println("This is a duplicate!")
141
153
}
142
154
143
155
/* This is a multiline comment */
@@ -171,7 +183,14 @@ module CC::Engine::Analyzers
171
183
172
184
package main
173
185
186
+ // import "fmt"
187
+
174
188
func main() {
189
+ // This is a comment.
190
+ // This is a comment.
191
+ // This is a comment.
192
+ // This is also a comment.
193
+ // This is also a comment.
175
194
}
176
195
177
196
/* This is a multiline comment */
@@ -212,7 +231,7 @@ def engine_conf
212
231
} ,
213
232
'languages' => {
214
233
'go' => {
215
- 'mass_threshold' => 11 ,
234
+ 'mass_threshold' => 10 ,
216
235
} ,
217
236
} ,
218
237
} ,
0 commit comments