Class: Pronto::Formatter::GitlabMergeRequestReviewFormatter

Inherits:
PullRequestFormatter show all
Defined in:
lib/pronto/formatter/gitlab_merge_request_review_formatter.rb

Instance Method Summary collapse

Methods inherited from GitFormatter

#format

Methods inherited from Base

#config, name

Instance Method Details

#client_moduleObject



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

def client_module
  Gitlab
end

#existing_comments(_, client, repo) ⇒ Object



12
13
14
15
16
# File 'lib/pronto/formatter/gitlab_merge_request_review_formatter.rb', line 12

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

#line_number(message, _) ⇒ Object



24
25
26
# File 'lib/pronto/formatter/gitlab_merge_request_review_formatter.rb', line 24

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

#pretty_nameObject



8
9
10
# File 'lib/pronto/formatter/gitlab_merge_request_review_formatter.rb', line 8

def pretty_name
  'Gitlab'
end

#submit_comments(client, comments) ⇒ Object



18
19
20
21
22
# File 'lib/pronto/formatter/gitlab_merge_request_review_formatter.rb', line 18

def submit_comments(client, comments)
  client.create_pull_request_review(comments)
rescue => e
  $stderr.puts "Failed to post: #{e.message}"
end