Module: RuboCop::Gradual::Configuration

Defined in:
lib/rubocop/gradual/configuration.rb

Overview

Configuration class stores Gradual and Rubocop options.

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.lint_pathsObject (readonly)

Returns the value of attribute lint_paths.



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

def lint_paths
  @lint_paths
end

.optionsObject (readonly)

Returns the value of attribute options.



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

def options
  @options
end

.rubocop_optionsObject (readonly)

Returns the value of attribute rubocop_options.



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

def rubocop_options
  @rubocop_options
end

.rubocop_resultsObject (readonly)

Returns the value of attribute rubocop_results.



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

def rubocop_results
  @rubocop_results
end

Class Method Details

.apply(options = {}, rubocop_options = {}, lint_paths = []) ⇒ Object



10
11
12
13
14
15
16
17
# File 'lib/rubocop/gradual/configuration.rb', line 10

def apply(options = {}, rubocop_options = {}, lint_paths = [])
  @options = options
  @rubocop_options = rubocop_options
  @lint_paths = lint_paths
  @target_file_paths = nil
  @standard_config_store = nil
  @rubocop_results = []
end

.commandObject



23
24
25
# File 'lib/rubocop/gradual/configuration.rb', line 23

def command
  options.fetch(:command, :base)
end

.debug?Boolean

Returns:

  • (Boolean)


35
36
37
# File 'lib/rubocop/gradual/configuration.rb', line 35

def debug?
  rubocop_options[:debug]
end

.display_time?Boolean

Returns:

  • (Boolean)


39
40
41
# File 'lib/rubocop/gradual/configuration.rb', line 39

def display_time?
  rubocop_options[:debug] || rubocop_options[:display_time]
end

.modeObject



27
28
29
# File 'lib/rubocop/gradual/configuration.rb', line 27

def mode
  options.fetch(:mode, :update)
end

.pathObject



31
32
33
# File 'lib/rubocop/gradual/configuration.rb', line 31

def path
  options.fetch(:path, ".rubocop_gradual.lock")
end

.rubocop_config_storeObject



43
44
45
46
47
48
49
# File 'lib/rubocop/gradual/configuration.rb', line 43

def rubocop_config_store
  return standard_config_store if options[:standard]

  RuboCop::ConfigStore.new.tap do |config_store|
    config_store.options_config = rubocop_options[:config] if rubocop_options[:config]
  end
end

.target_file_pathsObject



19
20
21
# File 'lib/rubocop/gradual/configuration.rb', line 19

def target_file_paths
  @target_file_paths ||= rubocop_target_file_paths
end