-
Notifications
You must be signed in to change notification settings - Fork 0
/
.rubocop.yml
706 lines (568 loc) · 19.8 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
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
AllCops:
TargetRubyVersion: 2.6.5
DisabledByDefault: true
#################### Layout ###############################
Layout/AccessModifierIndentation:
Description: Check indentation of private/protected visibility modifiers.
StyleGuide: '#indent-public-private-protected'
Enabled: true
Layout/ParameterAlignment:
EnforcedStyle: with_fixed_indentation
Description: >-
Align the parameters of a method call if they span more
than one line.
StyleGuide: '#no-double-indent'
Enabled: true
Layout/BlockAlignment:
Description: This cop checks whether the end keywords are aligned properly for do end blocks.
Enabled: true
Layout/BlockEndNewline:
Description: 'Put end statement of multiline block on its own line.'
Enabled: true
Layout/CaseIndentation:
Description: 'Indentation of when in a case/when/[else/]end.'
StyleGuide: '#indent-when-to-case'
Enabled: true
Layout/ConditionPosition:
Description: >-
Checks for condition placed in a confusing position relative to
the keyword.
StyleGuide: '#same-line-condition'
Enabled: true
Layout/ClosingParenthesisIndentation:
Description: 'Checks the indentation of hanging closing parentheses.'
Enabled: true
Layout/CommentIndentation:
Description: 'Indentation of comments.'
Enabled: true
Layout/EmptyLineBetweenDefs:
Description: 'Use empty lines between defs.'
StyleGuide: '#empty-lines-between-methods'
Enabled: true
Layout/EmptyLines:
Description: "Don't use several empty lines in a row."
StyleGuide: '#two-or-more-empty-lines'
Enabled: true
Layout/EmptyLinesAroundAccessModifier:
Description: "Keep blank lines around access modifiers."
StyleGuide: '#empty-lines-around-access-modifier'
Enabled: true
Layout/EmptyLinesAroundBeginBody:
Description: "Keeps track of empty lines around begin-end bodies."
StyleGuide: '#empty-lines-around-bodies'
Enabled: true
Layout/EmptyLinesAroundBlockBody:
Description: "Keeps track of empty lines around block bodies."
StyleGuide: '#empty-lines-around-bodies'
Enabled: true
Layout/EmptyLinesAroundClassBody:
Description: "Keeps track of empty lines around class bodies."
StyleGuide: '#empty-lines-around-bodies'
Enabled: true
Layout/EmptyLinesAroundExceptionHandlingKeywords:
Description: "Keeps track of empty lines around exception handling keywords."
StyleGuide: '#empty-lines-around-bodies'
Enabled: true
Layout/EmptyLinesAroundModuleBody:
Description: "Keeps track of empty lines around module bodies."
StyleGuide: '#empty-lines-around-bodies'
Enabled: true
Layout/EmptyLinesAroundMethodBody:
Description: "Keeps track of empty lines around method bodies."
StyleGuide: '#empty-lines-around-bodies'
Enabled: true
Layout/EndOfLine:
Description: 'Use Unix-style line endings.'
StyleGuide: '#crlf'
Enabled: true
Layout/ExtraSpacing:
Description: 'Do not use unnecessary spacing.'
Enabled: true
Layout/InitialIndentation:
Description: >-
Checks the indentation of the first non-blank non-comment line in a file.
Enabled: true
Layout/FirstArgumentIndentation:
Description: 'Checks the indentation of the first parameter in a method call.'
Enabled: true
Layout/IndentationConsistency:
Description: 'Keep indentation straight.'
StyleGuide: '#spaces-indentation'
Enabled: true
Layout/LeadingCommentSpace:
Description: 'Comments should start with a space.'
StyleGuide: '#hash-space'
Enabled: true
Layout/MultilineArrayBraceLayout:
Description: >-
Checks that the closing brace in an array literal is
either on the same line as the last array element, or
a new line.
Enabled: true
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
either on the same line as the last hash element, or
a new line.
Enabled: true
Layout/MultilineMethodCallBraceLayout:
Description: >-
Checks that the closing brace in a method call is
either on the same line as the last method argument, or
a new line.
Enabled: true
Layout/MultilineMethodCallIndentation:
EnforcedStyle: indented
Description: >-
Checks indentation of method calls with the dot operator
that span more than one line.
Enabled: true
Layout/MultilineMethodDefinitionBraceLayout:
Description: >-
Checks that the closing brace in a method definition is
either on the same line as the last method parameter, or
a new line.
Enabled: true
Layout/MultilineOperationIndentation:
Description: >-
Checks indentation of binary operations that span more than
one line.
Enabled: true
Layout/EmptyLineAfterMagicComment:
Description: 'Add an empty line after magic comments to separate them from code.'
StyleGuide: '#separate-magic-comments-from-code'
Enabled: true
Layout/RescueEnsureAlignment:
Description: 'Align rescues and ensures correctly.'
Enabled: false
Layout/SpaceBeforeFirstArg:
Description: >-
Checks that exactly one space is used between a method name
and the first argument for method calls without parentheses.
Enabled: true
Layout/SpaceAfterColon:
Description: 'Use spaces after colons.'
StyleGuide: '#spaces-operators'
Enabled: true
Layout/SpaceAfterComma:
Description: 'Use spaces after commas.'
StyleGuide: '#spaces-operators'
Enabled: true
Layout/SpaceAfterMethodName:
Description: >-
Do not put a space between a method name and the opening
parenthesis in a method definition.
StyleGuide: '#parens-no-spaces'
Enabled: true
Layout/SpaceAfterNot:
Description: Tracks redundant space after the ! operator.
StyleGuide: '#no-space-bang'
Enabled: true
Layout/SpaceBeforeBlockBraces:
Description: >-
Checks that the left block brace has or doesn't have space
before it.
Enabled: true
Layout/SpaceBeforeComma:
Description: 'No spaces before commas.'
Enabled: true
Layout/SpaceBeforeComment:
Description: >-
Checks for missing space between code and a comment on the
same line.
Enabled: true
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
Layout/SpaceAroundBlockParameters:
Description: 'Checks the spacing inside and after block parameters pipes.'
Enabled: true
Layout/SpaceAroundEqualsInParameterDefault:
Description: >-
Checks that the equals signs in parameter default assignments
have or don't have surrounding space depending on
configuration.
StyleGuide: '#spaces-around-equals'
Enabled: true
Layout/SpaceAroundKeyword:
Description: 'Use a space around keywords if appropriate.'
Enabled: true
Layout/SpaceAroundOperators:
Description: 'Use a single space around operators.'
StyleGuide: '#spaces-operators'
Enabled: true
Layout/SpaceInsideArrayLiteralBrackets:
Enabled: true
Description: 'No spaces after [ or before ].'
StyleGuide: '#no-spaces-braces'
Layout/SpaceInsideReferenceBrackets:
Description: 'No spaces after [ or before ].'
StyleGuide: '#no-spaces-braces'
Enabled: true
Layout/SpaceInsideHashLiteralBraces:
Description: "Use spaces inside hash literal braces - or don't."
StyleGuide: '#spaces-operators'
Enabled: true
Layout/SpaceInsideParens:
Description: 'No spaces after ( or before ).'
StyleGuide: '#no-spaces-braces'
Enabled: true
Layout/SpaceInsideRangeLiteral:
Description: 'No spaces inside range literals.'
StyleGuide: '#no-space-inside-range-literals'
Enabled: true
Layout/Tab:
Description: 'No hard tabs.'
StyleGuide: '#spaces-indentation'
Enabled: true
Layout/TrailingEmptyLines:
Description: 'Checks trailing blank lines and final newline.'
StyleGuide: '#newline-eof'
Enabled: true
Layout/TrailingWhitespace:
Description: 'Avoid trailing whitespace.'
StyleGuide: '#no-trailing-whitespace'
Enabled: true
#################### Style ###############################
Style/AndOr:
Description: 'Use &&/|| instead of and/or.'
StyleGuide: '#no-and-or-or'
Enabled: true
Style/BlockComments:
Description: 'Do not use block comments.'
StyleGuide: '#no-block-comments'
Enabled: true
Style/BlockDelimiters:
Description: >-
Avoid using {...} for multi-line blocks (multiline chaining is
always ugly).
Prefer {...} over do...end for single-line blocks.
StyleGuide: '#single-line-blocks'
Enabled: true
Style/BracesAroundHashParameters:
Description: 'Enforce braces style around hash parameters.'
Enabled: true
Style/ClassMethods:
Description: 'Use self when defining module/class methods.'
StyleGuide: '#def-self-class-methods'
Enabled: true
Style/CommentAnnotation:
Description: >-
Checks formatting of special comments
(TODO, FIXME, OPTIMIZE, HACK, REVIEW).
StyleGuide: '#annotate-keywords'
Enabled: false
Style/DefWithParentheses:
Description: 'Use def with parentheses when there are arguments.'
StyleGuide: '#method-parens'
Enabled: true
Style/EachForSimpleLoop:
Description: >-
Use `Integer#times` for a simple loop which iterates a fixed
number of times.
Enabled: true
Style/EmptyElse:
Description: 'Avoid empty else-clauses.'
Enabled: true
Style/EmptyCaseCondition:
Description: 'Avoid empty condition in case statements.'
Enabled: true
Style/For:
Description: 'Checks use of for or each in multiline loops.'
StyleGuide: '#no-for-loops'
Enabled: true
Style/GlobalVars:
Description: 'Do not introduce global variables.'
StyleGuide: '#instance-vars'
Reference: 'http://www.zenspider.com/Languages/Ruby/QuickRef.html'
Enabled: true
Style/GuardClause:
Description: 'Check for conditionals that can be replaced with guard clauses'
StyleGuide: '#no-nested-conditionals'
Enabled: true
Style/HashSyntax:
Description: >-
Prefer Ruby 1.9 hash syntax { a: 1, b: 2 } over 1.8 syntax
{ :a => 1, :b => 2 }.
StyleGuide: '#hash-literals'
Enabled: true
Style/IfInsideElse:
Description: 'Finds if nodes inside else, which can be converted to elsif.'
Enabled: true
Style/IfUnlessModifier:
Description: >-
Favor modifier if/unless usage when you have a
single-line body.
StyleGuide: '#if-as-a-modifier'
Enabled: true
Style/IfUnlessModifierOfIfUnless:
Description: >-
Avoid modifier if/unless usage on conditionals.
Enabled: true
Style/IdenticalConditionalBranches:
Description: >-
Checks that conditional statements do not have an identical
line at the end of each branch, which can validly be moved
out of the conditional.
Enabled: true
Layout/FirstArrayElementIndentation:
EnforcedStyle: consistent
Description: >-
Checks the indentation of the first element in an array
literal.
Enabled: true
Layout/FirstHashElementIndentation:
EnforcedStyle: consistent
Description: 'Checks the indentation of the first key in a hash literal.'
Enabled: true
Style/LineEndConcatenation:
Description: >-
Use \ instead of + or << to concatenate two string literals at
line end.
Enabled: true
Style/MethodCallWithoutArgsParentheses:
Description: 'Do not use parentheses for method calls with no arguments.'
StyleGuide: '#method-invocation-parens'
Enabled: true
Style/MethodDefParentheses:
Description: >-
Checks if the method definitions have or don't have
parentheses.
StyleGuide: '#method-parens'
Enabled: true
Style/MutableConstant:
Description: 'Do not assign mutable objects to constants.'
Enabled: true
Style/NegatedIf:
Description: >-
Favor unless over if for negative conditions
(or control flow or).
StyleGuide: '#unless-for-negatives'
Enabled: true
Style/NestedTernaryOperator:
Description: 'Use one expression per branch in a ternary operator.'
StyleGuide: '#no-nested-ternary'
Enabled: true
Style/Next:
Description: 'Use `next` to skip iteration instead of a condition at the end.'
StyleGuide: '#no-nested-conditionals'
Enabled: true
Style/NonNilCheck:
Description: 'Checks for redundant nil checks.'
StyleGuide: '#no-non-nil-checks'
Enabled: true
Style/Not:
Description: 'Use ! instead of not.'
StyleGuide: '#bang-not-not'
Enabled: true
Style/OneLineConditional:
Description: >-
Favor the ternary operator(?:) over
if/then/else/end constructs.
StyleGuide: '#ternary-operator'
Enabled: true
Style/OptionalArguments:
Description: >-
Checks for optional arguments that do not appear at the end
of the argument list
StyleGuide: '#optional-arguments'
Enabled: true
Style/RedundantParentheses:
Description: "Checks for parentheses that seem not to serve any purpose."
Enabled: true
Style/RedundantReturn:
Description: "Don't use return where it's not required."
StyleGuide: '#no-explicit-return'
Enabled: true
Style/RedundantSelf:
Description: "Don't use self where it's not needed."
StyleGuide: '#no-self-unless-required'
Enabled: true
Style/SafeNavigation:
Description: >-
This cop transforms usages of a method call safeguarded by
a check for the existance of the object to
safe navigation (`&.`).
Enabled: true
Style/StringLiterals:
Description: 'Checks if uses of quotes match the configured preference.'
StyleGuide: '#consistent-string-literals'
Enabled: true
Style/SymbolLiteral:
Description: 'Use plain symbols instead of string symbols when possible.'
Enabled: true
Style/SymbolProc:
Description: 'Use symbols as procs instead of blocks when possible.'
Enabled: true
Style/TrivialAccessors:
Description: 'Prefer attr_* methods to trivial readers/writers.'
StyleGuide: '#attr_family'
Enabled: true
Style/WhileUntilModifier:
Description: >-
Favor modifier while/until usage when you have a
single-line body.
StyleGuide: '#while-as-a-modifier'
Enabled: true
#################### Metrics ###############################
Metrics/LineLength:
Description: 'Limit lines to 120 characters.'
StyleGuide: '#80-character-limits'
Max: 120
Enabled: true
#################### Naming ###############################
Naming/ClassAndModuleCamelCase:
Description: 'Use CamelCase for classes and modules.'
StyleGuide: '#camelcase-classes'
Enabled: true
Naming/ConstantName:
Description: 'Constants should use SCREAMING_SNAKE_CASE.'
StyleGuide: '#screaming-snake-case'
Enabled: true
Naming/FileName:
Description: 'Use snake_case for source file names.'
StyleGuide: '#snake-case-files'
Enabled: true
Naming/MethodName:
Description: 'Use the configured style when naming methods.'
StyleGuide: '#snake-case-symbols-methods-vars'
Enabled: true
Naming/VariableName:
Description: 'Use the configured style when naming variables.'
StyleGuide: '#snake-case-symbols-methods-vars'
Enabled: true
#################### Lint ##################################
Lint/Debugger:
Description: 'Check for debugger calls.'
Enabled: true
Lint/DeprecatedClassMethods:
Description: 'Check for deprecated class method calls.'
Enabled: true
Lint/DuplicateCaseCondition:
Description: 'Do not repeat values in case conditionals.'
Enabled: true
Lint/DuplicateMethods:
Description: 'Check for duplicate method definitions.'
Enabled: true
Lint/DuplicateHashKey:
Description: 'Check for duplicate keys in hash literals.'
Enabled: true
Lint/EmptyExpression:
Description: 'Checks for empty expressions.'
Enabled: true
Lint/EmptyInterpolation:
Description: 'Checks for empty string interpolation.'
Enabled: true
Lint/EmptyWhen:
Description: 'Checks for `when` branches with empty bodies.'
Enabled: true
Lint/EnsureReturn:
Description: 'Do not use return in an ensure block.'
StyleGuide: '#no-return-ensure'
Enabled: true
Lint/FloatOutOfRange:
Description: >-
Catches floating-point literals too large or small for Ruby to
represent.
Enabled: true
Lint/ImplicitStringConcatenation:
Description: >-
Checks for adjacent string literals on the same line, which
could better be represented as a single string literal.
Enabled: true
Lint/IneffectiveAccessModifier:
Description: >-
Checks for attempts to use `private` or `protected` to set
the visibility of a class method, which does not work.
Enabled: true
Lint/InheritException:
Description: 'Avoid inheriting from the `Exception` class.'
Enabled: true
Lint/MultipleComparison:
Description: "Use `&&` operator to compare multiple value."
Enabled: true
Lint/ParenthesesAsGroupedExpression:
Description: >-
Checks for method calls with a space before the opening
parenthesis.
StyleGuide: '#parens-no-spaces'
Enabled: true
Lint/RequireParentheses:
Description: >-
Use parentheses in the method call to avoid confusion
about precedence.
Enabled: true
Lint/RescueException:
Description: 'Avoid rescuing the Exception class.'
StyleGuide: '#no-blind-rescues'
Enabled: true
Lint/SafeNavigationChain:
Description: 'Do not chain ordinary method call after safe navigation operator.'
Enabled: true
Lint/ShadowedException:
Description: >-
Avoid rescuing a higher level exception
before a lower level exception.
Enabled: true
Lint/ShadowingOuterLocalVariable:
Description: >-
Do not use the same name as outer local variable
for block arguments or block local variables.
Enabled: true
Lint/UnusedBlockArgument:
Description: 'Checks for unused block arguments.'
StyleGuide: '#underscore-unused-vars'
Enabled: true
Lint/UnusedMethodArgument:
Description: 'Checks for unused method arguments.'
StyleGuide: '#underscore-unused-vars'
Enabled: true
Lint/UnreachableCode:
Description: 'Unreachable code.'
Enabled: true
Lint/UselessAccessModifier:
Description: 'Checks for useless access modifiers.'
Enabled: true
ContextCreatingMethods: []
MethodCreatingMethods: []
Lint/UselessAssignment:
Description: 'Checks for useless assignment to a local variable.'
StyleGuide: '#underscore-unused-vars'
Enabled: true
Lint/UselessComparison:
Description: 'Checks for comparison of something with itself.'
Enabled: true
Lint/UselessElseWithoutRescue:
Description: 'Checks for useless `else` in `begin..end` without `rescue`.'
Enabled: true
Lint/UselessSetterCall:
Description: 'Checks for useless setter call to a local variable.'
Enabled: true
#################### Rails #################################
Rails/SafeNavigation:
Description: "Use Ruby's safe navigation operator (`&.`) instead of `try!`"
Enabled: true
#################### Security ##############################
Security/Eval:
Description: 'The use of eval represents a serious security risk.'
Enabled: true
#################### Bundler ###############################
Bundler/DuplicatedGem:
Description: 'Checks for duplicate gem entries in Gemfile.'
Enabled: true
Include:
- '**/Gemfile'
- '**/gems.rb'
Bundler/OrderedGems:
Description: >-
Gems within groups in the Gemfile should be alphabetically sorted.
Enabled: true
Include:
- '**/Gemfile'
- '**/gems.rb'