rubocop-graphql 0.8.1 → 0.8.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/config/default.yml +4 -5
- data/lib/rubocop/cop/graphql_cops.rb +0 -2
- data/lib/rubocop/graphql/version.rb +1 -1
- metadata +3 -4
- data/lib/rubocop/cop/graphql/cop.rb +0 -91
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 22be8928aa9fbce1700f99d21ccddacd9590ab7bd6c6723e4b7458f974e02f66
|
4
|
+
data.tar.gz: 6e06404047cba621b7493912723fa5eac13c19004d128339e494455758871831
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 94e9c24116f399d08b0c264e4b1b6c5dc50ac9436833fd8ec9f4916bdae102f5fdd5df5589a31502bca8aa65ccc61448a24b2e57aded363c35e6b0adec1513f6
|
7
|
+
data.tar.gz: '0855eb683b91a3d5bb6e78b89c7c3089df5832813b1c298b26edf56de2e3c4ee71da837d279bad5ce15fd4dbcf9197fe908f81f77967a7b7345c9a1b3fdcb1f2'
|
data/config/default.yml
CHANGED
@@ -1,7 +1,6 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
- "(?:^|/)graphql/"
|
1
|
+
GraphQL:
|
2
|
+
Include:
|
3
|
+
- "**/graphql/**/*"
|
5
4
|
|
6
5
|
GraphQL/ArgumentDescription:
|
7
6
|
Enabled: true
|
@@ -74,4 +73,4 @@ GraphQL/ObjectDescription:
|
|
74
73
|
Description: 'Ensures all types have a description'
|
75
74
|
Exclude:
|
76
75
|
- '**/*_schema.rb'
|
77
|
-
- '**/base_*.rb'
|
76
|
+
- '**/base_*.rb'
|
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.8.
|
4
|
+
version: 0.8.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dmitry Tsepelev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-04-
|
11
|
+
date: 2021-04-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -85,7 +85,6 @@ files:
|
|
85
85
|
- lib/rubocop-graphql.rb
|
86
86
|
- lib/rubocop/cop/graphql/argument_description.rb
|
87
87
|
- lib/rubocop/cop/graphql/argument_name.rb
|
88
|
-
- lib/rubocop/cop/graphql/cop.rb
|
89
88
|
- lib/rubocop/cop/graphql/extract_input_type.rb
|
90
89
|
- lib/rubocop/cop/graphql/extract_type.rb
|
91
90
|
- lib/rubocop/cop/graphql/field_definitions.rb
|
@@ -126,7 +125,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
126
125
|
requirements:
|
127
126
|
- - ">="
|
128
127
|
- !ruby/object:Gem::Version
|
129
|
-
version: '2.
|
128
|
+
version: '2.5'
|
130
129
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
131
130
|
requirements:
|
132
131
|
- - ">="
|
@@ -1,91 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module RuboCop
|
4
|
-
# Inspied by https://github.com/rubocop-hq/rubocop-rspec/blob/3a2088f79737e2e8e0e21482783f7d61411bf021/lib/rubocop/cop/rspec/cop.rb
|
5
|
-
module Cop
|
6
|
-
WorkaroundGraphqlCop = Cop.dup
|
7
|
-
|
8
|
-
# Clone of the the normal RuboCop::Cop::Cop class so we can rewrite
|
9
|
-
# the inherited method without breaking functionality
|
10
|
-
class WorkaroundGraphqlCop
|
11
|
-
# Remove the Cop.inherited method to be a noop. Our RSpec::Cop
|
12
|
-
# class will invoke the inherited hook instead
|
13
|
-
class << self
|
14
|
-
undef inherited
|
15
|
-
def inherited(*); end # rubocop:disable Lint/MissingSuper
|
16
|
-
end
|
17
|
-
|
18
|
-
# Special case `Module#<` so that the rspec support rubocop exports
|
19
|
-
# is compatible with our subclass
|
20
|
-
def self.<(other)
|
21
|
-
other.equal?(RuboCop::Cop::Cop) || super
|
22
|
-
end
|
23
|
-
end
|
24
|
-
private_constant(:WorkaroundGraphqlCop)
|
25
|
-
|
26
|
-
module GraphQL
|
27
|
-
# @abstract parent class to graphql-ruby cops
|
28
|
-
#
|
29
|
-
# The criteria for whether rubocop-rspec analyzes a certain ruby file
|
30
|
-
# is configured via `AllCops/GraphQL`. For example, if you want to
|
31
|
-
# customize your project to scan all files within a `graph/` directory
|
32
|
-
# then you could add this to your configuration:
|
33
|
-
#
|
34
|
-
# @example configuring analyzed paths
|
35
|
-
#
|
36
|
-
# AllCops:
|
37
|
-
# GraphQL:
|
38
|
-
# Patterns:
|
39
|
-
# - '(?:^|/)graph/'
|
40
|
-
class Cop < WorkaroundGraphqlCop
|
41
|
-
DEFAULT_CONFIGURATION =
|
42
|
-
RuboCop::GraphQL::CONFIG.fetch("AllCops").fetch("GraphQL")
|
43
|
-
|
44
|
-
DEFAULT_PATTERN_RE = Regexp.union(
|
45
|
-
DEFAULT_CONFIGURATION.fetch("Patterns")
|
46
|
-
.map(&Regexp.public_method(:new))
|
47
|
-
)
|
48
|
-
|
49
|
-
# Invoke the original inherited hook so our cops are recognized
|
50
|
-
def self.inherited(subclass) # rubocop:disable Lint/MissingSuper
|
51
|
-
RuboCop::Cop::Cop.inherited(subclass)
|
52
|
-
end
|
53
|
-
|
54
|
-
def relevant_file?(file)
|
55
|
-
relevant_rubocop_graphql_file?(file) && super
|
56
|
-
end
|
57
|
-
|
58
|
-
private
|
59
|
-
|
60
|
-
def relevant_rubocop_graphql_file?(file)
|
61
|
-
graphql_pattern =~ file
|
62
|
-
end
|
63
|
-
|
64
|
-
def graphql_pattern
|
65
|
-
if rspec_graphql_config?
|
66
|
-
Regexp.union(rspec_graphql_config.map(&Regexp.public_method(:new)))
|
67
|
-
else
|
68
|
-
DEFAULT_PATTERN_RE
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
|
-
def all_cops_config
|
73
|
-
config
|
74
|
-
.for_all_cops
|
75
|
-
end
|
76
|
-
|
77
|
-
def rspec_graphql_config?
|
78
|
-
return unless all_cops_config.key?("GraphQL")
|
79
|
-
|
80
|
-
all_cops_config.fetch("GraphQL").key?("Patterns")
|
81
|
-
end
|
82
|
-
|
83
|
-
def rspec_graphql_config
|
84
|
-
all_cops_config
|
85
|
-
.fetch("GraphQL", DEFAULT_CONFIGURATION)
|
86
|
-
.fetch("Patterns")
|
87
|
-
end
|
88
|
-
end
|
89
|
-
end
|
90
|
-
end
|
91
|
-
end
|