lib/danger/request_source/github.rb in danger-0.10.1 vs lib/danger/request_source/github.rb in danger-2.0.0
- old
+ new
@@ -34,10 +34,14 @@
def markdown_parser
@markdown_parser ||= Redcarpet::Markdown.new(Redcarpet::Render::HTML, no_intra_emphasis: true)
end
+ def pr_diff
+ @pr_diff ||= client.pull_request(ci_source.repo_slug, ci_source.pull_request_id, accept: 'application/vnd.github.v3.diff')
+ end
+
def setup_danger_branches
# we can use a github specific feature here:
base_commit = self.pr_json[:base][:sha]
head_commit = self.pr_json[:head][:sha]
@@ -105,10 +109,10 @@
errors: errors,
details_url: comment_result['html_url'])
end
def submit_pull_request_status!(warnings: [], errors: [], details_url: [])
- status = (errors.count == 0 ? 'success' : 'failure')
+ status = (errors.count.zero? ? 'success' : 'failure')
message = generate_github_description(warnings: warnings, errors: errors)
latest_pr_commit_ref = self.pr_json[:head][:sha]
if latest_pr_commit_ref.empty? || latest_pr_commit_ref.nil?