Class: RubyCritic::Configuration

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#base_branchObject

Returns the value of attribute base_branch


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

def base_branch
  @base_branch
end

#base_branch_collectionObject

Returns the value of attribute base_branch_collection


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

def base_branch_collection
  @base_branch_collection
end

#base_branch_scoreObject

Returns the value of attribute base_branch_score


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

def base_branch_score
  @base_branch_score
end

#base_root_directoryObject

Returns the value of attribute base_root_directory


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

def base_root_directory
  @base_root_directory
end

#churn_afterObject

Returns the value of attribute churn_after


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

def churn_after
  @churn_after
end

#compare_root_directoryObject

Returns the value of attribute compare_root_directory


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

def compare_root_directory
  @compare_root_directory
end

Returns the value of attribute deduplicate_symlinks


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

def deduplicate_symlinks
  @deduplicate_symlinks
end

#feature_branchObject

Returns the value of attribute feature_branch


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

def feature_branch
  @feature_branch
end

#feature_branch_collectionObject

Returns the value of attribute feature_branch_collection


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

def feature_branch_collection
  @feature_branch_collection
end

#feature_branch_scoreObject

Returns the value of attribute feature_branch_score


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

def feature_branch_score
  @feature_branch_score
end

#feature_root_directoryObject

Returns the value of attribute feature_root_directory


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

def feature_root_directory
  @feature_root_directory
end

#formatsObject

Returns the value of attribute formats


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

def formats
  @formats
end

#formattersObject

Returns the value of attribute formatters


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

def formatters
  @formatters
end

#modeObject

Returns the value of attribute mode


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

def mode
  @mode
end

#no_browserObject

Returns the value of attribute no_browser


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

def no_browser
  @no_browser
end

#open_withObject

Returns the value of attribute open_with


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

def open_with
  @open_with
end

#rootObject

Returns the value of attribute root


7
8
9
# File 'lib/rubycritic/configuration.rb', line 7

def root
  @root
end

#source_control_systemObject

Returns the value of attribute source_control_system


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

def source_control_system
  @source_control_system
end

#suppress_ratingsObject

Returns the value of attribute suppress_ratings


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

def suppress_ratings
  @suppress_ratings
end

#threshold_scoreObject

Returns the value of attribute threshold_score


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

def threshold_score
  @threshold_score
end

Instance Method Details

#set(options) ⇒ Object


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

def set(options)
  self.mode = options[:mode] || :default
  self.root = options[:root] || 'tmp/rubycritic'
  self.deduplicate_symlinks = options[:deduplicate_symlinks]
  self.suppress_ratings = options[:suppress_ratings]
  self.open_with = options[:open_with]
  self.no_browser = options[:no_browser]
  self.threshold_score = options[:threshold_score].to_i
  setup_version_control(options)
  setup_formats(options)
end

#setup_formats(options) ⇒ Object


33
34
35
36
37
# File 'lib/rubycritic/configuration.rb', line 33

def setup_formats(options)
  formats = options[:formats].to_a
  self.formats = formats.empty? ? [:html] : formats
  self.formatters = options[:formatters] || []
end

#setup_version_control(options) ⇒ Object


27
28
29
30
31
# File 'lib/rubycritic/configuration.rb', line 27

def setup_version_control(options)
  self.base_branch = options[:base_branch]
  self.feature_branch = options[:feature_branch]
  self.churn_after = options[:churn_after]
end

#source_control_present?Boolean

Returns:

  • (Boolean)

43
44
45
46
# File 'lib/rubycritic/configuration.rb', line 43

def source_control_present?
  source_control_system &&
    !source_control_system.is_a?(SourceControlSystem::Double)
end