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.
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 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/rigor/cli/check_command.rb', line 37 def run # rubocop:disable Metrics/AbcSize, Metrics/MethodLength # Arm deferred YJIT enablement before any analysis work: the deadline # thread only fires once a run outlasts the amortization window, so a # short check finishes before it ever pays JIT compile cost while a # long run JITs its dominant tail (Runtime::Jit). Runtime::Jit.enable_after(Runtime::Jit.deadline_seconds) # ADR-87 WD4 — parse options + resolve config WITHOUT the inference engine, so the run-cache hit probe # can run first. The heavy engine (`load_check_dependencies`) loads only on a miss / non-cacheable run. = buffer = Options.resolve_buffer_binding(, err: @err) return CLI::EXIT_USAGE if buffer == :usage_error configuration = load_check_configuration() configuration = apply_bleeding_edge_override(configuration, ) conflict = parameter_inference_incremental_conflict(configuration, ) return conflict unless conflict.nil? config_warnings = warn_unresolved_config(configuration) cache_root = configuration.cache_path handle_clear_cache(cache_root) if .fetch(:clear_cache) # ADR-87 WD4 — try to serve the whole run from the ADR-45 cache before booting the engine. A hit boots # only CLI + config + cache + digest code (no `rigor/inference`), skipping the plugin prepass + env # build entirely. probed = try_run_cache_hit(configuration, , buffer, cache_root) return finalize_cache_hit(probed, configuration, , config_warnings) unless probed.nil? load_check_dependencies 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, ) coverage = compute_coverage(runner, configuration, ) write_result(result, .fetch(:format), coverage: coverage, config_warnings: config_warnings) 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 |