-
Notifications
You must be signed in to change notification settings - Fork 5
/
.rubocop.yml
553 lines (532 loc) · 16.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
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
# Source: https://github.com/rubocop-hq/rubocop/blob/master/config/default.yml
Style/Documentation:
Description: 'Document classes and non-namespace modules.'
Enabled: false
VersionAdded: '0.9'
Exclude:
- 'spec/**/*'
- 'test/**/*'
Style/Encoding:
Enabled: false
Style/FrozenStringLiteralComment:
Description: >-
Add the frozen_string_literal comment to the top of files
to help transition to frozen string literals by default.
Enabled: false
VersionAdded: '0.36'
VersionChanged: '0.79'
EnforcedStyle: always
SupportedStyles:
# `always` will always add the frozen string literal comment to a file
# regardless of the Ruby version or if `freeze` or `<<` are called on a
# string literal. It is possible that this will create errors.
- always
# `always_true` will add the frozen string literal comment to a file,
# similarly to the `always` style, but will also change any disabled
# comments (e.g. `# frozen_string_literal: false`) to be enabled.
- always_true
# `never` will enforce that the frozen string literal comment does not
# exist in a file.
- never
Safe: false
Style/RegexpLiteral:
Description: 'Use / or %r around regular expressions.'
StyleGuide: '#percent-r'
Enabled: false
VersionAdded: '0.9'
VersionChanged: '0.30'
EnforcedStyle: slashes
# slashes: Always use slashes.
# percent_r: Always use `%r`.
# mixed: Use slashes on single-line regexes, and `%r` on multi-line regexes.
SupportedStyles:
- slashes
- percent_r
- mixed
# If `false`, the cop will always recommend using `%r` if one or more slashes
# are found in the regexp string.
AllowInnerSlashes: false
Layout/SpaceInsideStringInterpolation:
Description: 'Checks for padding/surrounding spaces inside string interpolation.'
StyleGuide: '#string-interpolation'
Enabled: true
VersionAdded: '0.49'
EnforcedStyle: space
SupportedStyles:
- space
- no_space
Layout/SpaceInsideArrayLiteralBrackets:
Description: 'Checks the spacing inside array literal brackets.'
Enabled: true
VersionAdded: '0.52'
EnforcedStyle: space
SupportedStyles:
- space
- no_space
# 'compact' normally requires a space inside the brackets, with the exception
# that successive left brackets or right brackets are collapsed together
- compact
EnforcedStyleForEmptyBrackets: no_space
SupportedStylesForEmptyBrackets:
- space
- no_space
Style/MutableConstant:
Description: 'Do not assign mutable objects to constants.'
Enabled: false
VersionAdded: '0.34'
VersionChanged: '0.65'
EnforcedStyle: literals
SupportedStyles:
# literals: freeze literals assigned to constants
# strict: freeze all constants
# Strict mode is considered an experimental feature. It has not been updated
# with an exhaustive list of all methods that will produce frozen objects so
# there is a decent chance of getting some false positives. Luckily, there is
# no harm in freezing an already frozen object.
- literals
- strict
Style/TrailingCommaInHashLiteral:
Description: 'Checks for trailing comma in hash literals.'
Enabled: true
# If `comma`, the cop requires a comma after the last item in a hash,
# but only when each item is on its own line.
# If `consistent_comma`, the cop requires a comma after the last item of all
# non-empty, multiline hash literals.
EnforcedStyleForMultiline: comma
SupportedStylesForMultiline:
- comma
- consistent_comma
- no_comma
VersionAdded: '0.53'
Metrics/PerceivedComplexity:
Description: >-
A complexity metric geared towards measuring complexity for a
human reader.
Enabled: false
VersionAdded: '0.25'
VersionChanged: '0.81'
IgnoredMethods: []
Max: 7
Metrics/CyclomaticComplexity:
Description: >-
A complexity metric that is strongly correlated to the number
of test cases needed to validate a method.
Enabled: false
VersionAdded: '0.25'
VersionChanged: '0.81'
IgnoredMethods: []
Max: 7
Metrics/AbcSize:
Description: >-
A calculated magnitude based on number of assignments,
branches, and conditions.
Reference:
- http://c2.com/cgi/wiki?AbcMetric
- https://en.wikipedia.org/wiki/ABC_Software_Metric
Enabled: false
VersionAdded: '0.27'
VersionChanged: '0.81'
# The ABC size is a calculated magnitude, so this number can be an Integer or
# a Float.
IgnoredMethods: []
Max: 15
Lint/AssignmentInCondition:
Description: "Don't use assignment in conditions."
StyleGuide: '#safe-assignment-in-condition'
Enabled: true
VersionAdded: '0.9'
AllowSafeAssignment: true
Layout/ArgumentAlignment:
Description: >-
Align the arguments of a method call if they span more
than one line.
StyleGuide: '#no-double-indent'
Enabled: true
VersionAdded: '0.68'
VersionChanged: '0.77'
# Alignment of arguments in multi-line method calls.
#
# The `with_first_argument` style aligns the following lines along the same
# column as the first parameter.
#
# method_call(a,
# b)
#
# The `with_fixed_indentation` style aligns the following lines with one
# level of indentation relative to the start of the line with the method call.
#
# method_call(a,
# b)
EnforcedStyle: with_first_argument
SupportedStyles:
- with_first_argument
- with_fixed_indentation
# By default, the indentation width from Layout/IndentationWidth is used
# But it can be overridden by setting this parameter
IndentationWidth: ~
Layout/EmptyLinesAroundClassBody:
Description: "Keeps track of empty lines around class bodies."
StyleGuide: '#empty-lines-around-bodies'
Enabled: false
VersionAdded: '0.49'
VersionChanged: '0.53'
EnforcedStyle: no_empty_lines
SupportedStyles:
- empty_lines
- empty_lines_except_namespace
- empty_lines_special
- no_empty_lines
- beginning_only
- ending_only
Layout/EmptyLinesAroundModuleBody:
Description: "Keeps track of empty lines around module bodies."
StyleGuide: '#empty-lines-around-bodies'
Enabled: true
VersionAdded: '0.49'
EnforcedStyle: no_empty_lines
SupportedStyles:
- empty_lines
- empty_lines_except_namespace
- empty_lines_special
- no_empty_lines
Layout/EmptyLinesAroundExceptionHandlingKeywords:
Description: "Keeps track of empty lines around exception handling keywords."
StyleGuide: '#empty-lines-around-bodies'
Enabled: false
VersionAdded: '0.49'
Naming/RescuedExceptionsVariableName:
Description: 'Use consistent rescued exceptions variables naming.'
Enabled: false
VersionAdded: '0.67'
VersionChanged: '0.68'
PreferredName: e
Metrics/BlockLength:
Description: 'Avoid long blocks with many lines.'
Enabled: false
VersionAdded: '0.44'
VersionChanged: '0.66'
CountComments: false # count full line comments?
Max: 25
ExcludedMethods:
# By default, exclude the `#refine` method, as it tends to have larger
# associated blocks.
- refine
Exclude:
- '**/*.gemspec'
Naming/MethodParameterName:
Description: >-
Checks for method parameter names that contain capital letters,
end in numbers, or do not meet a minimal length.
Enabled: false
VersionAdded: '0.53'
VersionChanged: '0.77'
# Parameter names may be equal to or greater than this value
MinNameLength: 3
AllowNamesEndingInNumbers: true
# Allowed names that will not register an offense
AllowedNames:
- io
- id
- to
- by
- 'on'
- in
- at
- ip
- db
- os
- pp
# Forbidden names that will register an offense
ForbiddenNames: []
Style/NumericLiteralPrefix:
Description: 'Use smallcase prefixes for numeric literals.'
StyleGuide: '#numeric-literal-prefixes'
Enabled: false
VersionAdded: '0.41'
EnforcedOctalStyle: zero_with_o
SupportedOctalStyles:
- zero_with_o
- zero_only
Style/ExpandPathArguments:
Description: "Use `expand_path(__dir__)` instead of `expand_path('..', __FILE__)`."
Enabled: false
VersionAdded: '0.53'
Naming/AccessorMethodName:
Description: Check the naming of accessor methods for get_/set_.
StyleGuide: '#accessor_mutator_method_names'
Enabled: false
VersionAdded: '0.50'
Naming/MemoizedInstanceVariableName:
Description: >-
Memoized method name should match memo instance variable name.
Enabled: false
VersionAdded: '0.53'
VersionChanged: '0.58'
EnforcedStyleForLeadingUnderscores: disallowed
SupportedStylesForLeadingUnderscores:
- disallowed
- required
- optional
Style/AndOr:
Description: 'Use &&/|| instead of and/or.'
StyleGuide: '#no-and-or-or'
Enabled: false
VersionAdded: '0.9'
VersionChanged: '0.25'
# Whether `and` and `or` are banned only in conditionals (conditionals)
# or completely (always).
EnforcedStyle: conditionals
SupportedStyles:
- always
- conditionals
Style/RedundantReturn:
Description: "Don't use return where it's not required."
StyleGuide: '#no-explicit-return'
Enabled: false
VersionAdded: '0.10'
VersionChanged: '0.14'
# When `true` allows code like `return x, y`.
AllowMultipleReturnValues: false
Style/IfUnlessModifier:
Description: >-
Favor modifier if/unless usage when you have a
single-line body.
StyleGuide: '#if-as-a-modifier'
Enabled: false
VersionAdded: '0.9'
VersionChanged: '0.30'
Style/GuardClause:
Description: 'Check for conditionals that can be replaced with guard clauses.'
StyleGuide: '#no-nested-conditionals'
Enabled: false
VersionAdded: '0.20'
VersionChanged: '0.22'
# `MinBodyLength` defines the number of lines of the a body of an `if` or `unless`
# needs to have to trigger this cop
MinBodyLength: 1
Style/WordArray:
Description: 'Use %w or %W for arrays of words.'
StyleGuide: '#percent-w'
Enabled: false
VersionAdded: '0.9'
VersionChanged: '0.36'
EnforcedStyle: percent
SupportedStyles:
# percent style: %w(word1 word2)
- percent
# bracket style: ['word1', 'word2']
- brackets
# The `MinSize` option causes the `WordArray` rule to be ignored for arrays
# smaller than a certain size. The rule is only applied to arrays
# whose element count is greater than or equal to `MinSize`.
MinSize: 2
# The regular expression `WordRegex` decides what is considered a word.
WordRegex: !ruby/regexp '/\A(?:\p{Word}|\p{Word}-\p{Word}|\n|\t)+\z/'
Style/NumericPredicate:
Description: >-
Checks for the use of predicate- or comparison methods for
numeric comparisons.
StyleGuide: '#predicate-methods'
Safe: false
# This will change to a new method call which isn't guaranteed to be on the
# object. Switching these methods has to be done with knowledge of the types
# of the variables which rubocop doesn't have.
SafeAutoCorrect: false
AutoCorrect: false
Enabled: false
VersionAdded: '0.42'
VersionChanged: '0.59'
EnforcedStyle: predicate
SupportedStyles:
- predicate
- comparison
IgnoredMethods: []
# Exclude RSpec specs because assertions like `expect(1).to be > 0` cause
# false positives.
Exclude:
- 'spec/**/*'
Style/ParallelAssignment:
Description: >-
Check for simple usages of parallel assignment.
It will only warn when the number of variables
matches on both sides of the assignment.
StyleGuide: '#parallel-assignment'
Enabled: false
VersionAdded: '0.32'
Style/ConditionalAssignment:
Description: >-
Use the return value of `if` and `case` statements for
assignment to a variable and variable comparison instead
of assigning that variable inside of each branch.
Enabled: false
VersionAdded: '0.36'
VersionChanged: '0.47'
EnforcedStyle: assign_to_condition
SupportedStyles:
- assign_to_condition
- assign_inside_condition
# When configured to `assign_to_condition`, `SingleLineConditionsOnly`
# will only register an offense when all branches of a condition are
# a single line.
# When configured to `assign_inside_condition`, `SingleLineConditionsOnly`
# will only register an offense for assignment to a condition that has
# at least one multiline branch.
SingleLineConditionsOnly: true
IncludeTernaryExpressions: true
Metrics/MethodLength:
Description: 'Avoid methods longer than 10 lines of code.'
StyleGuide: '#short-methods'
Enabled: false
VersionAdded: '0.25'
VersionChanged: '0.59.2'
CountComments: false # count full line comments?
Max: 10
ExcludedMethods: []
Metrics/ClassLength:
Description: 'Avoid classes longer than 100 lines of code.'
Enabled: false
VersionAdded: '0.25'
CountComments: false # count full line comments?
Max: 100
Style/PreferredHashMethods:
Description: 'Checks use of `has_key?` and `has_value?` Hash methods.'
StyleGuide: '#hash-key'
Enabled: false
Safe: false
VersionAdded: '0.41'
VersionChanged: '0.70'
EnforcedStyle: short
SupportedStyles:
- short
- verbose
Style/TrailingCommaInArguments:
Description: 'Checks for trailing comma in argument lists.'
StyleGuide: '#no-trailing-params-comma'
Enabled: false
VersionAdded: '0.36'
# If `comma`, the cop requires a comma after the last argument, but only for
# parenthesized method calls where each argument is on its own line.
# If `consistent_comma`, the cop requires a comma after the last argument,
# for all parenthesized method calls with arguments.
EnforcedStyleForMultiline: comma
SupportedStylesForMultiline:
- comma
- consistent_comma
- no_comma
Style/SymbolArray:
Description: 'Use %i or %I for arrays of symbols.'
StyleGuide: '#percent-i'
Enabled: false
VersionAdded: '0.9'
VersionChanged: '0.49'
EnforcedStyle: percent
MinSize: 2
SupportedStyles:
- percent
- brackets
Style/NilComparison:
Description: 'Prefer x.nil? to x == nil.'
StyleGuide: '#predicate-methods'
Enabled: false
VersionAdded: '0.12'
VersionChanged: '0.59'
EnforcedStyle: predicate
SupportedStyles:
- predicate
- comparison
Style/WhileUntilModifier:
Description: >-
Favor modifier while/until usage when you have a
single-line body.
StyleGuide: '#while-as-a-modifier'
Enabled: false
VersionAdded: '0.9'
VersionChanged: '0.30'
Style/TernaryParentheses:
Description: 'Checks for use of parentheses around ternary conditions.'
Enabled: false
VersionAdded: '0.42'
VersionChanged: '0.46'
EnforcedStyle: require_no_parentheses
SupportedStyles:
- require_parentheses
- require_no_parentheses
- require_parentheses_when_complex
AllowSafeAssignment: true
Layout/EmptyLinesAroundModuleBody:
Description: "Keeps track of empty lines around module bodies."
StyleGuide: '#empty-lines-around-bodies'
Enabled: false
VersionAdded: '0.49'
EnforcedStyle: no_empty_lines
SupportedStyles:
- empty_lines
- empty_lines_except_namespace
- empty_lines_special
- no_empty_lines
Style/UnpackFirst:
Description: >-
Checks for accessing the first element of `String#unpack`
instead of using `unpack1`.
Enabled: false
VersionAdded: '0.54'
Lint/UselessAssignment:
Description: 'Checks for useless assignment to a local variable.'
StyleGuide: '#underscore-unused-vars'
Enabled: false
VersionAdded: '0.11'
Style/StderrPuts:
Description: 'Use `warn` instead of `$stderr.puts`.'
StyleGuide: '#warn'
Enabled: false
VersionAdded: '0.51'
Style/RedundantBegin:
Description: "Don't use begin blocks when they are not needed."
StyleGuide: '#begin-implicit'
Enabled: false
VersionAdded: '0.10'
VersionChanged: '0.21'
Style/RescueStandardError:
Description: 'Avoid rescuing without specifying an error class.'
Enabled: false
VersionAdded: '0.52'
EnforcedStyle: explicit
# implicit: Do not include the error class, `rescue`
# explicit: Require an error class `rescue StandardError`
SupportedStyles:
- implicit
- explicit
Metrics/ParameterLists:
Description: 'Avoid parameter lists longer than three or four parameters.'
StyleGuide: '#too-many-params'
Enabled: false
VersionAdded: '0.25'
Max: 5
CountKeywordArgs: true
Style/Not:
Description: 'Use ! instead of not.'
StyleGuide: '#bang-not-not'
Enabled: false
VersionAdded: '0.9'
VersionChanged: '0.20'
Style/TrailingCommaInArrayLiteral:
Description: 'Checks for trailing comma in array literals.'
StyleGuide: '#no-trailing-array-commas'
Enabled: true
VersionAdded: '0.53'
# If `comma`, the cop requires a comma after the last item in an array,
# but only when each item is on its own line.
# If `consistent_comma`, the cop requires a comma after the last item of all
# non-empty, multiline array literals.
EnforcedStyleForMultiline: comma
SupportedStylesForMultiline:
- comma
- consistent_comma
- no_comma
Lint/SuppressedException:
Description: "Don't suppress exceptions."
StyleGuide: '#dont-hide-exceptions'
Enabled: false
AllowComments: true
VersionAdded: '0.9'
VersionChanged: '0.81'