Skip to content

Commit 5719a1f

Browse files
committed
Update Rubocop, enable new cops, fix offenses
1 parent 2ba90dd commit 5719a1f

File tree

6 files changed

+163
-156
lines changed

6 files changed

+163
-156
lines changed

.rubocop.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,15 @@ Minitest/NoAssertions:
137137
Minitest/NoTestCases:
138138
Enabled: true
139139

140+
Minitest/NonExecutableTestMethod:
141+
Enabled: true
142+
140143
Minitest/NonPublicTestMethod:
141144
Enabled: true
142145

146+
Minitest/RedundantMessageArgument:
147+
Enabled: true
148+
143149
Minitest/RefuteEmpty:
144150
Enabled: true
145151

Gemfile.lock

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,8 @@ GEM
155155
racc (~> 1.4)
156156
nokogiri (1.15.5-x86_64-linux)
157157
racc (~> 1.4)
158-
parallel (1.23.0)
159-
parser (3.2.2.4)
158+
parallel (1.24.0)
159+
parser (3.3.0.5)
160160
ast (~> 2.4.1)
161161
racc
162162
psych (5.1.1.1)
@@ -210,31 +210,32 @@ GEM
210210
rake (13.1.0)
211211
rdoc (6.6.0)
212212
psych (>= 4.0.0)
213-
regexp_parser (2.8.3)
213+
regexp_parser (2.9.0)
214214
reline (0.4.1)
215215
io-console (~> 0.5)
216216
responders (3.1.1)
217217
actionpack (>= 5.2)
218218
railties (>= 5.2)
219219
rexml (3.2.6)
220-
rubocop (1.59.0)
220+
rubocop (1.61.0)
221221
json (~> 2.3)
222222
language_server-protocol (>= 3.17.0)
223223
parallel (~> 1.10)
224-
parser (>= 3.2.2.4)
224+
parser (>= 3.3.0.2)
225225
rainbow (>= 2.2.2, < 4.0)
226226
regexp_parser (>= 1.8, < 3.0)
227227
rexml (>= 3.2.5, < 4.0)
228228
rubocop-ast (>= 1.30.0, < 2.0)
229229
ruby-progressbar (~> 1.7)
230230
unicode-display_width (>= 2.4.0, < 3.0)
231-
rubocop-ast (1.30.0)
232-
parser (>= 3.2.1.0)
233-
rubocop-minitest (0.33.0)
231+
rubocop-ast (1.31.1)
232+
parser (>= 3.3.0.4)
233+
rubocop-minitest (0.34.5)
234234
rubocop (>= 1.39, < 2.0)
235-
rubocop-performance (1.19.1)
236-
rubocop (>= 1.7.0, < 2.0)
237-
rubocop-ast (>= 0.4.0)
235+
rubocop-ast (>= 1.30.0, < 2.0)
236+
rubocop-performance (1.20.2)
237+
rubocop (>= 1.48.1, < 2.0)
238+
rubocop-ast (>= 1.30.0, < 2.0)
238239
ruby-progressbar (1.13.0)
239240
ruby2_keywords (0.0.5)
240241
simplecov (0.22.0)

lib/inherited_resources/base_helpers.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ def method_for_find
217217
#
218218
def get_resource_ivar #:nodoc:
219219
if instance_variable_defined?(:"@#{resource_instance_name}")
220-
instance_variable_get("@#{resource_instance_name}")
220+
instance_variable_get(:"@#{resource_instance_name}")
221221
else
222222
nil
223223
end
@@ -226,14 +226,14 @@ def get_resource_ivar #:nodoc:
226226
# Set resource ivar based on the current resource controller.
227227
#
228228
def set_resource_ivar(resource) #:nodoc:
229-
instance_variable_set("@#{resource_instance_name}", resource)
229+
instance_variable_set(:"@#{resource_instance_name}", resource)
230230
end
231231

232232
# Get collection ivar based on the current resource controller.
233233
#
234234
def get_collection_ivar #:nodoc:
235235
if instance_variable_defined?(:"@#{resource_collection_name}")
236-
instance_variable_get("@#{resource_collection_name}")
236+
instance_variable_get(:"@#{resource_collection_name}")
237237
else
238238
nil
239239
end
@@ -242,7 +242,7 @@ def get_collection_ivar #:nodoc:
242242
# Set collection ivar based on the current resource controller.
243243
#
244244
def set_collection_ivar(collection) #:nodoc:
245-
instance_variable_set("@#{resource_collection_name}", collection)
245+
instance_variable_set(:"@#{resource_collection_name}", collection)
246246
end
247247

248248
# Used to allow to specify success and failure within just one block:

lib/inherited_resources/belongs_to_helpers.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def evaluate_parent(parent_symbol, parent_config, chain = nil) #:nodoc:
7979

8080
def get_parent_ivar(instance_name) #:nodoc:
8181
instance_variable_defined?(:"@#{instance_name}") &&
82-
instance_variable_get("@#{instance_name}")
82+
instance_variable_get(:"@#{instance_name}")
8383
end
8484

8585
def set_parent_instance(parent_config, chain) #:nodoc:
@@ -99,7 +99,7 @@ def set_parent_instance(parent_config, chain) #:nodoc:
9999
parent = parent.send(parent_config[:finder], params[parent_config[:param]])
100100
end
101101

102-
instance_variable_set("@#{parent_config[:instance_name]}", parent)
102+
instance_variable_set(:"@#{parent_config[:instance_name]}", parent)
103103
end
104104

105105
# Maps parents_symbols to build association chain. In this case, it

lib/inherited_resources/polymorphic_helpers.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,8 @@ def parent_class
122122
#
123123
def parent
124124
if parent_type
125-
p = instance_variable_defined?("@#{parent_type}") && instance_variable_get("@#{parent_type}")
126-
p || instance_variable_set("@#{parent_type}", association_chain[-1])
125+
p = instance_variable_defined?(:"@#{parent_type}") && instance_variable_get(:"@#{parent_type}")
126+
p || instance_variable_set(:"@#{parent_type}", association_chain[-1])
127127
end
128128
end
129129

0 commit comments

Comments
 (0)