Skip to content

Commit f1b4ec3

Browse files
committed
Make rubocop happy
1 parent 300b778 commit f1b4ec3

File tree

7 files changed

+61
-74
lines changed

7 files changed

+61
-74
lines changed

.rubocop_todo.yml

Lines changed: 38 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,11 @@
11
# This configuration was generated by
22
# `rubocop --auto-gen-config`
3-
# on 2024-04-08 13:44:25 UTC using RuboCop version 1.27.0.
3+
# on 2024-05-27 18:22:30 UTC using RuboCop version 1.27.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: 1
10-
# This cop supports safe auto-correction (--auto-correct).
11-
# Configuration parameters: TreatCommentsAsGroupSeparators, ConsiderPunctuation, Include.
12-
# Include: **/*.gemfile, **/Gemfile, **/gems.rb
13-
Bundler/OrderedGems:
14-
Exclude:
15-
- 'Gemfile'
16-
17-
# Offense count: 1
18-
# This cop supports safe auto-correction (--auto-correct).
19-
# Configuration parameters: Include.
20-
# Include: **/*.gemspec
21-
Gemspec/RequireMFA:
22-
Exclude:
23-
- 'meilisearch-rails.gemspec'
24-
259
# Offense count: 1
2610
# This cop supports safe auto-correction (--auto-correct).
2711
# Configuration parameters: EnforcedStyle.
@@ -30,13 +14,12 @@ Layout/EmptyLinesAroundModuleBody:
3014
Exclude:
3115
- 'lib/meilisearch-rails.rb'
3216

33-
# Offense count: 3
17+
# Offense count: 1
3418
# This cop supports safe auto-correction (--auto-correct).
3519
# Configuration parameters: EnforcedStyle.
3620
# SupportedStyles: symmetrical, new_line, same_line
3721
Layout/MultilineMethodCallBraceLayout:
3822
Exclude:
39-
- 'spec/integration_spec.rb'
4023
- 'spec/ms_clean_up_job_spec.rb'
4124

4225
# Offense count: 1
@@ -70,7 +53,7 @@ Lint/UnusedMethodArgument:
7053
# Offense count: 12
7154
# Configuration parameters: IgnoredMethods, CountRepeatedAttributes.
7255
Metrics/AbcSize:
73-
Max: 104
56+
Max: 103
7457

7558
# Offense count: 1
7659
# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods.
@@ -81,7 +64,7 @@ Metrics/BlockLength:
8164
# Offense count: 1
8265
# Configuration parameters: CountComments, CountAsOne.
8366
Metrics/ClassLength:
84-
Max: 157
67+
Max: 169
8568

8669
# Offense count: 8
8770
# Configuration parameters: IgnoredMethods.
@@ -91,12 +74,12 @@ Metrics/CyclomaticComplexity:
9174
# Offense count: 18
9275
# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods.
9376
Metrics/MethodLength:
94-
Max: 103
77+
Max: 102
9578

9679
# Offense count: 1
9780
# Configuration parameters: CountComments, CountAsOne.
9881
Metrics/ModuleLength:
99-
Max: 449
82+
Max: 437
10083

10184
# Offense count: 8
10285
# Configuration parameters: IgnoredMethods.
@@ -123,47 +106,61 @@ Naming/MethodParameterName:
123106
Exclude:
124107
- 'lib/meilisearch-rails.rb'
125108

126-
# Offense count: 20
109+
# Offense count: 5
127110
RSpec/BeforeAfterAll:
128111
Exclude:
129-
- 'spec/integration_spec.rb'
112+
- 'spec/integration/active_record/record_has_associations_spec.rb'
113+
- 'spec/pagination/kaminari_spec.rb'
114+
- 'spec/pagination/will_paginate_spec.rb'
115+
- 'spec/settings_spec.rb'
116+
- 'spec/system/tech_shop_spec.rb'
117+
118+
# Offense count: 2
119+
# Configuration parameters: Prefixes.
120+
# Prefixes: when, with, without
121+
RSpec/ContextWording:
122+
Exclude:
123+
- 'spec/options_spec.rb'
124+
- 'spec/system/tech_shop_spec.rb'
130125

