Module: Rigor::Inference::ProjectPatchedScanner

Defined in:
lib/rigor/inference/project_patched_scanner.rb

Overview

ADR-17 slice 2 — pre-pass scanner. Walks every file the user listed under pre_eval: and harvests every def / def self. declaration inside a class / module body into a ProjectPatchedMethods registry the dispatcher consults below the plugin tier.

The walker is intentionally a strict subset of ScopeIndexer's machinery: it only needs class C; def m; end; end shape recognition, not full inference. Parse errors degrade to a fail-soft :warning pre-eval.parse-error diagnostic accumulated alongside the registry; per ADR-17 § "Failure modes" a parse failure in a pre-eval file MUST NOT abort the rest of the run.

Defined Under Namespace

Classes: Result

Class Method Summary collapse

Class Method Details

.scan(paths, buffer: nil) ⇒ Result

Returns the populated registry plus any per-file warnings.

Parameters:

  • paths (Array<String>)

    absolute paths to the pre-eval files. The runner has already validated that each path exists (slice-1 pre-eval.file-not-found :error covers missing entries); the scanner does NOT re-check existence.

  • buffer (Rigor::Analysis::BufferBinding, nil) (defaults to: nil)

    editor-mode buffer binding. When set, the scanner reads the buffer's physical bytes if a pre-eval entry matches the logical path, so users editing a monkey-patch file see the in-flight version in their analysis.

Returns:

  • (Result)

    the populated registry plus any per-file warnings.



40
41
42
43
44
45
46
47
48
49
# File 'lib/rigor/inference/project_patched_scanner.rb', line 40

def scan(paths, buffer: nil)
  entries = []
  diagnostics = []
  paths.each { |path| scan_file(path, entries, diagnostics, buffer) }
  diagnostics.concat(duplicate_declaration_diagnostics(entries))
  Result.new(
    registry: ProjectPatchedMethods.new(entries: entries),
    diagnostics: diagnostics
  )
end