Skip to content

Commit 47bf567

Browse files
committed
cleanup some rubocop todos
1 parent ad13726 commit 47bf567

16 files changed

Lines changed: 97 additions & 109 deletions

.rubocop_todo.yml

Lines changed: 12 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,30 @@
11
# This configuration was generated by
2-
# `rubocop --auto-gen-config`
3-
# on 2026-06-25 14:22:00 UTC using RuboCop version 1.69.0.
2+
# `rubocop --auto-gen-config --auto-gen-only-exclude --exclude-limit 100000`
3+
# on 2026-06-25 14:47:51 UTC using RuboCop version 1.88.0.
44
# The point is for the user to remove these configuration records
55
# one by one as the offenses are removed from the code base.
66
# Note that changes in the inspected code, or installation of new
77
# versions of RuboCop, may require this file to be generated again.
88

9-
# Offense count: 9
9+
# Offense count: 4
1010
# This cop supports safe autocorrection (--autocorrect).
11-
# Configuration parameters: EnforcedStyle.
12-
# SupportedStyles: have_no, not_to
13-
Capybara/RSpec/NegationMatcher:
11+
# Configuration parameters: Max, AllowHeredoc, AllowURI, AllowQualifiedName, URISchemes, AllowRBSInlineAnnotation, AllowCopDirectives, AllowedPatterns, SplitStrings.
12+
# URISchemes: http, https
13+
Layout/LineLength:
1414
Exclude:
15-
- 'spec/simple_navigation/renderer/breadcrumbs_spec.rb'
16-
- 'spec/simple_navigation/renderer/links_spec.rb'
17-
- 'spec/simple_navigation/renderer/list_spec.rb'
15+
- 'generators/navigation_config/templates/config/navigation.rb'
16+
- 'spec/simple_navigation/helpers_spec.rb'
1817

1918
# Offense count: 1
20-
Lint/ShadowingOuterLocalVariable:
19+
# Configuration parameters: MaxRangeSize.
20+
Lint/MissingCopEnableDirective:
2121
Exclude:
22-
- 'spec/spec_helper.rb'
22+
- 'spec/simple_navigation/configuration_spec.rb'
2323

2424
# Offense count: 11
2525
# Configuration parameters: EnforcedStyle, CheckMethodNames, CheckSymbols, AllowedIdentifiers, AllowedPatterns.
2626
# SupportedStyles: snake_case, normalcase, non_integer
27-
# AllowedIdentifiers: capture3, iso8601, rfc1123_date, rfc822, rfc2822, rfc3339, x86_64
27+
# AllowedIdentifiers: TLS1_1, TLS1_2, capture3, iso8601, rfc1123_date, rfc822, rfc2822, rfc3339, x86_64
2828
Naming/VariableNumber:
2929
Exclude:
3030
- 'generators/navigation_config/templates/config/navigation.rb'
@@ -68,15 +68,6 @@ RSpec/NamedSubject:
6868
Exclude:
6969
- 'spec/simple_navigation_spec.rb'
7070

71-
# Offense count: 3
72-
# This cop supports safe autocorrection (--autocorrect).
73-
# Configuration parameters: EnforcedStyle.
74-
# SupportedStyles: not_to, to_not
75-
RSpec/NotToNot:
76-
Exclude:
77-
- 'spec/simple_navigation/item_spec.rb'
78-
- 'spec/simple_navigation/renderer/list_spec.rb'
79-
8071
# Offense count: 24
8172
RSpec/SubjectStub:
8273
Exclude:
@@ -100,40 +91,3 @@ RSpec/VerifiedDoubles:
10091
- 'spec/simple_navigation/renderer/base_spec.rb'
10192
- 'spec/simple_navigation_spec.rb'
10293
- 'spec/spec_helper.rb'
103-
104-
# Offense count: 8
105-
# This cop supports safe autocorrection (--autocorrect).
106-
# Configuration parameters: EnforcedStyle, ProceduralMethods, FunctionalMethods, AllowedMethods, AllowedPatterns, AllowBracesOnProceduralOneLiners, BracesRequiredMethods.
107-
# SupportedStyles: line_count_based, semantic, braces_for_chaining, always_braces
108-
# ProceduralMethods: benchmark, bm, bmbm, create, each_with_object, measure, new, realtime, tap, with_object
109-
# FunctionalMethods: let, let!, subject, watch
110-
# AllowedMethods: lambda, proc, it
111-
Style/BlockDelimiters:
112-
Exclude:
113-
- 'spec/simple_navigation/helpers_spec.rb'
114-
- 'spec/simple_navigation/item_container_spec.rb'
115-
- 'spec/simple_navigation/item_spec.rb'
116-
- 'spec/simple_navigation_spec.rb'
117-
118-
# Offense count: 4
119-
# This cop supports safe autocorrection (--autocorrect).
120-
# Configuration parameters: .
121-
# SupportedStyles: same_as_string_literals, single_quotes, double_quotes
122-
Style/QuotedSymbols:
123-
EnforcedStyle: double_quotes
124-
125-
# Offense count: 7
126-
# This cop supports safe autocorrection (--autocorrect).
127-
# Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.
128-
# SupportedStyles: single_quotes, double_quotes
129-
Style/StringLiterals:
130-
Exclude:
131-
- 'lib/simple_navigation/item.rb'
132-
- 'spec/simple_navigation/item_spec.rb'
133-
134-
# Offense count: 19
135-
# This cop supports safe autocorrection (--autocorrect).
136-
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns, SplitStrings.
137-
# URISchemes: http, https
138-
Layout/LineLength:
139-
Max: 190

