forked from department-of-veterans-affairs/vets-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.rubocop.yml
189 lines (161 loc) · 5.68 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
AllCops:
TargetRailsVersion: 5.2
TargetRubyVersion: 2.4.5
Include:
- '**/Gemfile'
- '**/config.ru'
- '**/Rakefile'
- '**/*.rake'
Exclude:
- db/schema.rb
- db/seeds.rb
- db/migrate/*.rb
- 'script/**/*'
- 'vendor/**/*'
# This allows you to use have writers like self.method_name(name) vs self.method_name=(name)
Style/TrivialAccessors:
AllowDSLWriters: true
# This is the rubocop default but putting it here explicitly
# strong benefit for code readability and speed in reviewing PRs for code review
# only use double quote when doing interpolation or complex escape sequences
Style/StringLiterals:
EnforcedStyle: single_quotes
Style/Documentation:
Enabled: false
Style/ClassAndModuleChildren:
Enabled: false
# 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
Metrics/LineLength:
Max: 120
Rails:
Enabled: true
Rails/Output:
Exclude:
- 'lib/tasks/**/*'
Metrics/MethodLength:
Max: 20
Metrics/ClassLength:
Max: 400
Metrics/AbcSize:
Max: 40
# removing rule because get_session implies HTTP GET, and informs method
Naming/AccessorMethodName:
Enabled: false
# removing block length rule for rspec DSL
Metrics/BlockLength:
Exclude:
- 'spec/**/*.rb'
- 'rakelib/**/*.rake'
- 'config/**/*.rb'
- 'app/swagger/**/*.rb'
- 'app/controllers/v0/apidocs_controller.rb'
# Don't worry about ambiguous blocks in RSpec
Lint/AmbiguousBlockAssociation:
Exclude:
- "spec/**/*"
# This file does not need to be snake case
Naming/FileName:
Exclude:
- "Guardfile"
# TODO: REVIEW THESE AND MAKE CHANGES
# We should try to use StandardError, but some errors like timeout inherit from Exception (beware)
Style/RescueStandardError:
Exclude:
- "app/controllers/v0/id_card_attributes_controller.rb"
- "app/controllers/v0/sessions_controller.rb"
- "app/models/form_profile.rb"
- "app/models/mhv_account.rb"
- "app/services/mhv_accounts_service.rb"
- "app/uploaders/claim_documentation/uploader.rb"
- "app/workers/education_form/create_daily_spool_files.rb"
- "lib/common/client/concerns/monitoring.rb"
- "lib/common/client/configuration/soap.rb"
- "lib/common/exceptions/base_error.rb"
- "lib/github/github_service.rb"
- "lib/mvi/messages/find_profile_message_helpers.rb"
- "lib/mvi/responses/profile_parser.rb"
- "lib/saml/settings_service.rb"
- "rakelib/connectivity.rake"
- "rakelib/mvi.rake"
- "rakelib/redis.rake"
- "spec/request/authentication/standard_authentication.rb"
# Variable naming style apparently doesn't like: something_2, something_3
Naming/VariableNumber:
Exclude:
- "lib/hca/enrollment_system.rb"
- "spec/controllers/v0/post_911_gi_bill_statuses_controller_spec.rb"
- "spec/lib/preneeds/service_spec.rb"
# All kinds of issues with this cop right now, so disabling it.
Style/FormatStringToken:
Exclude:
- "rakelib/mvi.rake"
# This cop has an improvement for false positives in Mixins in future release, Exclude for now.
# https://github.com/bbatsov/rubocop/issues/5448
Rails/LexicallyScopedActionFilter:
Exclude:
- "app/controllers/concerns/filterable.rb"
- "app/controllers/v0/sessions_controller.rb"
# Disabling this rule for now. We should consider changing.
Lint/BooleanSymbol:
Exclude:
- "app/swagger/schemas/gibct/institutions.rb"
- "spec/request/breakers_integration_spec.rb"
- "spec/request/statsd_middleware_spec.rb"
- "spec/support/authenticated_session_helper.rb"
# Should consider enforcing this rule. Disabling for now.
Style/DateTime:
Exclude:
- "lib/common/models/attribute_types/date_time_string.rb"
- "lib/evss/auth_headers.rb"
- "lib/evss/pciu_address/service.rb"
- "rakelib/evss.rake"
- "rakelib/mvi.rake"
# IMPORTANT: this needs to be changed or handled differently. NoMethodError is not acceptable.
# Skipping it for now as I dont have time to address.
Lint/SafeNavigationChain:
Exclude:
- "app/workers/education_form/delete_old_applications.rb"
- "lib/saml/health_status.rb"
- "lib/saml/health_status.rb"
# 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"
- "app/models/terms_and_conditions.rb"
# Skipping for now, should revisit:
Rails/SkipsModelValidations:
Exclude:
- "app/workers/education_form/create_daily_spool_files.rb"
- "app/models/saved_claim.rb"
- 'spec/**/*.rb'
# Need to revisit why this is necessary:
Lint/RescueException:
Exclude:
- 'app/workers/github/create_issue_job.rb'