Class: RuboCop::Git::StyleGuide

Inherits:
Object
  • Object
show all
Defined in:
lib/rubocop/git/style_guide.rb

Overview

Instance Method Summary collapse

Constructor Details

#initialize(rubocop_options, config_file, custom_config = nil) ⇒ StyleGuide

Returns a new instance of StyleGuide.



3
4
5
6
7
# File 'lib/rubocop/git/style_guide.rb', line 3

def initialize(rubocop_options, config_file, custom_config = nil)
  @rubocop_options = rubocop_options
  @config_file = config_file
  @custom_config = custom_config
end

Instance Method Details

#inspectObject



20
21
22
# File 'lib/rubocop/git/style_guide.rb', line 20

def inspect
  "#<#{self.class.name}>"
end

#violations(file) ⇒ Object



9
10
11
12
13
14
15
16
17
18
# File 'lib/rubocop/git/style_guide.rb', line 9

def violations(file)
  if ignored_file?(file)
    []
  else
    src = process_source(file)
    t_class = RuboCop::Cop::Team
    team = t_class.send(t_class.respond_to?(:mobilize) ? :mobilize : :new, enabled_cops, config, rubocop_options)
    team.respond_to?(:investigate) ? team.investigate(src).offenses : team.inspect_file(src)
  end
end