forked from CardTapp/mongoidable
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.rubocop.yml
397 lines (395 loc) · 12 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
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
require:
- rubocop/require_tools
- rubocop-i18n
- rubocop-performance
- rubocop-rails
- rubocop-rspec
- rubocop-thread_safety
AllCops:
TargetRubyVersion: 2.7
Exclude:
- 'spec/dummy/bin/**/*'
- 'vendor/**/*'
- 'db/schema.rb'
- 'dashboard/**/*'
- 'script/**/*'
- 'Guardfile'
- 'config.ru'
- 'bin/**/*'
- 'node_modules/**/*'
NewCops: enable
UseCache: false
Layout/BlockAlignment:
Description: "Align block ends correctly."
Enabled: true
EnforcedStyleAlignWith: either
SupportedStylesAlignWith:
- either
- start_of_block
- start_of_line
Layout/CaseIndentation:
EnforcedStyle: case
IndentOneStep: true
Layout/DotPosition:
Description: "Checks the position of the dot in multi-line method calls."
Enabled: true
EnforcedStyle: trailing
StyleGuide: "https://github.com/bbatsov/ruby-style-guide#consistent-multi-line-chains"
SupportedStyles:
- leading
- trailing
Layout/EmptyLinesAroundAttributeAccessor:
Enabled: true
Layout/FirstArgumentIndentation:
IndentationWidth: 4
Layout/FirstArrayElementIndentation:
IndentationWidth: 4
Layout/FirstHashElementIndentation:
IndentationWidth: 4
Layout/HashAlignment:
Description: "Align the elements of a hash literal if they span more than one line."
Enabled: true
EnforcedColonStyle: table
EnforcedHashRocketStyle: table
EnforcedLastArgumentHashStyle: always_inspect
SupportedColonStyles:
- key
- separator
- table
SupportedHashRocketStyles:
- key
- separator
- table
SupportedLastArgumentHashStyles:
- always_inspect
- always_ignore
- ignore_implicit
- ignore_explicit
VersionAdded: "0.49"
Layout/LineLength:
Max: 150
Layout/MultilineHashBraceLayout:
Enabled: true
EnforcedStyle: symmetrical
SupportedStyles:
- symmetrical
- new_line
- same_line
Layout/MultilineMethodCallIndentation:
Enabled: false
EnforcedStyle: indented_relative_to_receiver
IndentationWidth: 4
Layout/MultilineOperationIndentation:
Enabled: false
EnforcedStyle: indented
IndentationWidth: 4
Layout/ParameterAlignment:
Description: "Align the parameters of a method call if they span more than one line."
Enabled: true
EnforcedStyle: with_first_parameter
Layout/SpaceAroundMethodCallOperator:
Enabled: true
Layout/TrailingEmptyLines:
Description: "Checks trailing blank lines and final newline."
Enabled: false
StyleGuide: "#newline-eof"
Lint/AssignmentInCondition:
AllowSafeAssignment: true
Description: "Don't use assignment in conditions."
Enabled: true
StyleGuide: "https://github.com/bbatsov/ruby-style-guide#safe-assignment-in-condition"
Lint/DeprecatedOpenSSLConstant:
Enabled: true
Lint/DisjunctiveAssignmentInConstructor:
Enabled: false
Lint/DuplicateElsifCondition:
Enabled: false
Lint/EachWithObjectArgument:
Description: "Check for immutable argument given to each_with_object."
Enabled: true
Lint/LiteralAsCondition:
Description: "Checks of literals used in conditions."
Enabled: false
Lint/LiteralInInterpolation:
Description: "Checks for literals used in interpolation."
Enabled: false
Lint/MixedRegexpCaptureTypes:
Enabled: true
Lint/RaiseException:
Description: "This cop checks for raise or fail statements which are raising Exception class."
Enabled: true
Lint/StructNewOverride:
Description: "This cop checks unexpected overrides of the Struct built-in methods via Struct.new"
Enabled: true
Lint/SuppressedException:
Description: "Don't suppress exception."
Enabled: true
StyleGuide: "https://github.com/bbatsov/ruby-style-guide#dont-hide-exceptions"
Metrics/AbcSize:
Description: "A calculated magnitude based on number of assignments, branches, and conditions."
Enabled: true
Max: 15
Metrics/ClassLength:
CountComments: false
Description: "Avoid classes longer than 100 lines of code."
Enabled: true
Max: 150
Metrics/CyclomaticComplexity:
Description: "A complexity metric that is strongly correlated to the number of test cases needed to validate a method."
Enabled: true
Max: 8
Metrics/MethodLength:
CountComments: false
Description: "Avoid methods longer than 15 lines of code."
Enabled: true
Max: 15
StyleGuide: "https://github.com/bbatsov/ruby-style-guide#short-methods"
Metrics/ModuleLength:
CountComments: false
Description: "Avoid modules longer than 100 lines of code."
Enabled: false
Max: 100
Metrics/ParameterLists:
CountKeywordArgs: true
Description: "Avoid parameter lists longer than three or four parameters."
Enabled: true
Max: 5
StyleGuide: "https://github.com/bbatsov/ruby-style-guide#too-many-params"
Metrics/PerceivedComplexity:
Description: "A complexity metric geared towards measuring complexity for a human reader."
Enabled: true
Max: 7
Naming/AccessorMethodName:
Description: "Check the naming of accessor methods for get_/set_."
Enabled: false
Naming/FileName:
Description: "Use snake_case for source file names."
Enabled: true
Exclude: []
StyleGuide: "https://github.com/bbatsov/ruby-style-guide#snake-case-files"
Naming/PredicateName:
Description: "Check the names of predicate methods."
Enabled: true
ForbiddenPrefixes:
- is_
NamePrefix:
- is_
- has_
- have_
StyleGuide: "https://github.com/bbatsov/ruby-style-guide#bool-methods-qmark"
Naming/RescuedExceptionsVariableName:
PreferredName: error
Naming/VariableNumber:
EnforcedStyle: snake_case
Performance/AncestorsInclude:
Enabled: false
Performance/BigDecimalWithNumericArgument:
Enabled: false
Performance/RedundantSortBlock:
Enabled: true
Performance/RedundantStringChars:
Enabled: true
Performance/ReverseFirst:
Enabled: true
Performance/SortReverse:
Enabled: true
Performance/Squeeze:
Enabled: true
Performance/StringInclude:
Enabled: true
RedundantBlockCall:
Enabled: false
Style/AccessorGrouping:
Enabled: true
Style/Alias:
Description: "Use alias_method instead of alias."
Enabled: true
StyleGuide: "https://github.com/bbatsov/ruby-style-guide#alias-method"
Style/ArrayCoercion:
Enabled: true
Style/BisectedAttrAccessor:
Enabled: true
Style/CaseLikeIf:
Enabled: true
Style/CollectionMethods:
Description: "Preferred collection methods."
Enabled: true
PreferredMethods:
collect: map
collect!: map!
find: detect
find_all: select
inject: reduce
StyleGuide: "https://github.com/bbatsov/ruby-style-guide#map-find-select-reduce-size"
Style/Documentation:
Description: "Document classes and non-namespace modules."
Enabled: false
Style/DoubleNegation:
Description: "Checks for uses of double negation (!!)."
Enabled: false
StyleGuide: "https://github.com/bbatsov/ruby-style-guide#no-bang-bang"
Style/EachWithObject:
Description: "Prefer `each_with_object` over `inject` or `reduce`."
Enabled: false
Style/EmptyLiteral:
Description: "Prefer literals to Array.new/Hash.new/String.new."
Enabled: true
StyleGuide: "https://github.com/bbatsov/ruby-style-guide#literal-array-hash"
Style/EmptyMethod:
Enabled: false
Style/ExponentialNotation:
Enabled: true
Style/FormatStringToken:
Enabled: false
Style/FrozenStringLiteralComment:
Enabled: true
Style/GuardClause:
Description: "Check for conditionals that can be replaced with guard clauses"
Enabled: true
MinBodyLength: 1
StyleGuide: "https://github.com/bbatsov/ruby-style-guide#no-nested-conditionals"
Style/HashAsLastArrayItem:
Enabled: true
Style/HashEachMethods:
Enabled: true
Style/HashLikeCase:
Enabled: true
Style/HashSyntax:
Enabled: true
EnforcedStyle: ruby19
SupportedStyles:
- ruby19
- hash_rockets
- no_mixed_keys
- ruby19_no_mixed_keys
Style/HashTransformKeys:
Enabled: true
Style/HashTransformValues:
Enabled: true
Style/IfUnlessModifier:
Description: "Favor modifier if/unless usage when you have a single-line body."
Enabled: false
StyleGuide: "https://github.com/bbatsov/ruby-style-guide#if-as-a-modifier"
Style/InlineComment:
Description: "Avoid inline comments."
Enabled: false
Style/ModuleFunction:
Description: "Checks for usage of `extend self` in modules."
Enabled: false
StyleGuide: "https://github.com/bbatsov/ruby-style-guide#module-function"
Style/OneLineConditional:
Description: "Favor the ternary operator(?:) over if/then/else/end constructs."
Enabled: false
StyleGuide: "https://github.com/bbatsov/ruby-style-guide#ternary-operator"
Style/OptionHash:
Description: "Don't use option hashes when you can use keyword arguments."
Enabled: false
Style/PerlBackrefs:
Description: "Avoid Perl-style regex back references."
Enabled: true
StyleGuide: "https://github.com/bbatsov/ruby-style-guide#no-perl-regexp-last-matchers"
Style/RaiseArgs:
Description: "Checks the arguments passed to raise/fail."
Enabled: true
EnforcedStyle: exploded
StyleGuide: "https://github.com/bbatsov/ruby-style-guide#exception-class-messages"
SupportedStyles:
- compact
- exploded
Style/RedundantAssignment:
Enabled: true
Style/RedundantFetchBlock:
Enabled: true
Style/RedundantFileExtensionInRequire:
Enabled: true
Style/RedundantRegexpCharacterClass:
Enabled: true
Style/RedundantRegexpEscape:
Enabled: true
Style/Send:
Description: "Prefer `Object#__send__` or `Object#public_send` to `send`, as `send` may overlap with existing methods."
Enabled: false
StyleGuide: "https://github.com/bbatsov/ruby-style-guide#prefer-public-send"
Style/SignalException:
Description: "Checks for proper usage of fail and raise."
Enabled: false
EnforcedStyle: semantic
StyleGuide: "https://github.com/bbatsov/ruby-style-guide#fail-method"
SupportedStyles:
- only_raise
- only_fail
- semantic
Style/SingleLineBlockParams:
Description: "Enforces the names of some block params."
Enabled: false
Methods:
-
reduce:
- a
- e
-
inject:
- a
- e
StyleGuide: "https://github.com/bbatsov/ruby-style-guide#reduce-blocks"
Style/SingleLineMethods:
AllowIfMethodIsEmpty: true
Description: "Avoid single-line methods."
Enabled: true
StyleGuide: "https://github.com/bbatsov/ruby-style-guide#no-single-line-methods"
Style/SlicingWithRange:
Enabled: true
Style/SpecialGlobalVars:
Description: "Avoid Perl-style global variables."
Enabled: true
StyleGuide: "https://github.com/bbatsov/ruby-style-guide#no-cryptic-perlisms"
Style/StringLiterals:
Description: "Checks if uses of quotes match the configured preference."
Enabled: true
EnforcedStyle: double_quotes
StyleGuide: "https://github.com/bbatsov/ruby-style-guide#consistent-string-literals"
SupportedStyles:
- single_quotes
- double_quotes
Style/StringLiteralsInInterpolation:
Description: "Checks if uses of quotes inside expressions in interpolated strings match the configured preference."
Enabled: true
EnforcedStyle: double_quotes
SupportedStyles:
- single_quotes
- double_quotes
Style/TrailingCommaInArguments:
Description: "Checks for trailing comma in argument lists."
Enabled: true
EnforcedStyleForMultiline: no_comma
StyleGuide: "https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas"
SupportedStylesForMultiline:
- comma
- consistent_comma
- no_comma
Style/TrailingCommaInArrayLiteral:
Description: "Checks for trailing comma in array and hash literals."
Enabled: true
EnforcedStyleForMultiline: no_comma
StyleGuide: "https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas"
SupportedStylesForMultiline:
- comma
- consistent_comma
- no_comma
Style/TrailingCommaInHashLiteral:
Description: "Checks for trailing comma in array and hash literals."
Enabled: true
EnforcedStyleForMultiline: no_comma
StyleGuide: "https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas"
SupportedStylesForMultiline:
- comma
- consistent_comma
- no_comma
Style/VariableInterpolation:
Description: "Don't interpolate global, instance and class variables directly in strings."
Enabled: false
StyleGuide: "https://github.com/bbatsov/ruby-style-guide#curlies-interpolate"
Style/WhenThen:
Description: "Use when x then ... for one-line cases."
Enabled: false
StyleGuide: "https://github.com/bbatsov/ruby-style-guide#one-line-cases"