forked from airbnb/ruby
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rubocop-layout.yml
558 lines (477 loc) · 15.7 KB
/
rubocop-layout.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
554
555
556
557
558
# Type 'Style' (166):
# Supports --auto-correct
Layout/AccessModifierIndentation:
Description: Check indentation of private/protected visibility modifiers.
# Airbnb: https://github.com/airbnb/ruby#access-modifiers
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#indent-public-private-protected
Enabled: true
EnforcedStyle: indent
SupportedStyles:
- outdent
- indent
# Supports --auto-correct
Layout/AlignArray:
Description: Align the elements of an array literal if they span more than one line.
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#align-multiline-arrays
Enabled: true
# Supports --auto-correct
Layout/AlignHash:
Description: Align the elements of a hash literal if they span more than one line.
Enabled: true
EnforcedHashRocketStyle: key
EnforcedColonStyle: key
EnforcedLastArgumentHashStyle: always_inspect
SupportedLastArgumentHashStyles:
- always_inspect
- always_ignore
- ignore_implicit
- ignore_explicit
# Supports --auto-correct
Layout/AlignParameters:
Description: Align the parameters of a method call if they span more than one line.
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#no-double-indent
Enabled: true
EnforcedStyle: with_first_parameter
SupportedStyles:
- with_first_parameter
- with_fixed_indentation
# Supports --auto-correct
Layout/BlockAlignment:
Description: Align block ends correctly.
Enabled: true
# Supports --auto-correct
Layout/BlockEndNewline:
Description: Put end statement of multiline block on its own line.
Enabled: true
# Supports --auto-correct
Layout/CaseIndentation:
Description: Indentation of when in a case/when/[else/]end.
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#indent-when-to-case
Enabled: true
EnforcedStyle: case
IndentOneStep: false
Layout/ClassStructure:
Enabled: false
Categories:
module_inclusion:
- include
- prepend
- extend
ExpectedOrder:
- module_inclusion
- constants
- public_class_methods
- initializer
- instance_methods
- protected_methods
- private_methods
Layout/ClosingHeredocIndentation:
Enabled: false
# Supports --auto-correct
Layout/ClosingParenthesisIndentation:
Description: Checks the indentation of hanging closing parentheses.
Enabled: true
# Supports --auto-correct
Layout/CommentIndentation:
Description: Indentation of comments.
Enabled: true
Layout/ConditionPosition:
Description: Checks for condition placed in a confusing position relative to the keyword.
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#same-line-condition
Enabled: true
# Supports --auto-correct
Layout/DefEndAlignment:
Description: Align ends corresponding to defs correctly.
Enabled: true
EnforcedStyleAlignWith: start_of_line
AutoCorrect: false
# Use trailing commas, because there are safer in ruby.
Layout/DotPosition:
Enabled: true
EnforcedStyle: trailing
# Supports --auto-correct
Layout/ElseAlignment:
Description: Align elses and elsifs correctly.
Enabled: true
Layout/EmptyComment:
Description: 'Checks empty comment.'
Enabled: true
Layout/EmptyLineAfterMagicComment:
Enabled: true
# Supports --auto-correct
Layout/EmptyLineBetweenDefs:
Description: Use empty lines between defs.
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#empty-lines-between-methods
Enabled: true
AllowAdjacentOneLineDefs: false
# Supports --auto-correct
Layout/EmptyLines:
Description: Don't use several empty lines in a row.
Enabled: true
Layout/EmptyLineAfterGuardClause:
Enabled: false
# Supports --auto-correct
Layout/EmptyLinesAroundAccessModifier:
Description: Keep blank lines around access modifiers.
Enabled: true
Layout/EmptyLinesAroundArguments:
Description: "Keeps track of empty lines around method arguments."
Enabled: false
Layout/EmptyLinesAroundBeginBody:
Enabled: true
# Supports --auto-correct
Layout/EmptyLinesAroundBlockBody:
Description: Keeps track of empty lines around block bodies.
Enabled: true
EnforcedStyle: no_empty_lines
SupportedStyles:
- empty_lines
- no_empty_lines
# Supports --auto-correct
Layout/EmptyLinesAroundClassBody:
Description: Keeps track of empty lines around class bodies.
Enabled: true
EnforcedStyle: no_empty_lines
SupportedStyles:
- beginning_only
- empty_lines
- end_only
- no_empty_lines
Layout/EmptyLinesAroundExceptionHandlingKeywords:
Enabled: false
# Supports --auto-correct
Layout/EmptyLinesAroundMethodBody:
Description: Keeps track of empty lines around method bodies.
Enabled: true
# Supports --auto-correct
Layout/EmptyLinesAroundModuleBody:
Description: Keeps track of empty lines around module bodies.
Enabled: true
EnforcedStyle: no_empty_lines
SupportedStyles:
- empty_lines
- no_empty_lines
# Supports --auto-correct
Layout/EndAlignment:
Description: Align ends correctly.
# The value `keyword` means that `end` should be aligned with the matching
# keyword (if, while, etc.).
# The value `variable` means that in assignments, `end` should be aligned
# with the start of the variable on the left hand side of `=`. In all other
# situations, `end` should still be aligned with the keyword.
# The value `start_of_line` means that `end` should be aligned with the start
# of the line which the matching keyword appears on.
Enabled: true
EnforcedStyleAlignWith: keyword
AutoCorrect: false
Layout/EndOfLine:
Description: Use Unix-style line endings.
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#crlf
Enabled: false
# Supports --auto-correct
Layout/ExtraSpacing:
Description: Do not use unnecessary spacing.
Enabled: true
AllowForAlignment: true
# Supports --auto-correct
Layout/FirstArrayElementLineBreak:
Description: Checks for a line break before the first element in a multi-line array.
Enabled: true
# Supports --auto-correct
Layout/FirstHashElementLineBreak:
Description: Checks for a line break before the first element in a multi-line hash.
Enabled: true
# Supports --auto-correct
Layout/FirstMethodArgumentLineBreak:
Description: Checks for a line break before the first argument in a multi-line method
call.
Enabled: false
# Supports --auto-correct
Layout/FirstMethodParameterLineBreak:
Description: Checks for a line break before the first parameter in a multi-line method
parameter definition.
Enabled: false
# Supports --auto-correct
Layout/IndentFirstArgument:
Description: Checks the indentation of the first parameter in a method call.
Enabled: true
EnforcedStyle: consistent
SupportedStyles:
- consistent
- consistent_relative_to_receiver
- special_for_inner_method_call
- special_for_inner_method_call_in_parentheses
# Supports --auto-correct
Layout/IndentFirstArrayElement:
Description: Checks the indentation of the first element in an array literal.
Enabled: true
EnforcedStyle: consistent
# Supports --auto-correct
Layout/IndentAssignment:
Description: Checks the indentation of the first line of the right-hand-side of a
multi-line assignment.
Enabled: true
# Supports --auto-correct
Layout/IndentFirstHashElement:
Description: Checks the indentation of the first key in a hash literal.
Enabled: true
EnforcedStyle: consistent
SupportedStyles:
- special_inside_parentheses
- consistent
Layout/IndentHeredoc:
Enabled: false
# Supports --auto-correct
Layout/IndentationConsistency:
Description: Keep indentation straight.
Enabled: true
EnforcedStyle: normal
SupportedStyles:
- normal
- rails
# Supports --auto-correct
Layout/IndentationWidth:
Description: Use 2 spaces for indentation.
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#spaces-indentation
Enabled: true
Width: 2
# Supports --auto-correct
Layout/InitialIndentation:
Description: Checks the indentation of the first non-blank non-comment line in a file.
Enabled: true
Layout/LeadingBlankLines:
Enabled: true
# Supports --auto-correct
Layout/LeadingCommentSpace:
Description: Comments should start with a space.
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#hash-space
Enabled: true
# Supports --auto-correct
Layout/MultilineArrayBraceLayout:
Description: Checks that the closing brace in an array literal is symmetrical with
respect to the opening brace and the array elements.
Enabled: true
# Supports --auto-correct
Layout/MultilineAssignmentLayout:
Description: Check for a newline after the assignment operator in multi-line assignments.
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#indent-conditional-assignment
Enabled: false
SupportedTypes:
- block
- case
- class
- if
- kwbegin
- module
EnforcedStyle: new_line
SupportedStyles:
- same_line
- new_line
# Supports --auto-correct
Layout/MultilineBlockLayout:
Description: Ensures newlines after multiline block do statements.
Enabled: true
Layout/MultilineHashBraceLayout:
Description: >-
Checks that the closing brace in a hash literal is
symmetrical with respect to the opening brace and the
hash elements.
Enabled: true
Layout/MultilineMethodCallBraceLayout:
Description: >-
Checks that the closing brace in a method call is
symmetrical with respect to the opening brace and the
method arguments.
Enabled: true
EnforcedStyle: symmetrical
# Supports --auto-correct
Layout/MultilineMethodCallIndentation:
Description: Checks indentation of method calls with the dot operator that span more
than one line.
Enabled: true
EnforcedStyle: indented
SupportedStyles:
- aligned
- indented
Layout/MultilineMethodDefinitionBraceLayout:
Description: >-
Checks that the closing brace in a method definition is
symmetrical with respect to the opening brace and the
method parametters.
Enabled: true
# The default (aligned) would force multi line operations to look like this
# balance = Balance.
# where(cond).
# where(cond).
# first
Layout/MultilineOperationIndentation:
Enabled: false
EnforcedStyle: indented
# Supports --auto-correct
Layout/RescueEnsureAlignment:
Description: Align rescues and ensures correctly.
Enabled: true
# Supports --auto-correct
Layout/SpaceAfterColon:
Description: Use spaces after colons.
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#spaces-operators
Enabled: true
# Supports --auto-correct
Layout/SpaceAfterComma:
Description: Use spaces after commas.
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#spaces-operators
Enabled: true
# Supports --auto-correct
Layout/SpaceAfterMethodName:
Description: Do not put a space between a method name and the opening parenthesis
in a method definition.
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#parens-no-spaces
Enabled: true
# Supports --auto-correct
Layout/SpaceAfterNot:
Description: Tracks redundant space after the ! operator.
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#no-space-bang
Enabled: true
# Supports --auto-correct
Layout/SpaceAfterSemicolon:
Description: Use spaces after semicolons.
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#spaces-operators
Enabled: true
# Supports --auto-correct
Layout/SpaceAroundBlockParameters:
Description: Checks the spacing inside and after block parameters pipes.
Enabled: true
EnforcedStyleInsidePipes: no_space
# Supports --auto-correct
Layout/SpaceAroundEqualsInParameterDefault:
Description: Checks that the equals signs in parameter default assignments have or
don't have surrounding space depending on configuration.
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#spaces-around-equals
Enabled: true
EnforcedStyle: space
SupportedStyles:
- space
- no_space
Layout/SpaceAroundKeyword:
Description: 'Use a space around keywords if appropriate.'
Enabled: true
# Supports --auto-correct
Layout/SpaceAroundOperators:
Description: Use a single space around operators.
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#spaces-operators
Enabled: true
AllowForAlignment: true
# Supports --auto-correct
Layout/SpaceBeforeBlockBraces:
Description: Checks that the left block brace has or doesn't have space before it.
Enabled: true
EnforcedStyle: space
SupportedStyles:
- space
- no_space
# Supports --auto-correct
Layout/SpaceBeforeComma:
Description: No spaces before commas.
Enabled: true
# Supports --auto-correct
Layout/SpaceBeforeComment:
Description: Checks for missing space between code and a comment on the same line.
Enabled: true
# Supports --auto-correct
Layout/SpaceBeforeFirstArg:
Description: Put a space between a method name and the first argument in a method
call without parentheses.
Enabled: true
# Supports --auto-correct
Layout/SpaceBeforeSemicolon:
Description: No spaces before semicolons.
Enabled: true
Layout/SpaceInLambdaLiteral:
Enabled: false
Layout/SpaceInsideArrayPercentLiteral:
Enabled: false
# Supports --auto-correct
Layout/SpaceInsideBlockBraces:
Description: Checks that block braces have or don't have surrounding space. For blocks
taking parameters, checks that the left brace has or doesn't have trailing space.
Enabled: true
EnforcedStyle: space
SupportedStyles:
- space
- no_space
EnforcedStyleForEmptyBraces: no_space
SpaceBeforeBlockParameters: true
Layout/SpaceInsideParens:
Description: 'No spaces after ( or before ).'
StyleGuide: '#spaces-braces'
Enabled: true
Layout/SpaceInsideArrayLiteralBrackets:
EnforcedStyle: no_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
Enabled: true
Layout/SpaceInsideReferenceBrackets:
EnforcedStyleForEmptyBrackets: no_space
SupportedStyles:
- space
- no_space
Enabled: true
# Supports --auto-correct
Layout/SpaceInsideHashLiteralBraces:
Description: Use spaces inside hash literal braces - or don't.
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#spaces-operators
Enabled: true
EnforcedStyle: space
EnforcedStyleForEmptyBraces: no_space
SupportedStyles:
- space
- no_space
# Supports --auto-correct
Layout/SpaceInsideParens:
Description: No spaces after ( or before ).
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#no-spaces-braces
Enabled: true
Layout/SpaceInsidePercentLiteralDelimiters:
Description: 'No unnecessary spaces inside delimiters of %i/%w/%x literals.'
Enabled: true
# Supports --auto-correct
Layout/SpaceInsideRangeLiteral:
Description: No spaces inside range literals.
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#no-space-inside-range-literals
Enabled: true
# Supports --auto-correct
Layout/SpaceInsideStringInterpolation:
Description: Checks for padding/surrounding spaces inside string interpolation.
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#string-interpolation
Enabled: true
EnforcedStyle: no_space
SupportedStyles:
- space
- no_space
# Supports --auto-correct
Layout/Tab:
Description: No hard tabs.
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#spaces-indentation
Enabled: true
# Supports --auto-correct
Layout/TrailingBlankLines:
Description: Checks trailing blank lines and final newline.
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#newline-eof
Enabled: true
EnforcedStyle: final_newline
SupportedStyles:
- final_newline
- final_blank_line
# Supports --auto-correct
Layout/TrailingWhitespace:
Description: Avoid trailing whitespace.
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#no-trailing-whitespace
Enabled: true