rubocop-teamtailor 0.2.0 → 0.3.0

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: 4592a277b04f19d85f74eb00d578242102318946d930c428ed655390ba3ccc40
4
- data.tar.gz: 10d484caaae9cbd10e72b919ad15aa17f90c488e459875d6a56a361480c7a2cd
3
+ metadata.gz: a3415d0a918da6562c673c1113f17a517e8841834a7005efddd48931d2b7245d
4
+ data.tar.gz: c3cd2927bc900eef6a7e55c6e96ff90087c7473ac2ce22b4ce6091ce3ca55abd
5
5
  SHA512:
6
- metadata.gz: 25b7a07bdb38ef5baa26e0e333dca5608710b9f71c8085fdb71fa27cd5e2df1689e151fb21f73f8d30627d167397f28b44af023203b3c0888caa7d9210c3a11f
7
- data.tar.gz: 48012ed398180b0d2120c00b3143cf98fd1428125d1d91b084a5c3c8c7698d6d0d366f13e054780eadb350b25ae96270ec73e70adc95b05d58b6ba43ed61f6c6
6
+ metadata.gz: c3252311d281326157c2e70dce4ddf9cd7677baf442df466e4cde62e26784a632bcc7696fabd9bd279b743f1197f6823a0060af6d3acb9bab422408845a3454a
7
+ data.tar.gz: e7b64854a74e7ef40b9fe1e03c8ae9e9f732d55c942b55ad640b29f429cb62c5d4eb2d14237c6595d03f523229b4c0c40a05324edf96710d04967935e24e59ce
@@ -10,6 +10,10 @@ module RuboCop
10
10
  (send nil? {:has_many | :has_one} ...)
11
11
  PATTERN
12
12
 
13
+ def_node_matcher :no_embed?, <<~PATTERN
14
+ (sym {:embed | :embed_in_root})
15
+ PATTERN
16
+
13
17
  def on_class(class_node)
14
18
  return unless class_node.defined_module_name.end_with?("Serializer")
15
19
  check_children(class_node)
@@ -17,8 +21,17 @@ module RuboCop
17
21
 
18
22
  private
19
23
 
24
+ def is_embedding?(node)
25
+ return true if no_embed?(node)
26
+
27
+ if node.respond_to?(:children)
28
+ return node.children.any? { |child| is_embedding?(child) }
29
+ end
30
+ false
31
+ end
32
+
20
33
  def check_children(node)
21
- if no_has_many?(node)
34
+ if no_has_many?(node) && is_embedding?(node)
22
35
  add_offense(node)
23
36
  end
24
37
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module RuboCop
4
4
  module Teamtailor
5
- VERSION = "0.2.0"
5
+ VERSION = "0.3.0"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubocop-teamtailor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonas Brusman
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-11-12 00:00:00.000000000 Z
11
+ date: 2025-08-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubocop
@@ -69,7 +69,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
69
69
  - !ruby/object:Gem::Version
70
70
  version: '0'
71
71
  requirements: []
72
- rubygems_version: 3.4.10
72
+ rubygems_version: 3.5.22
73
73
  signing_key:
74
74
  specification_version: 4
75
75
  summary: Teamtailor's RuboCop cops