lib/simple_navigation/configuration.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,9 @@ def id_generator
7474
# See SimpleNavigation::ItemAdapter for more details.
7575
#
7676
def items(items_provider = nil, &block)
77-
raise('please specify either items_provider or block, but not both') if (items_provider && block) || (items_provider.nil? && block.nil?)
77+
if (items_provider && block) || (items_provider.nil? && block.nil?)
78+
raise('please specify either items_provider or block, but not both')
79+
end
7880

7981
self.primary_navigation = ItemContainer.new
8082

lib/simple_navigation/item.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ def method
9393
def link_html_options
9494
@link_html_options ||= begin
9595
link_options = options[:link_html] || {}
96-
link_options[:"aria-current"] = "page" if !selected_by_subnav? && selected_by_condition?
96+
link_options[:'aria-current'] = 'page' if !selected_by_subnav? && selected_by_condition?
9797
link_options
9898
end
9999
end

spec/integration/rendering_navigation_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
scenario 'Rendering basic navigation', type: :feature do # rubocop:disable RSpec/MultipleExpectations
99
visit '/base_spec'
1010

11-
expect(page).to have_content('Item 1')
12-
expect(page).to have_content('Item 2')
11+
expect(page).to have_text('Item 1')
12+
expect(page).to have_text('Item 2')
1313
expect(page).to have_css('li.item_1 a#link_1')
1414
expect(page).to have_css('li.item_2 a#link_2')
1515
end

spec/simple_navigation/adapters/rails_spec.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,9 @@
185185
before { adapter.instance_variable_set(:@template, nil) }
186186

187187
it 'raises an exception' do
188-
expect { adapter.context_for_eval }.to raise_error(RuntimeError, 'no context set for evaluation the config file')
188+
expect do
189+
adapter.context_for_eval
190+
end.to raise_error(RuntimeError, 'no context set for evaluation the config file')
189191
end
190192
end
191193
end

spec/simple_navigation/adapters/sinatra_spec.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111
context "when adapter's context is not set" do
1212
it 'raises an exception' do
1313
allow(adapter).to receive_messages(context: nil)
14-
expect { adapter.context_for_eval }.to raise_error(RuntimeError, 'no context set for evaluation the config file')
14+
expect do
15+
adapter.context_for_eval
16+
end.to raise_error(RuntimeError, 'no context set for evaluation the config file')
1517
end
1618
end
1719

spec/simple_navigation/config_file_finder_spec.rb

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@
2424

2525
context 'and no navigation.rb file is found in the paths' do
2626
it 'raises an exception' do
27-
expect { finder.find(context) }.to raise_error(RuntimeError, /Config file 'navigation.rb' not found in path\(s\)/)
27+
expect do
28+
finder.find(context)
29+
end.to raise_error(RuntimeError, /Config file 'navigation.rb' not found in path\(s\)/)
2830
end
2931
end
3032
end
@@ -42,7 +44,9 @@
4244

