.rubocop.yml 27.3 KB
Newer Older
R
Robert Speicher 已提交
1 2
require: rubocop-rspec

3 4 5 6 7 8 9 10 11 12 13 14 15
AllCops:
  TargetRubyVersion: 2.1
  # Cop names are not displayed in offense messages by default. Change behavior
  # by overriding DisplayCopNames, or by giving the -D/--display-cop-names
  # option.
  DisplayCopNames: true
  # Style guide URLs are not displayed in offense messages by default. Change
  # behavior by overriding DisplayStyleGuide, or by giving the
  # -S/--display-style-guide option.
  DisplayStyleGuide: false
  # Exclude some GitLab files
  Exclude:
    - 'vendor/**/*'
S
Sean McGivern 已提交
16 17
    - 'db/*'
    - 'db/fixtures/**/*'
18 19 20 21 22 23 24 25 26
    - 'tmp/**/*'
    - 'bin/**/*'
    - 'lib/backup/**/*'
    - 'lib/ci/backup/**/*'
    - 'lib/tasks/**/*'
    - 'lib/ci/migrate/**/*'
    - 'lib/email_validator.rb'
    - 'lib/gitlab/upgrader.rb'
    - 'lib/gitlab/seeder.rb'
27
    - 'generator_templates/**/*'
28 29 30 31 32


##################### Style ##################################

# Check indentation of private/protected visibility modifiers.
33
Style/AccessModifierIndentation:
34
  Enabled: true
35

36
# Check the naming of accessor methods for get_/set_.
37
Style/AccessorMethodName:
38
  Enabled: false
39

40
# Use alias_method instead of alias.
41
Style/Alias:
42
  EnforcedStyle: prefer_alias_method
43
  Enabled: true
44

45
# Align the elements of an array literal if they span more than one line.
46
Style/AlignArray:
47
  Enabled: true
48

49
# Align the elements of a hash literal if they span more than one line.
50
Style/AlignHash:
51
  Enabled: true
52

53
# Align the parameters of a method call if they span more than one line.
54
Style/AlignParameters:
55
  Enabled: false
56

57
# Use &&/|| instead of and/or.
58
Style/AndOr:
59
  Enabled: false
60

61
# Use `Array#join` instead of `Array#*`.
62
Style/ArrayJoin:
63
  Enabled: true
64

65
# Use only ascii symbols in comments.
66
Style/AsciiComments:
67
  Enabled: true
68

69
# Use only ascii symbols in identifiers.
70
Style/AsciiIdentifiers:
71
  Enabled: true
72

73
# Checks for uses of Module#attr.
74
Style/Attr:
75
  Enabled: true
76

77
# Avoid the use of BEGIN blocks.
78
Style/BeginBlock:
D
Dmitriy Zaporozhets 已提交
79
  Enabled: true
80

81
# Checks if usage of %() or %Q() matches configuration.
82 83 84
Style/BarePercentLiterals:
  Enabled: false

85
# Do not use block comments.
86
Style/BlockComments:
87
  Enabled: true
88

89
# Put end statement of multiline block on its own line.
90
Style/BlockEndNewline:
91
  Enabled: true
92

93 94
# Avoid using {...} for multi-line blocks (multiline chaining is # always
# ugly). Prefer {...} over do...end for single-line blocks.
95
Style/BlockDelimiters:
96
  Enabled: true
97

98
# Enforce braces style around hash parameters.
99 100 101
Style/BracesAroundHashParameters:
  Enabled: false

102
# Avoid explicit use of the case equality operator(===).
103 104 105
Style/CaseEquality:
  Enabled: false

106
# Indentation of when in a case/when/[else/]end.
107
Style/CaseIndentation:
108
  Enabled: true
109

110
# Checks for uses of character literals.
111
Style/CharacterLiteral:
D
Dmitriy Zaporozhets 已提交
112
  Enabled: true
113

114
# Use CamelCase for classes and modules.'
115
Style/ClassAndModuleCamelCase:
D
Dmitriy Zaporozhets 已提交
116
  Enabled: true
117

118
# Checks style of children classes and modules.
119 120 121
Style/ClassAndModuleChildren:
  Enabled: false

122
# Enforces consistent use of `Object#is_a?` or `Object#kind_of?`.
123 124 125
Style/ClassCheck:
  Enabled: false

126
# Use self when defining module/class methods.
127
Style/ClassMethods:
128
  Enabled: true
129

130
# Avoid the use of class variables.
131
Style/ClassVars:
D
Dmitriy Zaporozhets 已提交
132
  Enabled: true
133

134
# Do not use :: for method call.
135 136 137
Style/ColonMethodCall:
  Enabled: false

138
# Checks formatting of special comments (TODO, FIXME, OPTIMIZE, HACK, REVIEW).
139 140 141
Style/CommentAnnotation:
  Enabled: false

142
# Indentation of comments.
143
Style/CommentIndentation:
144
  Enabled: true
145

146 147 148 149 150 151 152
# 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.
Style/ConditionalAssignment:
  Enabled: false

# Constants should use SCREAMING_SNAKE_CASE.
153
Style/ConstantName:
154
  Enabled: true
155

156
# Use def with parentheses when there are arguments.
157
Style/DefWithParentheses:
158
  Enabled: true
159

160
# Checks for use of deprecated Hash methods.
161 162 163
Style/DeprecatedHashMethods:
  Enabled: false

164
# Document classes and non-namespace modules.
165 166 167
Style/Documentation:
  Enabled: false

168
# Checks the position of the dot in multi-line method calls.
169 170 171
Style/DotPosition:
  Enabled: false

172
# Checks for uses of double negation (!!).
173 174 175
Style/DoubleNegation:
  Enabled: false

176
# Prefer `each_with_object` over `inject` or `reduce`.
177 178 179
Style/EachWithObject:
  Enabled: false

180
# Align elses and elsifs correctly.
181
Style/ElseAlignment:
182
  Enabled: true
183

184
# Avoid empty else-clauses.
185 186 187
Style/EmptyElse:
  Enabled: false

188
# Use empty lines between defs.
189 190 191
Style/EmptyLineBetweenDefs:
  Enabled: false

192
# Don't use several empty lines in a row.
193 194 195
Style/EmptyLines:
  Enabled: false

196
# Keep blank lines around access modifiers.
197
Style/EmptyLinesAroundAccessModifier:
198
  Enabled: true
199

200
# Keeps track of empty lines around block bodies.
201 202 203
Style/EmptyLinesAroundBlockBody:
  Enabled: false

204
# Keeps track of empty lines around class bodies.
205 206 207
Style/EmptyLinesAroundClassBody:
  Enabled: false

208
# Keeps track of empty lines around module bodies.
209 210 211
Style/EmptyLinesAroundModuleBody:
  Enabled: false

212
# Keeps track of empty lines around method bodies.
213 214 215
Style/EmptyLinesAroundMethodBody:
  Enabled: false

216
# Prefer literals to Array.new/Hash.new/String.new.
217 218 219
Style/EmptyLiteral:
  Enabled: false

220
# Avoid the use of END blocks.
221
Style/EndBlock:
222
  Enabled: true
223

224
# Use Unix-style line endings.
225
Style/EndOfLine:
226
  Enabled: true
227

228
# Favor the use of Fixnum#even? && Fixnum#odd?
229
Style/EvenOdd:
230
  Enabled: true
231

232
# Do not use unnecessary spacing.
233 234 235
Style/ExtraSpacing:
  Enabled: false

236
# Use snake_case for source file names.
237
Style/FileName:
238 239 240
  Enabled: true

# Checks for a line break before the first parameter in a multi-line method
241
# parameter definition.
242 243
Style/FirstMethodParameterLineBreak:
  Enabled: true
244

245
# Checks for flip flops.
246
Style/FlipFlop:
247
  Enabled: true
248

249
# Checks use of for or each in multiline loops.
250
Style/For:
G
Grzegorz Bizon 已提交
251
  Enabled: true
252

253
# Enforce the use of Kernel#sprintf, Kernel#format or String#%.
254 255 256
Style/FormatString:
  Enabled: false

257
# Do not introduce global variables.
258
Style/GlobalVars:
259
  Enabled: true
260

261
# Check for conditionals that can be replaced with guard clauses.
262 263 264
Style/GuardClause:
  Enabled: false

265 266
# Prefer Ruby 1.9 hash syntax `{ a: 1, b: 2 }`
# over 1.8 syntax `{ :a => 1, :b => 2 }`.
267
Style/HashSyntax:
268
  Enabled: true
269

270 271 272 273 274
# Finds if nodes inside else, which can be converted to elsif.
Style/IfInsideElse:
  Enabled: false

# Favor modifier if/unless usage when you have a single-line body.
275 276 277
Style/IfUnlessModifier:
  Enabled: false

278
# Do not use if x; .... Use the ternary operator instead.
279
Style/IfWithSemicolon:
280
  Enabled: true
281

282 283 284 285 286 287
# 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.
Style/IdenticalConditionalBranches:
  Enabled: false

# Checks the indentation of the first line of the right-hand-side of a
G
Gabriel Mazetto 已提交
288
# multi-line assignment.
289
Style/IndentAssignment:
290
  Enabled: true
