class Linterbot::Runner
Public Class Methods
new(configuration)
click to toggle source
# File lib/linterbot/runner.rb, line 15 def initialize(configuration) @configuration = configuration end
Public Instance Methods
run(repository, pull_request_number)
click to toggle source
# File lib/linterbot/runner.rb, line 19 def run(repository, pull_request_number) pull_request = new_pull_request(repository, pull_request_number) mark_pull_request_status_as_pending(pull_request) analyze(pull_request) end
Private Instance Methods
analyze(pull_request)
click to toggle source
# File lib/linterbot/runner.rb, line 31 def analyze(pull_request) analyzer = new_pull_request_analyzer(pull_request) handler = new_result_handler(pull_request) result = analyzer.analyze(project_base_path) handler.handle(result) rescue Exception => exception mark_pull_request_status_as_error(pull_request) raise exception end
approver()
click to toggle source
# File lib/linterbot/runner.rb, line 58 def approver @approver ||= approver_class.new(github_client) end
linter_report()
click to toggle source
# File lib/linterbot/runner.rb, line 27 def linter_report @linter_report ||= LinterReport.new(linter_report_file) end
mark_pull_request_status_as_error(pull_request)
click to toggle source
# File lib/linterbot/runner.rb, line 66 def mark_pull_request_status_as_error(pull_request) approver.error(pull_request.repository, pull_request.newest_commit.sha) end
mark_pull_request_status_as_pending(pull_request)
click to toggle source
# File lib/linterbot/runner.rb, line 62 def mark_pull_request_status_as_pending(pull_request) approver.pending(pull_request.repository, pull_request.newest_commit.sha) end
new_commenter(pull_request)
click to toggle source
# File lib/linterbot/runner.rb, line 45 def new_commenter(pull_request) commenter_class.new(pull_request.repository, pull_request.pull_request_number, github_client) end
new_pull_request(repository, pull_request_number)
click to toggle source
# File lib/linterbot/runner.rb, line 41 def new_pull_request(repository, pull_request_number) PullRequest.new(repository, pull_request_number, github_client) end
new_pull_request_analyzer(pull_request)
click to toggle source
# File lib/linterbot/runner.rb, line 49 def new_pull_request_analyzer(pull_request) PullRequestAnalyzer.new(linter_report, pull_request) end
new_result_handler(pull_request)
click to toggle source
# File lib/linterbot/runner.rb, line 53 def new_result_handler(pull_request) commenter = new_commenter(pull_request) ResultHandler.new(pull_request, commenter, approver) end