-
Notifications
You must be signed in to change notification settings - Fork 6
/
.rubocop.yml
267 lines (223 loc) · 7.03 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
inherit_from: .rubocop_todo.yml
require:
- rubocop-rails
- rubocop-rspec
AllCops:
Include:
- "**/Gemfile"
- "**/config.ru"
- "**/Rakefile"
- "**/*.rake"
- "**/*.rb"
Exclude:
- "db/**/*"
- "script/**/*"
- "vendor/**/*"
- "config/**/*"
- "bin/**/*"
- "log/**/*"
# 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
Style/SymbolProc:
Exclude:
- "lib/roo_helper/loader.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
# Added in v0.81
# https://rubocop.readthedocs.io/en/latest/cops_style/#stylehasheachmethods
Style/HashEachMethods:
Enabled: true
# Added in v0.81
# https://rubocop.readthedocs.io/en/latest/cops_style/#stylehashtransformkeys
Style/HashTransformKeys:
Enabled: true
# Added in v0.81
# https://rubocop.readthedocs.io/en/latest/cops_style/#stylehashtransformvalues
Style/HashTransformValues:
Enabled: true
Style/HashSyntax:
Enabled: false
Style/StringConcatenation:
Enabled: false
Style/OptionalBooleanParameter:
Enabled: false
Style/SingleArgumentDig:
Enabled: false
Layout/LineLength:
Max: 135
Exclude:
- "app/controllers/v0/institutions_controller.rb"
- "app/controllers/v1/institutions_controller.rb"
- "spec/models/shared_examples/shared_examples_for_archivable_by_version_id.rb"
- "app/models/gibct_site_mapper.rb"
- "app/models/archiver.rb"
- "app/models/institution_tree.rb"
- "app/validators/va_caution_flag_validator.rb"
- "spec/models/institution_tree_spec.rb"
- "spec/controllers/v0/institutions_controller_spec.rb"
- "spec/controllers/v1/institutions_controller_spec.rb"
- "spec/models/institution_spec.rb"
- "spec/factories/institution_programs.rb"
- "app/models/institution_school_rating.rb"
# removing rule because get_session implies HTTP GET, and informs method
Naming/AccessorMethodName:
Enabled: false
Naming/VariableNumber:
Enabled: false
Rails:
Enabled: true
Rails/Output:
Exclude:
- "app/models/db_cleanup.rb"
- "lib/**/*.rb"
Metrics/MethodLength:
Max: 20
Exclude:
- "app/models/institution_builder.rb"
- "app/models/archiver.rb"
- "app/models/caution_flag.rb"
- "app/concerns/geocoder_logic.rb"
- "app/controllers/dashboards_controller.rb"
- "app/controllers/v0/institutions_controller.rb"
- "app/controllers/v1/institutions_controller.rb"
- "lib/roo_helper/loader.rb"
- "lib/seed_utils.rb"
- "app/utilities/scorecard_api/service.rb"
- "app/models/converters/accreditation_date_time_converter.rb"
Metrics/ClassLength:
Exclude:
- "app/models/crosswalk_issue.rb"
- "app/models/scorecard.rb"
- "app/models/ipeds_ic.rb"
- "app/models/ipeds_ic_ay.rb"
- "app/models/ipeds_ic_py.rb"
- "app/models/institution.rb"
- "app/controllers/dashboards_controller.rb"
- "app/controllers/groups_controller.rb"
- "app/controllers/uploads_controller.rb"
- "app/models/upload.rb"
- "app/controllers/v0/institutions_controller.rb"
- "app/controllers/v0/institution_programs_controller.rb"
- "app/models/institution_builder.rb"
- "app/controllers/v1/institutions_controller.rb"
- "app/serializers/institution_compare_serializer.rb"
- "app/utilities/scorecard_api/service.rb"
Metrics/AbcSize:
Max: 40
Exclude:
- "app/concerns/geocoder_logic.rb"
- "app/controllers/dashboards_controller.rb"
- "app/models/institution_builder.rb"
- "lib/roo_helper/loader.rb"
- "spec/models/shared_examples/shared_examples_for_archivable_by_version_id.rb"
Metrics/ModuleLength:
Exclude:
- "app/concerns/geocoder_logic.rb"
- "app/models/institution_builder.rb"
- "lib/roo_helper/loader.rb"
Metrics/BlockLength:
Max: 40
Exclude:
- "config/**/*.rb"
- "lib/tasks/**/*.rake"
- "rakelib/**/*.rake"
- "spec/**/*"
Metrics/CyclomaticComplexity:
Exclude:
- "app/controllers/dashboards_controller.rb"
- "app/controllers/groups_controller.rb"
- "app/controllers/v1/institutions_controller.rb"
- "app/models/converters/accreditation_date_time_converter.rb"
- "app/validators/va_caution_flag_validator.rb"
- "app/models/search_geocoder.rb"
- "lib/roo_helper/loader.rb"
- "lib/common/client/base.rb"
Metrics/ParameterLists:
Exclude:
- "lib/common/exceptions/external/backend_service_exception.rb"
Metrics/PerceivedComplexity:
Exclude:
- "app/controllers/dashboards_controller.rb"
- "app/controllers/v1/institutions_controller.rb"
- "app/validators/va_caution_flag_validator.rb"
- "lib/roo_helper/loader.rb"
- "app/models/converters/accreditation_date_time_converter.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/**/*"
Naming/FileName:
Exclude:
- "Guardfile"
Lint/BooleanSymbol:
Exclude:
- "app/controllers/v0/institutions_controller.rb"
Lint/MissingSuper:
Enabled: false
Rails/HasManyOrHasOneDependent:
Exclude:
- "app/models/user.rb"
# the default style recently changed, but it's not worth changing
Rails/FilePath:
Enabled: false
Rails/UniqueValidationWithoutIndex:
Enabled: false
RSpec/FilePath:
Exclude:
- "spec/fixtures/**/*"
RSpec/DescribeClass:
Exclude:
- "spec/config/initializers/csv_types_spec.rb"
- "spec/config/initializers/group_types_spec.rb"
- "spec/config/initializers/upload_types_spec.rb"
- "spec/config/initializers/common_spec.rb"
- "spec/config/docker_spec.rb"
- "spec/models/archiver_spec.rb"
- "spec/utilities/caution_flags/caution_flag_template_spec.rb"
RSpec/ExampleLength:
Max: 15
Exclude:
- "spec/models/institution_builder/*.rb"
# Determined to be too benign and/or numerous to justify changing
RSpec/LeakyConstantDeclaration:
Enabled: false
RSpec/NestedGroups:
Max: 4
# Determined to be too benign and/or numerous to justify changing
RSpec/MultipleExpectations:
Enabled: false
RSpec/MultipleMemoizedHelpers:
Max: 10
# Added in v0.81
Lint/RaiseException:
Enabled: true
Lint/StructNewOverride:
Enabled: true
# Added in v0.82
Layout/SpaceAroundMethodCallOperator:
Enabled: true
Style/ExponentialNotation:
Enabled: true