Class: Testprune::DetectorResult

Inherits:
Object
  • Object
show all
Defined in:
lib/testprune/duplication_detector.rb

Overview

Holds the detection outcome and exposes the set that ‘apply` may patch. `ambient_units`/`setup_only` record what baseline subtraction removed, so the report can disclose it rather than silently dropping tests.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(footprints, candidates, ambient_units: 0, setup_only: 0) ⇒ DetectorResult

Returns a new instance of DetectorResult.



25
26
27
28
29
30
# File 'lib/testprune/duplication_detector.rb', line 25

def initialize(footprints, candidates, ambient_units: 0, setup_only: 0)
  @footprints = footprints
  @candidates = candidates
  @ambient_units = ambient_units
  @setup_only = setup_only
end

Instance Attribute Details

#ambient_unitsObject (readonly)

Returns the value of attribute ambient_units.



23
24
25
# File 'lib/testprune/duplication_detector.rb', line 23

def ambient_units
  @ambient_units
end

#candidatesObject (readonly)

Returns the value of attribute candidates.



23
24
25
# File 'lib/testprune/duplication_detector.rb', line 23

def candidates
  @candidates
end

#footprintsObject (readonly)

Returns the value of attribute footprints.



23
24
25
# File 'lib/testprune/duplication_detector.rb', line 23

def footprints
  @footprints
end

#setup_onlyObject (readonly)

Returns the value of attribute setup_only.



23
24
25
# File 'lib/testprune/duplication_detector.rb', line 23

def setup_only
  @setup_only
end

Instance Method Details

#approved_removalsObject

Only HIGH-confidence, non-review candidates that passed the safety check are auto-applicable. Structural (MEDIUM) and overlap (LOW) are review-only.



34
35
36
# File 'lib/testprune/duplication_detector.rb', line 34

def approved_removals
  @candidates.select { |c| c.confidence == :high && !c.review_only && c.safe }
end