class Saddler::Reporter::Github::CommitReviewComment
Public Instance Methods
report(messages, options)
click to toggle source
@param messages [String] checkstyle string @param options [Hash] @option options [String] sha target commit sha
@return [void]
@see developer.github.com/v3/repos/comments/#create-a-commit-comment
# File lib/saddler/reporter/github/commit_review_comment.rb, line 17 def report(messages, options) repo_path = '.' repo = Repository.new(repo_path) sha = options['sha'] || repo.head.sha data = parse(messages) client = Client.new(repo) # fetch commit_comments commit_comments = client.commit_comments(sha) patches = client.commit_patches(sha) # build comment comments = build_comments_with_patches(data, patches) return if comments.empty? posting_comments = comments - commit_comments return if posting_comments.empty? # create commit_comment posting_comments.each do |posting| client.create_commit_comment(posting) end end