This class handles the processing of files, which includes dealing with formatters and letting cops inspect the files.
# 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
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
Generated with the Darkfish Rdoc Generator 2.