Class: RSpec::Signal::Configuration
- Inherits:
-
Object
- Object
- RSpec::Signal::Configuration
- Defined in:
- lib/rspec/signal/configuration.rb
Overview
Everything tunable, with defaults chosen to need no tuning.
Instance Attribute Summary collapse
-
#capture_capybara ⇒ Object
Behaviour.
-
#capture_page_html ⇒ Object
Behaviour.
-
#enabled ⇒ Object
Behaviour.
-
#extra_first_party ⇒ Object
Classification.
-
#fallback_frames ⇒ Object
Backtrace reduction budgets.
-
#framework_patterns ⇒ Object
Classification.
-
#ignore_patterns ⇒ Object
Classification.
-
#max_affected_examples ⇒ Object
Report budgets.
-
#max_cluster_specs ⇒ Object
Related-failure clustering.
-
#max_clusters ⇒ Object
Related-failure clustering.
-
#max_diff_lines ⇒ Object
Message budgets.
-
#max_external_context ⇒ Object
Backtrace reduction budgets.
-
#max_frames ⇒ Object
Backtrace reduction budgets.
-
#max_groups ⇒ Object
Report budgets.
-
#max_html_chars ⇒ Object
Message budgets.
-
#max_message_lines ⇒ Object
Message budgets.
-
#max_project_frames ⇒ Object
Backtrace reduction budgets.
-
#output_dir ⇒ Object
Where artifacts are written, relative to the project root unless absolute.
-
#project_root ⇒ Object
Classification.
-
#redact ⇒ Object
Secret scrubbing.
-
#redaction_filter ⇒ Object
Secret scrubbing.
-
#redaction_patterns ⇒ Object
Secret scrubbing.
-
#reduce_html ⇒ Object
Message budgets.
-
#relate_failures ⇒ Object
Related-failure clustering.
-
#terminal_summary ⇒ Object
Behaviour.
-
#write_full ⇒ Object
Artifacts.
-
#write_gitignore ⇒ Object
Artifacts.
-
#write_json ⇒ Object
Artifacts.
Instance Method Summary collapse
- #classifier ⇒ Object
- #enabled? ⇒ Boolean
-
#html_threshold ⇒ Object
Nil means "leave HTML alone", which is what Message expects.
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #output_path ⇒ Object
- #project ⇒ Object
- #redact? ⇒ Boolean
- #redactor ⇒ Object
- #reducer ⇒ Object
-
#reset_memoized! ⇒ Object
Memoized collaborators must be rebuilt if the user reconfigures.
- #root ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
38 39 40 41 42 43 44 45 46 |
# File 'lib/rspec/signal/configuration.rb', line 38 def initialize default_budgets default_artifacts default_classification @output_dir = ENV.fetch("RSPEC_SIGNAL_OUTPUT_DIR", "tmp/rspec-signal") @enabled = !truthy?(ENV.fetch("RSPEC_SIGNAL_DISABLE", nil)) @terminal_summary = true end |
Instance Attribute Details
#capture_capybara ⇒ Object
Behaviour.
33 34 35 |
# File 'lib/rspec/signal/configuration.rb', line 33 def @capture_capybara end |
#capture_page_html ⇒ Object
Behaviour.
33 34 35 |
# File 'lib/rspec/signal/configuration.rb', line 33 def capture_page_html @capture_page_html end |
#enabled ⇒ Object
Behaviour.
33 34 35 |
# File 'lib/rspec/signal/configuration.rb', line 33 def enabled @enabled end |
#extra_first_party ⇒ Object
Classification.
36 37 38 |
# File 'lib/rspec/signal/configuration.rb', line 36 def extra_first_party @extra_first_party end |
#fallback_frames ⇒ Object
Backtrace reduction budgets.
11 12 13 |
# File 'lib/rspec/signal/configuration.rb', line 11 def fallback_frames @fallback_frames end |
#framework_patterns ⇒ Object
Classification.
36 37 38 |
# File 'lib/rspec/signal/configuration.rb', line 36 def framework_patterns @framework_patterns end |
#ignore_patterns ⇒ Object
Classification.
36 37 38 |
# File 'lib/rspec/signal/configuration.rb', line 36 def ignore_patterns @ignore_patterns end |
#max_affected_examples ⇒ Object
Report budgets. max_affected_examples caps the per-group list of other
failing examples; max_groups caps how many signatures are rendered in
full (nil means all).
20 21 22 |
# File 'lib/rspec/signal/configuration.rb', line 20 def max_affected_examples @max_affected_examples end |
#max_cluster_specs ⇒ Object
Related-failure clustering. relate_failures turns the whole layer off;
the budgets cap how much of it reaches the Markdown report.
24 25 26 |
# File 'lib/rspec/signal/configuration.rb', line 24 def max_cluster_specs @max_cluster_specs end |
#max_clusters ⇒ Object
Related-failure clustering. relate_failures turns the whole layer off;
the budgets cap how much of it reaches the Markdown report.
24 25 26 |
# File 'lib/rspec/signal/configuration.rb', line 24 def max_clusters @max_clusters end |
#max_diff_lines ⇒ Object
Message budgets. max_html_chars is the smallest HTML blob replaced by
a summary; reduce_html turns that off entirely.
15 16 17 |
# File 'lib/rspec/signal/configuration.rb', line 15 def max_diff_lines @max_diff_lines end |
#max_external_context ⇒ Object
Backtrace reduction budgets.
11 12 13 |
# File 'lib/rspec/signal/configuration.rb', line 11 def max_external_context @max_external_context end |
#max_frames ⇒ Object
Backtrace reduction budgets.
11 12 13 |
# File 'lib/rspec/signal/configuration.rb', line 11 def max_frames @max_frames end |
#max_groups ⇒ Object
Report budgets. max_affected_examples caps the per-group list of other
failing examples; max_groups caps how many signatures are rendered in
full (nil means all).
20 21 22 |
# File 'lib/rspec/signal/configuration.rb', line 20 def max_groups @max_groups end |
#max_html_chars ⇒ Object
Message budgets. max_html_chars is the smallest HTML blob replaced by
a summary; reduce_html turns that off entirely.
15 16 17 |
# File 'lib/rspec/signal/configuration.rb', line 15 def max_html_chars @max_html_chars end |
#max_message_lines ⇒ Object
Message budgets. max_html_chars is the smallest HTML blob replaced by
a summary; reduce_html turns that off entirely.
15 16 17 |
# File 'lib/rspec/signal/configuration.rb', line 15 def @max_message_lines end |
#max_project_frames ⇒ Object
Backtrace reduction budgets.
11 12 13 |
# File 'lib/rspec/signal/configuration.rb', line 11 def max_project_frames @max_project_frames end |
#output_dir ⇒ Object
Where artifacts are written, relative to the project root unless absolute.
8 9 10 |
# File 'lib/rspec/signal/configuration.rb', line 8 def output_dir @output_dir end |
#project_root ⇒ Object
Classification.
36 37 38 |
# File 'lib/rspec/signal/configuration.rb', line 36 def project_root @project_root end |
#redact ⇒ Object
Secret scrubbing.
27 28 29 |
# File 'lib/rspec/signal/configuration.rb', line 27 def redact @redact end |
#redaction_filter ⇒ Object
Secret scrubbing.
27 28 29 |
# File 'lib/rspec/signal/configuration.rb', line 27 def redaction_filter @redaction_filter end |
#redaction_patterns ⇒ Object
Secret scrubbing.
27 28 29 |
# File 'lib/rspec/signal/configuration.rb', line 27 def redaction_patterns @redaction_patterns end |
#reduce_html ⇒ Object
Message budgets. max_html_chars is the smallest HTML blob replaced by
a summary; reduce_html turns that off entirely.
15 16 17 |
# File 'lib/rspec/signal/configuration.rb', line 15 def reduce_html @reduce_html end |
#relate_failures ⇒ Object
Related-failure clustering. relate_failures turns the whole layer off;
the budgets cap how much of it reaches the Markdown report.
24 25 26 |
# File 'lib/rspec/signal/configuration.rb', line 24 def relate_failures @relate_failures end |
#terminal_summary ⇒ Object
Behaviour.
33 34 35 |
# File 'lib/rspec/signal/configuration.rb', line 33 def terminal_summary @terminal_summary end |
#write_full ⇒ Object
Artifacts.
30 31 32 |
# File 'lib/rspec/signal/configuration.rb', line 30 def write_full @write_full end |
#write_gitignore ⇒ Object
Artifacts.
30 31 32 |
# File 'lib/rspec/signal/configuration.rb', line 30 def write_gitignore @write_gitignore end |
#write_json ⇒ Object
Artifacts.
30 31 32 |
# File 'lib/rspec/signal/configuration.rb', line 30 def write_json @write_json end |
Instance Method Details
#classifier ⇒ Object
81 82 83 84 85 86 87 |
# File 'lib/rspec/signal/configuration.rb', line 81 def classifier @classifier ||= Backtrace::Classifier.new( project: project, framework_patterns: framework_patterns, ignore_patterns: ignore_patterns ) end |
#enabled? ⇒ Boolean
48 49 50 |
# File 'lib/rspec/signal/configuration.rb', line 48 def enabled? !!@enabled end |
#html_threshold ⇒ Object
Nil means "leave HTML alone", which is what Message expects.
57 58 59 |
# File 'lib/rspec/signal/configuration.rb', line 57 def html_threshold reduce_html ? max_html_chars : nil end |
#output_path ⇒ Object
65 66 67 |
# File 'lib/rspec/signal/configuration.rb', line 65 def output_path @output_path ||= File.(@output_dir, root) end |
#project ⇒ Object
69 70 71 |
# File 'lib/rspec/signal/configuration.rb', line 69 def project @project ||= Project.new(root: root, extra_first_party: extra_first_party) end |
#redact? ⇒ Boolean
52 53 54 |
# File 'lib/rspec/signal/configuration.rb', line 52 def redact? !!@redact end |
#redactor ⇒ Object
73 74 75 76 77 78 79 |
# File 'lib/rspec/signal/configuration.rb', line 73 def redactor @redactor ||= Redactor.new( enabled: redact?, extra_patterns: redaction_patterns, filter: redaction_filter ) end |
#reducer ⇒ Object
89 90 91 92 93 94 95 96 |
# File 'lib/rspec/signal/configuration.rb', line 89 def reducer @reducer ||= Backtrace::Reducer.new( max_frames: max_frames, max_external_context: max_external_context, max_project_frames: max_project_frames, fallback_frames: fallback_frames ) end |
#reset_memoized! ⇒ Object
Memoized collaborators must be rebuilt if the user reconfigures.
99 100 101 102 |
# File 'lib/rspec/signal/configuration.rb', line 99 def reset_memoized! @root = @output_path = @project = @redactor = @classifier = @reducer = nil self end |
#root ⇒ Object
61 62 63 |
# File 'lib/rspec/signal/configuration.rb', line 61 def root @root ||= File.(@project_root || default_root) end |