Skip to content

Commit 825bcb7

Browse files
committed
Run rubocop -A for all touched files
1 parent 3824d53 commit 825bcb7

File tree

4 files changed

+66
-52
lines changed

4 files changed

+66
-52
lines changed

Diff for: .rubocop_todo.yml

+17-30
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This configuration was generated by
22
# `rubocop --auto-gen-config --exclude-limit 10000`
3-
# on 2025-03-04 09:53:10 UTC using RuboCop version 1.73.2.
3+
# on 2025-04-10 07:53:12 UTC using RuboCop version 1.75.2.
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
@@ -54,11 +54,10 @@ Layout/FirstArgumentIndentation:
5454

5555
# Offense count: 2
5656
# This cop supports safe autocorrection (--autocorrect).
57-
# Configuration parameters: EnforcedStyle, IndentationWidth.
57+
# Configuration parameters: IndentationWidth.
5858
# SupportedStyles: special_inside_parentheses, consistent, align_braces
5959
Layout/FirstHashElementIndentation:
60-
Exclude:
61-
- 'spec/inertia/rspec_helper_spec.rb'
60+
EnforcedStyle: consistent
6261

6362
# Offense count: 4
6463
# This cop supports safe autocorrection (--autocorrect).
@@ -68,14 +67,13 @@ Layout/MultilineMethodCallIndentation:
6867
Exclude:
6968
- 'spec/inertia/ssr_spec.rb'
7069

71-
# Offense count: 6
70+
# Offense count: 5
7271
# This cop supports safe autocorrection (--autocorrect).
7372
# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces.
7473
# SupportedStyles: space, no_space
7574
# SupportedStylesForEmptyBraces: space, no_space
7675
Layout/SpaceBeforeBlockBraces:
7776
Exclude:
78-
- 'spec/dummy/app/controllers/inertia_render_test_controller.rb'
7977
- 'spec/inertia/error_sharing_spec.rb'
8078
- 'spec/inertia/request_spec.rb'
8179

@@ -127,13 +125,12 @@ Layout/TrailingEmptyLines:
127125
- 'lib/tasks/inertia_rails.rake'
128126
- 'spec/inertia/rails_mimic_spec.rb'
129127

130-
# Offense count: 10
128+
# Offense count: 9
131129
# This cop supports safe autocorrection (--autocorrect).
132130
# Configuration parameters: AllowInHeredoc.
133131
Layout/TrailingWhitespace:
134132
Exclude:
135133
- 'lib/inertia_rails/rspec.rb'
136-
- 'spec/dummy/app/controllers/inertia_render_test_controller.rb'
137134
- 'spec/dummy/config/environments/test.rb'
138135

139136
# Offense count: 1
@@ -164,14 +161,6 @@ Lint/SymbolConversion:
164161
Exclude:
165162
- 'spec/inertia/rails_mimic_spec.rb'
166163

167-
# Offense count: 1
168-
# This cop supports safe autocorrection (--autocorrect).
169-
# Configuration parameters: AutoCorrect, AllowUnusedKeywordArguments, IgnoreEmptyMethods, IgnoreNotImplementedMethods, NotImplementedExceptions.
170-
# NotImplementedExceptions: NotImplementedError
171-
Lint/UnusedMethodArgument:
172-
Exclude:
173-
- 'lib/patches/mapper.rb'
174-
175164
# Offense count: 1
176165
Naming/AccessorMethodName:
177166
Exclude:
@@ -190,7 +179,7 @@ Naming/FileName:
190179
# Offense count: 2
191180
# Configuration parameters: EnforcedStyle, CheckMethodNames, CheckSymbols, AllowedIdentifiers, AllowedPatterns.
192181
# SupportedStyles: snake_case, normalcase, non_integer
193-
# AllowedIdentifiers: capture3, iso8601, rfc1123_date, rfc822, rfc2822, rfc3339, x86_64
182+
# AllowedIdentifiers: TLS1_1, TLS1_2, capture3, iso8601, rfc1123_date, rfc822, rfc2822, rfc3339, x86_64
194183
Naming/VariableNumber:
195184
Exclude:
196185
- 'spec/dummy/app/controllers/inertia_test_controller.rb'
@@ -214,8 +203,10 @@ Style/BlockDelimiters:
214203

