Module: Rigor::Analysis::SeverityStamp
- Defined in:
- lib/rigor/analysis/severity_stamp.rb
Overview
ADR-8 § "Severity profile" — re-stamps each diagnostic's severity from the configured profile + per-rule
overrides and drops any diagnostic resolving to :off. Rules emit with their authored severity; the
profile is the final filter.
Extracted (ADR-87 WD4) so the miss path (Runner::DiagnosticAggregator) and the boot-slimming hit path (RunCacheProbe, which never loads the aggregator) apply the IDENTICAL final filter — a warm HIT's served diagnostics are byte-identical to what a full run would print.
Class Method Summary collapse
Class Method Details
.apply(diagnostics, configuration) ⇒ Object
18 19 20 |
# File 'lib/rigor/analysis/severity_stamp.rb', line 18 def apply(diagnostics, configuration) diagnostics.filter_map { |diagnostic| stamp(diagnostic, configuration) } end |
.stamp(diagnostic, configuration) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/rigor/analysis/severity_stamp.rb', line 22 def stamp(diagnostic, configuration) return diagnostic if diagnostic.rule.nil? resolved = Configuration::SeverityProfile.resolve( rule: diagnostic.rule, authored_severity: diagnostic.severity, profile: configuration.severity_profile, overrides: configuration.severity_overrides, bleeding_edge_overrides: configuration.bleeding_edge_severity_overrides ) return nil if resolved == :off return diagnostic if resolved == diagnostic.severity Diagnostic.new( path: diagnostic.path, line: diagnostic.line, column: diagnostic.column, message: diagnostic., severity: resolved, rule: diagnostic.rule, source_family: diagnostic.source_family ) end |