rubocop-rspec_parity 1.2.1 → 1.2.2

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: ee0b2418ab57fa718996d3af32feffceb4fb65d5f123a3766595262fc40f17cd
4
- data.tar.gz: b579f5b81afbd41e3f76cf431f2d2021531de01c88ad67674d84bbcbbfca2bfc
3
+ metadata.gz: 7f6cb712ad716f1a6c82659cd5114785bd93f7ed7344fb2ba6317de8bae3d37e
4
+ data.tar.gz: 2588d5b16c636142a361c2d0723d049099e7e1da76ed30b72b0c78b211734fb9
5
5
  SHA512:
6
- metadata.gz: 36866672cb6943729013c27c1e12bea13a5a7dd5230eb615314b77980c96ef66cb13f740d25b6b6e31686f41257b4b012b1785e64f5df4f10ccbd5b6a2c67381
7
- data.tar.gz: f0a52e1b235871983685705fff0d0a0be5229aa3607231412ecde547581443a32cccac8dd0b5cc948048b5f2e30ca8121753a4803d468aaa3a46812bf8657796
6
+ metadata.gz: a2d8de79c7cf285c21e656b96ac473037aabd21c9d206753d44c863b6844d9393217bdf1850b21646f96996355270467e07d711230702fbbb6ed51b4c3536699
7
+ data.tar.gz: 65836a3ae64470aa713d5c3492fb33b993d137f66f1be2d464104a3ce75a22733dd0a055fd2875f6d7ad24c25b407869d42bfebb9d494c3416a4d7003813d8b8
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [1.2.2] - 2026-02-10
4
+
5
+ Added: `PublicMethodHasSpec` now skips class methods marked with `private_class_method` (both inline and post-hoc forms)
6
+
3
7
  ## [1.2.1] - 2026-02-09
4
8
 
5
9
  Fixed: Detect tested methods correctly for classes nested inside modules (e.g. `Calendar::UserCreator`)
@@ -36,13 +36,35 @@ module RuboCop
36
36
  end
37
37
 
38
38
  def on_defs(node)
39
- return unless checkable_method?(node)
39
+ return unless checkable_method?(node) && public_class_method?(node)
40
40
 
41
41
  check_method_has_spec(node, instance_method: false)
42
42
  end
43
43
 
44
44
  private
45
45
 
46
+ def public_class_method?(node)
47
+ # Inline form: private_class_method def self.method_name
48
+ return false if node.parent&.send_type? && node.parent.method_name == :private_class_method
49
+
50
+ # Post-hoc form: private_class_method :method_name
51
+ class_node = find_class_or_module(node)
52
+ return true unless class_node&.body
53
+
54
+ !private_class_method_declared?(class_node, node.method_name)
55
+ end
56
+
57
+ def private_class_method_declared?(class_node, method_name)
58
+ children = class_node.body.begin_type? ? class_node.body.children : [class_node.body]
59
+ children.any? { |child| private_class_method_call?(child, method_name) }
60
+ end
61
+
62
+ def private_class_method_call?(node, method_name)
63
+ node&.send_type? &&
64
+ node.method_name == :private_class_method &&
65
+ node.arguments.any? { |arg| arg.sym_type? && arg.value == method_name }
66
+ end
67
+
46
68
  def checkable_method?(node)
47
69
  should_check_file? && !excluded_method?(node.method_name.to_s)
48
70
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module RuboCop
4
4
  module RSpecParity
5
- VERSION = "1.2.1"
5
+ VERSION = "1.2.2"
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.1
4
+ version: 1.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Povilas Jurcys