rubocop-rspec_parity 1.2.3 → 1.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/rubocop/cop/rspec_parity/public_method_has_spec.rb +21 -13
- data/lib/rubocop/rspec_parity/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ecd6c86604ffc218af17f9426fa6e5d6c542729ef78f22574fa3e86e926a71a7
|
|
4
|
+
data.tar.gz: 212c5fbd2bb677143e5819348c72bfe1fd75b8a400b5c9982a21720b33554cad
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7391df5bbb91eeb66f4121b39968f5ccc92eebe127bfb7bb510b74ebae2c391212a405d95cfeb4f024c2974b5eeea08c9f2813bd9aa602ba09774f332836b66f
|
|
7
|
+
data.tar.gz: d53b2da32d4237b63d5446eba5d40a3533f02542f97398c48d4f7b3eb0d2355f8c4f86bd026b7175a0b09341d3f89f230e8d6ae3c07f0dcf0e8649e3e2169ac2
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
## [Unreleased]
|
|
2
2
|
|
|
3
|
+
## [1.2.4] - 2026-02-10
|
|
4
|
+
|
|
5
|
+
Fixed: `PublicMethodHasSpec` correctly counts methods re-publicized with `public :method_name` and `public def method_name` for SkipMethodDescribeFor validation
|
|
6
|
+
|
|
3
7
|
## [1.2.3] - 2026-02-10
|
|
4
8
|
|
|
5
9
|
Fixed: `PublicMethodHasSpec` correctly detects visibility for `private :method_name`, `protected :method_name`, `private def method_name`, `protected def method_name`, and `private`/`protected` inside `class << self`
|
|
@@ -258,6 +258,7 @@ module RuboCop
|
|
|
258
258
|
|
|
259
259
|
public_methods = []
|
|
260
260
|
targeted_non_public = []
|
|
261
|
+
targeted_public = []
|
|
261
262
|
visibility = :public
|
|
262
263
|
children = scope_children(class_node)
|
|
263
264
|
|
|
@@ -266,7 +267,8 @@ module RuboCop
|
|
|
266
267
|
|
|
267
268
|
case child.type
|
|
268
269
|
when :send
|
|
269
|
-
|
|
270
|
+
result = count_handle_visibility_send(child, targeted_non_public, targeted_public)
|
|
271
|
+
visibility = result if result
|
|
270
272
|
when :def
|
|
271
273
|
if visibility == :public
|
|
272
274
|
method_name = child.method_name.to_s
|
|
@@ -275,26 +277,32 @@ module RuboCop
|
|
|
275
277
|
end
|
|
276
278
|
end
|
|
277
279
|
|
|
278
|
-
(public_methods - targeted_non_public).size
|
|
280
|
+
((public_methods - targeted_non_public) | targeted_public).size
|
|
279
281
|
end
|
|
280
282
|
# rubocop:enable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength, Metrics/PerceivedComplexity
|
|
281
283
|
|
|
282
|
-
def
|
|
283
|
-
return
|
|
284
|
+
def count_handle_visibility_send(child, targeted_non_public, targeted_public)
|
|
285
|
+
return nil unless VISIBILITY_METHODS.key?(child.method_name)
|
|
286
|
+
return VISIBILITY_METHODS[child.method_name] if child.arguments.empty?
|
|
284
287
|
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
else
|
|
288
|
-
collect_targeted_non_public(child, targeted_non_public)
|
|
289
|
-
nil
|
|
290
|
-
end
|
|
288
|
+
collect_targeted_methods(child, targeted_non_public, targeted_public)
|
|
289
|
+
nil
|
|
291
290
|
end
|
|
292
291
|
|
|
293
|
-
def
|
|
294
|
-
|
|
292
|
+
def collect_targeted_methods(child, targeted_non_public, targeted_public)
|
|
293
|
+
target_list = VISIBILITY_METHODS[child.method_name] == :public ? targeted_public : targeted_non_public
|
|
295
294
|
|
|
296
295
|
child.arguments.each do |arg|
|
|
297
|
-
|
|
296
|
+
name = targeted_method_name(arg)
|
|
297
|
+
target_list << name if name && !excluded_method?(name)
|
|
298
|
+
end
|
|
299
|
+
end
|
|
300
|
+
|
|
301
|
+
def targeted_method_name(arg)
|
|
302
|
+
if arg.sym_type?
|
|
303
|
+
arg.value.to_s
|
|
304
|
+
elsif arg.def_type?
|
|
305
|
+
arg.method_name.to_s
|
|
298
306
|
end
|
|
299
307
|
end
|
|
300
308
|
|