Class: Pronto::Formatter::GitlabFormatter

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

Instance Method Summary collapse

Instance Method Details

#format(messages, repo) ⇒ Object


4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/pronto/formatter/gitlab_formatter.rb', line 4

def format(messages, repo)
  messages = messages.uniq { |message| [message.msg, message.line.new_lineno] }
  client = Gitlab.new repo

  commit_messages = messages.map do |message|
    create_comment(client,
                   message.commit_sha,
                   message.msg,
                   message.path,
                   message.line.commit_line.new_lineno)
  end

  "#{commit_messages.compact.count} Pronto messages posted to GitLab"
end