.rubocop.yml 25.1 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
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/**/*'
    - 'db/**/*'
    - 'tmp/**/*'
    - 'bin/**/*'
    - 'lib/backup/**/*'
    - 'lib/ci/backup/**/*'
    - 'lib/tasks/**/*'
    - 'lib/ci/migrate/**/*'
    - 'lib/email_validator.rb'
    - 'lib/gitlab/upgrader.rb'
    - 'lib/gitlab/seeder.rb'
24
    - 'lib/templates/**/*'
25 26 27 28 29


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

# Check indentation of private/protected visibility modifiers.
30
Style/AccessModifierIndentation:
31
  Enabled: true
32

33
# Check the naming of accessor methods for get_/set_.
34
Style/AccessorMethodName:
35
  Enabled: false
36

37
# Use alias_method instead of alias.
38
Style/Alias:
39
  EnforcedStyle: prefer_alias_method
40
  Enabled: true
41

42
# Align the elements of an array literal if they span more than one line.
43
Style/AlignArray:
44
  Enabled: true
45

46
# Align the elements of a hash literal if they span more than one line.
47
Style/AlignHash:
48
  Enabled: true
49

50
# Align the parameters of a method call if they span more than one line.
51
Style/AlignParameters:
52
  Enabled: false
53

54
# Use &&/|| instead of and/or.
55
Style/AndOr:
56
  Enabled: false
57

58
# Use `Array#join` instead of `Array#*`.
59
Style/ArrayJoin:
60
  Enabled: false
61

62
# Use only ascii symbols in comments.
63
Style/AsciiComments:
64
  Enabled: true
65

66
# Use only ascii symbols in identifiers.
67
Style/AsciiIdentifiers:
68
  Enabled: true
69

70
# Checks for uses of Module#attr.
71 72 73
Style/Attr:
  Enabled: false

74
# Avoid the use of BEGIN blocks.
75
Style/BeginBlock:
76
  Enabled: true
77

78
# Checks if usage of %() or %Q() matches configuration.
79 80 81
Style/BarePercentLiterals:
  Enabled: false

82
# Do not use block comments.
83 84 85
Style/BlockComments:
  Enabled: false

86
# Put end statement of multiline block on its own line.
87
Style/BlockEndNewline:
88
  Enabled: true
89

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

95
# Enforce braces style around hash parameters.
96 97 98
Style/BracesAroundHashParameters:
  Enabled: false

99
# Avoid explicit use of the case equality operator(===).
100 101 102
Style/CaseEquality:
  Enabled: false

103
# Indentation of when in a case/when/[else/]end.
104
Style/CaseIndentation:
105
  Enabled: true
106

107
# Checks for uses of character literals.
108
Style/CharacterLiteral:
109
  Enabled: true
110

111
# Use CamelCase for classes and modules.'
112
Style/ClassAndModuleCamelCase:
113
  Enabled: true
114

115
# Checks style of children classes and modules.
116 117 118
Style/ClassAndModuleChildren:
  Enabled: false

119
# Enforces consistent use of `Object#is_a?` or `Object#kind_of?`.
120 121 122
Style/ClassCheck:
  Enabled: false

123
# Use self when defining module/class methods.
124 125 126
Style/ClassMethods:
  Enabled: false

127
# Avoid the use of class variables.
128
Style/ClassVars:
129
  Enabled: true
130

131
# Do not use :: for method call.
132 133 134
Style/ColonMethodCall:
  Enabled: false

135
# Checks formatting of special comments (TODO, FIXME, OPTIMIZE, HACK, REVIEW).
136 137 138
Style/CommentAnnotation:
  Enabled: false

139
# Indentation of comments.
140
Style/CommentIndentation:
141
  Enabled: true
142

143 144 145 146 147 148 149
# 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.
150
Style/ConstantName:
151
  Enabled: true
152

153
# Use def with parentheses when there are arguments.
154 155 156
Style/DefWithParentheses:
  Enabled: false

157
# Checks for use of deprecated Hash methods.
158 159 160
Style/DeprecatedHashMethods:
  Enabled: false

161
# Document classes and non-namespace modules.
162 163 164
Style/Documentation:
  Enabled: false

165
# Checks the position of the dot in multi-line method calls.
166 167 168
Style/DotPosition:
  Enabled: false

169
# Checks for uses of double negation (!!).
170 171 172
Style/DoubleNegation:
  Enabled: false

173
# Prefer `each_with_object` over `inject` or `reduce`.
174 175 176
Style/EachWithObject:
  Enabled: false

177
# Align elses and elsifs correctly.
178
Style/ElseAlignment:
179
  Enabled: true
180

181
# Avoid empty else-clauses.
182 183 184
Style/EmptyElse:
  Enabled: false

185
# Use empty lines between defs.
186 187 188
Style/EmptyLineBetweenDefs:
  Enabled: false

189
# Don't use several empty lines in a row.
190 191 192
Style/EmptyLines:
  Enabled: false

193
# Keep blank lines around access modifiers.
194 195 196
Style/EmptyLinesAroundAccessModifier:
  Enabled: false

197
# Keeps track of empty lines around block bodies.
198 199 200
Style/EmptyLinesAroundBlockBody:
  Enabled: false

201
# Keeps track of empty lines around class bodies.
202 203 204
Style/EmptyLinesAroundClassBody:
  Enabled: false

205
# Keeps track of empty lines around module bodies.
206 207 208
Style/EmptyLinesAroundModuleBody:
  Enabled: false

209
# Keeps track of empty lines around method bodies.
210 211 212
Style/EmptyLinesAroundMethodBody:
  Enabled: false

213
# Prefer literals to Array.new/Hash.new/String.new.
214 215 216
Style/EmptyLiteral:
  Enabled: false

217
# Avoid the use of END blocks.
218 219 220
Style/EndBlock:
  Enabled: false

221
# Use Unix-style line endings.
222 223 224
Style/EndOfLine:
  Enabled: false

225
# Favor the use of Fixnum#even? && Fixnum#odd?
226 227 228
Style/EvenOdd:
  Enabled: false

229
# Do not use unnecessary spacing.
230 231 232
Style/ExtraSpacing:
  Enabled: false

233
# Use snake_case for source file names.
234 235 236
Style/FileName:
  Enabled: false

237
# Checks for flip flops.
238 239 240
Style/FlipFlop:
  Enabled: false

241
# Checks use of for or each in multiline loops.
242 243 244
Style/For:
  Enabled: false

245
# Enforce the use of Kernel#sprintf, Kernel#format or String#%.
246 247 248
Style/FormatString:
  Enabled: false

249
# Do not introduce global variables.
250 251 252
Style/GlobalVars:
  Enabled: false

253
# Check for conditionals that can be replaced with guard clauses.
254 255 256
Style/GuardClause:
  Enabled: false

257 258
# Prefer Ruby 1.9 hash syntax `{ a: 1, b: 2 }`
# over 1.8 syntax `{ :a => 1, :b => 2 }`.
259
Style/HashSyntax:
260
  Enabled: true
261

262 263 264 265 266
# 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.
267 268 269
Style/IfUnlessModifier:
  Enabled: false

270
# Do not use if x; .... Use the ternary operator instead.
271 272 273
Style/IfWithSemicolon:
  Enabled: false

274 275 276 277 278 279
# 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
280
# multi-line assignment.
281 282 283 284
Style/IndentAssignment:
  Enabled: false

# Keep indentation straight.
285
Style/IndentationConsistency:
286
  Enabled: true
287

288
# Use 2 spaces for indentation.
289
Style/IndentationWidth:
290
  Enabled: true
291

292
# Checks the indentation of the first element in an array literal.
293 294 295
Style/IndentArray:
  Enabled: false

296
# Checks the indentation of the first key in a hash literal.
297 298 299
Style/IndentHash:
  Enabled: false

300
# Use Kernel#loop for infinite loops.
301 302 303
Style/InfiniteLoop:
  Enabled: false

304
# Use the new lambda literal syntax for single-line blocks.
305 306 307
Style/Lambda:
  Enabled: false

308
# Use lambda.call(...) instead of lambda.(...).
309 310 311
Style/LambdaCall:
  Enabled: false

312
# Comments should start with a space.
313 314 315
Style/LeadingCommentSpace:
  Enabled: false

316
# Use \ instead of + or << to concatenate two string literals at line end.
317 318 319
Style/LineEndConcatenation:
  Enabled: false

320
# Do not use parentheses for method calls with no arguments.
321 322 323
Style/MethodCallParentheses:
  Enabled: false

324
# Checks if the method definitions have or don't have parentheses.
325 326 327
Style/MethodDefParentheses:
  Enabled: false

328
# Use the configured style when naming methods.
329 330 331
Style/MethodName:
  Enabled: false

332
# Checks for usage of `extend self` in modules.
333 334 335
Style/ModuleFunction:
  Enabled: false

336
# Avoid multi-line chains of blocks.
337 338 339
Style/MultilineBlockChain:
  Enabled: false

340
# Ensures newlines after multiline block do statements.
341
Style/MultilineBlockLayout:
342
  Enabled: true
343

344
# Do not use then for multi-line if/unless.
345 346 347
Style/MultilineIfThen:
  Enabled: false

348 349 350 351 352 353
# Checks indentation of method calls with the dot operator that span more than
# one line.
Style/MultilineMethodCallIndentation:
  Enabled: false

# Checks indentation of binary operations that span more than one line.
354 355 356
Style/MultilineOperationIndentation:
  Enabled: false

357
# Avoid multi-line `? :` (the ternary operator), use if/unless instead.
358 359 360
Style/MultilineTernaryOperator:
  Enabled: false

361 362 363 364 365
# Do not assign mutable objects to constants.
Style/MutableConstant:
  Enabled: false

# Favor unless over if for negative conditions (or control flow or).
366 367 368
Style/NegatedIf:
  Enabled: false

369
# Favor until over while for negative conditions.
370 371 372
Style/NegatedWhile:
  Enabled: false

373 374 375 376 377 378 379 380 381 382
# Avoid using nested modifiers.
Style/NestedModifier:
  Enabled: false

# 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.
383
Style/NestedTernaryOperator:
384
  Enabled: true
385

386
# Use `next` to skip iteration instead of a condition at the end.
387 388 389
Style/Next:
  Enabled: false

390
# Prefer x.nil? to x == nil.
391
Style/NilComparison:
392
  Enabled: true
393

394
# Checks for redundant nil checks.
395
Style/NonNilCheck:
396
  Enabled: true
397

398
# Use ! instead of not.
399
Style/Not:
400
  Enabled: true
401

402
# Add underscores to large numeric literals to improve their readability.
403 404 405
Style/NumericLiterals:
  Enabled: false

406
# Favor the ternary operator(?:) over if/then/else/end constructs.
407
Style/OneLineConditional:
408
  Enabled: true
409

410
# When defining binary operators, name the argument other.
411 412 413
Style/OpMethod:
  Enabled: false

414 415
# Check for simple usages of parallel assignment. It will only warn when
# the number of variables matches on both sides of the assignment.
416 417 418
Style/ParallelAssignment:
  Enabled: false

419
# Don't use parentheses around the condition of an if/unless/while.
420
Style/ParenthesesAroundCondition:
421
  Enabled: true
422

423
# Use `%`-literal delimiters consistently.
424 425 426
Style/PercentLiteralDelimiters:
  Enabled: false

427
# Checks if uses of %Q/%q match the configured preference.
428 429 430
Style/PercentQLiterals:
  Enabled: false

431
# Avoid Perl-style regex back references.
432 433 434
Style/PerlBackrefs:
  Enabled: false

435
# Check the names of predicate methods.
436 437 438
Style/PredicateName:
  Enabled: false

439
# Use proc instead of Proc.new.
440 441 442
Style/Proc:
  Enabled: false

443
# Checks the arguments passed to raise/fail.
444 445 446
Style/RaiseArgs:
  Enabled: false

447
# Don't use begin blocks when they are not needed.
448 449 450
Style/RedundantBegin:
  Enabled: false

451
# Checks for an obsolete RuntimeException argument in raise/fail.
452 453 454
Style/RedundantException:
  Enabled: false

455 456 457 458 459 460 461 462 463 464
# Checks usages of Object#freeze on immutable objects.
Style/RedundantFreeze:
  Enabled: false

# TODO: Enable RedundantParentheses Cop.
# Checks for parentheses that seem not to serve any purpose.
Style/RedundantParentheses:
  Enabled: false

# Don't use return where it's not required.
465
Style/RedundantReturn:
466
  Enabled: true
467

468
# Don't use self where it's not needed.
469 470 471
Style/RedundantSelf:
  Enabled: false

472 473 474
# Use %r for regular expressions matching more than `MaxSlashes` '/'
# characters. Use %r only for regular expressions matching more
# than `MaxSlashes` '/' character.
475 476 477
Style/RegexpLiteral:
  Enabled: false

478
# Avoid using rescue in its modifier form.
479 480 481
Style/RescueModifier:
  Enabled: false

482
# Checks for places where self-assignment shorthand should have been used.
483 484 485
Style/SelfAssignment:
  Enabled: false

486
# Don't use semicolons to terminate expressions.
487 488 489
Style/Semicolon:
  Enabled: false

490
# Checks for proper usage of fail and raise.
491 492 493
Style/SignalException:
  Enabled: false

494
# Enforces the names of some block params.
495 496 497
Style/SingleLineBlockParams:
  Enabled: false

498
# Avoid single-line methods.
499 500 501
Style/SingleLineMethods:
  Enabled: false

502
# Use spaces after colons.
503 504 505
Style/SpaceAfterColon:
  Enabled: false

506
# Use spaces after commas.
507 508 509
Style/SpaceAfterComma:
  Enabled: false

510 511
# Do not put a space between a method name and the opening parenthesis in a
# method definition.
512 513 514
Style/SpaceAfterMethodName:
  Enabled: false

515
# Tracks redundant space after the ! operator.
516 517 518
Style/SpaceAfterNot:
  Enabled: false

519
# Use spaces after semicolons.
520 521 522
Style/SpaceAfterSemicolon:
  Enabled: false

523 524 525
# Checks that the equals signs in parameter default assignments have or don't
# have surrounding space depending on configuration.
Style/SpaceAroundEqualsInParameterDefault:
526 527
  Enabled: false

528 529 530
# TODO: Enable SpaceAroundKeyword Cop.
# Use a space around keywords if appropriate.
Style/SpaceAroundKeyword:
531 532
  Enabled: false

533 534
# Use a single space around operators.
Style/SpaceAroundOperators:
535
  Enabled: true
536

537 538
# Checks that the left block brace has or doesn't have space before it.
Style/SpaceBeforeBlockBraces:
539 540
  Enabled: false

541 542
# No spaces before commas.
Style/SpaceBeforeComma:
543 544
  Enabled: false

545 546
# Checks for missing space between code and a comment on the same line.
Style/SpaceBeforeComment:
547 548
  Enabled: false

549 550 551 552 553 554 555
# 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:
556 557
  Enabled: false

558 559 560 561
# 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:
562 563
  Enabled: false

564
# No spaces after [ or before ].
565 566 567
Style/SpaceInsideBrackets:
  Enabled: false

568
# Use spaces inside hash literal braces - or don't.
569
Style/SpaceInsideHashLiteralBraces:
570
  Enabled: true
571

572
# No spaces after ( or before ).
573 574 575
Style/SpaceInsideParens:
  Enabled: false

576
# No spaces inside range literals.
577 578 579
Style/SpaceInsideRangeLiteral:
  Enabled: false

580 581 582 583 584
# Checks for padding/surrounding spaces inside string interpolation.
Style/SpaceInsideStringInterpolation:
  Enabled: false

# Avoid Perl-style global variables.
585 586 587
Style/SpecialGlobalVars:
  Enabled: false

588 589 590 591 592
# Check for the usage of parentheses around stabby lambda arguments.
Style/StabbyLambdaParentheses:
  Enabled: false

# Checks if uses of quotes match the configured preference.
593 594 595
Style/StringLiterals:
  Enabled: false

596 597
# Checks if uses of quotes inside expressions in interpolated strings match the
# configured preference.
598 599 600
Style/StringLiteralsInInterpolation:
  Enabled: false

601 602 603 604 605 606 607 608 609
# Checks if configured preferred methods are used over non-preferred.
Style/StringMethods:
  Enabled: false

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

# Use symbols as procs instead of blocks when possible.
610 611 612
Style/SymbolProc:
  Enabled: false

613
# No hard tabs.
614
Style/Tab:
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
615
  Enabled: true
616

617
# Checks trailing blank lines and final newline.
618
Style/TrailingBlankLines:
619
  Enabled: true
620

621 622
# Checks for trailing comma in array and hash literals.
Style/TrailingCommaInLiteral:
623 624
  Enabled: false

625 626 627 628 629
# Checks for trailing comma in argument lists.
Style/TrailingCommaInArguments:
  Enabled: false

# Avoid trailing whitespace.
630 631 632
Style/TrailingWhitespace:
  Enabled: false

633 634
# Checks for the usage of unneeded trailing underscores at the end of
# parallel variable assignment.
635 636 637
Style/TrailingUnderscoreVariable:
  Enabled: false

638
# Prefer attr_* methods to trivial readers/writers.
639 640 641
Style/TrivialAccessors:
  Enabled: false

642
# Do not use unless with else. Rewrite these with the positive case first.
643 644 645
Style/UnlessElse:
  Enabled: false

646
# Checks for %W when interpolation is not needed.
647 648 649
Style/UnneededCapitalW:
  Enabled: false

650 651 652 653 654 655
# 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.
656 657 658
Style/UnneededPercentQ:
  Enabled: false

659
# Don't interpolate global, instance and class variables directly in strings.
660 661 662
Style/VariableInterpolation:
  Enabled: false

663
# Use the configured style when naming variables.
664 665 666
Style/VariableName:
  Enabled: false

667
# Use when x then ... for one-line cases.
668 669 670
Style/WhenThen:
  Enabled: false

671
# Checks for redundant do after while or until.
672 673 674
Style/WhileUntilDo:
  Enabled: false

675
# Favor modifier while/until usage when you have a single-line body.
676 677 678
Style/WhileUntilModifier:
  Enabled: false

679
# Use %w or %W for arrays of words.
680 681 682
Style/WordArray:
  Enabled: false

683 684 685 686 687 688
# TODO: Enable ZeroLengthPredicate Cop.
# Use #empty? when testing for objects of length 0.
Style/ZeroLengthPredicate:
  Enabled: false


689 690
#################### Metrics ################################

691 692
# A calculated magnitude based on number of assignments,
# branches, and conditions.
693
Metrics/AbcSize:
Grzegorz Bizon's avatar
Grzegorz Bizon committed
694
  Enabled: true
695
  Max: 60
Grzegorz Bizon's avatar
Grzegorz Bizon committed
696

697
# Avoid excessive block nesting.
698
Metrics/BlockNesting:
Grzegorz Bizon's avatar
Grzegorz Bizon committed
699 700
  Enabled: true
  Max: 4
701

702
# Avoid classes longer than 100 lines of code.
703 704 705
Metrics/ClassLength:
  Enabled: false

706 707 708 709 710 711 712
# 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.
713 714 715
Metrics/LineLength:
  Enabled: false

716
# Avoid methods longer than 10 lines of code.
717 718 719
Metrics/MethodLength:
  Enabled: false

720
# Avoid modules longer than 100 lines of code.
721 722 723
Metrics/ModuleLength:
  Enabled: false

724 725 726 727 728 729 730 731
# 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
732
  Max: 18
733 734


735 736
#################### Lint ################################

737 738
# Checks for ambiguous operators in the first argument of a method invocation
# without parentheses.
739 740 741
Lint/AmbiguousOperator:
  Enabled: false

742 743
# Checks for ambiguous regexp literals in the first argument of a method
# invocation without parentheses.
744 745 746
Lint/AmbiguousRegexpLiteral:
  Enabled: false

747
# Don't use assignment in conditions.
748 749 750
Lint/AssignmentInCondition:
  Enabled: false

751
# Align block ends correctly.
752 753 754
Lint/BlockAlignment:
  Enabled: false

755 756 757 758 759 760
# Default values in optional keyword arguments and optional ordinal arguments
# should not refer back to the name of the argument.
Lint/CircularArgumentReference:
  Enabled: false

# Checks for condition placed in a confusing position relative to the keyword.
761 762 763
Lint/ConditionPosition:
  Enabled: false

764
# Check for debugger calls.
765 766 767
Lint/Debugger:
  Enabled: false

768
# Align ends corresponding to defs correctly.
769 770 771
Lint/DefEndAlignment:
  Enabled: false

772
# Check for deprecated class method calls.
773
Lint/DeprecatedClassMethods:
774
  Enabled: true
775

776 777 778 779 780 781 782 783 784 785 786 787 788
# 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:
  Enabled: false

# Check for odd code arrangement in an else block.
789 790 791
Lint/ElseLayout:
  Enabled: false

792
# Checks for empty ensure block.
793 794 795
Lint/EmptyEnsure:
  Enabled: false

796
# Checks for empty string interpolation.
797 798 799
Lint/EmptyInterpolation:
  Enabled: false

800
# Align ends correctly.
801 802 803
Lint/EndAlignment:
  Enabled: false

804
# END blocks should not be placed inside method definitions.
805 806 807
Lint/EndInMethod:
  Enabled: false

808
# Do not use return in an ensure block.
809 810 811
Lint/EnsureReturn:
  Enabled: false

812
# The use of eval represents a serious security risk.
813 814 815
Lint/Eval:
  Enabled: false

816 817 818 819 820 821 822 823 824
# Catches floating-point literals too large or small for Ruby to represent.
Lint/FloatOutOfRange:
  Enabled: false

# The number of parameters to format/sprint must match the fields.
Lint/FormatParameterMismatch:
  Enabled: false

# Don't suppress exception.
825 826 827
Lint/HandleExceptions:
  Enabled: false

828 829 830 831 832 833 834 835 836 837 838 839 840 841
# TODO: Enable ImplicitStringConcatenation Cop.
# Checks for adjacent string literals on the same line, which could better be
# represented as a single string literal.
Lint/ImplicitStringConcatenation:
  Enabled: false

# 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.
842 843 844
Lint/InvalidCharacterLiteral:
  Enabled: false

845
# Checks of literals used in conditions.
846 847 848
Lint/LiteralInCondition:
  Enabled: false

849
# Checks for literals used in interpolation.
850 851 852
Lint/LiteralInInterpolation:
  Enabled: false

853 854
# Use Kernel#loop with break rather than begin/end/until or begin/end/while
# for post-loop tests.
855 856 857
Lint/Loop:
  Enabled: false

858 859 860 861 862 863 864 865 866
# Do not use nested method definitions.
Lint/NestedMethodDefinition:
  Enabled: false

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

# Checks for method calls with a space before the opening parenthesis.
867
Lint/ParenthesesAsGroupedExpression:
868
  Enabled: true
869

870 871 872 873 874 875
# Checks for `rand(1)` calls. Such calls always return `0` and most likely
# a mistake.
Lint/RandOne:
  Enabled: false

# Use parentheses in the method call to avoid confusion about precedence.
876 877 878
Lint/RequireParentheses:
  Enabled: false

879
# Avoid rescuing the Exception class.
880
Lint/RescueException:
881
  Enabled: true
882

883 884
# Do not use the same name as outer local variable for block arguments
# or block local variables.
885 886 887
Lint/ShadowingOuterLocalVariable:
  Enabled: false

888
# 'Checks for Object#to_s usage in string interpolation.
889 890 891
Lint/StringConversionInInterpolation:
  Enabled: false

892
# Do not use prefix `_` for a variable that is used.
893
Lint/UnderscorePrefixedVariableName:
894
  Enabled: true
895

896 897 898 899 900 901 902
# 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.
903 904 905
Lint/UnusedBlockArgument:
  Enabled: false

906
# Checks for unused method arguments.
907 908 909
Lint/UnusedMethodArgument:
  Enabled: false

910
# Unreachable code.
911 912 913
Lint/UnreachableCode:
  Enabled: false

914
# Checks for useless access modifiers.
915 916 917
Lint/UselessAccessModifier:
  Enabled: false

918
# Checks for useless assignment to a local variable.
919
Lint/UselessAssignment:
920
  Enabled: true
921

922
# Checks for comparison of something with itself.
923 924 925
Lint/UselessComparison:
  Enabled: false

926
# Checks for useless `else` in `begin..end` without `rescue`.
927 928 929
Lint/UselessElseWithoutRescue:
  Enabled: false

930
# Checks for useless setter call to a local variable.
931 932 933
Lint/UselessSetterCall:
  Enabled: false

934
# Possible use of operator/literal/variable in void context.
935 936 937
Lint/Void:
  Enabled: false

938 939 940 941 942

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

# Use `casecmp` rather than `downcase ==`.
Performance/Casecmp:
943
  Enabled: true
944 945 946 947 948 949 950 951 952 953 954 955 956 957

# TODO: Enable DoubleStartEndWith Cop.
# Use `str.{start,end}_with?(x, ..., y, ...)` instead of
# `str.{start,end}_with?(x, ...) || str.{start,end}_with?(y, ...)`.
Performance/DoubleStartEndWith:
  Enabled: false

# 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:
Connor Shea's avatar
Connor Shea committed
958
  Enabled: true
959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992

# TODO: Enable RangeInclude Cop.
# Use `Range#cover?` instead of `Range#include?`.
Performance/RangeInclude:
  Enabled: false

# 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

# TODO: Enable RedundantSortBy Cop.
# Use `sort` instead of `sort_by { |x| x }`.
Performance/RedundantSortBy:
  Enabled: false

# TODO: Enable StartWith Cop.
# Use `start_with?` instead of a regex match anchored to the beginning of a
# string.
Performance/StartWith:
  Enabled: false
993

994 995 996 997
# 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:
998
  Enabled: true
999 1000 1001 1002 1003 1004 1005

# TODO: Enable TimesMap Cop.
# Checks for `.times.map` calls.
Performance/TimesMap:
  Enabled: false


1006 1007
##################### Rails ##################################

1008 1009 1010 1011 1012
# Enables Rails cops.
Rails:
  Enabled: true

# Enforces consistent use of action filter methods.
1013
Rails/ActionFilter:
1014
  Enabled: true
1015
  EnforcedStyle: action
1016

1017 1018
# Checks the correct usage of date aware methods, such as `Date.today`,
# `Date.current`, etc.
Gabriel Mazetto's avatar
Gabriel Mazetto committed
1019 1020 1021
Rails/Date:
  Enabled: false

1022 1023
# Prefer delegate method for delegations.
Rails/Delegate:
1024 1025
  Enabled: false

1026 1027 1028 1029 1030 1031
# Prefer `find_by` over `where.first`.
Rails/FindBy:
  Enabled: false

# Prefer `all.find_each` over `all.find`.
Rails/FindEach:
1032 1033
  Enabled: false

1034
# Prefer has_many :through to has_and_belongs_to_many.
1035
Rails/HasAndBelongsToMany:
1036
  Enabled: true
1037

1038
# Checks for calls to puts, print, etc.
1039
Rails/Output:
1040
  Enabled: true
1041

1042 1043 1044 1045 1046
# Checks for incorrect grammar when using methods like `3.day.ago`.
Rails/PluralizationGrammar:
  Enabled: false

# Checks for `read_attribute(:attr)` and `write_attribute(:attr, val)`.
1047 1048 1049
Rails/ReadWriteAttribute:
  Enabled: false

1050
# Checks the arguments of ActiveRecord scopes.
1051 1052 1053
Rails/ScopeArgs:
  Enabled: false

1054 1055
# Checks the correct usage of time zone aware methods.
# http://danilenko.org/2012/7/6/rails_timezones
1056 1057 1058
Rails/TimeZone:
  Enabled: false

1059
# Use validates :attribute, hash of validations.
1060 1061
Rails/Validation:
  Enabled: false