rubocop-graphql 0.15.0 → 0.16.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: 07b20077b6c0a6ec0ff0aa58528140efd701a90c3059c2483b213ea9039dfe35
4
- data.tar.gz: 7f2e405ea2241a8f6d918577e75bfe523125700ed48441d434a1e671d1a93e56
3
+ metadata.gz: 54f884b232227042a66670cda20f99b749f559dfc1429c1803c4545c0335885c
4
+ data.tar.gz: 4ae6307ab827039a5dacff35d4075e123c2288752542923ea3ca2c7122658242
5
5
  SHA512:
6
- metadata.gz: 4ac7dc1b72346ef4f42d6739b1c0c9a10b35a80ab5b9421c937a3673d755384a15d06f5e358e88f1a4a29e426e7e2eea41e6e54634a76b8cf8dfeb34ea3a84ca
7
- data.tar.gz: 68aa6accd90828a337828ba69f7e7d42bd5034644762cf83021a71352cfd3a8c7292934a3da2d30b1522a7055502ee49cd7c6ed7abcf6590a6a7b00062847eb7
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
- has_i18n_description?(node) ||
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 resolve signature."
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 = "{({str|dstr|const} ...)|(send const ...)|(send ({str|dstr} ...) _)}"
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
@@ -1,5 +1,5 @@
1
1
  module RuboCop
2
2
  module GraphQL
3
- VERSION = "0.15.0".freeze
3
+ VERSION = "0.16.0".freeze
4
4
  end
5
5
  end
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.15.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-09-28 00:00:00.000000000 Z
11
+ date: 2022-10-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler