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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fb4e28828d5aa07e959ad98fd9da04872c4832d1c8b1d168d440d1ad7c80762c
4
- data.tar.gz: eaf5932cba816bfb478fac0cec298bb0e3db98b506b4f7112851503712e77068
3
+ metadata.gz: 80b3609f1de18b1e5db7198fdf29f7deed28cfe0e505c9485203dd38172ff4f9
4
+ data.tar.gz: 0d894dad1bc37192b76372d235d10fab4181e171574f471091e9bad0033212d2
5
5
  SHA512:
6
- metadata.gz: cf88847a0b7a49cd1274b30fcff4e4e5ecb47b16f11a7d5e3fddcbcd7985a8d43bb8911080064a23e8d444daab330327f8908355a2ad75b2a94b14f2f4a4b2c8
7
- data.tar.gz: a10cf2b637bc06a65338af84928c53ced64c78e634470a7fe988e4bf7a7037cfcd3035895914b99056fa11abc272c328d9be40da6ee608f33c900490dea0504d
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
@@ -74,7 +74,7 @@ GraphQL/ExtractInputType:
74
74
  Description: 'Suggests using input type instead of many arguments'
75
75
  MaxArguments: 2
76
76
  Include:
77
- - 'graphql/mutations/**/*.rb'
77
+ - '**/graphql/mutations/**/*.rb'
78
78
 
79
79
  GraphQL/ExtractType:
80
80
  Enabled: true
@@ -23,14 +23,14 @@ module RuboCop
23
23
  # # bad
24
24
  #
25
25
  # class UserType < BaseType
26
- # argument :filter, String, required: false, camelize: 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, camelize: true
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.loc.expression.end_pos)
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
@@ -1,5 +1,5 @@
1
1
  module RuboCop
2
2
  module GraphQL
3
- VERSION = "0.18.0".freeze
3
+ VERSION = "0.19.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.18.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: 2022-10-30 00:00:00.000000000 Z
11
+ date: 2023-01-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler