Module: SimpleCov::Sorbet::DirectiveExtension

Extended by:
T::Sig
Defined in:
lib/simplecov/sorbet/directive_extension.rb

Overview

Prepended onto SimpleCov::Directive's singleton class. Directive.disabled_ranges is the one choke point both SourceFile (loaded files) and LinesClassifier (tracked-but-unloaded files) consult for skip ranges, so extending its result covers every path SimpleCov classifies lines through. Ignored ranges join all three categories: type-level constructs are not behavior, so any line, branch, or method inside them is skippable.

Instance Method Summary collapse

Instance Method Details

#disabled_ranges(src_lines) ⇒ Object



14
15
16
17
18
19
20
21
# File 'lib/simplecov/sorbet/directive_extension.rb', line 14

def disabled_ranges(src_lines)
  ranges = T.let(super, T::Hash[Symbol, T::Array[T::Range[Integer]]])
  sorbet_ranges = ignored_ranges(src_lines.join)
  return ranges if sorbet_ranges.empty?

  ranges.each_value { |category_ranges| category_ranges.concat(sorbet_ranges) }
  ranges
end