rubocop-graphql 0.18.0 → 0.19.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -7
- data/config/default.yml +1 -1
- data/lib/rubocop/cop/graphql/unnecessary_argument_camelize.rb +2 -2
- data/lib/rubocop/graphql/swap_range.rb +10 -1
- data/lib/rubocop/graphql/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 80b3609f1de18b1e5db7198fdf29f7deed28cfe0e505c9485203dd38172ff4f9
|
4
|
+
data.tar.gz: 0d894dad1bc37192b76372d235d10fab4181e171574f471091e9bad0033212d2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3c2b2d1bcbae2e53e28567c0f13397f77427cc0b9d87a96171cd27fec5d33649568366a623c6ea7c6960f452709d02081c04e3dae1368b465da4fad304ae9ce5
|
7
|
+
data.tar.gz: b6b5588432b38eaa545bff20b2f52d966859ba1fac6fcad5004f22405fd4d1dab56c04238124f99f3ff1df860b385773e539981221b94d0e8c4c27266d4a7c9e
|
data/README.md
CHANGED
@@ -1,13 +1,7 @@
|
|
1
|
-
# RuboCop::GraphQL
|
1
|
+
# RuboCop::GraphQL ![](https://ruby-gem-downloads-badge.herokuapp.com/rubocop-graphql?type=total)
|
2
2
|
|
3
3
|
[Rubocop](https://github.com/rubocop-hq/rubocop) extension for enforcing [graphql-ruby](https://github.com/rmosolgo/graphql-ruby) best practices.
|
4
4
|
|
5
|
-
<p align="center">
|
6
|
-
<a href="https://evilmartians.com/?utm_source=graphql-rubocop">
|
7
|
-
<img src="https://evilmartians.com/badges/sponsored-by-evil-martians.svg" alt="Sponsored by Evil Martians" width="236" height="54">
|
8
|
-
</a>
|
9
|
-
</p>
|
10
|
-
|
11
5
|
## Installation
|
12
6
|
|
13
7
|
Install the gem:
|
@@ -69,6 +63,10 @@ GraphQL/ResolverMethodLength:
|
|
69
63
|
Max: 3
|
70
64
|
```
|
71
65
|
|
66
|
+
## Credits
|
67
|
+
|
68
|
+
Initially sponsored by [Evil Martians](http://evilmartians.com).
|
69
|
+
|
72
70
|
## Contributing
|
73
71
|
|
74
72
|
Bug reports and pull requests are welcome on GitHub at https://github.com/DmitryTsepelev/rubocop-graphql.
|
data/config/default.yml
CHANGED
@@ -23,14 +23,14 @@ module RuboCop
|
|
23
23
|
# # bad
|
24
24
|
#
|
25
25
|
# class UserType < BaseType
|
26
|
-
# argument :filter, String, required: false
|
26
|
+
# argument :filter, String, required: false
|
27
27
|
# end
|
28
28
|
#
|
29
29
|
# # bad
|
30
30
|
#
|
31
31
|
# class UserType < BaseType
|
32
32
|
# field :name, String, "Name of the user", null: true do
|
33
|
-
# argument :filter, String, required: false
|
33
|
+
# argument :filter, String, required: false
|
34
34
|
# end
|
35
35
|
# end
|
36
36
|
#
|
@@ -16,11 +16,20 @@ module RuboCop
|
|
16
16
|
def declaration(node)
|
17
17
|
buffer = processed_source.buffer
|
18
18
|
begin_pos = range_by_whole_lines(node.source_range).begin_pos
|
19
|
-
end_line = buffer.line_for_position(node.
|
19
|
+
end_line = buffer.line_for_position(final_end_location(node).end_pos)
|
20
20
|
end_pos = range_by_whole_lines(buffer.line_range(end_line),
|
21
21
|
include_final_newline: true).end_pos
|
22
22
|
Parser::Source::Range.new(buffer, begin_pos, end_pos)
|
23
23
|
end
|
24
|
+
|
25
|
+
def final_end_location(start_node)
|
26
|
+
heredoc_endings =
|
27
|
+
start_node.each_node(:str, :dstr, :xstr)
|
28
|
+
.select(&:heredoc?)
|
29
|
+
.map { |node| node.loc.heredoc_end }
|
30
|
+
|
31
|
+
[start_node.source_range.end, *heredoc_endings].max_by(&:line)
|
32
|
+
end
|
24
33
|
end
|
25
34
|
end
|
26
35
|
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.
|
4
|
+
version: 0.19.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:
|
11
|
+
date: 2023-01-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|