Class: Linterbot::PullRequestAnalyzer

Inherits:
Object
  • Object
show all
Defined in:
lib/linterbot/pull_request_analyzer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(linter_report, pull_request) ⇒ PullRequestAnalyzer

Returns a new instance of PullRequestAnalyzer.



8
9
10
11
# File 'lib/linterbot/pull_request_analyzer.rb', line 8

def initialize(linter_report, pull_request)
  @pull_request = pull_request
  @linter_report = linter_report
end

Instance Attribute Details

#linter_reportObject

Returns the value of attribute linter_report.



6
7
8
# File 'lib/linterbot/pull_request_analyzer.rb', line 6

def linter_report
  @linter_report
end

#pull_requestObject

Returns the value of attribute pull_request.



5
6
7
# File 'lib/linterbot/pull_request_analyzer.rb', line 5

def pull_request
  @pull_request
end

Instance Method Details

#analyze(base_path) ⇒ Object



13
14
15
16
17
18
19
20
# File 'lib/linterbot/pull_request_analyzer.rb', line 13

def analyze(base_path)
  comments = hints_in_pull_request(base_path)
    .each_pair
    .reduce([]) do |comments, (filename, hints)|
      comments + generate_comments(filename, hints)
    end
  PullRequestAnalysisResult.new(comments)
end