215204
# Offense count: 1
216205
# This cop supports unsafe autocorrection (--autocorrect-all).
217-
# Configuration parameters: EnforcedStyle.
206+
# Configuration parameters: EnforcedStyle, EnforcedStyleForClasses, EnforcedStyleForModules.
218207
# SupportedStyles: nested, compact
208+
# SupportedStylesForClasses: , nested, compact
209+
# SupportedStylesForModules: , nested, compact
219210
Style/ClassAndModuleChildren:
220211
Exclude:
221212
- 'lib/inertia_rails/helper.rb'
@@ -255,7 +246,7 @@ Style/ExpandPathArguments:
255246
Exclude:
256247
- 'spec/rails_helper.rb'
257248

258-
# Offense count: 69
249+
# Offense count: 67
259250
# This cop supports unsafe autocorrection (--autocorrect-all).
260251
# Configuration parameters: EnforcedStyle.
261252
# SupportedStyles: always, always_true, never
@@ -267,7 +258,6 @@ Style/FrozenStringLiteralComment:
267258
- 'lib/inertia_rails/controller.rb'
268259
- 'lib/inertia_rails/engine.rb'
269260
- 'lib/inertia_rails/helper.rb'
270-
- 'lib/inertia_rails/inertia_rails.rb'
271261
- 'lib/inertia_rails/rspec.rb'
272262
- 'lib/inertia_rails/version.rb'
273263
- 'lib/patches/better_errors.rb'
@@ -287,7 +277,6 @@ Style/FrozenStringLiteralComment:
287277
- 'spec/dummy/app/controllers/inertia_merge_shared_controller.rb'
288278
- 'spec/dummy/app/controllers/inertia_multithreaded_share_controller.rb'
289279
- 'spec/dummy/app/controllers/inertia_rails_mimic_controller.rb'
290-
- 'spec/dummy/app/controllers/inertia_render_test_controller.rb'
291280
- 'spec/dummy/app/controllers/inertia_responders_test_controller.rb'
292281
- 'spec/dummy/app/controllers/inertia_session_continuity_test_controller.rb'
293282
- 'spec/dummy/app/controllers/inertia_share_test_controller.rb'
@@ -369,14 +358,13 @@ Style/IfUnlessModifierOfIfUnless:
369358
Exclude:
370359
- 'lib/inertia_rails/controller.rb'
371360

372-
# Offense count: 3
361+
# Offense count: 2
373362
# This cop supports safe autocorrection (--autocorrect).
374363
# Configuration parameters: EnforcedStyle.
375364
# SupportedStyles: line_count_dependent, lambda, literal
376365
Style/Lambda:
377366
Exclude:
378367
- 'spec/dummy/app/controllers/inertia_lambda_shared_props_controller.rb'
379-
- 'spec/dummy/app/controllers/inertia_render_test_controller.rb'
380368
- 'spec/dummy/app/controllers/transformed_inertia_rails_mimic_controller.rb'
381369

382370
# Offense count: 1
@@ -446,7 +434,7 @@ Style/SoleNestedConditional:
446434
Exclude:
447435
- 'lib/inertia_rails/controller.rb'
448436

449-
# Offense count: 78
437+
# Offense count: 80
450438
# This cop supports safe autocorrection (--autocorrect).
451439
# Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.
452440
# SupportedStyles: single_quotes, double_quotes
@@ -495,7 +483,7 @@ Style/TrailingCommaInArguments:
495483
- 'spec/dummy/app/controllers/inertia_config_test_controller.rb'
496484
- 'spec/dummy/app/controllers/inertia_rails_mimic_controller.rb'
497485

498-
# Offense count: 22
486+
# Offense count: 12
499487
# This cop supports safe autocorrection (--autocorrect).
500488
# Configuration parameters: EnforcedStyleForMultiline.
501489
# SupportedStylesForMultiline: comma, consistent_comma, diff_comma, no_comma
@@ -505,21 +493,20 @@ Style/TrailingCommaInHashLiteral:
505493
- 'spec/dummy/app/controllers/inertia_lambda_shared_props_controller.rb'
506494
- 'spec/dummy/app/controllers/inertia_merge_instance_props_controller.rb'
507495
- 'spec/dummy/app/controllers/inertia_merge_shared_controller.rb'
508-
- 'spec/dummy/app/controllers/inertia_render_test_controller.rb'
509496
- 'spec/dummy/config/environments/development.rb'
510497
- 'spec/dummy/config/environments/test.rb'
511498
- 'spec/inertia/response_spec.rb'
512499
- 'spec/inertia/rspec_helper_spec.rb'
513500

514501
# Offense count: 1
515502
# This cop supports safe autocorrection (--autocorrect).
516-
# Configuration parameters: EnforcedStyle, MinSize, WordRegex.
503+
# Configuration parameters: WordRegex.
517504
# SupportedStyles: percent, brackets
518505
Style/WordArray:
519-
Exclude:
520-
- 'lib/inertia_rails/middleware.rb'
506+
EnforcedStyle: percent
507+
MinSize: 4
521508

