Class: SimpleCov::Formatter::AIFormatter::MarkdownBuilder::BypassCompiler

Inherits:
Object
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/simplecov-ai/markdown_builder/bypass_compiler.rb

Overview

Scans resolved AST blocks to report explicitly defined coverage ignores (e.g., :nocov:).

Constant Summary collapse

HEADING =

Section heading for bypassed coverage

T.let("## Ignored Coverage Bypasses\n\n", String)
FILE_HEADING_TEMPLATE =

Template for formatting file headers in the bypass section

T.let('### `%s`', String)
BYPASS_TEMPLATE =

Template for detailing an individual bypass directive

T.let(
  "- `%s`\n  " \
  '- **Bypass Present:** Contains `%s` directive artificially ' \
  'ignoring coverage (Occurrence %d of %d).',
  String
)

Instance Method Summary collapse

Constructor Details

#initialize(coverage_metrics, builder) ⇒ BypassCompiler

Returns a new instance of BypassCompiler.



25
26
27
28
# File 'lib/simplecov-ai/markdown_builder/bypass_compiler.rb', line 25

def initialize(coverage_metrics, builder)
  @coverage_metrics = coverage_metrics
  @builder = builder
end

Instance Method Details

#write_bypasses(buffer) ⇒ Object



31
32
33
34
35
36
37
38
39
# File 'lib/simplecov-ai/markdown_builder/bypass_compiler.rb', line 31

def write_bypasses(buffer)
  bypass_buffer = T.let(StringIO.new, StringIO)
  has_bypasses = compile_all_bypasses(bypass_buffer)

  return unless has_bypasses

  buffer.puts HEADING
  buffer.puts bypass_buffer.string
end