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

Commit 8f17fe9

Browse files
committed
Accept issues for JIRA
1 parent a961263 commit 8f17fe9

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

lib/cc/services/jira.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,14 @@ def receive_quality
4141
create_ticket(title, details_url)
4242
end
4343

44+
def receive_issue
45+
title = %{Fix "#{issue["check_name"]}" issue in #{constant_name}}
46+
47+
body = [issue["description"], details_url].join("\n\n")
48+
49+
create_ticket(title, body)
50+
end
51+
4452
def receive_vulnerability
4553
formatter = CC::Formatters::TicketFormatter.new(self)
4654

test/jira_test.rb

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,23 @@ def test_vulnerability
2929
)
3030
end
3131

32+
def test_issue
33+
payload = {
34+
issue: {
35+
"check_name" => "Style/LongLine",
36+
"description" => "Line is too long [1000/80]"
37+
},
38+
constant_name: "foo.rb",
39+
details_url: "http://example.com/repos/id/foo.rb#issue_123"
40+
}
41+
42+
assert_jira_receives(
43+
event(:issue, payload),
44+
"Fix \"Style/LongLine\" issue in foo.rb",
45+
"Line is too long [1000/80]\n\nhttp://example.com/repos/id/foo.rb#issue_123"
46+
)
47+
end
48+
3249
def test_receive_test
3350
@stubs.post '/rest/api/2/issue' do |env|
3451
[200, {}, '{"id": 12345, "key": "CC-123", "self": "http://foo.bar"}']

0 commit comments

Comments
 (0)