-
Notifications
You must be signed in to change notification settings - Fork 1
/
old-default.yml
291 lines (233 loc) · 8.1 KB
/
old-default.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
require:
- rubocop-rspec
- rubocop-rails
AllCops:
TargetRubyVersion: 2.7.4
EnabledByDefault: true
DisplayCopNames: true
Exclude:
- 'bin/**/*'
- 'db/**/*'
- 'vendor/**/*'
- 'config/**/*'
- 'docs/**/*'
- 'app/channels/**/*'
- 'script/**/*'
- 'lib/assets/**/*'
- 'Rakefile'
- 'Gemfile'
- 'Guardfile'
- '*.yml'
- '.pryrc'
# Capybara cops
# Allows us to use scenario/feature instead of it/describes
RSpec/Capybara/FeatureMethods:
Enabled: true
EnabledMethods: ['feature', 'scenario']
# https://docs.rubocop.org/rubocop/1.10/cops_layout.html#layoutclassstructure
Layout/ClassStructure:
Enabled: true
# Commonly used screens these days easily fit more than 80 characters.
# Ignores long lines with Heredocs or URIs in them
Layout/LineLength:
Max: 120
AllowHeredoc: true
# - There's a bug which considers commas after a URI too long so we can't use built-in AllowURI setting.
# Pattern matches valid URI encapsulated within a string literal.
# - Ignore top level comments (sometimes autogenerated, e.g. annotate_models)
AllowedPatterns: ['["\u0027].*https?[\w\:\/\$\–\-\#\.\+\!\*\‘\(\)\,]*.*["\u0027]', '\A#']
# No space makes the method definition shorter and differentiates
# from a regular assignment.
Layout/SpaceAroundEqualsInParameterDefault:
EnforcedStyle: no_space
# Most readable form.
Layout/HashAlignment:
EnforcedHashRocketStyle: table
EnforcedColonStyle: table
# Indenting the chained dots beneath each other is not supported by this cop,
# see https://github.com/bbatsov/rubocop/issues/1633
Layout/MultilineOperationIndentation:
Enabled: false
# Suppressing exceptions can be perfectly fine, and be it to avoid to
# explicitly type nil into the rescue since that's what you want to return,
# or suppressing LoadError for optional dependencies
Lint/SuppressedException:
Enabled: false
Layout/SpaceInsideBlockBraces:
# The space here provides no real gain in readability while consuming
# horizontal space that could be used for a better parameter name.
# Also {| differentiates better from a hash than { | does.
SpaceBeforeBlockParameters: false
# No trailing space differentiates better from the block:
# foo} means hash, foo } means block.
Layout/SpaceInsideHashLiteralBraces:
EnforcedStyle: no_space
# Exclude RSpec
Metrics/BlockLength:
Exclude:
- "spec/factories/**/*.rb"
AllowedMethods: ['describe', 'context']
# Too short methods lead to extraction of single-use methods, which can make
# the code easier to read (by naming things), but can also clutter the class
Metrics/MethodLength:
Max: 20
# The guiding principle of classes is SRP, SRP can't be accurately measured by LoC
Metrics/ClassLength:
Max: 1500
# Check with yard instead.
Style/DocumentationMethod:
Enabled: false
Style/Copyright:
Enabled: false
Style/Documentation:
Enabled: false
# We are using DateTime extensively.
Style/DateTime:
Enabled: false
# We do not need to support Ruby 1.9, so this is good to use.
Style/SymbolArray:
Enabled: true
# https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Style/MissingElse
Style/MissingElse:
Enabled: false
# https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Style/StringHashKeys
Style/StringHashKeys:
Enabled: false
# Single quotes being faster is hardly measurable and only affects parse time.
# Enforcing double quotes reduces the times where you need to change them
# when introducing an interpolation. Use single quotes only if their semantics
# are needed.
Style/StringLiterals:
EnforcedStyle: double_quotes
# Mixing the styles looks just silly.
Style/HashSyntax:
EnforcedStyle: ruby19_no_mixed_keys
# https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Style/HashEachMethods
Style/HashEachMethods:
Enabled: true
# https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Style/HashTransformKeys
Style/HashTransformKeys:
Enabled: false
# https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Style/HashTransformValues
Style/HashTransformValues:
Enabled: false
# has_key? and has_value? are far more readable than key? and value?
Style/PreferredHashMethods:
Enabled: false
# https://docs.rubocop.org/rubocop/cops_style.html#styledisablecopswithinsourcecodedirective
Style/DisableCopsWithinSourceCodeDirective:
Enabled: false
# String#% is by far the least verbose and only object oriented variant.
Style/FormatString:
EnforcedStyle: percent
Style/CollectionMethods:
Enabled: true
PreferredMethods:
# find is not equivalent on mongoid embeds or collections
find: "detect"
# inject seems more common in the community.
reduce: "inject"
# Either allow this style or don't. Marking it as safe with parenthesis
# is silly. Let's try to live without them for now.
Style/ParenthesesAroundCondition:
AllowSafeAssignment: false
# https://github.com/rubocop-hq/rubocop/blob/master/config/default.yml#L3095
# https://getdutchie.slack.com/archives/CJQCWSWQ4/p1592860363429600
# Optional inline and required multi
Style/MethodCallWithArgsParentheses:
Description: 'Use parentheses for method calls with arguments.'
StyleGuide: '#method-invocation-parens'
Enabled: false
VersionAdded: '0.47'
VersionChanged: '0.61'
IgnoreMacros: true
AllowedMethods: []
AllowedPatterns: []
IncludedMacros: []
AllowParenthesesInMultilineCall: false
AllowParenthesesInChaining: false
AllowParenthesesInCamelCaseMethod: false
EnforcedStyle: require_parentheses
SupportedStyles:
- require_parentheses
- omit_parentheses
Style/MethodCallWithoutArgsParentheses:
Description: 'Do not use parentheses for method calls with no arguments.'
StyleGuide: '#method-invocation-parens'
Enabled: true
AllowedMethods: []
VersionAdded: '0.47'
VersionChanged: '0.55'
# A specialized exception class will take one or more arguments and construct the message from it.
# So both variants make sense.
Style/RaiseArgs:
Enabled: false
# Fail is an alias of raise. Avoid aliases, it's more cognitive load for no gain.
# The argument that fail should be used to abort the program is wrong too,
# there's Kernel#abort for that.
Style/SignalException:
EnforcedStyle: only_raise
# do / end blocks should be used for side effects,
# methods that run a block for side effects and have
# a useful return value are rare, assign the return
# value to a local variable for those cases.
Style/MethodCalledOnDoEndBlock:
Enabled: true
# Enforcing the names of variables? To single letter ones? Just no.
Style/SingleLineBlockParams:
Enabled: false
# Style preference
Style/MethodDefParentheses:
Enabled: false
# Ignores requirement to add underscore to separate every 3 digits in a number
Style/NumericLiterals:
Enabled: false
# Shadowing outer local variables with block parameters is often useful
# to not reinvent a new name for the same thing, it highlights the relation
# between the outer variable and the parameter. The cases where it's actually
# confusing are rare, and usually bad for other reasons already, for example
# because the method is too long.
Lint/ShadowingOuterLocalVariable:
Enabled: false
# https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Lint/Debugger
# Show linting errors on debugger/binding.pry even in development
Lint/Debugger:
Enabled: true
Lint/AssignmentInCondition:
AllowSafeAssignment: false
# https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Lint/NumberConversion
Lint/NumberConversion:
Enabled: false
Naming/BinaryOperatorParameterName:
Enabled: false
Lint/ConstantResolution:
Enabled: false
# Rails
Rails/SaveBang:
Enabled: false
# Temporarily removing until Mongoid is no more...
# Mongoid #find_by raises an exception if it can't be found, unlike AR #find_by, so .where().first is preferred
# Rubocop can't tell the difference between the two
Rails/FindBy:
Enabled: false
Include:
- app/**/*.rb
Rails/PluckId:
Enabled: false
Rails/PluckInWhere:
Enabled: false
# RSpec
# Start context description without 'when', 'with', or 'without'.
RSpec/ContextWording:
Enabled: false
RSpec/AlignLeftLetBrace:
Enabled: true
RSpec/AlignRightLetBrace:
Enabled: false
RSpec/MultipleMemoizedHelpers:
Enabled: false
RSpec/NestedGroups:
Max: 5
# Allows us to mark specs as "skip"
RSpec/Pending:
Enabled: false