4345
context 'and no other_navigation.rb file is found in the paths' do
4446
it 'raise an exception' do
45-
expect { finder.find(context) }.to raise_error(RuntimeError, /Config file 'other_navigation.rb' not found in path\(s\)/)
47+
expect do
48+
finder.find(context)
49+
end.to raise_error(RuntimeError, /Config file 'other_navigation.rb' not found in path\(s\)/)
4650
end
4751
end
4852
end

spec/simple_navigation/configuration_spec.rb

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,11 @@
9090
let(:provider) { double(:provider) }
9191

9292
it 'raises an exception' do
93-
expect { config.items(provider) {} }.to raise_error(RuntimeError, 'please specify either items_provider or block, but not both') # rubocop:disable Lint/EmptyBlock
93+
# rubocop:disable Lint/EmptyBlock
94+
expect do
95+
config.items(provider) do
96+
end
97+
end.to raise_error(RuntimeError, 'please specify either items_provider or block, but not both')
9498
end
9599
end
96100

@@ -140,7 +144,9 @@
140144

141145
context 'when items_provider is not specified' do
142146
it 'raises an exception' do
143-
expect { config.items }.to raise_error(RuntimeError, 'please specify either items_provider or block, but not both')
147+
expect do
148+
config.items
149+
end.to raise_error(RuntimeError, 'please specify either items_provider or block, but not both')
144150
end
145151
end
146152
end

spec/simple_navigation/helpers_spec.rb

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -368,18 +368,18 @@
368368

369369
context "and the active_item_container isn't set" do
370370
it "doesn't raise an exception" do
371-
expect {
371+
expect do
372372
controller.render_navigation(level: 2)
373-
}.not_to raise_error
373+
end.not_to raise_error
374374
end
375375
end
376376
end
377377

378378
context "and its value isn't a valid level" do
379379
it 'raises an exception' do
380-
expect {
380+
expect do
381381
controller.render_navigation(level: :invalid)
382-
}.to raise_error(ArgumentError, 'Invalid navigation level: invalid')
382+
end.to raise_error(ArgumentError, 'Invalid navigation level: invalid')
383383
end
384384
end
385385
end
@@ -395,17 +395,20 @@
395395

396396
context 'when a block is given' do
397397
it 'calls the block passing it an item container' do
398-
expect { |blk|
398+
expect do |blk|
399399
controller.render_navigation(&blk)
400-
}.to yield_with_args(SimpleNavigation::ItemContainer)
400+
end.to yield_with_args(SimpleNavigation::ItemContainer)
401401
end
402402
end
403403

404404
context 'when no primary configuration is defined' do
405405
before { allow(SimpleNavigation).to receive_messages(primary_navigation: nil) }
406406

407407
it 'raises an exception' do
408-
expect { controller.render_navigation }.to raise_error(RuntimeError, 'no primary navigation defined, either use a navigation config file or pass items directly to render_navigation')
408+
expect do
409+
controller.render_navigation
410+
end.to raise_error(RuntimeError,
411+
'no primary navigation defined, either use a navigation config file or pass items directly to render_navigation')
409412
end
410413
end
411414

spec/simple_navigation/item_container_spec.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -220,9 +220,9 @@
220220
it 'yields a new ItemContainer' do
221221
allow_any_instance_of(SimpleNavigation::Item).to receive_messages(sub_navigation: sub_container) # rubocop:disable RSpec/AnyInstance
222222

223-
expect { |blk|
223+
expect do |blk|
224224
item_container.item('key', 'name', 'url', options, &blk)
225-
}.to yield_with_args(sub_container)
225+
end.to yield_with_args(sub_container)
226226
end
227227

228228
it 'creates a new Item with the given params and block' do
@@ -314,9 +314,9 @@
314314
end
315315

316316
it 'does not raise an exception' do
317-
expect {
317+
expect do
318318
item_container.item('key', 'name', 'url', options)
319-
}.not_to raise_error
319+
end.not_to raise_error
320320
end
321321
end
322322

@@ -433,9 +433,9 @@
433433

434434
context 'and it is not a proc or a method' do
435435
it 'raises an error' do
436-
expect {
436+
expect do
437437
item_container.item('key', 'name', 'url', { if: 'text' })
438-
}.to raise_error(ArgumentError, ':if or :unless must be procs or lambdas')
438+
end.to raise_error(ArgumentError, ':if or :unless must be procs or lambdas')
439439
end
440440
end
441441
end

0 commit comments

Comments
 (0)