Class: RubyCritic::Analyser::Churn

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Colorize

#colorize, #green, #red

Constructor Details

#initialize(analysed_modules) ⇒ Churn

Returns a new instance of Churn.


10
11
12
13
# File 'lib/rubycritic/analysers/churn.rb', line 10

def initialize(analysed_modules)
  @analysed_modules = analysed_modules
  @source_control_system = Config.source_control_system
end

Instance Attribute Details

#source_control_system=(value) ⇒ Object (writeonly)

Sets the attribute source_control_system

Parameters:

  • value

    the value to set the attribute source_control_system to.


8
9
10
# File 'lib/rubycritic/analysers/churn.rb', line 8

def source_control_system=(value)
  @source_control_system = value
end

Instance Method Details

#runObject


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

def run
  @analysed_modules.each do |analysed_module|
    analysed_module.churn = @source_control_system.revisions_count(analysed_module.path)
    analysed_module.committed_at = @source_control_system.date_of_last_commit(analysed_module.path)
    print green '.'
  end
  puts ''
end

#to_sObject


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

def to_s
  'churn'
end