Skip to content

Commit 3194842

Browse files
committed
Update spec
1 parent d359809 commit 3194842

File tree

1 file changed

+38
-4
lines changed

1 file changed

+38
-4
lines changed

spec/cc/engine/analyzers/go/main_spec.rb

Lines changed: 38 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,13 @@ module CC::Engine::Analyzers
3636
"path" => "foo.go",
3737
"lines" => { "begin" => 6, "end" => 6 },
3838
})
39-
expect(json["remediation_points"]).to eq(820_000)
39+
expect(json["remediation_points"]).to eq(500_000)
4040
expect(json["other_locations"]).to eq([
4141
{"path" => "foo.go", "lines" => { "begin" => 7, "end" => 7} },
4242
])
4343
expect(json["content"]["body"]).to match(/This issue has a mass of 16/)
4444
expect(json["fingerprint"]).to eq("484ee5799eb0e6c933751cfa85ba33c3")
45-
expect(json["severity"]).to eq(CC::Engine::Analyzers::Base::MAJOR)
45+
expect(json["severity"]).to eq(CC::Engine::Analyzers::Base::MINOR)
4646
end
4747

4848
it "prints an issue for similar code" do
@@ -82,7 +82,7 @@ module CC::Engine::Analyzers
8282
"path" => "foo.go",
8383
"lines" => { "begin" => 5, "end" => 7 },
8484
})
85-
expect(json["remediation_points"]).to eq(1_540_000)
85+
expect(json["remediation_points"]).to eq(1_220_000)
8686
expect(json["other_locations"]).to eq([
8787
{"path" => "foo.go", "lines" => { "begin" => 9, "end" => 11} },
8888
{"path" => "foo.go", "lines" => { "begin" => 13, "end" => 15} },
@@ -129,14 +129,48 @@ module CC::Engine::Analyzers
129129

130130
it "does not flag duplicate comments" do
131131
create_source_file("foo.go", <<-EOGO)
132+
// This is a comment.
133+
// This is a comment.
134+
// This is a comment.
135+
// This is also a comment.
136+
// This is also a comment.
137+
132138
package main
133139
140+
func main() {
141+
}
142+
143+
/* This is a multiline comment */
144+
/* This is a multiline comment */
145+
/* This is a also multiline comment */
146+
/* This is a also multiline comment */
147+
148+
// func add(x int, y int) int {
149+
// return x + y
150+
// }
151+
152+
// func add(x int, y int) int {
153+
// return x + y
154+
// }
155+
156+
// func add(x int, y int) int {
157+
// return x + y
158+
// }
159+
160+
// func add(x int, y int) int {
161+
// return x + y
162+
// }
163+
EOGO
164+
165+
create_source_file("bar.go", <<-EOGO)
134166
// This is a comment.
135167
// This is a comment.
136168
// This is a comment.
137169
// This is also a comment.
138170
// This is also a comment.
139171
172+
package main
173+
140174
func main() {
141175
}
142176
@@ -178,7 +212,7 @@ def engine_conf
178212
},
179213
'languages' => {
180214
'go' => {
181-
'mass_threshold' => 3,
215+
'mass_threshold' => 11,
182216
},
183217
},
184218
},

0 commit comments

Comments
 (0)