Class: Linterbot::GitHubPullRequestCommenter
- Inherits:
-
Object
- Object
- Linterbot::GitHubPullRequestCommenter
- Defined in:
- lib/linterbot/github_pull_request_commenter.rb
Instance Attribute Summary collapse
-
#github_client ⇒ Object
Returns the value of attribute github_client.
-
#pull_request_number ⇒ Object
Returns the value of attribute pull_request_number.
-
#repository ⇒ Object
Returns the value of attribute repository.
Instance Method Summary collapse
-
#initialize(repository, pull_request_number, github_client) ⇒ GitHubPullRequestCommenter
constructor
A new instance of GitHubPullRequestCommenter.
- #publish_comment(comment) ⇒ Object
- #publish_summary(summary) ⇒ Object
Constructor Details
#initialize(repository, pull_request_number, github_client) ⇒ GitHubPullRequestCommenter
Returns a new instance of GitHubPullRequestCommenter.
11 12 13 14 15 |
# File 'lib/linterbot/github_pull_request_commenter.rb', line 11 def initialize(repository, pull_request_number, github_client) @repository = repository @pull_request_number = pull_request_number @github_client = github_client end |
Instance Attribute Details
#github_client ⇒ Object
Returns the value of attribute github_client.
9 10 11 |
# File 'lib/linterbot/github_pull_request_commenter.rb', line 9 def github_client @github_client end |
#pull_request_number ⇒ Object
Returns the value of attribute pull_request_number.
8 9 10 |
# File 'lib/linterbot/github_pull_request_commenter.rb', line 8 def pull_request_number @pull_request_number end |
#repository ⇒ Object
Returns the value of attribute repository.
7 8 9 |
# File 'lib/linterbot/github_pull_request_commenter.rb', line 7 def repository @repository end |
Instance Method Details
#publish_comment(comment) ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/linterbot/github_pull_request_commenter.rb', line 17 def publish_comment(comment) = "#{comment.severity.upcase} - #{comment.}\n" if comment_exist?() puts "Comment was not published because it already exists: #{}" else create_pull_request_comment(, comment.sha, comment.file, comment.patch_line_number) end end |
#publish_summary(summary) ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/linterbot/github_pull_request_commenter.rb', line 26 def publish_summary(summary) if same_as_last_summary?(summary) puts "Summary was not published because it's the same as the last result summary:\n #{summary}" else github_client.add_comment(repository, pull_request_number, summary) end end |