lib/cc/analyzer/formatters/plain_text_formatter.rb in codeclimate-0.9.7 vs lib/cc/analyzer/formatters/plain_text_formatter.rb in codeclimate-0.10.0
- old
+ new
@@ -4,11 +4,10 @@
module CC
module Analyzer
module Formatters
class PlainTextFormatter < Formatter
-
def started
puts colorize("Starting analysis", :green)
end
def write(data)
@@ -19,36 +18,36 @@
when "issue"
issues << json
when "warning"
warnings << json
else
- raise "Invalid type found: #{json["type"]}"
+ raise "Invalid type found: #{json['type']}"
end
end
def finished
puts
issues_by_path.each do |path, file_issues|
- puts colorize("== #{path} (#{pluralize(file_issues.size, "issue")}) ==", :yellow)
+ puts colorize("== #{path} (#{pluralize(file_issues.size, 'issue')}) ==", :yellow)
IssueSorter.new(file_issues).by_location.each do |issue|
- if location = issue["location"]
+ if (location = issue["location"])
source_buffer = @filesystem.source_buffer_for(location["path"])
print(colorize(LocationDescription.new(source_buffer, location, ": "), :cyan))
end
print(issue["description"])
- print(colorize(" [#{issue["engine_name"]}]", "#333333"))
+ print(colorize(" [#{issue['engine_name']}]", "#333333"))
puts
end
puts
end
- print(colorize("Analysis complete! Found #{pluralize(issues.size, "issue")}", :green))
+ print(colorize("Analysis complete! Found #{pluralize(issues.size, 'issue')}", :green))
if warnings.size > 0
- print(colorize(" and #{pluralize(warnings.size, "warning")}", :green))
+ print(colorize(" and #{pluralize(warnings.size, 'warning')}", :green))
end
puts(colorize(".", :green))
end
def engine_running(engine, &block)
@@ -91,10 +90,10 @@
def issues
@issues ||= []
end
def issues_by_path
- issues.group_by { |i| i['location']['path'] }.sort
+ issues.group_by { |i| i["location"]["path"] }.sort
end
def warnings
@warnings ||= []
end