Class: Spoom::Coverage::Report

Inherits:
Page show all
Extended by:
T::Sig
Defined in:
lib/spoom/coverage/report.rb

Constant Summary

Constants inherited from Page

Page::TEMPLATE

Instance Attribute Summary

Attributes inherited from Page

#palette, #title

Instance Method Summary collapse

Methods inherited from Page

#body_html, #footer_html, #header_script, #header_style

Methods inherited from Template

#erb, #get_binding, #html

Constructor Details

#initialize(project_name:, palette:, snapshots:, file_tree:, nodes_strictnesses:, nodes_strictness_scores:, sorbet_intro_commit: nil, sorbet_intro_date: nil) ⇒ Report

Returns a new instance of Report.



276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
# File 'lib/spoom/coverage/report.rb', line 276

def initialize(
  project_name:,
  palette:,
  snapshots:,
  file_tree:,
  nodes_strictnesses:,
  nodes_strictness_scores:,
  sorbet_intro_commit: nil,
  sorbet_intro_date: nil
)
  super(title: project_name, palette: palette)
  @project_name = project_name
  @snapshots = snapshots
  @file_tree = file_tree
  @nodes_strictnesses = nodes_strictnesses
  @nodes_strictness_scores = nodes_strictness_scores
  @sorbet_intro_commit = sorbet_intro_commit
  @sorbet_intro_date = sorbet_intro_date
end

Instance Method Details

#cardsObject



308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
# File 'lib/spoom/coverage/report.rb', line 308

def cards
  last = T.must(@snapshots.last)
  cards = []
  cards << Cards::Snapshot.new(snapshot: last)
  cards << Cards::Map.new(
    file_tree: @file_tree,
    nodes_strictnesses: @nodes_strictnesses,
    nodes_strictness_scores: @nodes_strictness_scores,
  )
  cards << Cards::Timeline::Sigils.new(snapshots: @snapshots)
  cards << Cards::Timeline::Calls.new(snapshots: @snapshots)
  cards << Cards::Timeline::Sigs.new(snapshots: @snapshots)
  cards << Cards::Timeline::RBIs.new(snapshots: @snapshots)
  cards << Cards::Timeline::Versions.new(snapshots: @snapshots)
  cards << Cards::Timeline::Runtimes.new(snapshots: @snapshots)
  cards << Cards::SorbetIntro.new(
    sorbet_intro_commit: @sorbet_intro_commit,
    sorbet_intro_date: @sorbet_intro_date,
  )
  cards
end

#header_htmlObject



297
298
299
300
301
302
303
304
305
# File 'lib/spoom/coverage/report.rb', line 297

def header_html
  last = T.must(@snapshots.last)
  <<~ERB
    <h1 class="display-3">
      #{@project_name}
      <span class="badge badge-pill badge-dark" style="font-size: 20%;">#{last.commit_sha}</span>
    </h1>
  ERB
end