class ERBLint::Reporters::JsonReporter
Public Instance Methods
preview()
click to toggle source
# File lib/erb_lint/reporters/json_reporter.rb, line 8 def preview; end
show()
click to toggle source
# File lib/erb_lint/reporters/json_reporter.rb, line 10 def show puts formatted_data end
Private Instance Methods
format_offense(offense)
click to toggle source
# File lib/erb_lint/reporters/json_reporter.rb, line 57 def format_offense(offense) { linter: offense.linter.class.simple_name, message: offense.message.to_s, location: { start_line: offense.line_number, start_column: offense.column, last_line: offense.source_range.last_line, last_column: offense.source_range.last_column, length: offense.source_range.length, }, } end
formatted_data()
click to toggle source
# File lib/erb_lint/reporters/json_reporter.rb, line 16 def formatted_data { metadata: metadata, files: formatted_files, summary: summary, }.to_json end
formatted_files()
click to toggle source
# File lib/erb_lint/reporters/json_reporter.rb, line 42 def formatted_files processed_files.map do |filename, offenses| { path: filename, offenses: formatted_offenses(offenses), } end end
formatted_offenses(offenses)
click to toggle source
# File lib/erb_lint/reporters/json_reporter.rb, line 51 def formatted_offenses(offenses) offenses.map do |offense| format_offense(offense) end end
metadata()
click to toggle source
# File lib/erb_lint/reporters/json_reporter.rb, line 24 def metadata { erb_lint_version: ERBLint::VERSION, ruby_engine: RUBY_ENGINE, ruby_version: RUBY_VERSION, ruby_patchlevel: RUBY_PATCHLEVEL.to_s, ruby_platform: RUBY_PLATFORM, } end
summary()
click to toggle source
# File lib/erb_lint/reporters/json_reporter.rb, line 34 def summary { offenses: stats.found, inspected_files: stats.processed_files.size, corrected: stats.corrected, } end