lib/punchlist.rb in punchlist-0.0.1 vs lib/punchlist.rb in punchlist-0.0.2

- old
+ new

@@ -1,5 +1,8 @@ +# XXX: need to include BUG in list +# XXX: need to include BUG in my rubocop config +# BUG need to fix the fact that we create blank lines on files with no issues module Punchlist # Counts the number of 'todo' comments in your code. class Punchlist def initialize(args, outputter: STDOUT, @@ -28,14 +31,15 @@ @source_files_glob ||= '{app,lib,test,spec,feature}/**/*.{rb,swift,scala,js,cpp,c,java,py}' end def analyze_files + all_output = [] source_files.each do |filename| - output = look_for_punchlist_items(filename) - @outputter.puts render(output) + all_output.concat(look_for_punchlist_items(filename)) end + @outputter.print render(all_output) end def source_files @globber.glob(source_files_glob) end @@ -55,11 +59,12 @@ end lines end def render(output) - output.map do |filename, line_num, line| + lines = output.map do |filename, line_num, line| "#{filename}:#{line_num}: #{line}" - end.join("\n") + end + lines.join end end end