rubocop-graphql 0.15.0 → 0.16.0
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 54f884b232227042a66670cda20f99b749f559dfc1429c1803c4545c0335885c
|
4
|
+
data.tar.gz: 4ae6307ab827039a5dacff35d4075e123c2288752542923ea3ca2c7122658242
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0c00f215519826a44d044a1cf6f87aa6402c179213a7c8650632a73cf45871ee4daf31f0b9c1a6d203448b0e3259687085612521242f314287f683ca51cc5137
|
7
|
+
data.tar.gz: df7fc7edf61e5a66adb94ab131da35625ef4106cdef87cdd3859e1d63604fadda1725b8f0284f80e47bf2f2300395876b91a7637aea746ce83dc191a107961a8
|
@@ -26,11 +26,6 @@ module RuboCop
|
|
26
26
|
|
27
27
|
MSG = "Missing type description"
|
28
28
|
|
29
|
-
# @!method has_i18n_description?(node)
|
30
|
-
def_node_matcher :has_i18n_description?, <<~PATTERN
|
31
|
-
(send nil? :description (send (const nil? :I18n) :t ...))
|
32
|
-
PATTERN
|
33
|
-
|
34
29
|
# @!method interface?(node)
|
35
30
|
def_node_matcher :interface?, <<~PATTERN
|
36
31
|
(send nil? :include (const ...))
|
@@ -53,8 +48,7 @@ module RuboCop
|
|
53
48
|
private
|
54
49
|
|
55
50
|
def has_description?(node)
|
56
|
-
|
57
|
-
description_method_call?(node)
|
51
|
+
description_method_call?(node)
|
58
52
|
end
|
59
53
|
|
60
54
|
def child_nodes(node)
|
@@ -3,7 +3,8 @@
|
|
3
3
|
module RuboCop
|
4
4
|
module Cop
|
5
5
|
module GraphQL
|
6
|
-
# Arguments should either be listed explicitly or **rest should be in the resolve signature
|
6
|
+
# Arguments should either be listed explicitly or **rest should be in the resolve signature
|
7
|
+
# (and similar methods, such as #authorized?).
|
7
8
|
#
|
8
9
|
# @example
|
9
10
|
# # good
|
@@ -14,6 +15,7 @@ module RuboCop
|
|
14
15
|
# argument :post_id, String, loads: Types::PostType, as: :article
|
15
16
|
# argument :comment_ids, String, loads: Types::CommentType
|
16
17
|
#
|
18
|
+
# def authorized?(arg1:, user:, article:, comments:); end
|
17
19
|
# def resolve(arg1:, user:, article:, comments:); end
|
18
20
|
# end
|
19
21
|
#
|
@@ -46,6 +48,7 @@ module RuboCop
|
|
46
48
|
# argument :arg1, String, required: true
|
47
49
|
# argument :arg2, String, required: true
|
48
50
|
#
|
51
|
+
# def authorized?; end
|
49
52
|
# def resolve(arg1:); end
|
50
53
|
# end
|
51
54
|
#
|
@@ -63,7 +66,7 @@ module RuboCop
|
|
63
66
|
class UnusedArgument < Base
|
64
67
|
extend AutoCorrector
|
65
68
|
|
66
|
-
MSG = "Argument%<ending>s `%<unresolved_args>s` should be listed in the
|
69
|
+
MSG = "Argument%<ending>s `%<unresolved_args>s` should be listed in the %<name>s signature."
|
67
70
|
|
68
71
|
def on_class(node)
|
69
72
|
resolve_method_node = find_resolve_method_node(node)
|
@@ -123,7 +126,8 @@ module RuboCop
|
|
123
126
|
message = format(
|
124
127
|
self.class::MSG,
|
125
128
|
unresolved_args: unresolved_args_source,
|
126
|
-
ending: unresolved_args.size == 1 ? "" : "s"
|
129
|
+
ending: unresolved_args.size == 1 ? "" : "s",
|
130
|
+
name: node.method_name.to_s
|
127
131
|
)
|
128
132
|
|
129
133
|
add_offense(node, message: message) do |corrector|
|
@@ -182,7 +186,7 @@ module RuboCop
|
|
182
186
|
|
183
187
|
# @!method resolve_method_definition(node)
|
184
188
|
def_node_search :resolve_method_definition, <<~PATTERN
|
185
|
-
(def :resolve
|
189
|
+
(def {:resolve | :authorized?}
|
186
190
|
(args ...) ...)
|
187
191
|
PATTERN
|
188
192
|
end
|
@@ -20,7 +20,7 @@ module RuboCop
|
|
20
20
|
module DescriptionMethod
|
21
21
|
extend RuboCop::NodePattern::Macros
|
22
22
|
|
23
|
-
DESCRIPTION_STRING = "{
|
23
|
+
DESCRIPTION_STRING = "{str|dstr|const|send}"
|
24
24
|
|
25
25
|
# @!method description_method_call?(node)
|
26
26
|
def_node_matcher :description_method_call?, <<~PATTERN
|
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.16.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-10-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|