Class: RuboCop::Git::StyleChecker

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

Overview

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of StyleChecker.



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

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



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

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

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