Class: Policial::Commenter

Inherits:
Object
  • Object
show all
Defined in:
lib/policial/commenter.rb

Overview

Public: Comment violations on pull request.

Instance Method Summary collapse

Constructor Details

#initialize(pull_request) ⇒ Commenter

Returns a new instance of Commenter.



4
5
6
# File 'lib/policial/commenter.rb', line 4

def initialize(pull_request)
  @pull_request = pull_request
end

Instance Method Details

#comment_violation(violation) ⇒ Object



8
9
10
11
12
13
14
15
16
17
# File 'lib/policial/commenter.rb', line 8

def comment_violation(violation)
  Policial.octokit.create_pull_request_comment(
    @pull_request.repo,
    @pull_request.number,
    comment_body(violation),
    @pull_request.head_commit.sha,
    violation.filename,
    violation.line_number
  )
end