Class: RuboCop::Git::StyleChecker

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

Instance Method Summary collapse

Constructor Details

#initialize(modified_files, rubocop_options, config_file, custom_config = nil) ⇒ StyleChecker



3
4
5
6
7
8
9
10
11
# File 'lib/rubocop/git/style_checker.rb', line 3

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

Instance Method Details

#violationsObject



13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/rubocop/git/style_checker.rb', line 13

def violations
  file_violations = @modified_files.map do |modified_file|
    RuboCop::Git::FileViolation.new(
      modified_file.absolute_path,
      offenses(modified_file)
    )
  end

  file_violations.select do |file_violation|
    file_violation.offenses.any?
  end
end