Module: SimpleCov::Formatter::AIFormatter::ASTResolver::BypassScanner
- Extended by:
- T::Sig
- Defined in:
- lib/simplecov-ai/ast_resolver/bypass_scanner.rb
Overview
Attributes coverage-skip regions (line ranges SimpleCov excluded from its metrics, each paired with the directive text that caused the exclusion) to the semantic nodes they cover. A region is attributed to the outermost semantic nodes it fully contains, or — when it sits inside a single node — to that innermost enclosing node; a region wrapping only top-level code therefore lands on the root scope.
Constant Summary collapse
- Region =
A skipped line range together with the reason SimpleCov skipped it.
T.type_alias { [T::Range[Integer], String] }
- ReasonsByNode =
Reasons keyed by the node they apply to.
T.type_alias { T::Hash[SemanticNode, T::Array[String]] }
Class Method Summary collapse
Class Method Details
.attribute(nodes, regions) ⇒ Object
30 31 32 33 34 35 36 37 38 39 |
# File 'lib/simplecov-ai/ast_resolver/bypass_scanner.rb', line 30 def self.attribute(nodes, regions) reasons_by_node = T.let({}.compare_by_identity, ReasonsByNode) regions.each do |range, reason| targets_of(nodes, range).each do |node| node_reasons = (reasons_by_node[node] ||= []) node_reasons << reason unless node_reasons.include?(reason) end end reasons_by_node end |