Skip to content

Commit

Permalink
fix: Update rubocop config
Browse files Browse the repository at this point in the history
  • Loading branch information
ixti committed Dec 12, 2023
1 parent de57ddd commit 81d5a2b
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 13 deletions.
2 changes: 1 addition & 1 deletion lib/sidekiq/throttled.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def throttled?(message)
end

false
rescue
rescue StandardError
false
end

Expand Down
2 changes: 1 addition & 1 deletion lib/sidekiq/throttled/strategy/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def key(job_args)
return key unless @key_suffix

key << ":#{@key_suffix.call(*job_args)}"
rescue => e
rescue StandardError => e
Sidekiq.logger.error "Failed to get key suffix: #{e}"
raise e
end
Expand Down
4 changes: 4 additions & 0 deletions rubocop/layout.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ Layout/ArgumentAlignment:
Layout/EmptyLinesAroundAttributeAccessor:
Enabled: true

Layout/FirstArrayElementIndentation:
Enabled: true
EnforcedStyle: consistent

Layout/FirstHashElementIndentation:
Enabled: true
EnforcedStyle: consistent
Expand Down
9 changes: 5 additions & 4 deletions rubocop/rspec.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
RSpec/ExampleLength:
Enabled: true
Max: 10

RSpec/ExpectChange:
Enabled: true
EnforcedStyle: block
CountAsOne: [array, hash, heredoc, method_call]

RSpec/MultipleExpectations:
Enabled: false

RSpec/NamedSubject:
Enabled: false

RSpec/BeNil:
Enabled: true
EnforcedStyle: be
2 changes: 1 addition & 1 deletion rubocop/style.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ Style/RegexpLiteral:

Style/RescueStandardError:
Enabled: true
EnforcedStyle: implicit
EnforcedStyle: explicit

Style/SingleArgumentDig:
Enabled: true
Expand Down
6 changes: 3 additions & 3 deletions spec/lib/sidekiq/throttled/config_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
describe "#cooldown_period=" do
it "updates #cooldown_period" do
expect { config.cooldown_period = 42.0 }
.to change { config.cooldown_period }.to(42.0)
.to change(config, :cooldown_period).to(42.0)
end

it "allows setting value to `nil`" do
expect { config.cooldown_period = nil }
.to change { config.cooldown_period }.to(nil)
.to change(config, :cooldown_period).to(nil)
end

it "fails if given value is neither `NilClass` nor `Float`" do
Expand All @@ -42,7 +42,7 @@
describe "#cooldown_threshold=" do
it "updates #cooldown_threshold" do
expect { config.cooldown_threshold = 42 }
.to change { config.cooldown_threshold }.to(42)
.to change(config, :cooldown_threshold).to(42)
end

it "fails if given value is not `Integer`" do
Expand Down
2 changes: 1 addition & 1 deletion spec/lib/sidekiq/throttled/cooldown_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
context "when `cooldown_period` is nil" do
before { config.cooldown_period = nil }

it { is_expected.to be_nil }
it { is_expected.to be(nil) }
end
end

Expand Down
2 changes: 1 addition & 1 deletion spec/lib/sidekiq/throttled/patches/basic_fetch_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def enqueued_jobs(queue)
it "returns nothing" do
fetch.retrieve_work

expect(fetch.retrieve_work).to be_nil
expect(fetch.retrieve_work).to be(nil)
end

it "pushes job back to the head of the queue" do
Expand Down
2 changes: 1 addition & 1 deletion spec/lib/sidekiq/throttled/registry_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def stub_class(name, *parent, &block)
let(:name) { "foo" }

context "when strategy is not registered" do
it { is_expected.to be_nil }
it { is_expected.to be(nil) }
end

context "when strategy was registered" do
Expand Down

0 comments on commit 81d5a2b

Please sign in to comment.