Skip to content
This repository was archived by the owner on Jul 19, 2025. It is now read-only.

Commit acd994d

Browse files
committed
Send issues to lighthouse
1 parent 8f17fe9 commit acd994d

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

lib/cc/services/lighthouse.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,14 @@ def receive_quality
3535
create_ticket(title, details_url)
3636
end
3737

38+
def receive_issue
39+
title = %{Fix "#{issue["check_name"]}" issue in #{constant_name}}
40+
41+
body = [issue["description"], details_url].join("\n\n")
42+
43+
create_ticket(title, body)
44+
end
45+
3846
def receive_vulnerability
3947
formatter = CC::Formatters::TicketFormatter.new(self)
4048

test/lighthouse_test.rb

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,23 @@ def test_vulnerability
2323
)
2424
end
2525

26+
def test_issue
27+
payload = {
28+
issue: {
29+
"check_name" => "Style/LongLine",
30+
"description" => "Line is too long [1000/80]"
31+
},
32+
constant_name: "foo.rb",
33+
details_url: "http://example.com/repos/id/foo.rb#issue_123"
34+
}
35+
36+
assert_lighthouse_receives(
37+
event(:issue, payload),
38+
"Fix \"Style/LongLine\" issue in foo.rb",
39+
"Line is too long [1000/80]\n\nhttp://example.com/repos/id/foo.rb#issue_123"
40+
)
41+
end
42+
2643
def test_receive_test
2744
@stubs.post 'projects/123/tickets.json' do |env|
2845
[200, {}, '{"ticket":{"number": "123", "url":"http://foo.bar"}}']

0 commit comments

Comments
 (0)