522-
# Offense count: 17
509+
# Offense count: 19
523510
# This cop supports safe autocorrection (--autocorrect).
524511
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns, SplitStrings.
525512
# URISchemes: http, https

Diff for: lib/inertia_rails/inertia_rails.rb

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
require 'inertia_rails/base_prop'
24
require 'inertia_rails/ignore_on_first_load_prop'
35
require 'inertia_rails/always_prop'

Diff for: spec/dummy/app/controllers/inertia_render_test_controller.rb

+15-14
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1+
# frozen_string_literal: true
2+
13
class InertiaRenderTestController < ApplicationController
2-
34
def props
45
render inertia: 'TestComponent', props: {
56
name: 'Brandon',
6-
sport: -> { 'hockey' }
7+
sport: -> { 'hockey' },
78
}
89
end
910

@@ -18,9 +19,9 @@ def except_props
1819
end,
1920
nested: {
2021
first: 'first nested param',
21-
second: 'second nested param'
22+
second: 'second nested param',
2223
},
23-
always: InertiaRails.always { 'always prop' }
24+
always: InertiaRails.always { 'always prop' },
2425
}
2526
end
2627

@@ -36,10 +37,10 @@ def deeply_nested_props
3637
nested: {
3738
first: 'first nested param',
3839
second: 'second nested param',
39-
evaluated: -> do
40+
evaluated: lambda do
4041
{
4142
first: 'first evaluated nested param',
42-
second: 'second evaluated nested param'
43+
second: 'second evaluated nested param',
4344
}
4445
end,
4546
deeply_nested: {
@@ -48,10 +49,10 @@ def deeply_nested_props
4849
what_about_nil: nil,
4950
what_about_empty_hash: {},
5051
deeply_nested_always: InertiaRails.always { 'deeply nested always prop' },
51-
deeply_nested_lazy: InertiaRails.lazy { 'deeply nested lazy prop' }
52-
}
52+
deeply_nested_lazy: InertiaRails.lazy { 'deeply nested lazy prop' },
53+
},
5354
},
54-
always: InertiaRails.always { 'always prop' }
55+
always: InertiaRails.always { 'always prop' },
5556
}
5657
end
5758

@@ -79,7 +80,7 @@ def lazy_props
7980
level: InertiaRails.lazy do
8081
'worse than he believes'
8182
end,
82-
grit: InertiaRails.lazy(->{ 'intense' })
83+
grit: InertiaRails.lazy(-> { 'intense' }),
8384
}
8485
end
8586

@@ -98,17 +99,17 @@ def always_props
9899
optional: InertiaRails.optional do
99100
'optional prop'
100101
end,
101-
another_optional: InertiaRails.optional { 'another optional prop' }
102+
another_optional: InertiaRails.optional { 'another optional prop' },
102103
}
103104
end
104105

105106
def merge_props
106107
render inertia: 'TestComponent', props: {
107108
merge: InertiaRails.merge { 'merge prop' },
108-
deep_merge: InertiaRails.deep_merge { {deep: 'merge prop'} },
109+
deep_merge: InertiaRails.deep_merge { { deep: 'merge prop' } },
109110
regular: 'regular prop',
110111
deferred_merge: InertiaRails.defer(merge: true) { 'deferred and merge prop' },
111-
deferred_deep_merge: InertiaRails.defer(deep_merge: true) { {deep: 'deferred and merge prop'} },
112+
deferred_deep_merge: InertiaRails.defer(deep_merge: true) { { deep: 'deferred and merge prop' } },
112113
deferred: InertiaRails.defer { 'deferred' },
113114
}
114115
end
@@ -120,7 +121,7 @@ def deferred_props
120121
level: InertiaRails.defer do
121122
'worse than he believes'
122123
end,
123-
grit: InertiaRails.defer { 'intense' }
124+
grit: InertiaRails.defer { 'intense' },
124125
}
125126
end
126127
end

Diff for: spec/inertia/rendering_spec.rb

+32-8
Original file line numberDiff line numberDiff line change
@@ -83,39 +83,56 @@
8383
end
8484

8585
context 'with a default component' do
86-
let(:page) { InertiaRails::Renderer.new('inertia_route_with_default_component', controller, request, response, '').send(:page) }
86+
let(:page) do
87+
InertiaRails::Renderer.new('inertia_route_with_default_component', controller, request, response,
88+
'').send(:page)
89+
end
8790

