lib/punchlist.rb in punchlist-1.0.0 vs lib/punchlist.rb in punchlist-1.1.0

- old
+ new

@@ -4,42 +4,45 @@ # 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(outputter: STDOUT, - globber: Dir, + def initialize(args, + outputter: STDOUT, file_opener: File, - options_parser: Options.new(default_punchlist_line_regexp)) + options_parser: Options.new(args), + source_file_globber: SourceFinder::SourceFileGlobber.new) + @args = args @outputter = outputter - @globber = globber @file_opener = file_opener @options_parser = options_parser + @source_file_globber = source_file_globber end def run @options = @options_parser.parse_options analyze_files 0 end - def source_files_glob - @options[: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| all_output.concat(look_for_punchlist_items(filename)) end @outputter.print render(all_output) end def source_files - @globber.glob(source_files_glob) + if @options[:glob] + @source_file_globber.source_files_glob = @options[:glob] + end + if @options[:exclude] + @source_file_globber.source_files_exclude_glob = @options[:exclude] + end + @source_file_globber.source_files end def default_punchlist_line_regexp /XXX|TODO/ end