Skip to content

Commit

Permalink
Method "inspect" was divided into two parts.
Browse files Browse the repository at this point in the history
The functionality of one method was divided into two logically functioning parts. One method obtain offences and the other one inspects these offences.
  • Loading branch information
europ committed Feb 22, 2018
1 parent e471127 commit 1eaa11c
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions lib/pronto/rubocop.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,14 @@ def valid_patch?(patch)
ruby_file?(path)
end

def inspect(patch)
def offences(patch)
processed_source = processed_source_for(patch)
offences = @inspector.send(:inspect_file, processed_source).first

offences.sort.reject(&:disabled?).map do |offence|
@inspector.send(:inspect_file, processed_source).first
end

def inspect(patch)
offences(patch).sort.reject(&:disabled?).map do |offence|
patch.added_lines
.select { |line| line.new_lineno == offence.line }
.map { |line| new_message(offence, line) }
Expand Down

0 comments on commit 1eaa11c

Please sign in to comment.