Class: Rubycritic::Rubycritic

Inherits:
Object
  • Object
show all
Defined in:
lib/rubycritic.rb

Instance Method Summary collapse

Constructor Details

#initialize(dirs) ⇒ Rubycritic

Returns a new instance of Rubycritic.



11
12
13
14
# File 'lib/rubycritic.rb', line 11

def initialize(dirs)
  @source = SourceLocator.new(dirs)
  @source_control_system = SourceControlSystem.create
end

Instance Method Details

#critiqueObject



16
17
18
19
20
21
22
23
24
# File 'lib/rubycritic.rb', line 16

def critique
  if @source_control_system.has_revision?
    smelly_pathnames = RevisionComparator.new(@source.paths, @source_control_system).compare
  else
    smell_adapters = AnalysersRunner.new(@source.paths).run
    smelly_pathnames = SmellsAggregator.new(smell_adapters).smelly_pathnames
  end
  Reporter.new(@source.pathnames, smelly_pathnames).generate_report
end