Module: Rigor::SignaturePathAudit
- Defined in:
- lib/rigor/signature_path_audit.rb
Overview
Classifies each configured signature_paths: entry by what it actually contributes to
the RBS environment, so a caller can warn when a configured path resolves to nothing.
The failure this guards against is silent. Environment::RbsLoader adds a
signature_paths: entry only when path.directory?, and only the .rbs files under it
carry signatures — so a typo'd or moved path (or a directory holding no .rbs) loads
zero signatures with no trace on stderr or in the run summary. The downstream symptom is
the most authoritative diagnostics: every call into the extensions the missing RBS was
meant to describe fires call.undefined-method at evidence_tier: high. A one-character
path typo can manufacture hundreds of plausible-looking false positives; surfacing the
empty entry makes the real cause visible.
The audit deliberately mirrors the loader's own acceptance test (path.directory? + a
recursive **/*.rbs glob) so a :ok verdict means the loader did load from it and a
warning means it did not.
Defined Under Namespace
Classes: Entry
Class Method Summary collapse
-
.audit(signature_paths) ⇒ Array<Entry>
Audits each configured entry.
- .classify(path) ⇒ Object
-
.warnings(signature_paths) ⇒ Array<Entry>
The subset of SignaturePathAudit.audit that resolved to nothing — the entries worth warning about.
Class Method Details
.audit(signature_paths) ⇒ Array<Entry>
Audits each configured entry. signature_paths is the Configuration#signature_paths
array (absolute paths, already resolved against the config file's directory). Pass
nil — the unset default, where Rigor auto-detects <root>/sig — to get an empty
result: an absent auto-detected sig/ is a normal setup, not a misconfiguration, so it
is never audited.
66 67 68 |
# File 'lib/rigor/signature_path_audit.rb', line 66 def self.audit(signature_paths) Array(signature_paths).map { |path| classify(path.to_s) } end |
.classify(path) ⇒ Object
78 79 80 81 82 83 84 |
# File 'lib/rigor/signature_path_audit.rb', line 78 def self.classify(path) return Entry.new(path: path, status: :missing, rbs_file_count: 0) unless File.exist?(path) return Entry.new(path: path, status: :not_directory, rbs_file_count: 0) unless File.directory?(path) count = Dir.glob(File.join(path, "**", "*.rbs")).size Entry.new(path: path, status: count.zero? ? :empty : :ok, rbs_file_count: count) end |