lib/quality/quality_checker.rb in quality-4.0.2 vs lib/quality/quality_checker.rb in quality-5.0.0
- old
+ new
@@ -1,24 +1,26 @@
require_relative 'command_output_processor'
require_relative 'process_runner'
+# XXX: Should add *.gemspec to glob
module Quality
# Runs a quality-checking, command, checks it agaist the existing
# number of violations for that command, and decreases that number
# if possible, or outputs data if the number of violations increased.
class QualityChecker
- def initialize(cmd, command_options, output_dir, verbose, dependencies = {})
- @count_file = dependencies[:count_file] || File
- @count_io = dependencies[:count_io] || IO
- @command_output_processor_class =
- dependencies[:command_output_processor_class] ||
- Quality::CommandOutputProcessor
+ def initialize(cmd, command_options, output_dir, verbose,
+ count_file: File,
+ count_io: IO,
+ command_output_processor_class:
+ Quality::CommandOutputProcessor,
+ count_dir: Dir,
+ process_runner_class: ProcessRunner)
+ @count_file, @count_io, @command_output_processor_class, @count_dir =
+ count_file, count_io, command_output_processor_class, count_dir
@cmd, @command_options, @verbose = cmd, command_options, verbose
- @count_dir = dependencies[:count_dir] || Dir
@count_dir.mkdir(output_dir) unless @count_file.exists?(output_dir)
@filename = File.join(output_dir, "#{cmd}_high_water_mark")
- @process_runner_class =
- dependencies[:process_runner_class] || ProcessRunner
+ @process_runner_class = process_runner_class
end
def execute(&count_violations_on_line)
processor, exit_status = process_command(&count_violations_on_line)
@violations = processor.violations