Class: RubyCritic::Analyser::Complexity

Inherits:
Object
  • Object
show all
Includes:
Colorize
Defined in:
lib/rubycritic/analysers/complexity.rb

Instance Method Summary collapse

Methods included from Colorize

#colorize, #green, #red

Constructor Details

#initialize(analysed_modules) ⇒ Complexity

Returns a new instance of Complexity.


9
10
11
12
# File 'lib/rubycritic/analysers/complexity.rb', line 9

def initialize(analysed_modules)
  @flog = Flog.new
  @analysed_modules = analysed_modules
end

Instance Method Details

#runObject


14
15
16
17
18
19
20
21
22
# File 'lib/rubycritic/analysers/complexity.rb', line 14

def run
  @analysed_modules.each do |analysed_module|
    @flog.reset
    @flog.flog(analysed_module.path)
    analysed_module.complexity = @flog.total_score.round
    print green '.'
  end
  puts ''
end

#to_sObject


24
25
26
# File 'lib/rubycritic/analysers/complexity.rb', line 24

def to_s
  'complexity'
end