lib/reek/cli/report/report.rb in reek-2.0.0 vs lib/reek/cli/report/report.rb in reek-2.0.1
- old
+ new
@@ -1,6 +1,7 @@
require 'rainbow'
+require 'json'
module Reek
module Cli
module Report
#
@@ -56,16 +57,15 @@
end
private
def display_summary
- print smells.reject(&:empty?).join("\n")
+ smells.reject(&:empty?).each { |smell| puts smell }
end
def display_total_smell_count
return unless @examiners.size > 1
- print "\n"
print total_smell_count_message
end
def summarize_single_examiner(examiner)
result = heading_formatter.header(examiner)
@@ -97,9 +97,18 @@
# Displays a list of smells in YAML format
# YAML with empty array for 0 smells
class YamlReport < Base
def show
print smells.map(&:yaml_hash).to_yaml
+ end
+ end
+
+ #
+ # Displays a list of smells in JSON format
+ # JSON with empty array for 0 smells
+ class JsonReport < Base
+ def show
+ print ::JSON.generate(smells.map(&:yaml_hash))
end
end
#
# Saves the report as a HTML file