ezcater_rubocop 3.0.0 → 3.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.tool-versions +1 -0
- data/CHANGELOG.md +7 -2
- data/conf/rubocop.yml +19 -18
- data/conf/rubocop_rails.yml +1 -0
- data/config/default.yml +15 -15
- data/lib/ezcater_rubocop/version.rb +1 -1
- data/lib/rubocop/cop/ezcater/graphql_fields_naming.rb +1 -1
- data/lib/rubocop/cop/ezcater/rspec_dot_not_self_dot.rb +28 -10
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 32ed01c4904b105bcd1ac2b3b8871485448284bffe06dc6b90fda19775748175
|
4
|
+
data.tar.gz: 19755e3e83359f473ff961e1679c39b1bdb5f6d78a9c78e3ca6118be344c8400
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c215237f6c8fc40398c3947944261a457a2fc3efbebb51bc3e01ba743a3a4ad099a1a3ecfcc2782c056a78df6231b5bc0c258e0fa0f7ab8fd04e13be9ad26f79
|
7
|
+
data.tar.gz: f5066524144f916ff5d56c4aa320d916d4ed383b4eee01d20db2809a67eb2ed65bdf541709b8c0c9cec36a977a6ff9c92704564dacd7e9726a5b99bf02c0fffc
|
data/.tool-versions
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ruby 2.7.3
|
data/CHANGELOG.md
CHANGED
@@ -6,11 +6,16 @@ This gem is moving onto its own [Semantic Versioning](https://semver.org/) schem
|
|
6
6
|
|
7
7
|
Prior to v1.0.0 this gem was versioned based on the `MAJOR`.`MINOR` version of RuboCop. The first release of the ezcater_rubocop gem was `v0.49.0`.
|
8
8
|
|
9
|
+
## v3.0.1
|
10
|
+
- Fix the RspecDotNotSelfDot cop to work with rubocop-rspec
|
11
|
+
- Exclude appraisal generated gemfiles for possible embedded gems in rails apps
|
12
|
+
|
9
13
|
## v3.0.0
|
10
|
-
|
14
|
+
|
15
|
+
- Upgrade rubocop: 1.16.0
|
11
16
|
- Upgrade rubocop-rails: 2.10.1
|
12
17
|
- Upgrade rubocop-rspec: 2.3.0
|
13
|
-
- This is a major upgrade because a large number of cops have been introduced, tweaked, or renamed.
|
18
|
+
- This is a major upgrade because a large number of cops have been introduced, tweaked, or renamed. Here is an aggregate of the breaking changes introduced
|
14
19
|
- RuboCop assumes that Cop classes do not define new `on_<type>` methods at runtime (e.g. via `extend` in `initialize`).
|
15
20
|
- Enable all pending cops for RuboCop 1.0.
|
16
21
|
- Change logic for cop department name computation. Cops inside deep namespaces (5 or more levels deep) now belong to departments with names that are calculated by joining module names starting from the third one with slashes as separators. For example, cop `Rubocop::Cop::Foo::Bar::Baz` now belongs to `Foo/Bar` department (previously it was `Bar`).
|
data/conf/rubocop.yml
CHANGED
@@ -3,6 +3,7 @@ require: ezcater_rubocop
|
|
3
3
|
AllCops:
|
4
4
|
DisplayCopNames: true
|
5
5
|
NewCops: disable
|
6
|
+
SuggestExtensions: false
|
6
7
|
|
7
8
|
Layout/FirstHashElementIndentation:
|
8
9
|
EnforcedStyle: consistent
|
@@ -21,8 +22,8 @@ Metrics/AbcSize:
|
|
21
22
|
|
22
23
|
Metrics/BlockLength:
|
23
24
|
Exclude:
|
24
|
-
|
25
|
-
|
25
|
+
- "*.gemspec"
|
26
|
+
- "spec/**/*.rb"
|
26
27
|
|
27
28
|
Metrics/CyclomaticComplexity:
|
28
29
|
Enabled: false
|
@@ -30,7 +31,7 @@ Metrics/CyclomaticComplexity:
|
|
30
31
|
Layout/LineLength:
|
31
32
|
Max: 120
|
32
33
|
Exclude:
|
33
|
-
|
34
|
+
- "Gemfile"
|
34
35
|
|
35
36
|
Metrics/MethodLength:
|
36
37
|
Enabled: true
|
@@ -45,9 +46,9 @@ Naming/MemoizedInstanceVariableName:
|
|
45
46
|
|
46
47
|
Naming/MethodParameterName:
|
47
48
|
AllowedNames:
|
48
|
-
|
49
|
-
|
50
|
-
|
49
|
+
- e
|
50
|
+
- ex
|
51
|
+
- id
|
51
52
|
|
52
53
|
Naming/VariableNumber:
|
53
54
|
Enabled: false
|
@@ -60,12 +61,12 @@ RSpec/ContextWording:
|
|
60
61
|
|
61
62
|
RSpec/DescribeClass:
|
62
63
|
Exclude:
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
64
|
+
- "spec/requests/**/*.rb"
|
65
|
+
- "spec/features/**/*.rb"
|
66
|
+
- "spec/routing/**/*.rb"
|
67
|
+
- "spec/views/**/*.rb"
|
68
|
+
- "spec/system/**/*.rb"
|
69
|
+
- "spec/integrations/**/*.rb"
|
69
70
|
|
70
71
|
RSpec/ExampleLength:
|
71
72
|
Max: 25
|
@@ -113,12 +114,12 @@ Style/NumericLiterals:
|
|
113
114
|
|
114
115
|
Style/PercentLiteralDelimiters:
|
115
116
|
PreferredDelimiters:
|
116
|
-
default:
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
117
|
+
default: "()"
|
118
|
+
"%i": "()"
|
119
|
+
"%I": "()"
|
120
|
+
"%r": "{}"
|
121
|
+
"%w": "()"
|
122
|
+
"%W": "()"
|
122
123
|
|
123
124
|
Style/RaiseArgs:
|
124
125
|
EnforcedStyle: compact
|
data/conf/rubocop_rails.yml
CHANGED
data/config/default.yml
CHANGED
@@ -5,57 +5,57 @@ Ezcater/GraphqlFieldsNaming:
|
|
5
5
|
- snake_case
|
6
6
|
- camelCase
|
7
7
|
Include:
|
8
|
-
-
|
8
|
+
- "app/graphql/**/*.rb"
|
9
9
|
|
10
10
|
Ezcater/RailsConfiguration:
|
11
|
-
Description:
|
11
|
+
Description: "Enforce the use of `Rails.configuration` instead of `Rails.application.config`."
|
12
12
|
Enabled: true
|
13
13
|
|
14
14
|
Ezcater/RailsEnv:
|
15
|
-
Description:
|
15
|
+
Description: "Enforce the use of `Rails.configuration.x.<foo>` instead of checking `Rails.env`."
|
16
16
|
Enabled: false
|
17
17
|
|
18
18
|
Ezcater/DirectEnvCheck:
|
19
|
-
Description:
|
19
|
+
Description: "Enforce the use of `Rails.configuration.x.<foo>` instead of checking `ENV`."
|
20
20
|
Enabled: false
|
21
21
|
|
22
22
|
Ezcater/FeatureFlagActive:
|
23
|
-
Description:
|
23
|
+
Description: "Enforce the proper arguments are given to EzcaterFeatureFlag.active?"
|
24
24
|
Enabled: true
|
25
25
|
|
26
26
|
Ezcater/RspecDotNotSelfDot:
|
27
27
|
Description: 'Enforce ".<class method>" instead of "self.<class method>" for example group description.'
|
28
28
|
Enabled: true
|
29
29
|
Include:
|
30
|
-
-
|
30
|
+
- "**/*_spec.rb"
|
31
31
|
|
32
32
|
Ezcater/RspecRequireBrowserMock:
|
33
|
-
Description:
|
33
|
+
Description: "Enforce use of `mock_ezcater_app`, `mock_chrome_browser` & `mock_custom_browser` helpers instead of mocking `Browser` or `EzBrowser` directly."
|
34
34
|
Enabled: true
|
35
35
|
Include:
|
36
|
-
-
|
36
|
+
- "**/*_spec.rb"
|
37
37
|
|
38
38
|
Ezcater/RspecRequireFeatureFlagMock:
|
39
|
-
Description:
|
39
|
+
Description: "Enforce use of `mock_feature_flag` helpers instead of mocking `FeatureFlag.is_active?` directly."
|
40
40
|
Enabled: true
|
41
41
|
Include:
|
42
|
-
-
|
42
|
+
- "**/*_spec.rb"
|
43
43
|
|
44
44
|
Ezcater/RspecRequireHttpStatusMatcher:
|
45
|
-
Description:
|
45
|
+
Description: "Use the HTTP status code matcher, like `expect(response).to have_http_status :bad_request`, rather than `expect(response.code).to eq 400`"
|
46
46
|
Enabled: true
|
47
47
|
Include:
|
48
|
-
-
|
48
|
+
- "**/*_spec.rb"
|
49
49
|
|
50
50
|
Ezcater/RequireGqlErrorHelpers:
|
51
|
-
Description:
|
51
|
+
Description: "Use the helpers provided by `GQLErrors` instead of raising `GraphQL::ExecutionError` directly."
|
52
52
|
Enabled: true
|
53
53
|
|
54
54
|
Ezcater/StyleDig:
|
55
|
-
Description:
|
55
|
+
Description: "Recommend `dig` for deeply nested access."
|
56
56
|
Enabled: true
|
57
57
|
AutoCorrect: false
|
58
58
|
|
59
59
|
Ezcater/RubyTimeout:
|
60
|
-
Description:
|
60
|
+
Description: "Disallow use of `Timeout.timeout` because it is unsafe and can cause unexpected behavior."
|
61
61
|
Enabled: true
|
@@ -25,26 +25,44 @@ module RuboCop
|
|
25
25
|
|
26
26
|
class RspecDotNotSelfDot < Cop
|
27
27
|
include RuboCop::RSpec::Language
|
28
|
+
extend RuboCop::RSpec::Language::NodePattern
|
28
29
|
|
29
|
-
|
30
|
-
|
30
|
+
RSPEC_EXAMPLE_PREFIXES = ["", "x", "f"].freeze
|
31
|
+
EXAMPLE_GROUP_IDENTIFIERS = (RSPEC_EXAMPLE_PREFIXES.map do |prefix|
|
32
|
+
%w(describe context feature).map { |identifier| "#{prefix}#{identifier}" }
|
33
|
+
end.flatten + %w(example_group)).freeze
|
34
|
+
EXAMPLE_IDENTIFIERS = (RSPEC_EXAMPLE_PREFIXES.map do |prefix|
|
35
|
+
%w(it specify example scenario).map { |identifier| "#{prefix}#{identifier}" }
|
36
|
+
end.flatten + %w(its focus skip)).freeze
|
37
|
+
|
38
|
+
SELF_DOT_REGEXP = /\Aself\./.freeze
|
39
|
+
COLON_COLON_REGEXP = /\A(\:\:)/.freeze
|
31
40
|
|
32
41
|
SELF_DOT_MSG = 'Use ".<class method>" instead of "self.<class method>" for example group description.'
|
33
42
|
COLON_COLON_MSG = 'Use ".<class method>" instead of "::<class method>" for example group description.'
|
34
43
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
44
|
+
def_node_matcher :example_group?, <<~PATTERN
|
45
|
+
(block
|
46
|
+
(send #rspec? {#{EXAMPLE_GROUP_IDENTIFIERS.map { |i| ":#{i}" }.join(' ')}}
|
47
|
+
(str ...) ...
|
48
|
+
) ...
|
49
|
+
)
|
50
|
+
PATTERN
|
51
|
+
|
52
|
+
def on_block(node)
|
53
|
+
return unless example_group?(node)
|
54
|
+
|
55
|
+
str_node = node.send_node.arguments[0]
|
56
|
+
if str_node.value.match?(SELF_DOT_REGEXP)
|
57
|
+
add_offense(str_node, location: :expression, message: SELF_DOT_MSG)
|
58
|
+
elsif str_node.value.match?(COLON_COLON_REGEXP)
|
59
|
+
add_offense(str_node, location: :expression, message: COLON_COLON_MSG)
|
42
60
|
end
|
43
61
|
end
|
44
62
|
|
45
63
|
def autocorrect(node)
|
46
64
|
lambda do |corrector|
|
47
|
-
experession_end = node.source.match?(
|
65
|
+
experession_end = node.source.match?("::") ? 3 : 6
|
48
66
|
corrector.replace(Parser::Source::Range.new(node.source_range.source_buffer,
|
49
67
|
node.source_range.begin_pos + 1,
|
50
68
|
node.source_range.begin_pos + experession_end), ".")
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ezcater_rubocop
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ezCater, Inc
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-03-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -160,6 +160,7 @@ extra_rdoc_files: []
|
|
160
160
|
files:
|
161
161
|
- ".github/CODEOWNERS"
|
162
162
|
- ".github/PULL_REQUEST_TEMPLATE.md"
|
163
|
+
- ".tool-versions"
|
163
164
|
- CHANGELOG.md
|
164
165
|
- Gemfile
|
165
166
|
- LICENSE.txt
|
@@ -192,7 +193,7 @@ licenses:
|
|
192
193
|
- MIT
|
193
194
|
metadata:
|
194
195
|
allowed_push_host: https://rubygems.org
|
195
|
-
post_install_message:
|
196
|
+
post_install_message:
|
196
197
|
rdoc_options: []
|
197
198
|
require_paths:
|
198
199
|
- lib
|
@@ -208,7 +209,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
208
209
|
version: '0'
|
209
210
|
requirements: []
|
210
211
|
rubygems_version: 3.1.6
|
211
|
-
signing_key:
|
212
|
+
signing_key:
|
212
213
|
specification_version: 4
|
213
214
|
summary: ezCater custom cops and shared configuration
|
214
215
|
test_files: []
|