rubocop-graphql 0.15.1 → 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: 7d6c5f9bf491004d53992e994ed1f1f1a4b71c8861678ac37aa477ccf56df8bd
4
- data.tar.gz: 3e4d23b1d5b9037f5865007c417b4369331c3da3a45472253532b2307dcad154
3
+ metadata.gz: 54f884b232227042a66670cda20f99b749f559dfc1429c1803c4545c0335885c
4
+ data.tar.gz: 4ae6307ab827039a5dacff35d4075e123c2288752542923ea3ca2c7122658242
5
5
  SHA512:
6
- metadata.gz: 9de08df6e6bae9d0530fa7d05c521585b0017cc3c334c38c8975b7c4cf8dfc8f18b307ab4145311ba3d577ca0e2fc691938a6123e7b2d5436fb8892d8b1cf15f
7
- data.tar.gz: 33c062e880965add9e25ab820e885bf2580c65041cee30ce1168a4e410cfece1af1bb0c3cadd7486ee98e67599f4ccc4b825e2f4bcae9996ee89924f47b14715
6
+ metadata.gz: 0c00f215519826a44d044a1cf6f87aa6402c179213a7c8650632a73cf45871ee4daf31f0b9c1a6d203448b0e3259687085612521242f314287f683ca51cc5137
7
+ data.tar.gz: df7fc7edf61e5a66adb94ab131da35625ef4106cdef87cdd3859e1d63604fadda1725b8f0284f80e47bf2f2300395876b91a7637aea746ce83dc191a107961a8
@@ -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
@@ -1,5 +1,5 @@
1
1
  module RuboCop
2
2
  module GraphQL
3
- VERSION = "0.15.1".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.1
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-10-11 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