rubocop-graphql 1.5.0 → 1.5.1

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: b6b8cbd4a0d9dec84fd66e8fd76716d4d23d1a6ce486c713a951cd6c375255dd
4
- data.tar.gz: 9f7b85517392c031a54e63d9cbd28280cf41d9afb890f67f8e4054fc0704e553
3
+ metadata.gz: 1307db3b7122e5a576ca03bbaecbb5798b03a927718aa85fa25fd5a9afe1ec07
4
+ data.tar.gz: ea58763eb067a3e576149ebe41830a7ca7210e080e61382011fab9707ceaf2b9
5
5
  SHA512:
6
- metadata.gz: 3474232c9c512d5b86d3c8fd43b790562b01ac458786e96c3c34a1556f530390fff21bd55a7805c382278b43d6c13cb336307b987ce070cbab01788e3c6e5194
7
- data.tar.gz: f8c5fba9247ad3ce42131b4bd3ee8dfd7f623eb896ca7cce9fb6e0f6ad29c6d38ce616f877e0a5d92dedc8a7701110cd37334fd9af1cb042bcc130285fa2b7d6
6
+ metadata.gz: 86d2c4c34918bb8713b15c4485b681d62b8b8c74b894aefbfb4d12e1d364ef2eff48c6c5562ca5b10690195b8f8403dacac73552b0cdfa2960f64fde07b63e3c
7
+ data.tar.gz: 784d752ff412289d3eeeabdd204939bef5ad946e6cd5f40c8cc2ccfd1ebe4b7ec657f8ebe44c3d14fc7d8b50508891bc9b945f732b1b25c1a9dff6d6751ce87f
data/config/default.yml CHANGED
@@ -128,6 +128,7 @@ GraphQL/ResolverMethodLength:
128
128
  Max: 10
129
129
  CountComments: false
130
130
  ExcludedMethods: []
131
+ CountAsOne: []
131
132
 
132
133
  GraphQL/ObjectDescription:
133
134
  Enabled: true
@@ -23,9 +23,11 @@ module RuboCop
23
23
  return if excluded_methods.include?(String(node.method_name))
24
24
 
25
25
  if field_is_defined?(node)
26
- length = code_length(node)
26
+ return if node.line_count <= max_length
27
27
 
28
- return unless length > max_length
28
+ calculator = build_code_length_calculator(node)
29
+ length = calculator.calculate
30
+ return if length <= max_length
29
31
 
30
32
  add_offense(node, message: message(length))
31
33
  end
@@ -34,10 +36,6 @@ module RuboCop
34
36
 
35
37
  private
36
38
 
37
- def code_length(node)
38
- node.source.lines[1..-2].count { |line| !irrelevant_line(line) }
39
- end
40
-
41
39
  def field_is_defined?(node)
42
40
  node.parent
43
41
  .children
@@ -33,7 +33,7 @@ module RuboCop
33
33
 
34
34
  # @!method field_description(node)
35
35
  def_node_matcher :field_description, <<~PATTERN
36
- (send nil? :field _ _ (:str $_) ...)
36
+ (send nil? :field _ _ {(:str $_)|(:dstr $...)} ...)
37
37
  PATTERN
38
38
 
39
39
  attr_reader :node
@@ -1,5 +1,5 @@
1
1
  module RuboCop
2
2
  module GraphQL
3
- VERSION = "1.5.0".freeze
3
+ VERSION = "1.5.1".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: 1.5.0
4
+ version: 1.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dmitry Tsepelev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-01-06 00:00:00.000000000 Z
11
+ date: 2024-03-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler