Class: Rigor::CLI::CheckCommand
- Defined in:
- lib/rigor/cli/check_command.rb
Overview
Executes ‘rigor check` — the analyzer’s primary command.
The other subcommands delegate to a ‘CLI::Command` subclass once they grow beyond a few lines; `check` is the largest of them, owning option parsing, the baseline filter (ADR-22), the incremental modes (ADR-46), cache-stats reporting, editor mode, the CI-native output formats (ADR-51), and the diagnostic-only / heap / budget appendices. Keeping it in its own class follows the same dispatch-vs-implementation split the rest of the CLI uses and keeps `Rigor::CLI` focused on dispatch.
The class-length budget is relaxed (as on ‘Rigor::CLI` itself) because `check` aggregates several independent concerns that are clearer read together than split across micro-classes.
Instance Method Summary collapse
-
#run ⇒ Integer
CLI exit status.
Methods inherited from Command
Constructor Details
This class inherits a constructor from Rigor::CLI::Command
Instance Method Details
#run ⇒ Integer
Returns CLI exit status.
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/rigor/cli/check_command.rb', line 31 def run # rubocop:disable Metrics/AbcSize load_check_dependencies = buffer = Options.resolve_buffer_binding(, err: @err) return CLI::EXIT_USAGE if buffer == :usage_error configuration = load_check_configuration() cache_root = configuration.cache_path handle_clear_cache(cache_root) if .fetch(:clear_cache) special = dispatch_special_check_mode(configuration, , cache_root) return special unless special.nil? runner = build_check_runner( configuration: configuration, options: , buffer: buffer, cache_root: cache_root ) raw_result = runner.run(@argv.empty? ? configuration.paths : @argv) result = apply_baseline_filter(raw_result, configuration, ) write_result(result, .fetch(:format)) emit_ci_detected_output(result, ) write_run_stats(result.stats) if result.stats write_trace_appendices runner.cache_store&.evict! write_cache_stats(cache_root, runner.cache_store) if .fetch(:cache_stats) exit_code = result.success? ? 0 : 1 exit_code = 1 if baseline_strict_violation?(raw_result.diagnostics, configuration, ) exit_code end |