lib/reek/cli/report/report.rb in reek-1.5.1 vs lib/reek/cli/report/report.rb in reek-1.6.0
- old
+ new
@@ -56,16 +56,17 @@
print "\n"
print total_smell_count_message
end
def sort_examiners
- @examiners.sort! { |first, second| second.smells_count <=> first.smells_count } if @sort_by_issue_count
+ @examiners.sort_by!(&:smells_count).reverse! if @sort_by_issue_count
end
def total_smell_count_message
colour = smells? ? WARNINGS_COLOR : NO_WARNINGS_COLOR
- Rainbow("#{@total_smell_count} total warning#{'s' unless @total_smell_count == 1 }\n").color(colour)
+ s = @total_smell_count == 1 ? '' : 's'
+ Rainbow("#{@total_smell_count} total warning#{s}\n").color(colour)
end
end
#
# Displays a list of smells in YAML format
@@ -90,14 +91,14 @@
super @options.merge!(strategy: Strategy::Normal)
end
require 'erb'
- TEMPLATE = File.read(File.expand_path('../../../../../assets/html_output.html.erb', __FILE__))
-
def show
+ path = File.expand_path('../../../../../assets/html_output.html.erb',
+ __FILE__)
File.open('reek.html', 'w+') do |file|
- file.puts ERB.new(TEMPLATE).result(binding)
+ file.puts ERB.new(File.read(path)).result(binding)
end
print("Html file saved\n")
end
end
end