Class: Rubocop::Formatter::ProgressFormatter
Overview
This formatter display dots for files with no offenses and
letters for files with problems in the them. In the end it
appends the regular report data in the clang style format.
Constant Summary
SimpleTextFormatter::COLOR_FOR_SEVERITY
Instance Attribute Summary
#output
Instance Method Summary
collapse
#highlight_line, #report_file
#report_file, #report_summary
Methods included from PathUtil
match_path?, relative_path
#colorize, #rainbow
#file_started, #initialize
Instance Method Details
#file_finished(file, offenses) ⇒ Object
16
17
18
19
20
21
22
23
|
# File 'lib/rubocop/formatter/progress_formatter.rb', line 16
def file_finished(file, offenses)
unless offenses.empty?
count_stats(offenses)
@offenses_for_files[file] = offenses
end
report_file_as_mark(file, offenses)
end
|
#finished(inspected_files) ⇒ Object
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
# File 'lib/rubocop/formatter/progress_formatter.rb', line 25
def finished(inspected_files)
output.puts
unless @offenses_for_files.empty?
output.puts
output.puts 'Offenses:'
output.puts
@offenses_for_files.each do |file, offenses|
report_file(file, offenses)
end
end
report_summary(inspected_files.count,
@total_offense_count,
@total_correction_count)
end
|
#report_file_as_mark(file, offenses) ⇒ Object
43
44
45
46
47
48
49
50
51
52
|
# File 'lib/rubocop/formatter/progress_formatter.rb', line 43
def report_file_as_mark(file, offenses)
mark = if offenses.empty?
green('.')
else
highest_offense = offenses.max_by { |o| o.severity }
colored_severity_code(highest_offense)
end
output.write mark
end
|
#started(target_files) ⇒ Object
9
10
11
12
13
14
|
# File 'lib/rubocop/formatter/progress_formatter.rb', line 9
def started(target_files)
super
@offenses_for_files = {}
file_phrase = target_files.count == 1 ? 'file' : 'files'
output.puts "Inspecting #{target_files.count} #{file_phrase}"
end
|