graphql-client 0.8.5 → 0.8.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/graphql/client/deprecation.rb +30 -0
- data/lib/graphql/client/query_result.rb +2 -0
- data/lib/rubocop/cop/graphql/overfetch.rb +19 -4
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2256abdf15f085e2b5ae475f68b7815fadad41a2
|
4
|
+
data.tar.gz: ee7092f75f95536dce4c06104ad6994343b94ec0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8ac15dedea572296ae6f613aff4c92b80c4f3018af09661418e4e43e28b7297f595f8d9df8f0aa1c5705bfc39ef7d8512ece0f5e7b5c8d50cd1bf4b901650038
|
7
|
+
data.tar.gz: ec6539aeec8d8f0bda5cf3dbe746f49fa06a9fc156bbf207881d40fdb66282ed4065253281701b3cc877a8b641e85a1695044d6aa4ea720cd29c13b9afa2bd4c
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require "active_support/deprecation"
|
3
|
+
|
4
|
+
module GraphQL
|
5
|
+
class Client
|
6
|
+
if ActiveSupport::Deprecation.is_a?(Class)
|
7
|
+
Deprecation = ActiveSupport::Deprecation.new("0.9", "graphql-client")
|
8
|
+
else
|
9
|
+
module Deprecation
|
10
|
+
extend self
|
11
|
+
|
12
|
+
def silence(&block)
|
13
|
+
ActiveSupport::Deprecation.silence(&block)
|
14
|
+
end
|
15
|
+
|
16
|
+
def warn(*args)
|
17
|
+
ActiveSupport::Deprecation.warn(*args)
|
18
|
+
end
|
19
|
+
|
20
|
+
def deprecate_methods(*args)
|
21
|
+
# TODO
|
22
|
+
end
|
23
|
+
|
24
|
+
def deprecation_warning(deprecated_method_name, message = nil, caller_backtrace = nil)
|
25
|
+
warn "#{deprecated_method_name} is deprecated and will be removed from graphql-client 0.9 (#{message})"
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -9,7 +9,7 @@ module RuboCop
|
|
9
9
|
module GraphQL
|
10
10
|
# Public: Rubocop for catching overfetched fields in ERB templates.
|
11
11
|
class Overfetch < Cop
|
12
|
-
def_node_search :send_methods, "({send csend} ...)"
|
12
|
+
def_node_search :send_methods, "({send csend block_pass} ...)"
|
13
13
|
|
14
14
|
def investigate(processed_source)
|
15
15
|
erb = File.read(processed_source.buffer.name)
|
@@ -33,9 +33,12 @@ module RuboCop
|
|
33
33
|
visitor.visit
|
34
34
|
|
35
35
|
send_methods(processed_source.ast).each do |node|
|
36
|
-
|
37
|
-
|
38
|
-
|
36
|
+
method_names = method_names_for(*node)
|
37
|
+
|
38
|
+
method_names.each do |method_name|
|
39
|
+
aliases.fetch(method_name, []).each do |field_name|
|
40
|
+
fields[field_name] += 1
|
41
|
+
end
|
39
42
|
end
|
40
43
|
end
|
41
44
|
|
@@ -56,6 +59,18 @@ module RuboCop
|
|
56
59
|
|
57
60
|
names
|
58
61
|
end
|
62
|
+
|
63
|
+
def method_names_for(*node)
|
64
|
+
receiver, method_name, *_args = node
|
65
|
+
method_names = []
|
66
|
+
|
67
|
+
method_names << method_name if method_name
|
68
|
+
|
69
|
+
# add field accesses like `nodes.map(&:field)`
|
70
|
+
method_names.concat(receiver.children) if receiver && receiver.sym_type?
|
71
|
+
|
72
|
+
method_names.map!(&:to_s)
|
73
|
+
end
|
59
74
|
end
|
60
75
|
end
|
61
76
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: graphql-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GitHub
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-04-
|
11
|
+
date: 2017-04-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -160,6 +160,7 @@ files:
|
|
160
160
|
- lib/graphql/client/collocated_enforcement.rb
|
161
161
|
- lib/graphql/client/definition.rb
|
162
162
|
- lib/graphql/client/definition_variables.rb
|
163
|
+
- lib/graphql/client/deprecation.rb
|
163
164
|
- lib/graphql/client/document_types.rb
|
164
165
|
- lib/graphql/client/error.rb
|
165
166
|
- lib/graphql/client/errors.rb
|