Parent

Files

Class/Module Index [+]

Quicksearch

RuboCop::FileInspector

This class handles the processing of files, which includes dealing with formatters and letting cops inspect the files.

Public Class Methods

new(options) click to toggle source
# File lib/rubocop/file_inspector.rb, line 6
def initialize(options)
  @options = options
  @errors = []
end

Public Instance Methods

display_error_summary() click to toggle source
# File lib/rubocop/file_inspector.rb, line 37
def display_error_summary
  return if @errors.empty?
  plural = @errors.count > 1 ? 's' : ''
  warn "\n#{@errors.count} error#{plural} occurred:".color(:red)
  @errors.each { |error| warn error }
  warn 'Errors are usually caused by RuboCop bugs.'
  warn 'Please, report your problems to RuboCop\s issue tracker.'
  warn 'Mention the following information in the issue report:'
  warn RuboCop::Version.version(true)
end
process_files(target_files, config_store) click to toggle source

Takes a block which it calls once per inspected file. The block shall return true if the caller wants to break the loop early.

# File lib/rubocop/file_inspector.rb, line 13
def process_files(target_files, config_store)
  target_files.each(&:freeze).freeze
  inspected_files = []
  any_failed = false

  formatter_set.started(target_files)

  target_files.each do |file|
    break if yield
    offenses = process_file(file, config_store)

    any_failed = true if offenses.any? do |o|
      o.severity >= fail_level
    end
    inspected_files << file
    break if @options[:fail_fast] && any_failed
  end

  formatter_set.finished(inspected_files.freeze)

  formatter_set.close_output_files
  any_failed
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.