Class: MutationTester::Configuration
- Inherits:
-
Object
- Object
- MutationTester::Configuration
- Defined in:
- lib/mutation_tester/configuration.rb
Constant Summary collapse
- RUNNER_MODES =
%i[auto fork spawn in_memory].freeze
- AUTO_PARALLEL_CAP =
8
Instance Attribute Summary collapse
-
#baseline_timeout ⇒ Object
Returns the value of attribute baseline_timeout.
-
#fail_fast ⇒ Object
Returns the value of attribute fail_fast.
-
#fail_on_threshold ⇒ Object
Returns the value of attribute fail_on_threshold.
-
#minimum_score ⇒ Object
Returns the value of attribute minimum_score.
-
#mutation_types ⇒ Object
Returns the value of attribute mutation_types.
-
#output_dir ⇒ Object
Returns the value of attribute output_dir.
-
#parallel_processes ⇒ Object
Returns the value of attribute parallel_processes.
-
#reporters ⇒ Object
Returns the value of attribute reporters.
-
#runner ⇒ Object
Returns the value of attribute runner.
-
#show_file_path ⇒ Object
Returns the value of attribute show_file_path.
-
#show_progress ⇒ Object
Returns the value of attribute show_progress.
-
#test_selection ⇒ Object
Returns the value of attribute test_selection.
-
#timeout ⇒ Object
Returns the value of attribute timeout.
-
#verbose ⇒ Object
Returns the value of attribute verbose.
-
#worker_env_var ⇒ Object
Returns the value of attribute worker_env_var.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #initialize_copy(source) ⇒ Object
- #merge(options) ⇒ Object
- #worker_env_assignment(index) ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/mutation_tester/configuration.rb', line 32 def initialize self.parallel_processes = ENV['MUTATION_TESTER_PARALLEL_PROCESSES'] || self.class.auto_parallel_processes self.runner = ENV['MUTATION_TESTER_RUNNER'] || :auto self.worker_env_var = ENV['MUTATION_TESTER_WORKER_ENV'] @timeout = 30 @baseline_timeout = 300 @mutation_types = { arithmetic: true, comparison: true, logical: true, boolean: true, number: true, string: true, conditional: true, call_removal: true, nil_injection: true, argument: true, strict_equality: false } @reporters = %i[console html json] @output_dir = 'tmp/mutation_reports' @minimum_score = 80.0 @fail_on_threshold = true @verbose = false @show_file_path = true @show_progress = true @test_selection = true @fail_fast = false end |
Instance Attribute Details
#baseline_timeout ⇒ Object
Returns the value of attribute baseline_timeout.
19 20 21 |
# File 'lib/mutation_tester/configuration.rb', line 19 def baseline_timeout @baseline_timeout end |
#fail_fast ⇒ Object
Returns the value of attribute fail_fast.
19 20 21 |
# File 'lib/mutation_tester/configuration.rb', line 19 def fail_fast @fail_fast end |
#fail_on_threshold ⇒ Object
Returns the value of attribute fail_on_threshold.
19 20 21 |
# File 'lib/mutation_tester/configuration.rb', line 19 def fail_on_threshold @fail_on_threshold end |
#minimum_score ⇒ Object
Returns the value of attribute minimum_score.
19 20 21 |
# File 'lib/mutation_tester/configuration.rb', line 19 def minimum_score @minimum_score end |
#mutation_types ⇒ Object
Returns the value of attribute mutation_types.
19 20 21 |
# File 'lib/mutation_tester/configuration.rb', line 19 def mutation_types @mutation_types end |
#output_dir ⇒ Object
Returns the value of attribute output_dir.
19 20 21 |
# File 'lib/mutation_tester/configuration.rb', line 19 def output_dir @output_dir end |
#parallel_processes ⇒ Object
Returns the value of attribute parallel_processes.
17 18 19 |
# File 'lib/mutation_tester/configuration.rb', line 17 def parallel_processes @parallel_processes end |
#reporters ⇒ Object
Returns the value of attribute reporters.
19 20 21 |
# File 'lib/mutation_tester/configuration.rb', line 19 def reporters @reporters end |
#runner ⇒ Object
Returns the value of attribute runner.
17 18 19 |
# File 'lib/mutation_tester/configuration.rb', line 17 def runner @runner end |
#show_file_path ⇒ Object
Returns the value of attribute show_file_path.
19 20 21 |
# File 'lib/mutation_tester/configuration.rb', line 19 def show_file_path @show_file_path end |
#show_progress ⇒ Object
Returns the value of attribute show_progress.
19 20 21 |
# File 'lib/mutation_tester/configuration.rb', line 19 def show_progress @show_progress end |
#test_selection ⇒ Object
Returns the value of attribute test_selection.
19 20 21 |
# File 'lib/mutation_tester/configuration.rb', line 19 def test_selection @test_selection end |
#timeout ⇒ Object
Returns the value of attribute timeout.
19 20 21 |
# File 'lib/mutation_tester/configuration.rb', line 19 def timeout @timeout end |
#verbose ⇒ Object
Returns the value of attribute verbose.
19 20 21 |
# File 'lib/mutation_tester/configuration.rb', line 19 def verbose @verbose end |
#worker_env_var ⇒ Object
Returns the value of attribute worker_env_var.
17 18 19 |
# File 'lib/mutation_tester/configuration.rb', line 17 def worker_env_var @worker_env_var end |
Class Method Details
.auto_parallel_processes ⇒ Object
8 9 10 |
# File 'lib/mutation_tester/configuration.rb', line 8 def self.auto_parallel_processes [[Etc.nprocessors, AUTO_PARALLEL_CAP].min, 1].max end |
.worker_env_value(index) ⇒ Object
12 13 14 15 |
# File 'lib/mutation_tester/configuration.rb', line 12 def self.worker_env_value(index) number = index.to_i number <= 0 ? '' : (number + 1).to_s end |
Instance Method Details
#initialize_copy(source) ⇒ Object
70 71 72 73 74 |
# File 'lib/mutation_tester/configuration.rb', line 70 def initialize_copy(source) super @mutation_types = source.mutation_types.dup @reporters = source.reporters.dup end |
#merge(options) ⇒ Object
62 63 64 65 66 67 68 |
# File 'lib/mutation_tester/configuration.rb', line 62 def merge() config = dup .each do |key, value| config.public_send("#{key}=", value) if config.respond_to?("#{key}=") end config end |
#worker_env_assignment(index) ⇒ Object
99 100 101 102 103 |
# File 'lib/mutation_tester/configuration.rb', line 99 def worker_env_assignment(index) return nil unless @worker_env_var { @worker_env_var => self.class.worker_env_value(index) } end |