class Reek::CodeClimate::CodeClimateFormatter
Generates a hash in the structure specified by the Code Climate engine spec
Attributes
Public Class Methods
Source
# File lib/reek/code_climate/code_climate_formatter.rb, line 10 def initialize(warning) @warning = warning end
Public Instance Methods
Source
# File lib/reek/code_climate/code_climate_formatter.rb, line 14 def render CCEngine::Issue.new(check_name: check_name, description: description, categories: categories, location: location, remediation_points: remediation_points, fingerprint: fingerprint, content: content).render end
Private Instance Methods
Source
# File lib/reek/code_climate/code_climate_formatter.rb, line 36 def categories ['Complexity'] end
Source
# File lib/reek/code_climate/code_climate_formatter.rb, line 32 def check_name warning.smell_type end
Source
# File lib/reek/code_climate/code_climate_formatter.rb, line 59 def configuration @configuration ||= CodeClimateConfiguration.load end
Source
# File lib/reek/code_climate/code_climate_formatter.rb, line 55 def content configuration[warning.smell_type].fetch('content') end
Source
# File lib/reek/code_climate/code_climate_formatter.rb, line 28 def description [warning.context, warning.message].join(' ') end
Source
# File lib/reek/code_climate/code_climate_formatter.rb, line 51 def fingerprint CodeClimateFingerprint.new(warning).compute end
Source
# File lib/reek/code_climate/code_climate_formatter.rb, line 40 def location warning_lines = warning.lines CCEngine::Location::LineRange.new( path: warning.source, line_range: warning_lines.first..warning_lines.last) end
Source
# File lib/reek/code_climate/code_climate_formatter.rb, line 47 def remediation_points configuration[warning.smell_type].fetch('remediation_points') end