8891
before { get inertia_route_with_default_component_path }
8992

9093
it { is_expected.to include inertia_div(page) }
9194
end
9295

9396
context 'with a default component resource' do
94-
let(:page) { InertiaRails::Renderer.new('items/inertia_route_with_default_component', controller, request, response, '').send(:page) }
97+
let(:page) do
98+
InertiaRails::Renderer.new('items/inertia_route_with_default_component', controller, request, response,
99+
'').send(:page)
100+
end
95101

96102
before { get item_inertia_route_with_default_component_path(item_id: 1) }
97103

98104
it { is_expected.to include inertia_div(page) }
99105
end
100106

101107
context 'with a default component resource on member' do
102-
let(:page) { InertiaRails::Renderer.new('items/inertia_route_with_default_component_on_member', controller, request, response, '').send(:page) }
108+
let(:page) do
109+
InertiaRails::Renderer.new(
110+
'items/inertia_route_with_default_component_on_member', controller, request, response, ''
111+
).send(:page)
112+
end
103113

104114
before { get inertia_route_with_default_component_on_member_item_path(id: 1) }
105115

106116
it { is_expected.to include inertia_div(page) }
107117
end
108118

109119
context 'with a default component resource on collection' do
110-
let(:page) { InertiaRails::Renderer.new('items/inertia_route_with_default_component_on_collection', controller, request, response, '').send(:page) }
120+
let(:page) do
121+
InertiaRails::Renderer.new(
122+
'items/inertia_route_with_default_component_on_collection', controller, request, response, ''
123+
).send(:page)
124+
end
111125

112126
before { get inertia_route_with_default_component_on_collection_items_path }
113127

114128
it { is_expected.to include inertia_div(page) }
115129
end
116130

117131
context 'with a default component resource & scoped' do
118-
let(:page) { InertiaRails::Renderer.new('items/inertia_route_with_default_component', controller, request, response, '').send(:page) }
132+
let(:page) do
133+
InertiaRails::Renderer.new('items/inertia_route_with_default_component', controller, request, response,
134+
'').send(:page)
135+
end
119136

120137
before { get scoped_item_inertia_route_with_default_component_path(item_id: 1) }
121138

@@ -513,7 +530,8 @@
513530
before { get merge_props_path, headers: headers }
514531

515532
it 'returns non-optional props and meta on first load' do
516-
expect(response.parsed_body['props']).to eq('merge' => 'merge prop', 'deep_merge' => { 'deep' => 'merge prop' }, 'regular' => 'regular prop')
533+
expect(response.parsed_body['props']).to eq('merge' => 'merge prop', 'deep_merge' => { 'deep' => 'merge prop' },
534+
'regular' => 'regular prop')
517535
expect(response.parsed_body['mergeProps']).to match_array(%w[merge deferred_merge])
518536
expect(response.parsed_body['deepMergeProps']).to match_array(%w[deep_merge deferred_deep_merge])
519537
expect(response.parsed_body['deferredProps']).to eq('default' => %w[deferred_merge deferred_deep_merge deferred])
@@ -529,7 +547,10 @@
529547
end
530548

531549
it 'returns listed and merge props' do
532-
expect(response.parsed_body['props']).to eq({ 'deferred_merge' => 'deferred and merge prop', 'deferred_deep_merge' => { 'deep' => 'deferred and merge prop' } })
550+
expect(response.parsed_body['props']).to eq(
551+
'deferred_merge' => 'deferred and merge prop',
552+
'deferred_deep_merge' => { 'deep' => 'deferred and merge prop' }
553+
)
533554
expect(response.parsed_body['mergeProps']).to match_array(%w[merge deferred_merge])
534555
expect(response.parsed_body['deepMergeProps']).to match_array(%w[deep_merge deferred_deep_merge])
535556
expect(response.parsed_body['deferredProps']).to be_nil
@@ -547,7 +568,10 @@
547568
end
548569

549570
it 'returns listed and merge props' do
550-
expect(response.parsed_body['props']).to eq({ 'deferred_merge' => 'deferred and merge prop', 'deferred_deep_merge' => { 'deep' => 'deferred and merge prop' } })
571+
expect(response.parsed_body['props']).to eq(
572+
'deferred_merge' => 'deferred and merge prop',
573+
'deferred_deep_merge' => { 'deep' => 'deferred and merge prop' }
574+
)
551575
expect(response.parsed_body['mergeProps']).to match_array(%w[merge])
552576
expect(response.parsed_body['deferredProps']).to be_nil
553577
end

0 commit comments

Comments
 (0)