Skip to content

Commit

Permalink
Fix new RuboCop warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
JacobEvelyn committed Jun 10, 2024
1 parent 085eaae commit 26e0569
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 16 deletions.
2 changes: 1 addition & 1 deletion benchmarks/benchmarks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def benchmark_name

# Use metaprogramming to ensure that each class is created in exactly the
# the same way.
BENCHMARK_GEMS.each do |benchmark_gem|
BENCHMARK_GEMS.each do |benchmark_gem| # rubocop:disable Metrics/BlockLength
eval <<~HEREDOC, binding, __FILE__, __LINE__ + 1 # rubocop:disable Security/Eval
class #{benchmark_gem.klass}Example
#{benchmark_gem.activation_code}
Expand Down
3 changes: 1 addition & 2 deletions lib/memo_wise.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# frozen_string_literal: true

# Disable RuboCop here because Ruby < 3.2 does not load `set` by default.
require "set" # rubocop:disable Lint/RedundantRequireStatement
require "set" # Ruby < 3.2 does not load `set` by default.

require "memo_wise/internal_api"
require "memo_wise/version"
Expand Down
2 changes: 1 addition & 1 deletion spec/dokaz_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
require "memo_wise"

# Enable the example RSpec `after` call in README.md to execute successfully
def after(scope, &)
def after(scope, &block)
# Do nothing
end
22 changes: 11 additions & 11 deletions spec/memo_wise_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,11 @@
expect(target.proc_method_counter).to eq(1)
end

it "will not memoize methods with implicit block arguments" do
it "does not memoize methods with implicit block arguments" do
expect { target.implicit_block_method }.to raise_error(LocalJumpError)
end

it "will not memoize methods with explicit block arguments" do
it "does not memoize methods with explicit block arguments" do
expect { target.explicit_block_method { nil } }.to raise_error(LocalJumpError)
end
end
Expand All @@ -153,7 +153,7 @@

# Now confirm our non-memoized method is not memoized.
expect(Array.new(4) { non_memoized.no_args }).to all eq("#{non_memoized_name}_no_args")
expect(non_memoized.send("#{non_memoized_name}_no_args_counter")).to eq(4)
expect(non_memoized.send(:"#{non_memoized_name}_no_args_counter")).to eq(4)
end
end

Expand All @@ -167,7 +167,7 @@
expect(Array.new(4) { non_memoized.with_one_positional_arg(1) }).
to all eq("#{non_memoized_name}_with_one_positional_arg: a=1")

expect(non_memoized.send("#{non_memoized_name}_one_positional_arg_counter")).to eq(4)
expect(non_memoized.send(:"#{non_memoized_name}_one_positional_arg_counter")).to eq(4)
end
end

Expand All @@ -181,7 +181,7 @@
expect(Array.new(4) { non_memoized.with_positional_args(1, 2) }).
to all eq("#{non_memoized_name}_with_positional_args: a=1, b=2")

expect(non_memoized.send("#{non_memoized_name}_positional_args_counter")).to eq(4)
expect(non_memoized.send(:"#{non_memoized_name}_positional_args_counter")).to eq(4)
end
end
end
Expand Down Expand Up @@ -884,8 +884,8 @@ def no_args_counter
end

it "doesn't define #inherited" do
expect(klass).to be_respond_to(:inherited)
expect(klass.new).to_not be_respond_to(:inherited)
expect(klass).to respond_to(:inherited)
expect(klass.new).to_not respond_to(:inherited)
end
end

Expand Down Expand Up @@ -921,8 +921,8 @@ def no_args_counter
end

it "doesn't define #inherited" do
expect(klass).to be_respond_to(:inherited)
expect(klass.new).to_not be_respond_to(:inherited)
expect(klass).to respond_to(:inherited)
expect(klass.new).to_not respond_to(:inherited)
end
end

Expand Down Expand Up @@ -960,8 +960,8 @@ def no_args_counter
end

it "doesn't define #inherited" do
expect(klass).to be_respond_to(:inherited)
expect(klass.new).to_not be_respond_to(:inherited)
expect(klass).to respond_to(:inherited)
expect(klass.new).to_not respond_to(:inherited)
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion spec/support/define_methods_for_testing_memo_wise.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def self.define_methods_for_testing_memo_wise(target:, via:)

# :nocov:
raise ArgumentError, "Not a Class or Module: #{target.inspect}" unless target.is_a?(Module)
raise ArgumentError, "Unknown value for 'via': #{via}" unless %i[instance self_dot].include?(via) # rubocop:disable Layout/EmptyLineAfterGuardClause
raise ArgumentError, "Unknown value for 'via': #{via}" unless %i[instance self_dot].include?(via)
# :nocov:

self_prefix = via == :self_dot ? "self." : ""
Expand Down

0 comments on commit 26e0569

Please sign in to comment.