131-
# Offense count: 56
126+
# Offense count: 54
132127
# Configuration parameters: CountAsOne.
133128
RSpec/ExampleLength:
134-
Max: 19
129+
Max: 16
135130

136-
# Offense count: 3
131+
# Offense count: 6
137132
# Configuration parameters: Include, CustomTransform, IgnoreMethods, SpecSuffixOnly.
138133
# Include: **/*_spec*rb*, **/spec/**/*
139134
RSpec/FilePath:
140135
Exclude:
141136
- 'spec/configuration_spec.rb'
137+
- 'spec/integration/active_record/meilisearch_calls_are_deactivated.rb'
138+
- 'spec/meilisearch/activation_spec.rb'
139+
- 'spec/safe_index_spec.rb'
142140
- 'spec/settings_spec.rb'
143141
- 'spec/utilities_spec.rb'
144142

145-
# Offense count: 25
143+
# Offense count: 29
146144
# Configuration parameters: AssignmentOnly.
147145
RSpec/InstanceVariable:
148146
Exclude:
149-
- 'spec/integration_spec.rb'
147+
- 'spec/system/tech_shop_spec.rb'
150148

151149
# Offense count: 1
152150
RSpec/MultipleDescribes:
153151
Exclude:
154-
- 'spec/integration_spec.rb'
152+
- 'spec/search_spec.rb'
153+
154+
# Offense count: 2
155+
RSpec/NestedGroups:
156+
Max: 4
155157

156158
# Offense count: 1
157159
# Configuration parameters: IgnoreNameless, IgnoreSymbolicNames.
158160
RSpec/VerifiedDoubles:
159161
Exclude:
160162
- 'spec/configuration_spec.rb'
161163

162-
# Offense count: 1
163-
Security/MarshalLoad:
164-
Exclude:
165-
- 'spec/integration_spec.rb'
166-
167164
# Offense count: 2
168165
# This cop supports safe auto-correction (--auto-correct).
169166
# Configuration parameters: EnforcedStyle.
@@ -172,13 +169,13 @@ Style/Alias:
172169
Exclude:
173170
- 'lib/meilisearch-rails.rb'
174171

175-
# Offense count: 2
172+
# Offense count: 3
176173
# Configuration parameters: MinBodyLength.
177174
Style/GuardClause:
178175
Exclude:
179176
- 'lib/meilisearch-rails.rb'
180177

181-
# Offense count: 9
178+
# Offense count: 8
182179
# This cop supports safe auto-correction (--auto-correct).
183180
Style/IfUnlessModifier:
184181
Exclude:
@@ -212,26 +209,17 @@ Style/OptionalBooleanParameter:
212209
Exclude:
213210
- 'lib/meilisearch-rails.rb'
214211

215-
# Offense count: 11
212+
# Offense count: 5
216213
# This cop supports safe auto-correction (--auto-correct).
217214
# Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.
218215
# SupportedStyles: single_quotes, double_quotes
219216
Style/StringLiterals:
220217
Exclude:
221-
- 'spec/integration_spec.rb'
222218
- 'spec/ms_clean_up_job_spec.rb'
223219

224-
# Offense count: 2
225-
# This cop supports safe auto-correction (--auto-correct).
226-
# Configuration parameters: EnforcedStyleForMultiline.
227-
# SupportedStylesForMultiline: comma, consistent_comma, no_comma
228-
Style/TrailingCommaInArguments:
229-
Exclude:
230-
- 'spec/integration_spec.rb'
231-
232-
# Offense count: 20
220+
# Offense count: 16
233221
# This cop supports safe auto-correction (--auto-correct).
234222
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
235223
# URISchemes: http, https
236224
Layout/LineLength:
237-
Max: 178
225+
Max: 170

spec/instance_methods_spec.rb

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
)
1414

1515
expect(book.ms_entries).to contain_exactly(
16-
a_hash_including("index_uid" => /SecuredBook/),
17-
a_hash_including("index_uid" => /BookAuthor/),
18-
a_hash_including("index_uid" => /Book/),
16+
a_hash_including('index_uid' => /SecuredBook/),
17+
a_hash_including('index_uid' => /BookAuthor/),
18+
a_hash_including('index_uid' => /Book/)
1919
)
2020
end
2121

