Class: Quality::QualityChecker
- Inherits:
-
Object
- Object
- Quality::QualityChecker
- Defined in:
- lib/quality/quality_checker.rb
Overview
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.
Instance Method Summary collapse
- #execute(&count_violations_on_line) ⇒ Object
-
#initialize(cmd, command_options, output_dir, verbose, count_file: File, count_io: IO, command_output_processor_class: Quality::CommandOutputProcessor, count_dir: Dir, process_class: Process) ⇒ QualityChecker
constructor
A new instance of QualityChecker.
Constructor Details
#initialize(cmd, command_options, output_dir, verbose, count_file: File, count_io: IO, command_output_processor_class: Quality::CommandOutputProcessor, count_dir: Dir, process_class: Process) ⇒ QualityChecker
Returns a new instance of QualityChecker.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/quality/quality_checker.rb', line 11 def initialize(cmd, , output_dir, verbose, count_file: File, count_io: IO, command_output_processor_class: Quality::CommandOutputProcessor, count_dir: Dir, process_class: Process) @count_file = count_file @count_io = count_io @command_output_processor_class = command_output_processor_class @count_dir = count_dir @cmd = cmd @command_options = @verbose = verbose @count_dir.mkdir(output_dir) unless @count_file.exists?(output_dir) @filename = File.join(output_dir, "#{cmd}_high_water_mark") @process_class = process_class end |
Instance Method Details
#execute(&count_violations_on_line) ⇒ Object
30 31 32 33 34 35 |
# File 'lib/quality/quality_checker.rb', line 30 def execute(&count_violations_on_line) processor, exit_status = process_command(&count_violations_on_line) @violations = processor.violations check_exit_status(exit_status) ratchet_violations end |