rubocop-graphql 0.12.3 → 0.13.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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d809ed60d2d98c5f7f84a3555d8ad24ad2c2e1ece6a5fed616b6698260981d29
|
4
|
+
data.tar.gz: e62936fc399419ee72070e658be32660763a96144776727e183007aa53ad0bd8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8c508f31ceb2e6f1290ef0220896019c5f3ff007dbd2ec651ba44ad5cc422680ec761ccb6739a7e90f243cc434b787f849d872143c6e709967deeeb81e6500ec
|
7
|
+
data.tar.gz: ccd1741a8b20403f5a904aa321526fb089f4af357b1a8cce37547221f11ef1fa4f407169aedb35923b85c4b5dc5eb0bba76f74ce7b585b260a0d90549c2d7dfb
|
@@ -57,7 +57,19 @@ module RuboCop
|
|
57
57
|
"Field `%<current>s` should appear before `%<previous>s`."
|
58
58
|
|
59
59
|
def on_class(node)
|
60
|
-
|
60
|
+
declarations_with_blocks = argument_declarations_with_blocks(node)
|
61
|
+
declarations_without_blocks = argument_declarations_without_blocks(node)
|
62
|
+
|
63
|
+
argument_declarations = declarations_without_blocks.map do |node|
|
64
|
+
arg_name = argument_name(node)
|
65
|
+
same_arg_with_block_declaration = declarations_with_blocks.find do |dec|
|
66
|
+
argument_name(dec) == arg_name
|
67
|
+
end
|
68
|
+
|
69
|
+
same_arg_with_block_declaration || node
|
70
|
+
end
|
71
|
+
|
72
|
+
argument_declarations.each_cons(2) do |previous, current|
|
61
73
|
next unless consecutive_lines(previous, current)
|
62
74
|
next if argument_name(current) >= argument_name(previous)
|
63
75
|
|
@@ -80,16 +92,26 @@ module RuboCop
|
|
80
92
|
end
|
81
93
|
|
82
94
|
def argument_name(node)
|
83
|
-
node.first_argument.
|
95
|
+
argument = node.block_type? ? node.children.first.first_argument : node.first_argument
|
96
|
+
|
97
|
+
argument.value.to_s
|
84
98
|
end
|
85
99
|
|
86
100
|
def consecutive_lines(previous, current)
|
87
101
|
previous.source_range.last_line == current.source_range.first_line - 1
|
88
102
|
end
|
89
103
|
|
90
|
-
def_node_search :
|
104
|
+
def_node_search :argument_declarations_without_blocks, <<~PATTERN
|
91
105
|
(send nil? :argument (:sym _) ...)
|
92
106
|
PATTERN
|
107
|
+
|
108
|
+
def_node_search :argument_declarations_with_blocks, <<~PATTERN
|
109
|
+
(block
|
110
|
+
(send nil? :argument
|
111
|
+
(:sym _)
|
112
|
+
...)
|
113
|
+
...)
|
114
|
+
PATTERN
|
93
115
|
end
|
94
116
|
end
|
95
117
|
end
|
@@ -90,7 +90,10 @@ module RuboCop
|
|
90
90
|
|
91
91
|
def find_resolve_method_node(node)
|
92
92
|
resolve_method_nodes = resolve_method_definition(node)
|
93
|
-
resolve_method_nodes.
|
93
|
+
resolve_method_nodes.find do |resolve_node|
|
94
|
+
# reject resolve methods from other classes
|
95
|
+
resolve_node.each_ancestor(:class).first == node
|
96
|
+
end
|
94
97
|
end
|
95
98
|
|
96
99
|
def find_unresolved_args(method_node, declared_arg_nodes)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubocop-graphql
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.13.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dmitry Tsepelev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-02-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|