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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e3c642272877446cd87c6b7d88339e284fe29fac025f153489d28398e20e73bd
4
- data.tar.gz: bb91681c2f70a3a35febf88a132344a125e0f5a6735df0a2a0b5c39bcee79c97
3
+ metadata.gz: ecd6c86604ffc218af17f9426fa6e5d6c542729ef78f22574fa3e86e926a71a7
4
+ data.tar.gz: 212c5fbd2bb677143e5819348c72bfe1fd75b8a400b5c9982a21720b33554cad
5
5
  SHA512:
6
- metadata.gz: 83ee14e1845f77229138051716410f1cc1c9d751430800300d4e204b6a4ab07df7c0380549e200723d8ff861a8ce52a5ed02fe461ef8059a02217ffe2da3467b
7
- data.tar.gz: d9300dd4aacf6711bbfc2135c9814f03cfef4b42981f6cc5c9f7c8291ee1f525ebd092cb5645e25faf31c9171311e92a2841f9cc67ba0780ee2cce6e56297057
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
- count_public_methods_handle_send(child, visibility, targeted_non_public).tap { |v| visibility = v if v }
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 count_public_methods_handle_send(child, visibility, targeted_non_public)
283
- return visibility unless VISIBILITY_METHODS.key?(child.method_name)
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
- if child.arguments.empty?
286
- VISIBILITY_METHODS[child.method_name]
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 collect_targeted_non_public(child, targeted_non_public)
294
- return if VISIBILITY_METHODS[child.method_name] == :public
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
- targeted_non_public << arg.value.to_s if arg.sym_type?
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
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module RuboCop
4
4
  module RSpecParity
5
- VERSION = "1.2.3"
5
+ VERSION = "1.2.4"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubocop-rspec_parity
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.3
4
+ version: 1.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Povilas Jurcys