Class: Pronto::Formatter::GitlabMergeRequestReviewFormatter

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

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from GitFormatter

#format

Methods inherited from Base

#config

Class Method Details

.nameObject



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

def self.name
  'gitlab_mr'
end

Instance Method Details

#client_moduleObject



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

def client_module
  Gitlab
end

#existing_comments(_, client, repo) ⇒ Object



16
17
18
19
20
# File 'lib/pronto/formatter/gitlab_merge_request_review_formatter.rb', line 16

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

#line_number(message, _) ⇒ Object



28
29
30
# File 'lib/pronto/formatter/gitlab_merge_request_review_formatter.rb', line 28

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

#pretty_nameObject



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

def pretty_name
  'Gitlab'
end

#submit_comments(client, comments) ⇒ Object



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

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