291 292

# Keep indentation straight.
293
Style/IndentationConsistency:
294
  Enabled: true
295

296
# Use 2 spaces for indentation.
297
Style/IndentationWidth:
298
  Enabled: true
299

300
# Checks the indentation of the first element in an array literal.
301 302 303
Style/IndentArray:
  Enabled: false

304
# Checks the indentation of the first key in a hash literal.
305 306 307
Style/IndentHash:
  Enabled: false

308
# Use Kernel#loop for infinite loops.
309
Style/InfiniteLoop:
310
  Enabled: true
311

312
# Use the new lambda literal syntax for single-line blocks.
313 314 315
Style/Lambda:
  Enabled: false

316
# Use lambda.call(...) instead of lambda.(...).
317
Style/LambdaCall:
318
  Enabled: true
319

320
# Comments should start with a space.
321
Style/LeadingCommentSpace:
F
Felipe Artur 已提交
322
  Enabled: true
323

324
# Use \ instead of + or << to concatenate two string literals at line end.
325 326 327
Style/LineEndConcatenation:
  Enabled: false

328
# Do not use parentheses for method calls with no arguments.
329 330 331
Style/MethodCallParentheses:
  Enabled: false

332
# Checks if the method definitions have or don't have parentheses.
333
Style/MethodDefParentheses:
334
  Enabled: true
335

336
# Use the configured style when naming methods.
337
Style/MethodName:
338
  Enabled: true
339

340
# Checks for usage of `extend self` in modules.
341 342 343
Style/ModuleFunction:
  Enabled: false

R
Robert Speicher 已提交
344 345 346 347 348 349
# Checks that the closing brace in an array literal is either on the same line
# as the last array element, or a new line.
Style/MultilineArrayBraceLayout:
  Enabled: false
  EnforcedStyle: symmetrical

350
# Avoid multi-line chains of blocks.
351
Style/MultilineBlockChain:
352
  Enabled: true
353

354
# Ensures newlines after multiline block do statements.
355
Style/MultilineBlockLayout:
356
  Enabled: true
357

R
Robert Speicher 已提交
358 359 360 361 362 363
# Checks that the closing brace in a hash literal is either on the same line as
# the last hash element, or a new line.
Style/MultilineHashBraceLayout:
  Enabled: false
  EnforcedStyle: symmetrical

364
# Do not use then for multi-line if/unless.
365
Style/MultilineIfThen:
366
  Enabled: true
367

R
Robert Speicher 已提交
368 369 370 371 372 373
# Checks that the closing brace in a method call is either on the same line as
# the last method argument, or a new line.
Style/MultilineMethodCallBraceLayout:
  Enabled: false
  EnforcedStyle: symmetrical

374 375 376 377 378
# Checks indentation of method calls with the dot operator that span more than
# one line.
Style/MultilineMethodCallIndentation:
  Enabled: false

379 380 381 382 383
# Checks that the closing brace in a method definition is symmetrical with
# respect to the opening brace and the method parameters.
Style/MultilineMethodDefinitionBraceLayout:
  Enabled: false

384
# Checks indentation of binary operations that span more than one line.
385 386 387
Style/MultilineOperationIndentation:
  Enabled: false

388
# Avoid multi-line `? :` (the ternary operator), use if/unless instead.
389 390 391
Style/MultilineTernaryOperator:
  Enabled: false

392 393 394 395 396
# Do not assign mutable objects to constants.
Style/MutableConstant:
  Enabled: false

# Favor unless over if for negative conditions (or control flow or).
397
Style/NegatedIf:
398
  Enabled: true
399

400
# Favor until over while for negative conditions.
401 402 403
Style/NegatedWhile:
  Enabled: false

404 405
# Avoid using nested modifiers.
Style/NestedModifier:
406
  Enabled: true
407 408 409 410 411 412 413

# Parenthesize method calls which are nested inside the argument list of
# another parenthesized method call.
Style/NestedParenthesizedCalls:
  Enabled: false

# Use one expression per branch in a ternary operator.
414
Style/NestedTernaryOperator:
415
  Enabled: true
416

417
# Use `next` to skip iteration instead of a condition at the end.
418 419 420
Style/Next:
  Enabled: false

421
# Prefer x.nil? to x == nil.
422
Style/NilComparison:
423
  Enabled: true
424

425
# Checks for redundant nil checks.
426
Style/NonNilCheck:
427
  Enabled: true
428

429
# Use ! instead of not.
430
Style/Not:
431
  Enabled: true
432

433
# Add underscores to large numeric literals to improve their readability.
434 435 436
Style/NumericLiterals:
  Enabled: false

437
# Favor the ternary operator(?:) over if/then/else/end constructs.
438
Style/OneLineConditional:
439
  Enabled: true
440

441
# When defining binary operators, name the argument other.
442
Style/OpMethod:
443
  Enabled: true
444

445 446
# Check for simple usages of parallel assignment. It will only warn when
# the number of variables matches on both sides of the assignment.
447 448 449
Style/ParallelAssignment:
  Enabled: false

450
# Don't use parentheses around the condition of an if/unless/while.
451
Style/ParenthesesAroundCondition:
452
  Enabled: true
453

454
# Use `%`-literal delimiters consistently.
455 456 457
Style/PercentLiteralDelimiters:
  Enabled: false

458
# Checks if uses of %Q/%q match the configured preference.
459 460 461
Style/PercentQLiterals:
  Enabled: false

462
# Avoid Perl-style regex back references.
463 464 465
Style/PerlBackrefs:
  Enabled: false

466
# Check the names of predicate methods.
467 468 469
Style/PredicateName:
  Enabled: false

470
# Use proc instead of Proc.new.
471 472 473
Style/Proc:
  Enabled: false

474
# Checks the arguments passed to raise/fail.
475 476 477
Style/RaiseArgs:
  Enabled: false

478
# Don't use begin blocks when they are not needed.
479 480 481
Style/RedundantBegin:
  Enabled: false

482
# Checks for an obsolete RuntimeException argument in raise/fail.
483 484 485
Style/RedundantException:
  Enabled: false

486 487 488 489 490 491
# Checks usages of Object#freeze on immutable objects.
Style/RedundantFreeze:
  Enabled: false

# Checks for parentheses that seem not to serve any purpose.
Style/RedundantParentheses:
492
  Enabled: true
493 494

# Don't use return where it's not required.
495
Style/RedundantReturn:
496
  Enabled: true
497

498
# Don't use self where it's not needed.
499 500 501
Style/RedundantSelf:
  Enabled: false

502 503 504
# Use %r for regular expressions matching more than `MaxSlashes` '/'
# characters. Use %r only for regular expressions matching more
# than `MaxSlashes` '/' character.
505 506 507
Style/RegexpLiteral:
  Enabled: false

508
# Avoid using rescue in its modifier form.
509 510 511
Style/RescueModifier:
  Enabled: false

512
# Checks for places where self-assignment shorthand should have been used.
513 514 515
Style/SelfAssignment:
  Enabled: false

516
# Don't use semicolons to terminate expressions.
517
Style/Semicolon:
518
  Enabled: true
519

520
# Checks for proper usage of fail and raise.
521
Style/SignalException:
522 523
  EnforcedStyle: only_raise
  Enabled: true
524

525
# Enforces the names of some block params.
526 527 528
Style/SingleLineBlockParams:
  Enabled: false

529
# Avoid single-line methods.
530 531 532
Style/SingleLineMethods:
  Enabled: false

533
# Use spaces after colons.
534 535 536
Style/SpaceAfterColon:
  Enabled: false

537
# Use spaces after commas.
538 539 540
Style/SpaceAfterComma:
  Enabled: false

541 542
# Do not put a space between a method name and the opening parenthesis in a
# method definition.
543
Style/SpaceAfterMethodName:
544
  Enabled: true
545

546
# Tracks redundant space after the ! operator.
547
Style/SpaceAfterNot:
548
  Enabled: true
549

550
# Use spaces after semicolons.
551
Style/SpaceAfterSemicolon:
552
  Enabled: true
553

554 555 556
# Checks that the equals signs in parameter default assignments have or don't
# have surrounding space depending on configuration.
Style/SpaceAroundEqualsInParameterDefault:
557 558
  Enabled: false

559 560
# Use a space around keywords if appropriate.
Style/SpaceAroundKeyword:
561
  Enabled: true
562

563 564
# Use a single space around operators.
Style/SpaceAroundOperators:
G
Gabriel Mazetto 已提交
565
  Enabled: true
566

567 568
# Checks that the left block brace has or doesn't have space before it.
Style/SpaceBeforeBlockBraces:
569 570
  Enabled: false

571 572
# No spaces before commas.
Style/SpaceBeforeComma:
573
  Enabled: true
574

575 576
# Checks for missing space between code and a comment on the same line.
Style/SpaceBeforeComment:
577
  Enabled: true
578

579 580 581 582 583 584 585
# Checks that exactly one space is used between a method name and the first
# argument for method calls without parentheses.
Style/SpaceBeforeFirstArg:
  Enabled: false

# No spaces before semicolons.
Style/SpaceBeforeSemicolon:
586
  Enabled: true
587

588 589 590 591
# 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.
Style/SpaceInsideBlockBraces:
592 593
  Enabled: false

594
# No spaces after [ or before ].
595 596 597
Style/SpaceInsideBrackets:
  Enabled: false

598
# Use spaces inside hash literal braces - or don't.
599
Style/SpaceInsideHashLiteralBraces:
600
  Enabled: true
601

602
# No spaces after ( or before ).
603 604 605
Style/SpaceInsideParens:
  Enabled: false

606
# No spaces inside range literals.
607
Style/SpaceInsideRangeLiteral:
608
  Enabled: true
609

610 611
# Checks for padding/surrounding spaces inside string interpolation.
Style/SpaceInsideStringInterpolation:
612 613
  EnforcedStyle: no_space
  Enabled: true
614 615

# Avoid Perl-style global variables.
616 617 618
Style/SpecialGlobalVars:
  Enabled: false

619 620
# Check for the usage of parentheses around stabby lambda arguments.
Style/StabbyLambdaParentheses:
621 622
  EnforcedStyle: require_parentheses
  Enabled: true
623 624

# Checks if uses of quotes match the configured preference.
625 626 627
Style/StringLiterals:
  Enabled: false

628 629
# Checks if uses of quotes inside expressions in interpolated strings match the
# configured preference.
630 631 632
Style/StringLiteralsInInterpolation:
  Enabled: false

633 634
# Checks if configured preferred methods are used over non-preferred.
Style/StringMethods:
635 636 637
  PreferredMethods:
    intern: to_sym
  Enabled: true
638 639 640 641 642 643

# Use %i or %I for arrays of symbols.
Style/SymbolArray:
  Enabled: false

# Use symbols as procs instead of blocks when possible.
644 645 646
Style/SymbolProc:
  Enabled: false

647
# No hard tabs.
648
Style/Tab:
D
Dmitriy Zaporozhets 已提交
649
  Enabled: true
650

651
# Checks trailing blank lines and final newline.
652
Style/TrailingBlankLines:
653
  Enabled: true
654

655 656
# Checks for trailing comma in array and hash literals.
Style/TrailingCommaInLiteral:
657 658
  Enabled: false

659 660 661 662 663
# Checks for trailing comma in argument lists.
Style/TrailingCommaInArguments:
  Enabled: false

# Avoid trailing whitespace.
664 665 666
Style/TrailingWhitespace:
  Enabled: false

667 668
# Checks for the usage of unneeded trailing underscores at the end of
# parallel variable assignment.
669 670 671
Style/TrailingUnderscoreVariable:
  Enabled: false

672
# Prefer attr_* methods to trivial readers/writers.
673 674 675
Style/TrivialAccessors:
  Enabled: false

676
# Do not use unless with else. Rewrite these with the positive case first.
677 678 679
Style/UnlessElse:
  Enabled: false

680
# Checks for %W when interpolation is not needed.
681 682 683
Style/UnneededCapitalW:
  Enabled: false

684 685 686 687 688 689
# TODO: Enable UnneededInterpolation Cop.
# Checks for strings that are just an interpolated expression.
Style/UnneededInterpolation:
  Enabled: false

# Checks for %q/%Q when single quotes or double quotes would do.
690 691 692
Style/UnneededPercentQ:
  Enabled: false

693
# Don't interpolate global, instance and class variables directly in strings.
694
Style/VariableInterpolation:
695
  Enabled: true
696

697
# Use the configured style when naming variables.
698
Style/VariableName:
699 700
  EnforcedStyle: snake_case
  Enabled: true
701

702
# Use when x then ... for one-line cases.
703
Style/WhenThen:
704
  Enabled: true
705

706
# Checks for redundant do after while or until.
707
Style/WhileUntilDo:
708
  Enabled: true
709

710
# Favor modifier while/until usage when you have a single-line body.
711
Style/WhileUntilModifier:
712
  Enabled: true
713

714
# Use %w or %W for arrays of words.
715 716 717
Style/WordArray:
  Enabled: false

718 719 720 721 722 723
# TODO: Enable ZeroLengthPredicate Cop.
# Use #empty? when testing for objects of length 0.
Style/ZeroLengthPredicate:
  Enabled: false


724 725
#################### Metrics ################################

726 727
# A calculated magnitude based on number of assignments,
# branches, and conditions.
728
Metrics/AbcSize:
G
Grzegorz Bizon 已提交
729
  Enabled: true
730
  Max: 60
G
Grzegorz Bizon 已提交
731

732
# Avoid excessive block nesting.
733
Metrics/BlockNesting:
G
Grzegorz Bizon 已提交
734 735
  Enabled: true
  Max: 4
736

737
# Avoid classes longer than 100 lines of code.
738 739 740
Metrics/ClassLength:
  Enabled: false

741 742 743 744 745 746 747
# A complexity metric that is strongly correlated to the number
# of test cases needed to validate a method.
Metrics/CyclomaticComplexity:
  Enabled: true
  Max: 17

# Limit lines to 80 characters.
748 749 750
Metrics/LineLength:
  Enabled: false

751
# Avoid methods longer than 10 lines of code.
752 753 754
Metrics/MethodLength:
  Enabled: false

755
# Avoid modules longer than 100 lines of code.
756 757 758
Metrics/ModuleLength:
  Enabled: false

759 760 761 762 763 764 765 766
# Avoid parameter lists longer than three or four parameters.
Metrics/ParameterLists:
  Enabled: true
  Max: 8

# A complexity metric geared towards measuring complexity for a human reader.
Metrics/PerceivedComplexity:
  Enabled: true
V
Valery Sizov 已提交
767
  Max: 18
768 769


770 771
#################### Lint ################################

772 773
# Checks for ambiguous operators in the first argument of a method invocation
# without parentheses.
774
Lint/AmbiguousOperator:
775
  Enabled: true
776

777 778
# Checks for ambiguous regexp literals in the first argument of a method
# invocation without parentheses.
779 780 781
Lint/AmbiguousRegexpLiteral:
  Enabled: false

782
# Don't use assignment in conditions.
783 784 785
Lint/AssignmentInCondition:
  Enabled: false

786
# Align block ends correctly.
787
Lint/BlockAlignment:
788
  Enabled: true
789

790 791 792
# Default values in optional keyword arguments and optional ordinal arguments
# should not refer back to the name of the argument.
Lint/CircularArgumentReference:
793
  Enabled: true
794 795

# Checks for condition placed in a confusing position relative to the keyword.
796
Lint/ConditionPosition:
797
  Enabled: true
798

799
# Check for debugger calls.
800
Lint/Debugger:
801
  Enabled: true
802

803
# Align ends corresponding to defs correctly.
804
Lint/DefEndAlignment:
805
  Enabled: true
806

807
# Check for deprecated class method calls.
808
Lint/DeprecatedClassMethods:
809
  Enabled: true
810

811 812 813 814 815 816 817 818 819 820
# Check for duplicate method definitions.
Lint/DuplicateMethods:
  Enabled: false

# Check for duplicate keys in hash literals.
Lint/DuplicatedKey:
  Enabled: false

# Check for immutable argument given to each_with_object.
Lint/EachWithObjectArgument:
821
  Enabled: true
822 823

# Check for odd code arrangement in an else block.
824
Lint/ElseLayout:
825
  Enabled: true
826

827
# Checks for empty ensure block.
828
Lint/EmptyEnsure:
829
  Enabled: true
830

831
# Checks for empty string interpolation.
832 833 834
Lint/EmptyInterpolation:
  Enabled: false

835
# Align ends correctly.
836
Lint/EndAlignment:
837
  Enabled: true
838

839
# END blocks should not be placed inside method definitions.
840
Lint/EndInMethod:
841
  Enabled: true
842

843
# Do not use return in an ensure block.
844
Lint/EnsureReturn:
845
  Enabled: true
846

847
# The use of eval represents a serious security risk.
848
Lint/Eval:
849
  Enabled: true
850

851 852
# Catches floating-point literals too large or small for Ruby to represent.
Lint/FloatOutOfRange:
853
  Enabled: true
854 855 856

# The number of parameters to format/sprint must match the fields.
Lint/FormatParameterMismatch:
857
  Enabled: true
858 859

# Don't suppress exception.
860 861 862
Lint/HandleExceptions:
  Enabled: false

863 864 865
# Checks for adjacent string literals on the same line, which could better be
# represented as a single string literal.
Lint/ImplicitStringConcatenation:
866
  Enabled: true
867 868 869 870 871 872 873 874 875

# TODO: Enable IneffectiveAccessModifier Cop.
# Checks for attempts to use `private` or `protected` to set the visibility
# of a class method, which does not work.
Lint/IneffectiveAccessModifier:
  Enabled: false

# Checks for invalid character literals with a non-escaped whitespace
# character.
876
Lint/InvalidCharacterLiteral:
877
  Enabled: true
878

879
# Checks of literals used in conditions.
880
Lint/LiteralInCondition:
881
  Enabled: true
882

883
# Checks for literals used in interpolation.
884
Lint/LiteralInInterpolation:
885
  Enabled: true
886

887 888
# Use Kernel#loop with break rather than begin/end/until or begin/end/while
# for post-loop tests.
889 890 891
Lint/Loop:
  Enabled: false

892 893
# Do not use nested method definitions.
Lint/NestedMethodDefinition:
894
  Enabled: true
895 896 897

# Do not omit the accumulator when calling `next` in a `reduce`/`inject` block.
Lint/NextWithoutAccumulator:
898
  Enabled: true
899 900

# Checks for method calls with a space before the opening parenthesis.
901
Lint/ParenthesesAsGroupedExpression:
902
  Enabled: true
903

904 905 906
# Checks for `rand(1)` calls. Such calls always return `0` and most likely
# a mistake.
Lint/RandOne:
907
  Enabled: true
908 909

# Use parentheses in the method call to avoid confusion about precedence.
910
Lint/RequireParentheses:
911
  Enabled: true
912

913
# Avoid rescuing the Exception class.
914
Lint/RescueException:
915
  Enabled: true
916

917 918
# Do not use the same name as outer local variable for block arguments
# or block local variables.
919 920 921
Lint/ShadowingOuterLocalVariable:
  Enabled: false

922
# 'Checks for Object#to_s usage in string interpolation.
923 924 925
Lint/StringConversionInInterpolation:
  Enabled: false

926
# Do not use prefix `_` for a variable that is used.
927
Lint/UnderscorePrefixedVariableName:
928
  Enabled: true
929

930 931 932 933 934 935 936
# Checks for rubocop:disable comments that can be removed.
# Note: this cop is not disabled when disabling all cops.
# It must be explicitly disabled.
Lint/UnneededDisable:
  Enabled: false

# Checks for unused block arguments.
937 938 939
Lint/UnusedBlockArgument:
  Enabled: false

940
# Checks for unused method arguments.
941 942 943
Lint/UnusedMethodArgument:
  Enabled: false

944
# Unreachable code.
945
Lint/UnreachableCode:
946
  Enabled: true
947

948
# Checks for useless access modifiers.
949 950 951
Lint/UselessAccessModifier:
  Enabled: false

952
# Checks for useless assignment to a local variable.
953
Lint/UselessAssignment:
954
  Enabled: true
955

956
# Checks for comparison of something with itself.
957
Lint/UselessComparison:
958
  Enabled: true
959

960
# Checks for useless `else` in `begin..end` without `rescue`.
961
Lint/UselessElseWithoutRescue:
962
  Enabled: true
963

964
# Checks for useless setter call to a local variable.
965
Lint/UselessSetterCall:
966
  Enabled: true
967

968
# Possible use of operator/literal/variable in void context.
969
Lint/Void:
970
  Enabled: true
971

972 973 974 975 976

##################### Performance ############################

# Use `casecmp` rather than `downcase ==`.
Performance/Casecmp:
977
  Enabled: true
978 979 980 981

# Use `str.{start,end}_with?(x, ..., y, ...)` instead of
# `str.{start,end}_with?(x, ...) || str.{start,end}_with?(y, ...)`.
Performance/DoubleStartEndWith:
982
  Enabled: true
983 984 985 986 987 988 989 990

# TODO: Enable EndWith Cop.
# Use `end_with?` instead of a regex match anchored to the end of a string.
Performance/EndWith:
  Enabled: false

# Use `strip` instead of `lstrip.rstrip`.
Performance/LstripRstrip:
C
Connor Shea 已提交
991
  Enabled: true
992 993 994

# Use `Range#cover?` instead of `Range#include?`.
Performance/RangeInclude:
995
  Enabled: true
996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016

# TODO: Enable RedundantBlockCall Cop.
# Use `yield` instead of `block.call`.
Performance/RedundantBlockCall:
  Enabled: false

# TODO: Enable RedundantMatch Cop.
# Use `=~` instead of `String#match` or `Regexp#match` in a context where the
# returned `MatchData` is not needed.
Performance/RedundantMatch:
  Enabled: false

# TODO: Enable RedundantMerge Cop.
# Use `Hash#[]=`, rather than `Hash#merge!` with a single key-value pair.
Performance/RedundantMerge:
  # Max number of key-value pairs to consider an offense
  MaxKeyValuePairs: 2
  Enabled: false

# Use `sort` instead of `sort_by { |x| x }`.
Performance/RedundantSortBy:
1017
  Enabled: true
1018 1019 1020 1021

# Use `start_with?` instead of a regex match anchored to the beginning of a
# string.
Performance/StartWith:
1022
  Enabled: true
C
Connor Shea 已提交
1023

1024 1025 1026 1027
# Use `tr` instead of `gsub` when you are replacing the same number of
# characters. Use `delete` instead of `gsub` when you are deleting
# characters.
Performance/StringReplacement:
C
Connor Shea 已提交
1028
  Enabled: true
