Class: CC::Service::PullRequestsPresenter

Inherits:
Object
  • Object
show all
Includes:
ActiveSupport::NumberHelper
Defined in:
lib/cc/presenters/pull_requests_presenter.rb

Instance Method Summary collapse

Constructor Details

#initialize(payload) ⇒ PullRequestsPresenter

Returns a new instance of PullRequestsPresenter.



6
7
8
9
10
11
12
13
# File 'lib/cc/presenters/pull_requests_presenter.rb', line 6

def initialize(payload)
  issue_comparison_counts = payload["issue_comparison_counts"]

  if issue_comparison_counts
    @fixed_count = issue_comparison_counts["fixed"]
    @new_count = issue_comparison_counts["new"]
  end
end

Instance Method Details

#error_messageObject



15
16
17
# File 'lib/cc/presenters/pull_requests_presenter.rb', line 15

def error_message
  "Code Climate encountered an error attempting to analyze this pull request."
end

#pending_messageObject



19
20
21
# File 'lib/cc/presenters/pull_requests_presenter.rb', line 19

def pending_message
  "Code Climate is analyzing this code."
end

#skipped_messageObject



23
24
25
# File 'lib/cc/presenters/pull_requests_presenter.rb', line 23

def skipped_message
  "Code Climate has skipped analysis of this commit."
end

#success_messageObject



27
28
29
30
31
32
33
# File 'lib/cc/presenters/pull_requests_presenter.rb', line 27

def success_message
  if both_issue_counts_zero?
    "Code Climate didn't find any new or fixed issues."
  else
    "Code Climate found #{formatted_issue_counts}."
  end
end