Class: Pronto::Formatter::PullRequestFormatter

Inherits:
GitFormatter
  • Object
show all
Defined in:
lib/pronto/formatter/pull_request_formatter.rb

Instance Method Summary collapse

Methods inherited from GitFormatter

#client_module, #format, #pretty_name

Instance Method Details

#existing_comments(client, sha) ⇒ Object



4
5
6
7
# File 'lib/pronto/formatter/pull_request_formatter.rb', line 4

def existing_comments(client, sha)
  comments = client.pull_comments(sha)
  grouped_comments(comments)
end

#line_number(message, _) ⇒ Object



9
10
11
# File 'lib/pronto/formatter/pull_request_formatter.rb', line 9

def line_number(message, _)
  message.line.line.new_lineno
end

#submit_comments(client, comments) ⇒ Object



13
14
15
16
17
# File 'lib/pronto/formatter/pull_request_formatter.rb', line 13

def submit_comments(client, comments)
  comments.each { |comment| client.create_pull_comment(comment) }
rescue Octokit::UnprocessableEntity, HTTParty::Error => e
  $stderr.puts "Failed to post: #{e.message}"
end