rubocop-graphql 1.5.4 → 1.5.5

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: e0d8efee42cd1c4f7443f6d83ffcf7f0aeb030de07573486bbf12bc9f758e0a2
4
- data.tar.gz: 4bc42c5823b8dceca37a2ca48b086478c7fa360817f864ce4ee2c420e103fba0
3
+ metadata.gz: 5ee5569071019423fb93f2d3a6ef5f20d9149e5d650cf13b3f54e54fbe2bb979
4
+ data.tar.gz: 53b3bb5710e42c42cc759195b762bbb9a5dc8073a7cebd6e6e10155909277582
5
5
  SHA512:
6
- metadata.gz: addcc849a825b94134f1d19743a10a7c6784d984831b41f3b9e0292c2aca6a2ab1d055bd97fae7fed9a918d4edf865f8c4d81684f43d0b9b981dab782669b476
7
- data.tar.gz: c7958b6e456137e98f4116954b6982d417eab63202ce4da778fd154a70620159e44ce69da7cac078a25d983a917ebfbc02f9acfcf11681f90399be911307df2b
6
+ metadata.gz: 93602bdec3e0672725cb1607d28432c6279e6f28e1faee2eb7279d5a14601986bceaf0898eb86a702541f04c0648465eeb972b84ede3aafc42cb7603dc9f5335
7
+ data.tar.gz: d187ab697121d4e5d1f36ce1238febbfe2dd8d8e194f06d28ecfc768836a3f1d04a68d633effb4f20b5aa4f6ed7ef33227f426c7ceaa58c4966adae6bf51d4ca
data/README.md CHANGED
@@ -2,6 +2,8 @@
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
+ You can support my open–source work [here](https://boosty.to/dmitry_tsepelev).
6
+
5
7
  ## Installation
6
8
 
7
9
  Install the gem:
@@ -25,30 +27,33 @@ You need to tell RuboCop to load the GraphQL extension. There are three ways to
25
27
  Put this into your `.rubocop.yml`.
26
28
 
27
29
  ```yaml
28
- require: rubocop-graphql
30
+ plugins: rubocop-graphql
29
31
  ```
30
32
 
31
33
  Alternatively, use the following array notation when specifying multiple extensions.
32
34
 
33
35
  ```yaml
34
- require:
36
+ plugins:
35
37
  - rubocop-other-extension
36
38
  - rubocop-graphql
37
39
  ```
38
40
 
39
41
  Now you can run `rubocop` and it will automatically load the RuboCop GraphQL cops together with the standard cops.
40
42
 
43
+ > [!NOTE]
44
+ > The plugin system is supported in RuboCop 1.72+. In earlier versions, use `require` instead of `plugins`.
45
+
41
46
  ### Command line
42
47
 
43
48
  ```sh
44
- rubocop --require rubocop-graphql
49
+ rubocop --plugins rubocop-graphql
45
50
  ```
46
51
 
47
52
  ### Rake task
48
53
 
49
54
  ```ruby
50
55
  RuboCop::RakeTask.new do |task|
51
- task.requires << 'rubocop-graphql'
56
+ task.plugins << 'rubocop-graphql'
52
57
  end
53
58
  ```
54
59
 
@@ -58,6 +58,8 @@ module RuboCop
58
58
  end
59
59
  end
60
60
 
61
+ alias on_module on_class
62
+
61
63
  private
62
64
 
63
65
  def consecutive_fields(previous, current)
@@ -103,7 +103,7 @@ module RuboCop
103
103
 
104
104
  def find_unresolved_args(method_node, declared_arg_nodes)
105
105
  resolve_method_kwargs = method_node.arguments.select do |arg|
106
- arg.kwarg_type? || arg.kwoptarg_type?
106
+ arg.type?(:kwarg, :kwoptarg)
107
107
  end
108
108
  resolve_method_kwargs_names = resolve_method_kwargs.map do |node|
109
109
  node.node_parts[0]
@@ -116,7 +116,7 @@ module RuboCop
116
116
 
117
117
  def ignore_arguments_type?(resolve_method_node)
118
118
  resolve_method_node.arguments.any? do |arg|
119
- arg.arg_type? || arg.kwrestarg_type? || arg.forward_arg_type?
119
+ arg.type?(:arg, :kwrestarg, :forward_arg)
120
120
  end
121
121
  end
122
122
 
@@ -172,11 +172,11 @@ module RuboCop
172
172
  end
173
173
 
174
174
  def scope_changing_syntax?(node)
175
- node.def_type? || node.defs_type? || node.class_type? || node.module_type?
175
+ node.type?(:def, :defs, :class, :module)
176
176
  end
177
177
 
178
178
  def block_or_lambda?(node)
179
- node.block_type? || node.lambda_type?
179
+ node.type?(:block, :lambda)
180
180
  end
181
181
 
182
182
  # @!method argument_declaration?(node)
@@ -4,7 +4,7 @@ module RuboCop
4
4
  module GraphQL
5
5
  module Heredoc
6
6
  def heredoc?(node)
7
- (node.str_type? || node.dstr_type?) && node.heredoc?
7
+ node.type?(:str, :dstr) && node.heredoc?
8
8
  end
9
9
 
10
10
  def range_including_heredoc(node)
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "lint_roller"
4
+
5
+ module RuboCop
6
+ module GraphQL
7
+ # A plugin that integrates rubocop-graphql with RuboCop's plugin system.
8
+ class Plugin < LintRoller::Plugin
9
+ def about
10
+ LintRoller::About.new(
11
+ name: "rubocop-graphql",
12
+ version: VERSION,
13
+ homepage: "https://github.com/DmitryTsepelev/rubocop-graphql",
14
+ description: "RuboCop extension for enforcing graphql-ruby best practices."
15
+ )
16
+ end
17
+
18
+ def supported?(context)
19
+ context.engine == :rubocop
20
+ end
21
+
22
+ def rules(_context)
23
+ LintRoller::Rules.new(
24
+ type: :path,
25
+ config_format: :rubocop,
26
+ value: Pathname.new(__dir__).join("../../../config/default.yml")
27
+ )
28
+ end
29
+ end
30
+ end
31
+ end
@@ -1,5 +1,5 @@
1
1
  module RuboCop
2
2
  module GraphQL
3
- VERSION = "1.5.4".freeze
3
+ VERSION = "1.5.5".freeze
4
4
  end
5
5
  end
@@ -1,12 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RuboCop
4
- # RuboCop GraphQL project namespace
4
+ # RuboCop GraphQL project namespace.
5
5
  module GraphQL
6
- PROJECT_ROOT = Pathname.new(__dir__).parent.parent.expand_path.freeze
7
- CONFIG_DEFAULT = PROJECT_ROOT.join("config", "default.yml").freeze
8
- CONFIG = YAML.safe_load(CONFIG_DEFAULT.read).freeze
9
-
10
- private_constant(:CONFIG_DEFAULT, :PROJECT_ROOT)
11
6
  end
12
7
  end
@@ -6,7 +6,7 @@ require_relative "rubocop/graphql/ext/snake_case"
6
6
 
7
7
  require_relative "rubocop/graphql"
8
8
  require_relative "rubocop/graphql/version"
9
- require_relative "rubocop/graphql/inject"
9
+ require_relative "rubocop/graphql/plugin"
10
10
  require_relative "rubocop/graphql/compare_order"
11
11
  require_relative "rubocop/graphql/description_method"
12
12
  require_relative "rubocop/graphql/heredoc"
@@ -24,6 +24,4 @@ require_relative "rubocop/graphql/field/block"
24
24
  require_relative "rubocop/graphql/field/kwargs"
25
25
  require_relative "rubocop/graphql/schema_member"
26
26
 
27
- RuboCop::GraphQL::Inject.defaults!
28
-
29
27
  require_relative "rubocop/cop/graphql_cops"
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubocop-graphql
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.4
4
+ version: 1.5.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dmitry Tsepelev
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2024-08-03 00:00:00.000000000 Z
10
+ date: 2025-03-18 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: bundler
@@ -52,13 +51,27 @@ dependencies:
52
51
  - - "~>"
53
52
  - !ruby/object:Gem::Version
54
53
  version: '3.9'
54
+ - !ruby/object:Gem::Dependency
55
+ name: lint_roller
56
+ requirement: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - "~>"
59
+ - !ruby/object:Gem::Version
60
+ version: '1.1'
61
+ type: :runtime
62
+ prerelease: false
63
+ version_requirements: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - "~>"
66
+ - !ruby/object:Gem::Version
67
+ version: '1.1'
55
68
  - !ruby/object:Gem::Dependency
56
69
  name: rubocop
57
70
  requirement: !ruby/object:Gem::Requirement
58
71
  requirements:
59
72
  - - ">="
60
73
  - !ruby/object:Gem::Version
61
- version: '1.50'
74
+ version: 1.72.1
62
75
  - - "<"
63
76
  - !ruby/object:Gem::Version
64
77
  version: '2'
@@ -68,7 +81,7 @@ dependencies:
68
81
  requirements:
69
82
  - - ">="
70
83
  - !ruby/object:Gem::Version
71
- version: '1.50'
84
+ version: 1.72.1
72
85
  - - "<"
73
86
  - !ruby/object:Gem::Version
74
87
  version: '2'
@@ -123,9 +136,9 @@ files:
123
136
  - lib/rubocop/graphql/field/block.rb
124
137
  - lib/rubocop/graphql/field/kwargs.rb
125
138
  - lib/rubocop/graphql/heredoc.rb
126
- - lib/rubocop/graphql/inject.rb
127
139
  - lib/rubocop/graphql/node_pattern.rb
128
140
  - lib/rubocop/graphql/node_uniqueness.rb
141
+ - lib/rubocop/graphql/plugin.rb
129
142
  - lib/rubocop/graphql/schema_member.rb
130
143
  - lib/rubocop/graphql/sorbet.rb
131
144
  - lib/rubocop/graphql/swap_range.rb
@@ -137,7 +150,7 @@ metadata:
137
150
  homepage_uri: https://github.com/DmitryTsepelev/rubocop-graphql
138
151
  source_code_uri: https://github.com/DmitryTsepelev/rubocop-graphql
139
152
  changelog_uri: https://github.com/DmitryTsepelev/rubocop-graphql/blob/master/CHANGELOG.md
140
- post_install_message:
153
+ default_lint_roller_plugin: RuboCop::GraphQL::Plugin
141
154
  rdoc_options: []
142
155
  require_paths:
143
156
  - lib
@@ -152,8 +165,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
152
165
  - !ruby/object:Gem::Version
153
166
  version: '0'
154
167
  requirements: []
155
- rubygems_version: 3.3.7
156
- signing_key:
168
+ rubygems_version: 3.6.2
157
169
  specification_version: 4
158
170
  summary: Automatic performance checking tool for Ruby code.
159
171
  test_files: []
@@ -1,18 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module RuboCop
4
- module GraphQL
5
- # Because RuboCop doesn't yet support plugins, we have to monkey patch in a
6
- # bit of our configuration.
7
- module Inject
8
- def self.defaults!
9
- path = CONFIG_DEFAULT.to_s
10
- hash = ConfigLoader.send(:load_yaml_configuration, path)
11
- config = Config.new(hash, path).tap(&:make_excludes_absolute)
12
- puts "configuration from \#{path}" if ConfigLoader.debug?
13
- config = ConfigLoader.merge_with_default(config, path)
14
- ConfigLoader.instance_variable_set(:@default_configuration, config)
15
- end
16
- end
17
- end
18
- end