-
Notifications
You must be signed in to change notification settings - Fork 66
/
.rubocop.yml
375 lines (317 loc) · 11.9 KB
/
.rubocop.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
inherit_from:
- .rubocop_explicit_enables.yml
- .rubocop_todo.yml
# in rakelib/lint.rake we require rubocop-thread_safety for the CI env only,
# because codeclimate does not support rubocop-thread_safety
require:
- rubocop-rails
- rubocop-rspec
- rubocop-capybara
- rubocop-factory_bot
- rubocop-rspec_rails
- rubocop-thread_safety
- './lib/rubocop/cops/ams_serializer.rb'
AllCops:
NewCops: disable
TargetRailsVersion: 6.1
Include:
- '**/Dangerfile'
- '**/Gemfile'
- '**/config.ru'
- '**/Rakefile'
- '**/*.rake'
- '**/*.rb'
Exclude:
- db/schema.rb
- db/seeds.rb
- db/migrate/*.rb
- 'vendor/**/*'
- modules/**/db/migrate/*.rb
- 'tmp/**/*'
Style/Documentation:
Enabled: false
Style/ClassAndModuleChildren:
Enabled: false
Style/GlobalVars:
AllowedVariables:
- $redis
# Bug in 1.11.0
RSpec/VariableName:
Exclude:
- spec/sidekiq/facilities/pssg_download_spec.rb
# This cop forces you to put a return at the beginning of a block of code rather than having an if statement
# whose body carries to the end of the function. For example:
#
# def foo
# ...
# if test
# ...
# end
# end
#
# would be considered bad, and the cop would force you to put a `return if !test` before that block and
# then remove the if. The problem is that this hides intent, since the if test does have a purpose in
# readability, and it could also be easier for future changes to miss the return statement and add code
# after it expecting it to be executed.
Style/GuardClause:
Enabled: false
# This is pretty much the same thing as the one above. Inside a loop, it forces you to use next to skip
# iteration rather than using an if block that runs to the end of the loop, and it suffers from the same
# problems as above.
Style/Next:
Enabled: false
# This forces you to replace things like: `[1, 2, 3].length == 0` with `[1,2,3].empty?`. The problem is that
# not all things that implement length also implement empty? so you will get errors that cannot be resolved,
# and the cop will encourage you to do things that are incorrect.
Style/ZeroLengthPredicate:
Enabled: false
Layout/LineLength:
Max: 120
Exclude:
- 'Gemfile'
- 'Dangerfile'
Rails:
Enabled: true
Exclude:
- 'Dangerfile'
Rails/Output:
Exclude:
- 'lib/tasks/**/*'
- 'bin/lib/vets-api/**/*'
Metrics/MethodLength:
Max: 20
Exclude:
- 'spec/support/form1010cg_helpers/build_claim_data_for.rb'
- 'spec/simplecov_helper.rb'
- 'app/sidekiq/education_form/create_daily_spool_files.rb'
- 'lib/map/security_token/service.rb'
- 'Dangerfile'
Metrics/ClassLength:
Max: 400
Rails/LexicallyScopedActionFilter:
Exclude:
- "app/controllers/concerns/filterable.rb"
# Blocks are limited to 25 lines or less
# removing block length rule for rspec DSL
Metrics/BlockLength:
Exclude:
- 'spec/**/*.rb'
- 'rakelib/**/*.rake'
- 'lib/tasks/**/*.rake'
- 'config/**/*.rb'
- 'app/swagger/**/*.rb'
- 'app/controllers/v0/apidocs_controller.rb'
- 'app/controllers/v1/apidocs_controller.rb'
- 'modules/*/spec/**/*.rb'
- 'modules/*/app/swagger/**/*.rb'
- 'modules/*/config/routes.rb'
# Don't worry about ambiguous blocks in RSpec
# Official recommendation from rubocop team is to disable this rule for specs.
# See: https://github.com/rubocop-hq/rubocop/issues/4222
Lint/AmbiguousBlockAssociation:
Exclude:
- "spec/**/*"
# This file does not need to be snake case
Naming/FileName:
Exclude:
- '**/Gemfile'
- '**/Guardfile'
- '**/Rakefile'
- 'config/initializers/rswag-ui.rb'
# TODO: REVIEW THESE AND MAKE CHANGES
# We should try to use StandardError, but some errors like timeout inherit from Exception (beware)
Style/RescueStandardError:
EnforcedStyle: implicit
# Skipping for now, should revisit:
Rails/HasManyOrHasOneDependent:
Exclude:
- "app/models/education_benefits_claim.rb"
- "app/models/saved_claim/education_benefits.rb"
- "app/models/saved_claim.rb"
# The suggestions here don't seem to make sense in most cases. Skip for now.
Naming/MemoizedInstanceVariableName:
Enabled: false
# It was determined these suggestions had the potential to change behavior.
Rails/ActiveRecordAliases:
Enabled: false
# The use of variables such as n to represent number, x and y for x-axis and y-axis, el for element,
# v for value, i for index, and e for error are all standard abbreviations and should be excluded.
Naming/MethodParameterName:
Enabled: false
# FactoryBot 5.x replaced static factory attributes with dynamic ones. Auto-converting using rubocop-rspec
# always uses {...} which means a lot of existing factories because invalid. Allowed exception in pr #3300.
Style/BlockDelimiters:
Exclude:
- "spec/factories/*.rb"
- "modules/*/spec/factories/*.rb"
# Excluding modules specs for now and a few that may need to be revisited.
RSpec/SpecFilePathFormat:
Enabled: true
Exclude:
- 'modules/**/*'
- 'spec/lib/common/models/**/*'
- 'spec/lib/saml/*_user_spec.rb'
- 'spec/lib/ihub/appointments/service_spec.rb'
- 'spec/requests/in_progress_forms_request_spec.rb'
- 'spec/sidekiq/pagerduty/**/*'
- 'spec/lib/pagerduty/**/*'
- 'spec/lib/common/client/middleware/response/appeals_response_middleware_spec.rb'
- 'spec/lib/common/client/middleware/response/gids_response_middleware_spec.rb'
- 'spec/lib/common/client/middleware/response/response_middleware_spec.rb'
- 'spec/lib/evss/pciu_address/pciu_address_spec.rb'
- 'spec/lib/sm/client/message_drafts_spec.rb'
- 'spec/lib/lighthouse/veterans_health/integration/client_spec.rb'
- 'spec/lib/mail_automation/integration/client_spec.rb'
- 'spec/lib/virtual_regional_office/integration/client_spec.rb'
- 'spec/rakelib/piilog_repl/piilog_helpers_spec.rb'
CustomTransform:
SSOeSettingsService: ssoe_settings_service
# Use in conjunction with SpecFilePathFormat
RSpec/SpecFilePathSuffix:
Enabled: true
# Was determined that using described_class makes the code less readable.
RSpec/DescribedClass:
Enabled: false
# Excluding these for now. May need to be revisited.
RSpec/DescribeClass:
Exclude:
- 'spec/lib/mhv_ac/client_spec.rb'
- 'spec/lib/mhv_logging/api/audits_spec.rb'
- 'spec/rakelib/vet360_spec.rb'
- 'spec/requests/**/*'
- 'spec/lib/sm/client/preferences_spec.rb'
- 'spec/lib/sm/client/triage_teams_spec.rb'
- 'spec/lib/sm/client/messages_spec.rb'
- 'spec/lib/bb/client_spec.rb'
- 'spec/lib/gi/client_spec.rb'
- 'spec/lib/sm/client/folders_spec.rb'
# Determined to be too benign and/or numerous to justify changing
RSpec/AnyInstance:
Enabled: false
# Determined to be too benign and/or numerous to justify changing
RSpec/BeforeAfterAll:
Enabled: false
# Determined to be too benign and/or numerous to justify changing
RSpec/ExpectInLet:
Enabled: false
# Determined to be too benign and/or numerous to justify changing
RSpec/IndexedLet:
Enabled: false
RSpec/RemoveConst:
Exclude:
- 'spec/sidekiq/kms_key_rotation/batch_initiator_job_spec.rb'
- 'modules/vba_documents/spec/mailers/unsuccessful_report_mailer_spec.rb'
# Determined to be too benign and/or numerous to justify changing
RSpec/ContextWording:
Enabled: false
# Determined to be too benign and/or numerous to justify changing
RSpec/MissingExpectationTargetMethod:
Enabled: false
# Determined to be too benign and/or numerous to justify changing
RSpec/ExampleLength:
Enabled: false
# Determined to be too benign and/or numerous to justify changing
RSpec/ExpectInHook:
Enabled: false
# Determined to be too benign and/or numerous to justify changing
RSpec/InstanceVariable:
Enabled: false
# Determined to be too benign and/or numerous to justify changing
RSpec/LeakyConstantDeclaration:
Enabled: false
# Determined to be too benign and/or numerous to justify changing
RSpec/MultipleMemoizedHelpers:
Enabled: false
# Determined to be too benign and/or numerous to justify changing
RSpec/MessageSpies:
Enabled: false
# Determined to be too benign and/or numerous to justify changing
RSpec/NamedSubject:
Enabled: false
# Determined to be too benign and/or numerous to justify changing
RSpec/VerifiedDoubles:
Enabled: false
# Determined to be too benign and/or numerous to justify changing
RSpec/MultipleExpectations:
Enabled: false
# Determined to be too benign and/or numerous to justify changing
RSpec/NestedGroups:
Enabled: false
# This seems to generate a lot of false positives
RSpec/EmptyExampleGroup:
Enabled: false
# This seems to generate a lot of false positives
RSpec/LetSetup:
Enabled: false
# Might be worth revisiting at some point
RSpec/MessageChain:
Exclude:
- 'modules/veteran_verification/spec/requests/service_history_request_spec.rb'
- 'modules/veteran_verification/spec/requests/veteran_status_request_spec.rb'
- 'spec/lib/va_profile/service_spec.rb'
- 'spec/requests/service_history_request_spec.rb'
- 'spec/requests/swagger_spec.rb'
# These instances seem to be necessary
RSpec/MultipleDescribes:
Exclude:
- 'spec/sidekiq/evss/document_upload_spec.rb'
- 'spec/sidekiq/evss/request_decision_spec.rb'
- 'spec/requests/swagger_spec.rb'
- 'spec/sidekiq/cypress_viewport_updater/existing_github_file_spec.rb'
# These instances seem to be false positives
RSpec/RepeatedExample:
Exclude:
- 'modules/vba_documents/spec/sidekiq/upload_processor_spec.rb'
- 'modules/vba_documents/spec/models/upload_submission_spec.rb'
- 'modules/vba_documents/spec/request/v0/reports_request_spec.rb'
- 'modules/vba_documents/spec/request/v1/reports_request_spec.rb'
# Might be worth revisiting at some point
RSpec/ScatteredLet:
Exclude:
- 'spec/controllers/openid_application_controller_spec.rb'
- 'spec/controllers/v0/dependents_applications_controller_spec.rb'
- 'spec/controllers/v0/post911_gi_bill_statuses_controller_spec.rb'
- 'spec/lib/bb/client_spec.rb'
- 'spec/lib/evss/auth_headers_spec.rb'
- 'spec/lib/evss/gi_bill_status/service_spec.rb'
- 'spec/lib/sentry/scrubbers/log_as_warning_spec.rb'
- 'spec/mailers/spool_submissions_report_mailer_spec.rb'
- 'spec/models/form_profile_spec.rb'
- 'spec/models/va_profile_redis/contact_information_spec.rb'
- 'spec/models/va_profile_redis/v2/contact_information_spec.rb'
- 'spec/requests/health_care_applications_request_spec.rb'
- 'spec/requests/health_records_request_spec.rb'
- 'spec/requests/http_method_not_allowed_spec.rb'
- 'spec/requests/swagger_spec.rb'
# Might be worth revisiting at some point
RSpec/SubjectStub:
Exclude:
- 'modules/vaos/spec/services/user_service_spec.rb'
- 'spec/sidekiq/education_form/create_daily_spool_files_spec.rb'
- 'spec/sidekiq/education_form/process10203_submissions_spec.rb'
- 'spec/sidekiq/education_form/create10203_applicant_decision_letters_spec.rb'
- 'spec/sidekiq/education_form/forms/va1990_spec.rb'
- 'spec/sidekiq/transactional_email_analytics_job_spec.rb'
- 'spec/sidekiq/form526_confirmation_email_job_spec.rb'
- 'spec/lib/bb/generate_report_request_form_spec.rb'
- 'spec/lib/common/models/redis_store_spec.rb'
- 'spec/lib/evss/disability_compensation_form/data_translation_all_claim_spec.rb'
- 'spec/lib/evss/disability_compensation_form/data_translation_spec.rb'
- 'spec/lib/mpi/service_spec.rb'
- 'spec/lib/sm/client/folders_spec.rb'
- 'spec/models/session_spec.rb'
- 'spec/services/evss_claim_service_spec.rb'
- 'spec/uploaders/evss_claim_document_uploader_spec.rb'
- 'spec/services/form1010cg/service_spec.rb'
- 'spec/services/form1010cg/auditor_spec.rb'
# the default style recently changed, but it's not worth changing
Rails/FilePath:
EnforcedStyle: arguments
# This one doesn’t always make sense, it’s mostly the swagger,
# factories and pact provider states — which need a tear_down block regardless
Lint/EmptyBlock:
Enabled: false
Layout/EmptyLineBetweenDefs:
AllowAdjacentOneLineDefs: true
Cops/AmsSerializer:
Enabled: true