Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Prefix any unused block arguments with an underscore
  • Loading branch information
deepsource-autofix[bot] authored Feb 27, 2022
commit d1777ad74e652d6bccd55d719978897e8beafc97
16 changes: 8 additions & 8 deletions test/scientist/experiment_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ def @ex.enabled?
end

it "reports an error and returns the original value when an error is raised in a clean block" do
@ex.clean { |value| raise "kaboom" }
@ex.clean { |_value| raise "kaboom" }

@ex.use { "control" }
@ex.try { "candidate" }
Expand Down Expand Up @@ -328,7 +328,7 @@ def @ex.enabled?
it "rescues errors raised in the cohort determination block" do
@ex.use { 5670 }
@ex.try { 5670 }
@ex.cohort { |res| raise "intentional" }
@ex.cohort { |_res| raise "intentional" }

@ex.run

Expand Down Expand Up @@ -412,9 +412,9 @@ def @ex.enabled?

it "calls multiple ignore blocks to see if any match" do
called_one = called_two = called_three = false
@ex.ignore { |a, b| called_one = true; false }
@ex.ignore { |a, b| called_two = true; false }
@ex.ignore { |a, b| called_three = true; false }
@ex.ignore { |_a, _b| called_one = true; false }
@ex.ignore { |_a, _b| called_two = true; false }
@ex.ignore { |_a, _b| called_three = true; false }
refute @ex.ignore_mismatched_observation?(@a, @b)
assert called_one
assert called_two
Expand All @@ -423,9 +423,9 @@ def @ex.enabled?

it "only calls ignore blocks until one matches" do
called_one = called_two = called_three = false
@ex.ignore { |a, b| called_one = true; false }
@ex.ignore { |a, b| called_two = true; true }
@ex.ignore { |a, b| called_three = true; false }
@ex.ignore { |_a, _b| called_one = true; false }
@ex.ignore { |_a, _b| called_two = true; true }
@ex.ignore { |_a, _b| called_three = true; false }
assert @ex.ignore_mismatched_observation?(@a, @b)
assert called_one
assert called_two
Expand Down
2 changes: 1 addition & 1 deletion test/scientist/observation_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@
end

it "doesn't clean nil values" do
@experiment.clean { |value| "foo" }
@experiment.clean { |_value| "foo" }
a = Scientist::Observation.new("test", @experiment) { nil }
assert_nil a.cleaned_value
end
Expand Down
4 changes: 2 additions & 2 deletions test/scientist/result_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
y = Scientist::Observation.new("y", @experiment) { :y }
z = Scientist::Observation.new("z", @experiment) { :z }

@experiment.ignore { |control, candidate| candidate == :y }
@experiment.ignore { |_control, candidate| candidate == :y }

result = Scientist::Result.new @experiment, [x, y, z], x

Expand All @@ -105,7 +105,7 @@
result = Scientist::Result.new @experiment, [a, b], a
assert_nil result.cohort

result = Scientist::Result.new @experiment, [a, b], a, ->(res) { "cohort-1" }
result = Scientist::Result.new @experiment, [a, b], a, ->(_res) { "cohort-1" }
assert_equal "cohort-1", result.cohort
end

Expand Down