@@ -27,10 +27,10 @@
2727
)
2828

2929
expect(book.ms_entries).to contain_exactly(
30-
a_hash_including("index_uid" => /SecuredBook/),
31-
a_hash_including("index_uid" => /BookAuthor/),
30+
a_hash_including('index_uid' => /SecuredBook/),
31+
a_hash_including('index_uid' => /BookAuthor/),
3232
# also includes book's id as if it was a public book
33-
a_hash_including("index_uid" => /Book/),
33+
a_hash_including('index_uid' => /Book/)
3434
)
3535
end
3636

@@ -42,10 +42,12 @@
4242
taby_cat = Cat.create!(name: 'Taby the Cat')
4343

4444
expect(toby_dog.ms_entries).to contain_exactly(
45-
a_hash_including('primary_key' => /dog_\d+/))
45+
a_hash_including('primary_key' => /dog_\d+/)
46+
)
4647

4748
expect(taby_cat.ms_entries).to contain_exactly(
48-
a_hash_including('primary_key' => /cat_\d+/))
49+
a_hash_including('primary_key' => /cat_\d+/)
50+
)
4951
end
5052
end
5153
end

spec/integration/active_record/attributes_have_changed_spec.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,4 +65,3 @@
6565
expect(results[0].id).to eq(m.id)
6666
end
6767
end
68-

spec/integration/active_record/ms_rails_is_included_without_block_spec.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,3 @@
77
end.to raise_error(ArgumentError)
88
end
99
end
10-

spec/integration/active_record/record_has_associations_spec.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,3 @@
2121
end
2222
end
2323
end
24-

spec/meilisearch/activation_spec.rb

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,39 @@
11
describe MeiliSearch::Rails do
22
it 'is active by default' do
3-
expect(MeiliSearch::Rails).to be_active
3+
expect(described_class).to be_active
44
end
55

66
describe '#deactivate!' do
77
context 'without block' do
8-
before { MeiliSearch::Rails.deactivate! }
8+
before { described_class.deactivate! }
99

10-
after { MeiliSearch::Rails.activate! }
10+
after { described_class.activate! }
1111

1212
it 'deactivates the requests until activate!-ed' do
13-
expect(MeiliSearch::Rails).not_to be_active
13+
expect(described_class).not_to be_active
1414
end
1515

1616
it 'responds with a black hole' do
17-
expect(MeiliSearch::Rails.client.foo.bar.now.nil.item.issue).to be_nil
17+
expect(described_class.client.foo.bar.now.nil.item.issue).to be_nil
1818
end
1919
end
2020

2121
context 'with a block' do
2222
it 'disables only around call' do
23-
MeiliSearch::Rails.deactivate! do
24-
expect(MeiliSearch::Rails).not_to be_active
23+
described_class.deactivate! do
24+
expect(described_class).not_to be_active
2525
end
2626

27-
expect(MeiliSearch::Rails).to be_active
27+
expect(described_class).to be_active
2828
end
2929

3030
it 'works in multi-threaded environments' do
3131
Threads.new(5, log: $stdout).assert(20) do |_i, _r|
32-
MeiliSearch::Rails.deactivate! do
33-
expect(MeiliSearch::Rails).not_to be_active
32+
described_class.deactivate! do
33+
expect(described_class).not_to be_active
3434
end
3535

36-
expect(MeiliSearch::Rails).to be_active
36+
expect(described_class).to be_active
3737
end
3838
end
3939
end

spec/options_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@
216216

217217
expect(b['hits'][0]).to include(
218218
'name' => '"> hack0r',
219-
'author' => '',
219+
'author' => ''
220220
)
221221
end
222222

@@ -229,7 +229,7 @@
229229
b = Book.raw_search('hack', { attributes_to_highlight: ['*'] })
230230

231231
expect(b['hits'][0]['_formatted']).to include(
232-
'name' => '"&gt; <em>hack</em>0r',
232+
'name' => '"&gt; <em>hack</em>0r'
233233
)
234234
end
235235
end

0 commit comments

Comments
 (0)