Class: Pinspec::Validate::PinScorer

Inherits:
Object
  • Object
show all
Defined in:
lib/pinspec/validate/pin_scorer.rb

Defined Under Namespace

Classes: Report, Score

Constant Summary collapse

ASPECTS =
%i[return error jobs mail].freeze
SCRATCH_DIR =
"tmp/pinspec/aspects"
STRONG =
80.0
WEAK =
40.0
WRAPPER =
"tmp/pinspec/run_suite.sh"

Instance Method Summary collapse

Constructor Details

#initialize(app_root:, target:, plan:, corpus:, stability:, fk_map:, env: {}, test_command: nil) ⇒ PinScorer

Returns a new instance of PinScorer.



54
55
56
57
58
59
60
61
62
63
# File 'lib/pinspec/validate/pin_scorer.rb', line 54

def initialize(app_root:, target:, plan:, corpus:, stability:, fk_map:, env: {}, test_command: nil)
  @app_root = app_root
  @target = target
  @plan = plan
  @corpus = corpus
  @stability = stability
  @fk_map = fk_map
  @env = env
  @test_command = test_command
end

Instance Method Details

#runObject



65
66
67
68
69
70
71
72
# File 'lib/pinspec/validate/pin_scorer.rb', line 65

def run
  MutationAdapter.refuse_unless_available!
  @command = @test_command || generate_wrapper

  scores = present_aspects.map { |aspect| score_aspect(aspect) }

  Report.new(subject: @target.qualified_name, scores: scores, skipped: excluded_aspects)
end