Class: Rucoa::Rubocop::Investigator

Inherits:
RuboCop::Runner
  • Object
show all
Defined in:
lib/rucoa/rubocop/investigator.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(source:) ⇒ Investigator

Returns a new instance of Investigator.

Parameters:



17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/rucoa/rubocop/investigator.rb', line 17

def initialize(source:)
  @source = source
  @offenses = []
  super(
    ::RuboCop::Options.new.parse(
      %w[
        --stderr
        --force-exclusion
        --format RuboCop::Formatter::BaseFormatter
      ]
    ).first,
    ::RuboCop::ConfigStore.new
  )
end

Class Method Details

.call(source:) ⇒ Array<RuboCop::Cop::Offense>

Parameters:

Returns:

  • (Array<RuboCop::Cop::Offense>)


11
12
13
# File 'lib/rucoa/rubocop/investigator.rb', line 11

def call(source:)
  new(source: source).call
end

Instance Method Details

#callArray<RuboCop::Cop::Offense>

Returns:

  • (Array<RuboCop::Cop::Offense>)


33
34
35
36
37
# File 'lib/rucoa/rubocop/investigator.rb', line 33

def call
  @options[:stdin] = @source.content
  run([path])
  @offenses
end