Skip to content

Commit

Permalink
Fix multiple correction for same offense & fix error text
Browse files Browse the repository at this point in the history
  • Loading branch information
Mangoov committed Feb 20, 2018
1 parent 8b78634 commit c44636e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/erb_lint/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,9 @@ def run(args = ARGV)
end

if @stats.corrected > 0
if @stats.found > 0
warn "#{@stats.corrected} error(s) corrected and #{@stats.found} error(s) remaining in ERB files".red
corrected_found_diff = @stats.found - @stats.corrected
if corrected_found_diff > 0
warn "#{@stats.corrected} error(s) corrected and #{corrected_found_diff} error(s) remaining in ERB files".red
else
puts "#{@stats.corrected} error(s) corrected in ERB files".green
end
Expand Down Expand Up @@ -99,6 +100,7 @@ def run_with_corrections(filename)

7.times do
processed_source = ERBLint::ProcessedSource.new(filename, file_content)
previous_offenses = runner.offenses
runner.run(processed_source)
break unless autocorrect? && runner.offenses.any?

Expand All @@ -113,6 +115,7 @@ def run_with_corrections(filename)
end

file_content = corrector.corrected_content
break if previous_offenses.eql?(runner.offenses)
end

@stats.found += runner.offenses.size
Expand Down

0 comments on commit c44636e

Please sign in to comment.