class RuboCop::Formatter::MaximusRuboFormatter
This formatter formats the report data in JSON Makes it consistent with output of other Maximus
linters
Attributes
output_hash[R]
Public Class Methods
new(output)
click to toggle source
Calls superclass method
# File lib/maximus/reporter/rubocop.rb, line 18 def initialize(output) super @output_hash = {} end
Public Instance Methods
file_finished(file, offenses)
click to toggle source
# File lib/maximus/reporter/rubocop.rb, line 26 def file_finished(file, offenses) unless offenses.empty? @output_hash[relative_path(file).to_sym] = {} @output_hash[relative_path(file).to_sym] = offenses.map { |o| hash_for_offense(o) } end end
finished(inspected_files)
click to toggle source
# File lib/maximus/reporter/rubocop.rb, line 33 def finished(inspected_files) output.write @output_hash.to_json end
hash_for_offense(offense)
click to toggle source
# File lib/maximus/reporter/rubocop.rb, line 37 def hash_for_offense(offense) { severity: offense.severity.name, reason: offense.message, linter: offense.cop_name, line: offense.line, column: offense.real_column } end
started(target_files)
click to toggle source
# File lib/maximus/reporter/rubocop.rb, line 23 def started(target_files) end