Class: Saddler::Reporter::Github::PullRequestReviewComment

Inherits:
Object
  • Object
show all
Includes:
Helper, Support
Defined in:
lib/saddler/reporter/github/pull_request_review_comment.rb

Instance Method Summary collapse

Methods included from Helper

#build_comments_with_patches, #concat_body

Instance Method Details

#report(messages, _options) ⇒ void

This method returns an undefined value.

Parameters:

  • messages (String)

    checkstyle string

  • _options (Hash)

See Also:



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/saddler/reporter/github/pull_request_review_comment.rb', line 14

def report(messages, _options)
  repo_path = '.'
  repo = Repository.new(repo_path)

  data = parse(messages)
  client = Client.new(repo)
  # fetch pull_request_review_comments
  pull_request_review_comments = client.pull_request_review_comments

  patches = client.pull_request_patches

  # build comment
  comments = build_comments_with_patches(data, patches)
  return if comments.empty?

  posting_comments = comments - pull_request_review_comments
  return if posting_comments.empty?

  # create pull_request_review_comments
  posting_comments.each do |posting|
    client.create_pull_request_review_comment(posting)
  end
end