Class: TodoListFormatter
- Inherits:
-
RuboCop::Formatter::ProgressFormatter
- Object
- RuboCop::Formatter::ProgressFormatter
- TodoListFormatter
- Defined in:
- lib/datarockets/style/formatter/todo_list_formatter.rb
Overview
This formatter works like default formattter (display dots for files with no offenses and letters for files with problems in the them).
In the end, it shows report with sorted cops and files which can be added to rubocop config.
Here’s the format:
Inspecting 3 files .CC 3 files inspected, 1005001 offenses detected
LineLength
Exclude:
- "really/bad/file.rb" # 100500
- "almost/ok.rb" # 1
Defined Under Namespace
Classes: FileOffence
Instance Attribute Summary collapse
-
#offense_list ⇒ Object
readonly
Returns the value of attribute offense_list.
Instance Method Summary collapse
- #file_finished(file, offenses) ⇒ Object
- #finished(inspected_files) ⇒ Object
- #started(target_files) ⇒ Object
Instance Attribute Details
#offense_list ⇒ Object (readonly)
Returns the value of attribute offense_list.
20 21 22 |
# File 'lib/datarockets/style/formatter/todo_list_formatter.rb', line 20 def offense_list @offense_list end |
Instance Method Details
#file_finished(file, offenses) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/datarockets/style/formatter/todo_list_formatter.rb', line 29 def file_finished(file, offenses) count_stats(offenses) report_file_as_mark(offenses) return if offenses.empty? path = Pathname.new(file).relative_path_from(Pathname.new(Dir.pwd)) offenses.reject(&:corrected?).each do |offense| offense_list << FileOffence.new(path, offense.cop_name) end end |
#finished(inspected_files) ⇒ Object
42 43 44 45 46 47 48 49 50 |
# File 'lib/datarockets/style/formatter/todo_list_formatter.rb', line 42 def finished(inspected_files) report_summary(inspected_files.length, @total_offense_count, @total_correction_count, @total_correctable_count) output.puts Datarockets::Style::Formatter::TodoListFormatter::ReportSummary.new(offense_list).call(output) end |
#started(target_files) ⇒ Object
24 25 26 27 |
# File 'lib/datarockets/style/formatter/todo_list_formatter.rb', line 24 def started(target_files) super @offense_list = [] end |