1029 1030 1031

# Checks for `.times.map` calls.
Performance/TimesMap:
1032
  Enabled: true
1033 1034


1035 1036
##################### Rails ##################################

1037 1038 1039 1040 1041
# Enables Rails cops.
Rails:
  Enabled: true

# Enforces consistent use of action filter methods.
1042
Rails/ActionFilter:
1043
  Enabled: true
1044
  EnforcedStyle: action
1045

1046 1047
# Checks the correct usage of date aware methods, such as `Date.today`,
# `Date.current`, etc.
G
Gabriel Mazetto 已提交
1048 1049 1050
Rails/Date:
  Enabled: false

1051 1052
# Prefer delegate method for delegations.
Rails/Delegate:
1053 1054
  Enabled: false

1055 1056
# Prefer `find_by` over `where.first`.
Rails/FindBy:
1057
  Enabled: true
1058 1059 1060

# Prefer `all.find_each` over `all.find`.
Rails/FindEach:
1061
  Enabled: true
1062

1063
# Prefer has_many :through to has_and_belongs_to_many.
1064
Rails/HasAndBelongsToMany:
1065
  Enabled: true
1066

1067
# Checks for calls to puts, print, etc.
1068
Rails/Output:
1069
  Enabled: true
1070

1071 1072
# Checks for incorrect grammar when using methods like `3.day.ago`.
Rails/PluralizationGrammar:
1073
  Enabled: true
1074 1075

# Checks for `read_attribute(:attr)` and `write_attribute(:attr, val)`.
1076 1077 1078
Rails/ReadWriteAttribute:
  Enabled: false

1079
# Checks the arguments of ActiveRecord scopes.
1080
Rails/ScopeArgs:
1081
  Enabled: true
1082

1083 1084
# Checks the correct usage of time zone aware methods.
# http://danilenko.org/2012/7/6/rails_timezones
1085 1086 1087
Rails/TimeZone:
  Enabled: false

1088
# Use validates :attribute, hash of validations.
1089 1090
Rails/Validation:
  Enabled: false
R
Robert Speicher 已提交
1091

1092 1093 1094
Rails/UniqBeforePluck:
  Enabled: false

R
Robert Speicher 已提交
1095 1096
##################### RSpec ##################################

1097
# Check that instances are not being stubbed globally.
R
Robert Speicher 已提交
1098 1099 1100
RSpec/AnyInstance:
  Enabled: false

1101 1102
# Check that the first argument to the top level describe is the tested class or
# module.
R
Robert Speicher 已提交
1103 1104 1105
RSpec/DescribeClass:
  Enabled: false

1106
# Use `described_class` for tested class / module.
R
Robert Speicher 已提交
1107 1108 1109
RSpec/DescribeMethod:
  Enabled: false

1110 1111
# Checks that the second argument to top level describe is the tested method
# name.
R
Robert Speicher 已提交
1112 1113 1114
RSpec/DescribedClass:
  Enabled: false

1115
# Checks for long example.
R
Robert Speicher 已提交
1116 1117 1118 1119
RSpec/ExampleLength:
  Enabled: false
  Max: 5

1120
# Do not use should when describing your tests.
R
Robert Speicher 已提交
1121 1122 1123 1124 1125 1126 1127 1128
RSpec/ExampleWording:
  Enabled: false
  CustomTransform:
    be: is
    have: has
    not: does not
  IgnoredWords: []

1129
# Checks the file and folder naming of the spec file.
R
Robert Speicher 已提交
1130 1131 1132 1133 1134 1135
RSpec/FilePath:
  Enabled: false
  CustomTransform:
    RuboCop: rubocop
    RSpec: rspec

1136
# Checks if there are focused specs.
R
Robert Speicher 已提交
1137 1138 1139
RSpec/Focus:
  Enabled: true

1140
# Checks for the usage of instance variables.
R
Robert Speicher 已提交
1141 1142 1143
RSpec/InstanceVariable:
  Enabled: false

1144
# Checks for multiple top-level describes.
R
Robert Speicher 已提交
1145 1146 1147
RSpec/MultipleDescribes:
  Enabled: false

1148
# Enforces the usage of the same method on all negative message expectations.
R
Robert Speicher 已提交
1149 1150
RSpec/NotToNot:
  EnforcedStyle: not_to
1151
  Enabled: true
R
Robert Speicher 已提交
1152

1153
# Prefer using verifying doubles over normal doubles.
R
Robert Speicher 已提交
1154 1155
RSpec/VerifiedDoubles:
  Enabled: false