ezcater_rubocop 3.0.1 → 5.0.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: 32ed01c4904b105bcd1ac2b3b8871485448284bffe06dc6b90fda19775748175
4
- data.tar.gz: 19755e3e83359f473ff961e1679c39b1bdb5f6d78a9c78e3ca6118be344c8400
3
+ metadata.gz: 8d5368b75099f59a900d7c2b9805ea045e3dc0e8150612b4a455d0aa4bf661fe
4
+ data.tar.gz: 96200ba4b7ee03b2781ad4b3bb8c202eab19a54600ec135d2d422cde96caef1f
5
5
  SHA512:
6
- metadata.gz: c215237f6c8fc40398c3947944261a457a2fc3efbebb51bc3e01ba743a3a4ad099a1a3ecfcc2782c056a78df6231b5bc0c258e0fa0f7ab8fd04e13be9ad26f79
7
- data.tar.gz: f5066524144f916ff5d56c4aa320d916d4ed383b4eee01d20db2809a67eb2ed65bdf541709b8c0c9cec36a977a6ff9c92704564dacd7e9726a5b99bf02c0fffc
6
+ metadata.gz: fc5992ee8b6cb9facd94ef7fa312271352d405f6617375cb2fa9eae60e76f5d74930bc2aff46218a934268558fbc3374e46730d16209fdc3f68d6cd3c98f7879
7
+ data.tar.gz: 6d240eca17afb70b3072dfb92f50773bb48c9d207ce316cd0223a56b04ac6ff5d0196784387a524063c976e10d1d1270ae0ad7eddd248e384dc6a31b893eed59
data/.tool-versions CHANGED
@@ -1 +1 @@
1
- ruby 2.7.3
1
+ ruby 3.1.1
data/CHANGELOG.md CHANGED
@@ -6,7 +6,21 @@ 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
+ ## 5.0.0
10
+ - Enable all added cops since 0.8. There are a lot of new cops now, be sure to use `--regenerate-todo` if you're on a large project that can't be updated easily.
11
+
12
+ ## 4.0.0
13
+
14
+ - Add the [rubcop-graphql](https://github.com/DmitryTsepelev/rubocop-graphql) helpers and enable
15
+ them by default
16
+ - Remove `Ezcater/GraphqlFieldsNaming` cop. The same rule exists in `rubocop-graphql`.
17
+
18
+ ## v3.0.2
19
+
20
+ - Loosen restrictions to allow for Ruby 3.1 and latest dependency gems
21
+
9
22
  ## v3.0.1
23
+
10
24
  - Fix the RspecDotNotSelfDot cop to work with rubocop-rspec
11
25
  - Exclude appraisal generated gemfiles for possible embedded gems in rails apps
12
26
 
@@ -37,101 +51,128 @@ Prior to v1.0.0 this gem was versioned based on the `MAJOR`.`MINOR` version of R
37
51
  - Enabled pending cop (`RSpec/StubbedMock`).
38
52
 
39
53
  ## v2.4.0
54
+
40
55
  - Fix `FeatureFlagActive` cop so that it allows feature flag names to be variables in addition to strings.
41
56
  - Add check to `FeatureFlagActive` that the first parameter is a string or a variable, and use the appropriate messaging.
42
57
 
43
58
  ## v2.3.0
59
+
44
60
  - Add `FeatureFlagActive` cop. This provides confidence that upgrading to `ezcater_feature_flag-client` v2.0.0, which
45
- contains breaking API changes, can be done safely.
61
+ contains breaking API changes, can be done safely.
46
62
 
47
63
  ## v2.2.0
64
+
48
65
  - Require Ruby 2.6 or later.
49
66
  - Set `TargetRubyVersion` to 2.6 in `rubocop_gem` configuration.
50
67
 
51
68
  ## v2.1.0
69
+
52
70
  - Enable `Rails/SaveBang` with `AllowImplicitReturn: false`, and with autocorrection disabled.
53
71
 
54
72
  ## v2.0.0
73
+
55
74
  - Update to `rubocop` v0.81.0, `rubocop-rspec` v1.38.1 and `rubocop-rails` v2.5.2.
56
75
  - This is being released as a major update because cops have been renamed so this is unlikely to be
57
76
  a drop-in replacement.
58
77
  - This is the first release to support Ruby 2.7.
59
78
 
60
79
  ## v1.4.1
80
+
61
81
  - Correct a matching syntax issue with `Ezcater/RubyTimeout` so that it applies in the expected cases.
62
82
 
63
83
  ## v1.4.0
84
+
64
85
  - Add `Ezcater/RubyTimeout` cop.
65
86
 
66
87
  ## v1.3.0
88
+
67
89
  - Add `Ezcater/GraphqlFieldsNaming` cop.
68
90
 
69
91
  ## v1.2.0
92
+
70
93
  - Add `Ezcater/RailsTopLevelSqlExecute` to replace `ActiveRecord::Base.connection.execute` with `execute` in `db/migrate/`.
71
94
 
72
95
  ## v1.1.1
96
+
73
97
  - Exclude `lib/tasks/` for `Ezcater/RailsEnv` and `Ezcater/DirectEnvCheck`.
74
98
 
75
99
  ## v1.1.0
100
+
76
101
  - Add `Ezcater/RailsEnv` cop.
77
102
  - Add `Ezcater/DirectEnvCheck` cop.
78
103
 
79
104
  ## v1.0.2
105
+
80
106
  - Exclude bootsnap cache directory (`tmp/cache`).
81
107
 
82
108
  ## v1.0.1
109
+
83
110
  - Disable `Rails/HasAndBelongsToMany` cop.
84
111
  - Disable `Style/DoubleNegation` cop.
85
112
 
86
113
  ## v1.0.0
114
+
87
115
  - Begin using Semantic Versioning
88
116
  - Delete `Ezcater/PrivateAttr`
89
117
 
90
118
  ## v0.61.1
119
+
91
120
  - `Layout/IndentHash` enforces consistent style
92
121
  - `Layout/IndentArray` enforces consistent style
93
122
 
94
123
  ## v0.61.0
124
+
95
125
  - Update to `rubocop` v0.61.1.
96
126
  - Update to `rubocop-rspec` v1.30.1
97
127
 
98
128
  ## v0.59.0
129
+
99
130
  - Disable `Style/NegatedIf`.
100
131
 
101
132
  ## v0.58.4
133
+
102
134
  - Update `Metrics/BlockLength` to exclude `app/graphql/**/*.rb`
103
135
  - Move `Metrics/BlockLength` exclusions for `lib/tasks/**/*.rake` and
104
136
  `config/environments/*.rb` into rubocop_rails.yml
105
137
 
106
138
  ## v0.58.3
139
+
107
140
  - Updated `Layout/MultilineMethodCallIndentation` to `indented`.
108
141
 
109
142
  ## v0.58.2
143
+
110
144
  - Updated `Ezcater/RspecDotNotSelfDot` to flag offenses for `::class_method`.
111
145
 
112
146
  ## v0.58.1
147
+
113
148
  - Update to `rubocop-rspec` v1.28.0.
114
149
  - Remove configuration for removed `FactoryBot/DynamicAttributeDefinedStatically` cop.
115
150
 
116
151
  ## v0.58.0
152
+
117
153
  - Update to rubocop v0.58.1.
118
154
  - Enable `Naming/MemoizedInstanceVariableName` with required leading
119
155
  underscore.
120
156
 
121
157
  ## v0.57.4
158
+
122
159
  - Configure `Rspec/MessageExpectation` with the `allow` style.
123
160
 
124
161
  ## v0.57.3
162
+
125
163
  - Do not use broken parser v2.5.1.1.
126
164
 
127
165
  ## v0.57.2
166
+
128
167
  - Fix `Ezcater/RspecRequireHttpStatusMatcher` cop.
129
168
 
130
169
  ## v0.57.1
170
+
131
171
  - Add `Ezcater/RspecRequireHttpStatusMatcher` cop.
132
172
  - Enable `Rails/HttpStatus` cop and enforce symbols.
133
173
 
134
174
  ## v0.57.0
175
+
135
176
  - Update to rubocop v0.57.2 and rubocop-rspec v1.27.0.
136
177
  - Disable new cop `Naming/MemoizedInstanceVariableName` until configuration
137
178
  options are available.
@@ -142,100 +183,128 @@ Prior to v1.0.0 this gem was versioned based on the `MAJOR`.`MINOR` version of R
142
183
  - Exclude appraisal generated gemfiles for gems.
143
184
 
144
185
  ## v0.52.8
186
+
145
187
  - Add new configuration `rubocop_gem` for use with gems.
146
188
 
147
189
  ## v0.52.7
190
+
148
191
  - Enable `Style/FrozenStringLiteralComment` with the `when_needed` style.
149
192
 
150
193
  ## v0.52.6
194
+
151
195
  - Configure `Style/TrailingCommaInLiteral` with `consistent_comma` style.
152
196
 
153
197
  ## v0.52.5
198
+
154
199
  - Add `Ezcater/RspecMatchOrderedArray` cop.
155
200
  - Fix array equality matcher violations in specs.
156
201
 
157
202
  ## v0.52.4
203
+
158
204
  - Configure `Style/RegexpLiteral` cop with the `AllowInnerSlashes: true` option.
159
205
 
160
206
  ## v0.52.3
207
+
161
208
  - Disable `Style/GuardClause` cop.
162
209
  - Exclude `spec/integrations` for `RSpec/DescribeClass`.
163
210
 
164
211
  ## v0.52.2
212
+
165
213
  - Disable `Style/IfUnlessModifier` cop.
166
214
 
167
215
  ## v0.52.1
216
+
168
217
  - Allow staging as a rails environment for the Rails/UnknownEnv cop.
169
218
 
170
219
  ## v0.52.0
220
+
171
221
  - Update to rubocop v0.52.1 and rubocop-rspec v1.22.2.
172
222
 
173
223
  ## v0.51.8
224
+
174
225
  - Disable `RSpec/LetSetup` cop.
175
226
 
176
227
  ## v0.51.7
228
+
177
229
  - Rename `Ezcater/RspecRequireGqlErrorHelpers` cop to `Ezcater/RequireGqlErrorHelpers`.
178
230
 
179
231
  ## v0.51.6
232
+
180
233
  - Add `Ezcater/RailsConfiguration` cop.
181
234
  - Exclude `config/environments/*.rb` for the `Metrics/BlockLength` cop.
182
235
 
183
236
  ## v0.51.5
237
+
184
238
  - Add `Ezcater/RspecRequireGqlErrorHelpers` cop.
185
239
 
186
240
  ## v0.51.4
241
+
187
242
  - Exclude `Gemfile` for the `Metrics/LineLength` cop.
188
243
  - Add `system` to the excluded spec directories for `RSpec/DescribeClass`.
189
244
 
190
245
  ## v0.51.3
246
+
191
247
  - Configure `RSpec/DescribeClass` to exclude the spec directories which
192
248
  are excluded by explicit metadata.
193
249
  - Exclude `lib/tasks` for the `Metrics/BlockLength` cop.
194
250
 
195
251
  ## v0.51.2
252
+
196
253
  - Configure `Style/RaiseArgs` to use the `compact` style.
197
254
 
198
255
  ## v0.51.1
256
+
199
257
  - Disable `Rails/FilePath` cop.
200
258
  - Disable `Style/EmptyLiteral` cop.
201
259
 
202
260
  ## v0.51.0
261
+
203
262
  - Update to rubocop v0.51.0 and rubocop-rspec v1.20.0.
204
263
  - Disable new cop `RSpec/ContextWording`.
205
264
  - Disable `Style/StderrPuts` for `bin/yarn`.
206
265
 
207
266
  ## v0.50.5
267
+
208
268
  - Configure `RSpec/NestedGroups` with a `Max` value of 5.
209
269
 
210
270
  ## v0.50.4
271
+
211
272
  - Configure `Style/PercentLiteralDelimiters` to prefer parentheses.
212
273
 
213
274
  ## v0.50.3
275
+
214
276
  - Configure `RSpec/MultipleExpectations` with a `Max` value of 5.
215
277
 
216
278
  ## v0.50.2
279
+
217
280
  - Add `Ezcater/PrivateAttr` custom cop.
218
281
  - Configure `RSpec/ExampleLength` with a `Max` value of 25.
219
282
  - Add `circle_rubocop.rb` script.
220
283
 
221
284
  ## v0.50.1
285
+
222
286
  - Add shared configuration.
223
287
  - Do not apply `Ezcater/StyleDig` to access using a range.
224
288
 
225
289
  ## v0.50.0
290
+
226
291
  - Update to rubocop v0.50.0 and rubocop-rspec v1.18.0.
227
292
  - Do not apply `Ezcater/StyleDig` to assignments with nested access.
228
293
 
229
294
  # v0.49.3
295
+
230
296
  - Do not apply `Ezcater/StyleDig` to access using a range.
231
297
 
232
298
  # v0.49.2
299
+
233
300
  - Do not apply `Ezcater/StyleDig` to assignments to with nested access.
234
301
 
235
302
  ## v0.49.1
303
+
236
304
  - Add `Ezcater/RspecRequireBrowserMock` cop.
237
305
 
238
306
  ## v0.49.0
307
+
239
308
  - Initial release.
240
309
  - Add `Ezcater/RspecRequireFeatureFlagMock` cop.
241
310
  - Add `Ezcater/RspecDotNotSelfDot` cop.
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # ezcater_rubocop
1
+ # ezcater_rubocop [![CircleCI](https://circleci.com/gh/ezcater/ezcater_rubocop/tree/main.svg?style=svg)](https://circleci.com/gh/ezcater/ezcater_rubocop/tree/main)
2
2
 
3
3
  ezCater custom cops and shared RuboCop configuration.
4
4
 
@@ -61,28 +61,32 @@ configuration for existing offenses and auto-correction.
61
61
 
62
62
  This gem contains a script, `circle_rubocop.rb`, that can be used to run RuboCop in CI.
63
63
 
64
- The behavior of the script is that all files are checked on master or if the rubocop
65
- configuration has changed. On non-master branches, only the files added or changed on
64
+ The behavior of the script is that all files are checked on main or if the rubocop
65
+ configuration has changed. On non-main branches, only the files added or changed on
66
66
  the branch are checked.
67
67
 
68
- For non-master branches, `[rubocop skip]` can be included in the commit message to skip
68
+ For non-main branches, `[rubocop skip]` can be included in the commit message to skip
69
69
  running rubocop.
70
70
 
71
71
  ## Versioning
72
72
 
73
73
  This gem is using [Semantic Versioning](https://semver.org/). All version bumps should increment using `MAJOR.MINOR.PATCH` based on changes.
74
74
 
75
+ When adding a new cop, please enable the cop and release a new major version. This allows us to
76
+ constantly roll out improvements without clients having their suite break unknowingly. When a
77
+ breaking change is released, users can opt to use `--regenerate-todo` to update their TODO file. Do
78
+ not add cops with `enabled: false` unless you want that cop to always be disabled.
79
+
75
80
  ## Custom Cops
76
81
 
77
- 1. [RailsConfiguration](https://github.com/ezcater/ezcater_rubocop/blob/master/lib/rubocop/cop/ezcater/rails_configuration.rb) - Enforce use of `Rails.configuration` instead of `Rails.application.config`.
78
- 1. [RequireGqlErrorHelpers](https://github.com/ezcater/ezcater_rubocop/blob/master/lib/rubocop/cop/ezcater/require_gql_error_helpers.rb) - Use the helpers provided by `GQLErrors` instead of raising `GraphQL::ExecutionError` directly.
79
- 1. [RspecDotNotSelfDot](https://github.com/ezcater/ezcater_rubocop/blob/master/lib/rubocop/cop/ezcater/rspec_dot_not_self_dot.rb) - Enforce ".<class method>" instead of "self.<class method>" and "::<class method>" for example group description.
80
- 1. [RspecMatchOrderedArray](https://github.com/ezcater/ezcater_rubocop/blob/master/lib/rubocop/cop/ezcater/rspec_match_ordered_array.rb) - Enforce use of `match_ordered_array` matcher instead of `eq` matcher. This matcher comes from the [ezcater_matchers](https://github.com/ezcater/ezcater_matchers) gem.
81
- 1. [RspecRequireBrowserMock](https://github.com/ezcater/ezcater_rubocop/blob/master/lib/rubocop/cop/ezcater/rspec_require_browser_mock.rb) - Enforce use of `mock_ezcater_app`, `mock_chrome_browser` & `mock_custom_browser` helpers instead of mocking `Browser` or `EzBrowser` directly.
82
- 1. [RspecRequireFeatureFlagMock](https://github.com/ezcater/ezcater_rubocop/blob/master/lib/rubocop/cop/ezcater/rspec_require_feature_flag_mock.rb) - Enforce use of `mock_feature_flag` helper instead of mocking `FeatureFlag.is_active?` directly.
83
- 1. [RspecRequireHttpStatusMatcher](https://github.com/ezcater/ezcater_rubocop/blob/master/lib/rubocop/cop/ezcater/rspec_require_http_status_matcher.rb) - Use the HTTP status code matcher, like `expect(response).to have_http_status :bad_request`, rather than `expect(response.code).to eq 400`
84
- 1. [StyleDig](https://github.com/ezcater/ezcater_rubocop/blob/master/lib/rubocop/cop/ezcater/style_dig.rb) - Recommend `dig` for deeply nested access.
85
- 1. [GraphqlFieldsNaming](https://github.com/ezcater/ezcater_rubocop/blob/master/lib/rubocop/cop/ezcater/graphql_fields_naming.rb) - Enforce the configured style when naming graphQL fields and arguments.
82
+ 1. [RailsConfiguration](https://github.com/ezcater/ezcater_rubocop/blob/main/lib/rubocop/cop/ezcater/rails_configuration.rb) - Enforce use of `Rails.configuration` instead of `Rails.application.config`.
83
+ 1. [RequireGqlErrorHelpers](https://github.com/ezcater/ezcater_rubocop/blob/main/lib/rubocop/cop/ezcater/require_gql_error_helpers.rb) - Use the helpers provided by `GQLErrors` instead of raising `GraphQL::ExecutionError` directly.
84
+ 1. [RspecDotNotSelfDot](https://github.com/ezcater/ezcater_rubocop/blob/main/lib/rubocop/cop/ezcater/rspec_dot_not_self_dot.rb) - Enforce ".<class method>" instead of "self.<class method>" and "::<class method>" for example group description.
85
+ 1. [RspecMatchOrderedArray](https://github.com/ezcater/ezcater_rubocop/blob/main/lib/rubocop/cop/ezcater/rspec_match_ordered_array.rb) - Enforce use of `match_ordered_array` matcher instead of `eq` matcher. This matcher comes from the [ezcater_matchers](https://github.com/ezcater/ezcater_matchers) gem.
86
+ 1. [RspecRequireBrowserMock](https://github.com/ezcater/ezcater_rubocop/blob/main/lib/rubocop/cop/ezcater/rspec_require_browser_mock.rb) - Enforce use of `mock_ezcater_app`, `mock_chrome_browser` & `mock_custom_browser` helpers instead of mocking `Browser` or `EzBrowser` directly.
87
+ 1. [RspecRequireFeatureFlagMock](https://github.com/ezcater/ezcater_rubocop/blob/main/lib/rubocop/cop/ezcater/rspec_require_feature_flag_mock.rb) - Enforce use of `mock_feature_flag` helper instead of mocking `FeatureFlag.is_active?` directly.
88
+ 1. [RspecRequireHttpStatusMatcher](https://github.com/ezcater/ezcater_rubocop/blob/main/lib/rubocop/cop/ezcater/rspec_require_http_status_matcher.rb) - Use the HTTP status code matcher, like `expect(response).to have_http_status :bad_request`, rather than `expect(response.code).to eq 400`
89
+ 1. [StyleDig](https://github.com/ezcater/ezcater_rubocop/blob/main/lib/rubocop/cop/ezcater/style_dig.rb) - Recommend `dig` for deeply nested access.
86
90
 
87
91
  ## Development
88
92
 
@@ -4,10 +4,10 @@
4
4
  require "English"
5
5
 
6
6
  # This script is used to run Rubocop in CircleCI so that on branches only
7
- # the changed files are checked and on master all files are checked.
7
+ # the changed files are checked and on main all files are checked.
8
8
  #
9
9
  # Additionally if rubocop configuration is changed, all files are checked, and
10
- # if the commit description on a non-master branch includes [rubocop skip]
10
+ # if the commit description on a non-main branch includes [rubocop skip]
11
11
  # then rubocop is skipped.
12
12
 
13
13
  def run(command)
@@ -20,7 +20,7 @@ def rubocop_everything
20
20
  end
21
21
 
22
22
  begin
23
- if ENV["CIRCLE_BRANCH"] == "master"
23
+ if ENV["CIRCLE_BRANCH"] == "main"
24
24
  rubocop_everything
25
25
  else
26
26
  git_commit_desc = `git log --format=%B -n 1 $CIRCLE_SHA1`
@@ -30,7 +30,7 @@ begin
30
30
  exit 0
31
31
  end
32
32
 
33
- changed_files = `git diff --diff-filter=d --name-only origin/master...$CIRCLE_BRANCH`.split("\n").join(" ")
33
+ changed_files = `git diff --diff-filter=d --name-only origin/main...$CIRCLE_BRANCH`.split("\n").join(" ")
34
34
  raise "Failed to identify changed files" unless $CHILD_STATUS.success?
35
35
 
36
36
  if changed_files.strip.empty? || changed_files.include?(".rubocop")
data/conf/rubocop.yml CHANGED
@@ -148,191 +148,183 @@ Style/TrailingCommaInArrayLiteral:
148
148
  Style/TrailingCommaInHashLiteral:
149
149
  EnforcedStyleForMultiline: consistent_comma
150
150
 
151
- ### New Cops
152
151
 
153
- # Cops are now introduced in a "pending" state and must be explicitly
154
- # enabled or disabled. New cops are not enabled by default until the
155
- # next major release.
156
-
157
- # New cops introduced between 0.81.0 and 1.16.0
158
152
  Layout/BeginEndAlignment:
159
- Enabled: false
153
+ Enabled: true
160
154
 
161
155
  Layout/EmptyLinesAroundAttributeAccessor:
162
- Enabled: false
156
+ Enabled: true
163
157
 
164
158
  Layout/IndentationStyle:
165
- Enabled: false
159
+ Enabled: true
166
160
 
167
161
  Layout/SpaceAroundMethodCallOperator:
168
- Enabled: false
162
+ Enabled: true
169
163
 
170
164
  Lint/BinaryOperatorWithIdenticalOperands:
171
- Enabled: false
165
+ Enabled: true
172
166
 
173
167
  Lint/ConstantDefinitionInBlock:
174
- Enabled: false
168
+ Enabled: true
175
169
 
176
170
  Lint/DeprecatedOpenSSLConstant:
177
- Enabled: false
171
+ Enabled: true
178
172
 
179
173
  Lint/DuplicateElsifCondition:
180
- Enabled: false
174
+ Enabled: true
181
175
 
182
176
  Lint/DuplicateRequire:
183
- Enabled: false
177
+ Enabled: true
184
178
 
185
179
  Lint/DuplicateRescueException:
186
- Enabled: false
180
+ Enabled: true
187
181
 
188
182
  Lint/EmptyConditionalBody:
189
- Enabled: false
183
+ Enabled: true
190
184
 
191
185
  Lint/EmptyFile:
192
- Enabled: false
186
+ Enabled: true
193
187
 
194
188
  Lint/FloatComparison:
195
- Enabled: false
189
+ Enabled: true
196
190
 
197
191
  Lint/HashCompareByIdentity:
198
- Enabled: false
192
+ Enabled: true
199
193
 
200
194
  Lint/IdentityComparison:
201
- Enabled: false
195
+ Enabled: true
202
196
 
203
197
  Lint/MissingSuper:
204
- Enabled: false
198
+ Enabled: true
205
199
 
206
200
  Lint/MixedRegexpCaptureTypes:
207
- Enabled: false
201
+ Enabled: true
208
202
 
209
203
  Lint/OutOfRangeRegexpRef:
210
- Enabled: false
204
+ Enabled: true
211
205
 
212
206
  Lint/RedundantSafeNavigation:
213
- Enabled: false
207
+ Enabled: true
214
208
 
215
209
  Lint/SelfAssignment:
216
- Enabled: false
210
+ Enabled: true
217
211
 
218
212
  Lint/TopLevelReturnWithArgument:
219
- Enabled: false
213
+ Enabled: true
220
214
 
221
215
  Lint/TrailingCommaInAttributeDeclaration:
222
- Enabled: false
216
+ Enabled: true
223
217
 
224
218
  Lint/UnreachableLoop:
225
- Enabled: false
219
+ Enabled: true
226
220
 
227
221
  Lint/UselessMethodDefinition:
228
- Enabled: false
222
+ Enabled: true
229
223
 
230
224
  Lint/UselessTimes:
231
- Enabled: false
225
+ Enabled: true
232
226
 
233
227
  Rails/ArelStar:
234
- Enabled: false
228
+ Enabled: true
235
229
 
236
230
  Rails/Pick:
237
- Enabled: false
231
+ Enabled: true
238
232
 
239
233
  Rails/RedundantForeignKey:
240
- Enabled: false
234
+ Enabled: true
241
235
 
242
236
  RSpec/Capybara/CurrentPathExpectation:
243
- Enabled: false
237
+ Enabled: true
244
238
 
245
239
  RSpec/Capybara/FeatureMethods:
246
- Enabled: false
240
+ Enabled: true
247
241
 
248
242
  RSpec/Capybara/VisibilityMatcher:
249
- Enabled: false
243
+ Enabled: true
250
244
 
251
245
  RSpec/EmptyHook:
252
- Enabled: false
246
+ Enabled: true
253
247
 
254
248
  RSpec/FactoryBot/AttributeDefinedStatically:
255
- Enabled: false
249
+ Enabled: true
256
250
 
257
251
  RSpec/FactoryBot/CreateList:
258
- Enabled: false
252
+ Enabled: true
259
253
 
260
254
  RSpec/FactoryBot/FactoryClassName:
261
- Enabled: false
255
+ Enabled: true
262
256
 
263
257
  RSpec/MultipleMemoizedHelpers:
264
- Enabled: false
258
+ Enabled: true
265
259
 
266
260
  RSpec/NotToNot:
267
- Enabled: false
261
+ Enabled: true
268
262
 
269
263
  RSpec/Rails/HttpStatus:
270
- Enabled: false
264
+ Enabled: true
271
265
 
272
266
  RSpec/RepeatedIncludeExample:
273
- Enabled: false
267
+ Enabled: true
274
268
 
275
269
  RSpec/StubbedMock:
276
- Enabled: false
270
+ Enabled: true
277
271
 
278
272
  RSpec/VariableDefinition:
279
- Enabled: false
273
+ Enabled: true
280
274
 
281
275
  RSpec/VariableName:
282
- Enabled: false
276
+ Enabled: true
283
277
 
284
278
  Style/AccessorGrouping:
285
- Enabled: false
279
+ Enabled: true
286
280
 
287
281
  Style/BisectedAttrAccessor:
288
- Enabled: false
282
+ Enabled: true
289
283
 
290
284
  Style/CaseLikeIf:
291
- Enabled: false
285
+ Enabled: true
292
286
 
293
287
  Style/CombinableLoops:
294
- Enabled: false
288
+ Enabled: true
295
289
 
296
290
  Style/ExponentialNotation:
297
- Enabled: false
291
+ Enabled: true
298
292
 
299
293
  Style/GlobalStdStream:
300
- Enabled: false
294
+ Enabled: true
301
295
 
302
296
  Style/HashAsLastArrayItem:
303
- Enabled: false
297
+ Enabled: true
304
298
 
305
299
  Style/HashLikeCase:
306
- Enabled: false
300
+ Enabled: true
307
301
 
308
302
  Style/KeywordParametersOrder:
309
- Enabled: false
303
+ Enabled: true
310
304
 
311
305
  Style/OptionalBooleanParameter:
312
- Enabled: false
306
+ Enabled: true
313
307
 
314
308
  Style/RedundantAssignment:
315
- Enabled: false
309
+ Enabled: true
316
310
 
317
311
  Style/RedundantRegexpCharacterClass:
318
- Enabled: false
312
+ Enabled: true
319
313
 
320
314
  Style/RedundantRegexpEscape:
321
- Enabled: false
315
+ Enabled: true
322
316
 
323
317
  Style/RedundantSelfAssignment:
324
- Enabled: false
318
+ Enabled: true
325
319
 
326
320
  Style/SingleArgumentDig:
327
- Enabled: false
321
+ Enabled: true
328
322
 
329
323
  Style/SlicingWithRange:
330
- Enabled: false
324
+ Enabled: true
331
325
 
332
326
  Style/SoleNestedConditional:
333
- Enabled: false
334
-
335
- #### New cops in v0.81
327
+ Enabled: true
336
328
 
337
329
  Lint/RaiseException:
338
330
  Enabled: true
@@ -340,8 +332,6 @@ Lint/RaiseException:
340
332
  Lint/StructNewOverride:
341
333
  Enabled: true
342
334
 
343
- #### New cops in v0.80
344
-
345
335
  Style/HashEachMethods:
346
336
  Enabled: true
347
337
 
data/config/default.yml CHANGED
@@ -1,12 +1,3 @@
1
- Ezcater/GraphqlFieldsNaming:
2
- EnforcedStyle: snake_case
3
- Enabled: true
4
- SupportedStyles:
5
- - snake_case
6
- - camelCase
7
- Include:
8
- - "app/graphql/**/*.rb"
9
-
10
1
  Ezcater/RailsConfiguration:
11
2
  Description: "Enforce the use of `Rails.configuration` instead of `Rails.application.config`."
12
3
  Enabled: true
@@ -59,3 +50,15 @@ Ezcater/StyleDig:
59
50
  Ezcater/RubyTimeout:
60
51
  Description: "Disallow use of `Timeout.timeout` because it is unsafe and can cause unexpected behavior."
61
52
  Enabled: true
53
+
54
+ GraphQL/FieldDescription:
55
+ Enabled: false
56
+ GraphQL/ArgumentDescription:
57
+ Enabled: false
58
+ GraphQL/ObjectDescription:
59
+ Include:
60
+ - "**/types/**/*.rb"
61
+ - "**/mutations/**/*.rb"
62
+ GraphQL/ExtractInputType:
63
+ Exclude:
64
+ - "**/input_objects/**/*.rb"
@@ -44,15 +44,16 @@ Gem::Specification.new do |spec|
44
44
 
45
45
  spec.required_ruby_version = ">= 2.6"
46
46
 
47
- spec.add_development_dependency "bundler", "~> 2.1"
47
+ spec.add_development_dependency "bundler"
48
48
  spec.add_development_dependency "pry-byebug"
49
- spec.add_development_dependency "rake", "~> 12.3"
50
- spec.add_development_dependency "rspec", "~> 3.0"
49
+ spec.add_development_dependency "rake", "~> 13.0"
50
+ spec.add_development_dependency "rspec", "~> 3.11"
51
51
  spec.add_development_dependency "rspec_junit_formatter"
52
- spec.add_development_dependency "simplecov", "< 0.18.0"
52
+ spec.add_development_dependency "simplecov"
53
53
 
54
- spec.add_runtime_dependency "parser", "!= 2.5.1.1"
55
- spec.add_runtime_dependency "rubocop", "~> 1.16.0"
56
- spec.add_runtime_dependency "rubocop-rails", "~> 2.10.1"
57
- spec.add_runtime_dependency "rubocop-rspec", "~> 2.3.0"
54
+ spec.add_runtime_dependency "parser", ">= 2.6"
55
+ spec.add_runtime_dependency "rubocop", ">= 1.16.0", "< 2.0"
56
+ spec.add_runtime_dependency "rubocop-graphql", ">= 0.14.0", "< 1.0"
57
+ spec.add_runtime_dependency "rubocop-rails", ">= 2.10.1", "< 3.0"
58
+ spec.add_runtime_dependency "rubocop-rspec", ">= 2.3.0", "< 3.0"
58
59
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EzcaterRubocop
4
- VERSION = "3.0.1"
4
+ VERSION = "5.0.0"
5
5
  end
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "ezcater_rubocop/version"
4
+ require "rubocop-graphql"
4
5
  require "rubocop-rails"
5
6
  require "rubocop-rspec"
6
7
 
@@ -17,7 +18,6 @@ RuboCop::ConfigLoader.instance_variable_set(:@default_configuration, config)
17
18
 
18
19
  require "rubocop/cop/ezcater/direct_env_check"
19
20
  require "rubocop/cop/ezcater/feature_flag_active"
20
- require "rubocop/cop/ezcater/graphql_fields_naming"
21
21
  require "rubocop/cop/ezcater/rails_configuration"
22
22
  require "rubocop/cop/ezcater/rails_env"
23
23
  require "rubocop/cop/ezcater/ruby_timeout"
@@ -35,8 +35,8 @@ module RuboCop
35
35
  %w(it specify example scenario).map { |identifier| "#{prefix}#{identifier}" }
36
36
  end.flatten + %w(its focus skip)).freeze
37
37
 
38
- SELF_DOT_REGEXP = /\Aself\./.freeze
39
- COLON_COLON_REGEXP = /\A(\:\:)/.freeze
38
+ SELF_DOT_REGEXP = /\Aself\./.freeze # rubocop:disable Style/RedundantFreeze
39
+ COLON_COLON_REGEXP = /\A(::)/.freeze # rubocop:disable Style/RedundantFreeze
40
40
 
41
41
  SELF_DOT_MSG = 'Use ".<class method>" instead of "self.<class method>" for example group description.'
42
42
  COLON_COLON_MSG = 'Use ".<class method>" instead of "::<class method>" for example group description.'
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ezcater_rubocop
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.1
4
+ version: 5.0.0
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: 2022-03-23 00:00:00.000000000 Z
11
+ date: 2022-07-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '2.1'
19
+ version: '0'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '2.1'
26
+ version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: pry-byebug
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -44,28 +44,28 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '12.3'
47
+ version: '13.0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '12.3'
54
+ version: '13.0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rspec
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '3.0'
61
+ version: '3.11'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '3.0'
68
+ version: '3.11'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rspec_junit_formatter
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -84,72 +84,110 @@ dependencies:
84
84
  name: simplecov
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - "<"
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
- version: 0.18.0
89
+ version: '0'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - "<"
94
+ - - ">="
95
95
  - !ruby/object:Gem::Version
96
- version: 0.18.0
96
+ version: '0'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: parser
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - "!="
101
+ - - ">="
102
102
  - !ruby/object:Gem::Version
103
- version: 2.5.1.1
103
+ version: '2.6'
104
104
  type: :runtime
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - "!="
108
+ - - ">="
109
109
  - !ruby/object:Gem::Version
110
- version: 2.5.1.1
110
+ version: '2.6'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: rubocop
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - "~>"
115
+ - - ">="
116
116
  - !ruby/object:Gem::Version
117
117
  version: 1.16.0
118
+ - - "<"
119
+ - !ruby/object:Gem::Version
120
+ version: '2.0'
118
121
  type: :runtime
119
122
  prerelease: false
120
123
  version_requirements: !ruby/object:Gem::Requirement
121
124
  requirements:
122
- - - "~>"
125
+ - - ">="
123
126
  - !ruby/object:Gem::Version
124
127
  version: 1.16.0
128
+ - - "<"
129
+ - !ruby/object:Gem::Version
130
+ version: '2.0'
131
+ - !ruby/object:Gem::Dependency
132
+ name: rubocop-graphql
133
+ requirement: !ruby/object:Gem::Requirement
134
+ requirements:
135
+ - - ">="
136
+ - !ruby/object:Gem::Version
137
+ version: 0.14.0
138
+ - - "<"
139
+ - !ruby/object:Gem::Version
140
+ version: '1.0'
141
+ type: :runtime
142
+ prerelease: false
143
+ version_requirements: !ruby/object:Gem::Requirement
144
+ requirements:
145
+ - - ">="
146
+ - !ruby/object:Gem::Version
147
+ version: 0.14.0
148
+ - - "<"
149
+ - !ruby/object:Gem::Version
150
+ version: '1.0'
125
151
  - !ruby/object:Gem::Dependency
126
152
  name: rubocop-rails
127
153
  requirement: !ruby/object:Gem::Requirement
128
154
  requirements:
129
- - - "~>"
155
+ - - ">="
130
156
  - !ruby/object:Gem::Version
131
157
  version: 2.10.1
158
+ - - "<"
159
+ - !ruby/object:Gem::Version
160
+ version: '3.0'
132
161
  type: :runtime
133
162
  prerelease: false
134
163
  version_requirements: !ruby/object:Gem::Requirement
135
164
  requirements:
136
- - - "~>"
165
+ - - ">="
137
166
  - !ruby/object:Gem::Version
138
167
  version: 2.10.1
168
+ - - "<"
169
+ - !ruby/object:Gem::Version
170
+ version: '3.0'
139
171
  - !ruby/object:Gem::Dependency
140
172
  name: rubocop-rspec
141
173
  requirement: !ruby/object:Gem::Requirement
142
174
  requirements:
143
- - - "~>"
175
+ - - ">="
144
176
  - !ruby/object:Gem::Version
145
177
  version: 2.3.0
178
+ - - "<"
179
+ - !ruby/object:Gem::Version
180
+ version: '3.0'
146
181
  type: :runtime
147
182
  prerelease: false
148
183
  version_requirements: !ruby/object:Gem::Requirement
149
184
  requirements:
150
- - - "~>"
185
+ - - ">="
151
186
  - !ruby/object:Gem::Version
152
187
  version: 2.3.0
188
+ - - "<"
189
+ - !ruby/object:Gem::Version
190
+ version: '3.0'
153
191
  description: ezCater custom cops and shared configuration
154
192
  email:
155
193
  - engineering@ezcater.com
@@ -175,7 +213,6 @@ files:
175
213
  - lib/ezcater_rubocop/version.rb
176
214
  - lib/rubocop/cop/ezcater/direct_env_check.rb
177
215
  - lib/rubocop/cop/ezcater/feature_flag_active.rb
178
- - lib/rubocop/cop/ezcater/graphql_fields_naming.rb
179
216
  - lib/rubocop/cop/ezcater/rails_configuration.rb
180
217
  - lib/rubocop/cop/ezcater/rails_env.rb
181
218
  - lib/rubocop/cop/ezcater/rails_top_level_sql_execute.rb
@@ -193,7 +230,7 @@ licenses:
193
230
  - MIT
194
231
  metadata:
195
232
  allowed_push_host: https://rubygems.org
196
- post_install_message:
233
+ post_install_message:
197
234
  rdoc_options: []
198
235
  require_paths:
199
236
  - lib
@@ -208,8 +245,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
208
245
  - !ruby/object:Gem::Version
209
246
  version: '0'
210
247
  requirements: []
211
- rubygems_version: 3.1.6
212
- signing_key:
248
+ rubygems_version: 3.3.7
249
+ signing_key:
213
250
  specification_version: 4
214
251
  summary: ezCater custom cops and shared configuration
215
252
  test_files: []
@@ -1,74 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module RuboCop
4
- module Cop
5
- module Ezcater
6
- # This cop makes sure that GraphQL fields & arguments match the supported style
7
- # https://git.io/JeofW
8
- #
9
- # The cop also ignores when users provide a :camelize option, because
10
- # the user is manually requesting to override the value
11
- #
12
- # @example
13
- # # bad
14
- # field :fooBar, ID, null: false
15
- # argument :barBaz, ID, required: true
16
- #
17
- # # good
18
- # field :foo_bar, ID, null: true
19
- # field :foo_bar, ID, null: true do
20
- # argument :bar_baz, ID, required: true
21
- # end
22
- #
23
- # field :fooBar, ID, null: true, camelize: true
24
- #
25
- class GraphqlFieldsNaming < Cop
26
- include ConfigurableNaming
27
-
28
- MSG = "Use %<style>s for GraphQL fields & arguments names. " \
29
- "See https://git.io/JeofW for our guide. " \
30
- "This can be overridden with camelize."
31
- FIELD_ADDING_METHODS = %i(field argument).freeze
32
- PROCESSABLE_TYPES = %i(sym string).freeze
33
-
34
- def on_send(node)
35
- method = method_name(node)
36
- first_arg = node.first_argument
37
-
38
- return unless FIELD_ADDING_METHODS.include? method
39
- return unless PROCESSABLE_TYPES.include?(first_arg&.type)
40
-
41
- return if includes_camelize?(node)
42
-
43
- check_name(node, first_arg.value, node.first_argument)
44
- end
45
-
46
- alias on_super on_send
47
- alias on_yield on_send
48
-
49
- private
50
-
51
- def includes_camelize?(node)
52
- results = []
53
- node.last_argument.each_child_node { |arg| results << args_include_camelize?(arg) }
54
- results.any?
55
- end
56
-
57
- def args_include_camelize?(arg_pair)
58
- key_node = arg_pair.key
59
- _value_node = arg_pair.value
60
-
61
- key_node.value.match?(/camelize/)
62
- end
63
-
64
- def method_name(node)
65
- node.children[1]
66
- end
67
-
68
- def message(style)
69
- format(MSG, style: style) # Rubocop:disable Style/HashSyntax
70
- end
71
- end
72
- end
73
- end
74
- end