Class: Crystalball::Predictor
- Inherits:
-
Object
- Object
- Crystalball::Predictor
- Defined in:
- lib/crystalball/predictor.rb,
lib/crystalball/predictor/strategy.rb,
lib/crystalball/predictor/modified_specs.rb,
lib/crystalball/predictor/associated_specs.rb,
lib/crystalball/predictor/helpers/path_formatter.rb,
lib/crystalball/predictor/modified_support_specs.rb,
lib/crystalball/predictor/modified_execution_paths.rb,
lib/crystalball/predictor/helpers/affected_example_groups_detector.rb
Overview
Class to predict test failures with given execution map and sources diff
Defined Under Namespace
Modules: Helpers, Strategy Classes: AssociatedSpecs, ModifiedExecutionPaths, ModifiedSpecs, ModifiedSupportSpecs
Instance Attribute Summary collapse
-
#from ⇒ Object
readonly
Returns the value of attribute from.
-
#map ⇒ Object
readonly
Returns the value of attribute map.
-
#prediction_strategies ⇒ Object
readonly
Returns the value of attribute prediction_strategies.
-
#to ⇒ Object
readonly
Returns the value of attribute to.
Instance Method Summary collapse
- #diff ⇒ Object
-
#initialize(map, repo, from: 'HEAD', to: nil) {|_self| ... } ⇒ Predictor
constructor
A new instance of Predictor.
-
#prediction ⇒ Crystalball::Prediction
List of examples which may fail.
-
#use(strategy) ⇒ Object
Adds additional predictor to use.
Constructor Details
#initialize(map, repo, from: 'HEAD', to: nil) {|_self| ... } ⇒ Predictor
Returns a new instance of Predictor.
12 13 14 15 16 17 18 19 |
# File 'lib/crystalball/predictor.rb', line 12 def initialize(map, repo, from: 'HEAD', to: nil) @map = map @repo = repo @from = from @to = to @prediction_strategies = [] yield self if block_given? end |
Instance Attribute Details
#from ⇒ Object (readonly)
Returns the value of attribute from.
6 7 8 |
# File 'lib/crystalball/predictor.rb', line 6 def from @from end |
#map ⇒ Object (readonly)
Returns the value of attribute map.
6 7 8 |
# File 'lib/crystalball/predictor.rb', line 6 def map @map end |
#prediction_strategies ⇒ Object (readonly)
Returns the value of attribute prediction_strategies.
6 7 8 |
# File 'lib/crystalball/predictor.rb', line 6 def prediction_strategies @prediction_strategies end |
#to ⇒ Object (readonly)
Returns the value of attribute to.
6 7 8 |
# File 'lib/crystalball/predictor.rb', line 6 def to @to end |
Instance Method Details
#diff ⇒ Object
33 34 35 36 37 38 |
# File 'lib/crystalball/predictor.rb', line 33 def diff @diff ||= begin ancestor = repo.merge_base(from, to || 'HEAD').sha repo.diff(ancestor, to) end end |
#prediction ⇒ Crystalball::Prediction
Returns list of examples which may fail.
29 30 31 |
# File 'lib/crystalball/predictor.rb', line 29 def prediction Prediction.new(filter(raw_prediction(diff))) end |
#use(strategy) ⇒ Object
Adds additional predictor to use
24 25 26 |
# File 'lib/crystalball/predictor.rb', line 24 def use(strategy) prediction_strategies << strategy end |