class RubyCritic::Analyser::ReekSmells
Public Class Methods
new(analysed_modules)
click to toggle source
# File lib/rubycritic/analysers/smells/reek.rb, line 11 def initialize(analysed_modules) @analysed_modules = analysed_modules end
Public Instance Methods
run()
click to toggle source
# File lib/rubycritic/analysers/smells/reek.rb, line 15 def run @analysed_modules.each do |analysed_module| add_smells_to(analysed_module) print green '.' end puts '' end
to_s()
click to toggle source
# File lib/rubycritic/analysers/smells/reek.rb, line 23 def to_s 'reek smells' end
Private Instance Methods
add_smells_to(analysed_module)
click to toggle source
# File lib/rubycritic/analysers/smells/reek.rb, line 29 def add_smells_to(analysed_module) Reek.new(analysed_module.pathname).smells.each do |smell| analysed_module.smells << create_smell(smell) end end
create_smell(smell)
click to toggle source
# File lib/rubycritic/analysers/smells/reek.rb, line 35 def create_smell(smell) Smell.new( locations: smell_locations(smell.source, smell.lines), context: smell.context, message: smell.message, type: smell.smell_type, analyser: 'reek', cost: 0 ) end
smell_locations(file_path, file_lines)
click to toggle source
# File lib/rubycritic/analysers/smells/reek.rb, line 46 def smell_locations(file_path, file_lines) file_lines.uniq.map do |file_line| Location.new(file_path, file_line) end.sort end