Class: Evilution::Config Private
- Inherits:
-
Object
- Object
- Evilution::Config
- Defined in:
- lib/evilution/config.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Defined Under Namespace
Modules: Builders, EnvLoader, FileLoader, Sources, Validators
Constant Summary collapse
- CONFIG_FILES =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
%w[.evilution.yml config/evilution.yml].freeze
- CURRENT_SCHEMA_VERSION =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
1- DEFAULTS =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
{ schema_version: CURRENT_SCHEMA_VERSION, timeout: 30, format: :text, target: nil, min_score: 0.0, integration: :rspec, verbose: false, quiet: false, jobs: 1, fail_fast: nil, baseline: true, isolation: :auto, incremental: false, suggest_tests: false, progress: true, save_session: false, line_ranges: {}, spec_files: [], ignore_patterns: [], show_disabled: false, baseline_session: nil, skip_heredoc_literals: false, related_specs_heuristic: false, fallback_to_full_suite: false, preload: nil, spec_mappings: {}, spec_pattern: nil, example_targeting: true, example_targeting_fallback: :full_file, example_targeting_strategy: :lexical, example_targeting_cache: { max_files: 50, max_blocks: 10_000 }, quiet_children: false, quiet_children_dir: "tmp/evilution_children", profile: :default, canary: true }.freeze
Instance Attribute Summary collapse
- #baseline ⇒ Object readonly private
- #baseline_session ⇒ Object readonly private
- #canary ⇒ Object readonly private
- #example_targeting ⇒ Object readonly private
- #example_targeting_cache ⇒ Object readonly private
- #example_targeting_fallback ⇒ Object readonly private
- #example_targeting_strategy ⇒ Object readonly private
- #fail_fast ⇒ Object readonly private
- #fallback_to_full_suite ⇒ Object readonly private
- #format ⇒ Object readonly private
- #hooks ⇒ Object readonly private
- #ignore_patterns ⇒ Object readonly private
- #incremental ⇒ Object readonly private
- #integration ⇒ Object readonly private
- #isolation ⇒ Object readonly private
- #jobs ⇒ Object readonly private
- #line_ranges ⇒ Object readonly private
- #min_score ⇒ Object readonly private
- #preload ⇒ Object readonly private
- #profile ⇒ Object readonly private
- #progress ⇒ Object readonly private
- #quiet ⇒ Object readonly private
- #quiet_children ⇒ Object readonly private
- #quiet_children_dir ⇒ Object readonly private
- #related_specs_heuristic ⇒ Object readonly private
- #save_session ⇒ Object readonly private
- #schema_version ⇒ Object readonly private
- #show_disabled ⇒ Object readonly private
- #skip_heredoc_literals ⇒ Object readonly private
- #spec_files ⇒ Object readonly private
- #spec_mappings ⇒ Object readonly private
- #spec_pattern ⇒ Object readonly private
- #spec_selector ⇒ Object readonly private
- #suggest_tests ⇒ Object readonly private
- #target ⇒ Object readonly private
- #target_files ⇒ Object readonly private
- #timeout ⇒ Object readonly private
- #verbose ⇒ Object readonly private
Class Method Summary collapse
- .default_template ⇒ Object private
- .file_options ⇒ Object private
Instance Method Summary collapse
- #baseline? ⇒ Boolean private
- #canary? ⇒ Boolean private
- #coverage_targeting? ⇒ Boolean private
- #example_targeting? ⇒ Boolean private
- #fail_fast? ⇒ Boolean private
- #fallback_to_full_suite? ⇒ Boolean private
- #html? ⇒ Boolean private
- #incremental? ⇒ Boolean private
-
#initialize(**options) ⇒ Config
constructor
private
A new instance of Config.
- #json? ⇒ Boolean private
- #line_ranges? ⇒ Boolean private
- #progress? ⇒ Boolean private
- #related_specs_heuristic? ⇒ Boolean private
- #save_session? ⇒ Boolean private
- #show_disabled? ⇒ Boolean private
- #skip_heredoc_literals? ⇒ Boolean private
- #suggest_tests? ⇒ Boolean private
- #target? ⇒ Boolean private
- #text? ⇒ Boolean private
Constructor Details
#initialize(**options) ⇒ Config
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Config.
38 39 40 41 42 43 |
# File 'lib/evilution/config.rb', line 38 def initialize(**) skip_file = .delete(:skip_config_file) ? true : false merged = Sources.merge(explicit: , skip_file: skip_file) assign_attributes(merged) freeze end |
Instance Attribute Details
#baseline ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
27 28 29 |
# File 'lib/evilution/config.rb', line 27 def baseline @baseline end |
#baseline_session ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
27 28 29 |
# File 'lib/evilution/config.rb', line 27 def baseline_session @baseline_session end |
#canary ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
27 28 29 |
# File 'lib/evilution/config.rb', line 27 def canary @canary end |
#example_targeting ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
27 28 29 |
# File 'lib/evilution/config.rb', line 27 def example_targeting @example_targeting end |
#example_targeting_cache ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
27 28 29 |
# File 'lib/evilution/config.rb', line 27 def example_targeting_cache @example_targeting_cache end |
#example_targeting_fallback ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
27 28 29 |
# File 'lib/evilution/config.rb', line 27 def example_targeting_fallback @example_targeting_fallback end |
#example_targeting_strategy ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
27 28 29 |
# File 'lib/evilution/config.rb', line 27 def example_targeting_strategy @example_targeting_strategy end |
#fail_fast ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
27 28 29 |
# File 'lib/evilution/config.rb', line 27 def fail_fast @fail_fast end |
#fallback_to_full_suite ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
27 28 29 |
# File 'lib/evilution/config.rb', line 27 def fallback_to_full_suite @fallback_to_full_suite end |
#format ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
27 28 29 |
# File 'lib/evilution/config.rb', line 27 def format @format end |
#hooks ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
27 28 29 |
# File 'lib/evilution/config.rb', line 27 def hooks @hooks end |
#ignore_patterns ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
27 28 29 |
# File 'lib/evilution/config.rb', line 27 def ignore_patterns @ignore_patterns end |
#incremental ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
27 28 29 |
# File 'lib/evilution/config.rb', line 27 def incremental @incremental end |
#integration ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
27 28 29 |
# File 'lib/evilution/config.rb', line 27 def integration @integration end |
#isolation ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
27 28 29 |
# File 'lib/evilution/config.rb', line 27 def isolation @isolation end |
#jobs ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
27 28 29 |
# File 'lib/evilution/config.rb', line 27 def jobs @jobs end |
#line_ranges ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
27 28 29 |
# File 'lib/evilution/config.rb', line 27 def line_ranges @line_ranges end |
#min_score ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
27 28 29 |
# File 'lib/evilution/config.rb', line 27 def min_score @min_score end |
#preload ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
27 28 29 |
# File 'lib/evilution/config.rb', line 27 def preload @preload end |
#profile ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
27 28 29 |
# File 'lib/evilution/config.rb', line 27 def profile @profile end |
#progress ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
27 28 29 |
# File 'lib/evilution/config.rb', line 27 def progress @progress end |
#quiet ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
27 28 29 |
# File 'lib/evilution/config.rb', line 27 def quiet @quiet end |
#quiet_children ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
27 28 29 |
# File 'lib/evilution/config.rb', line 27 def quiet_children @quiet_children end |
#quiet_children_dir ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
27 28 29 |
# File 'lib/evilution/config.rb', line 27 def quiet_children_dir @quiet_children_dir end |
#related_specs_heuristic ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
27 28 29 |
# File 'lib/evilution/config.rb', line 27 def @related_specs_heuristic end |
#save_session ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
27 28 29 |
# File 'lib/evilution/config.rb', line 27 def save_session @save_session end |
#schema_version ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
27 28 29 |
# File 'lib/evilution/config.rb', line 27 def schema_version @schema_version end |
#show_disabled ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
27 28 29 |
# File 'lib/evilution/config.rb', line 27 def show_disabled @show_disabled end |
#skip_heredoc_literals ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
27 28 29 |
# File 'lib/evilution/config.rb', line 27 def skip_heredoc_literals @skip_heredoc_literals end |
#spec_files ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
27 28 29 |
# File 'lib/evilution/config.rb', line 27 def spec_files @spec_files end |
#spec_mappings ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
27 28 29 |
# File 'lib/evilution/config.rb', line 27 def spec_mappings @spec_mappings end |
#spec_pattern ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
27 28 29 |
# File 'lib/evilution/config.rb', line 27 def spec_pattern @spec_pattern end |
#spec_selector ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
27 28 29 |
# File 'lib/evilution/config.rb', line 27 def spec_selector @spec_selector end |
#suggest_tests ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
27 28 29 |
# File 'lib/evilution/config.rb', line 27 def suggest_tests @suggest_tests end |
#target ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
27 28 29 |
# File 'lib/evilution/config.rb', line 27 def target @target end |
#target_files ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
27 28 29 |
# File 'lib/evilution/config.rb', line 27 def target_files @target_files end |
#timeout ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
27 28 29 |
# File 'lib/evilution/config.rb', line 27 def timeout @timeout end |
#verbose ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
27 28 29 |
# File 'lib/evilution/config.rb', line 27 def verbose @verbose end |
Class Method Details
.default_template ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 |
# File 'lib/evilution/config.rb', line 121 def self.default_template <<~YAML # Evilution configuration # See: https://github.com/marinazzio/evilution # Schema version for this config file (current: #{CURRENT_SCHEMA_VERSION}). # Declaring schema_version opts the file into strict validation: # unknown keys raise ConfigError, and a future schema_version is # rejected so an old gem cannot silently misread a newer config. # Omit to keep the legacy lenient behavior (unknown keys ignored). schema_version: #{CURRENT_SCHEMA_VERSION} # Per-mutation timeout in seconds (default: 30) # timeout: 30 # Output format: text or json (default: text) # format: text # Minimum mutation score to pass (0.0 to 1.0, default: 0.0) # min_score: 0.0 # Proof-of-life canary: run a synthetic, guaranteed-unobservable # mutation at session start and abort if the pipeline misreports it # (default: true). Set false to skip (e.g. for CI speed). # canary: true # Test integration: rspec, minitest, test_unit (default: rspec) # integration: rspec # Number of parallel workers (default: 1) # jobs: 1 # Stop after N surviving mutants (default: disabled) # fail_fast: 1 # Generate concrete test code in suggestions, matching integration (default: false) # suggest_tests: false # Skip all string literal mutations inside heredocs (default: false). # Useful for Rails apps where heredoc content (SQL, templates, fixtures) # rarely has meaningful test coverage and produces noisy survivors. # skip_heredoc_literals: true # Opt into the RelatedSpecHeuristic, which appends request/integration/ # feature/system specs for mutations that touch `.includes(...)` calls # (default: false). Off by default because the fan-out can be heavy and # push runs over the per-mutation timeout. Enable if you need coverage # of N+1 regressions that only surface in higher-level specs. # related_specs_heuristic: true # When no matching spec resolves for a mutation's source file, the # default is to skip that mutation and mark it :unresolved in the # report (a coverage gap signal). Set to true to fall back to running # the entire test suite for such mutations instead (slow, high memory). # fallback_to_full_suite: false # Preload file required in the parent process before forking workers. # For Rails projects, the autodetect chain tries (in order): # spec/rails_helper.rb -> spec/spec_helper.rb -> test/test_helper.rb # when isolation resolves to :fork. Set to false to disable. # preload: spec/rails_helper.rb # or spec/spec_helper.rb, test/test_helper.rb # Hooks: Ruby files returning a Proc, keyed by lifecycle event # hooks: # worker_process_start: config/evilution_hooks/worker_start.rb # mutation_insert_pre: config/evilution_hooks/mutation_pre.rb # Per-mutation example targeting (default: true). When enabled, Evilution # parses resolved spec files and restricts each mutation run to examples # whose bodies reference the mutated method/class token. Set to false # to run every example in the resolved spec files. You can also disable # without editing the file by exporting EV_DISABLE_EXAMPLE_TARGETING=1. # example_targeting: true # How targeting picks examples (default: lexical). # lexical - text-grep resolved spec files for the mutated method/class name # coverage - run exactly the examples that EXECUTE the mutated line, from a # cached full-suite line-coverage map (falls back to lexical for # any file the map has not fully built) # example_targeting_strategy: lexical # Behavior when targeting finds no matching example (default: full_file). # full_file - run every example in the resolved spec files # unresolved - mark the mutation :unresolved and skip # example_targeting_fallback: full_file # LRU cache bounds for the spec AST parser that powers example targeting. # example_targeting_cache: # max_files: 50 # max_blocks: 10000 # AST patterns to skip during mutation generation (default: []) # See docs/ast_pattern_syntax.md for pattern syntax # ignore_patterns: # - "call{name=info, receiver=call{name=logger}}" # - "call{name=debug|warn}" # Operator profile: default or strict (default: default). # strict adds aggressive truthiness mutators (e.g. replaces # `x.predicate?` with `nil`) intended for pre-merge audits. # profile: default YAML end |
.file_options ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
117 118 119 |
# File 'lib/evilution/config.rb', line 117 def self. FileLoader.load end |
Instance Method Details
#baseline? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
69 70 71 |
# File 'lib/evilution/config.rb', line 69 def baseline? baseline end |
#canary? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
73 74 75 |
# File 'lib/evilution/config.rb', line 73 def canary? canary end |
#coverage_targeting? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
109 110 111 |
# File 'lib/evilution/config.rb', line 109 def coverage_targeting? example_targeting && example_targeting_strategy == :coverage end |
#example_targeting? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
105 106 107 |
# File 'lib/evilution/config.rb', line 105 def example_targeting? example_targeting end |
#fail_fast? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
65 66 67 |
# File 'lib/evilution/config.rb', line 65 def fail_fast? !fail_fast.nil? end |
#fallback_to_full_suite? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
113 114 115 |
# File 'lib/evilution/config.rb', line 113 def fallback_to_full_suite? fallback_to_full_suite end |
#html? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
53 54 55 |
# File 'lib/evilution/config.rb', line 53 def html? format == :html end |
#incremental? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
77 78 79 |
# File 'lib/evilution/config.rb', line 77 def incremental? incremental end |
#json? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
45 46 47 |
# File 'lib/evilution/config.rb', line 45 def json? format == :json end |
#line_ranges? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
57 58 59 |
# File 'lib/evilution/config.rb', line 57 def line_ranges? !line_ranges.empty? end |
#progress? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
85 86 87 |
# File 'lib/evilution/config.rb', line 85 def progress? progress end |
#related_specs_heuristic? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
101 102 103 |
# File 'lib/evilution/config.rb', line 101 def end |
#save_session? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
89 90 91 |
# File 'lib/evilution/config.rb', line 89 def save_session? save_session end |
#show_disabled? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
93 94 95 |
# File 'lib/evilution/config.rb', line 93 def show_disabled? show_disabled end |
#skip_heredoc_literals? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
97 98 99 |
# File 'lib/evilution/config.rb', line 97 def skip_heredoc_literals? skip_heredoc_literals end |
#suggest_tests? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
81 82 83 |
# File 'lib/evilution/config.rb', line 81 def suggest_tests? suggest_tests end |
#target? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
61 62 63 |
# File 'lib/evilution/config.rb', line 61 def target? !target.nil? end |
#text? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
49 50 51 |
# File 'lib/evilution/config.rb', line 49 def text? format == :text end |