.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 24 25 26 27 28
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'


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

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

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

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

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

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

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

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

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

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

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

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

73
# Avoid the use of BEGIN blocks.
74
Style/BeginBlock:
D
Dmitriy Zaporozhets 已提交
75
  Enabled: true
76

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

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

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

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

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

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

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

106
# Checks for uses of character literals.
107
Style/CharacterLiteral:
D
Dmitriy Zaporozhets 已提交
108
  Enabled: true
109

110
# Use CamelCase for classes and modules.'
111
Style/ClassAndModuleCamelCase:
D
Dmitriy Zaporozhets 已提交
112
  Enabled: true
113

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

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

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

126
# Avoid the use of class variables.
127
Style/ClassVars:
D
Dmitriy Zaporozhets 已提交
128
  Enabled: true
129

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

347 348 349 350 351 352
# 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.
353 354 355
Style/MultilineOperationIndentation:
  Enabled: false

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

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

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

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

372 373 374 375 376 377 378 379 380 381
# 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.
382
Style/NestedTernaryOperator:
383
  Enabled: true
384

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

454 455 456 457 458 459 460 461 462 463
# 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.
464
Style/RedundantReturn:
465
  Enabled: true
466

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

532 533
# Use a single space around operators.
Style/SpaceAroundOperators:
G
Gabriel Mazetto 已提交
534
  Enabled: true
535

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

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

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

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

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

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

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

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

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

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

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

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

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

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

600 601 602 603 604 605 606 607 608
# 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.
609 610 611
Style/SymbolProc:
  Enabled: false

612
# No hard tabs.
613
Style/Tab:
D
Dmitriy Zaporozhets 已提交
614
  Enabled: true
615

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


688 689
#################### Metrics ################################

690 691
# A calculated magnitude based on number of assignments,
# branches, and conditions.
692
Metrics/AbcSize:
G
Grzegorz Bizon 已提交
693
  Enabled: true
694
  Max: 60
G
Grzegorz Bizon 已提交
695

696
# Avoid excessive block nesting.
697
Metrics/BlockNesting:
G
Grzegorz Bizon 已提交
698 699
  Enabled: true
  Max: 4
700

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

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

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

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

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


734 735
#################### Lint ################################

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

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

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

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

754 755 756 757 758 759
# 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.
760 761 762
Lint/ConditionPosition:
  Enabled: false

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

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

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

775 776 777 778 779 780 781 782 783 784 785 786 787
# 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.
788 789 790
Lint/ElseLayout:
  Enabled: false

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

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

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

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

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

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

815 816 817 818 819 820 821 822 823
# 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.
824 825 826
Lint/HandleExceptions:
  Enabled: false

827 828 829 830 831 832 833 834 835 836 837 838 839 840
# 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.
841 842 843
Lint/InvalidCharacterLiteral:
  Enabled: false

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

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

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

857 858 859 860 861 862 863 864 865
# 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.
866
Lint/ParenthesesAsGroupedExpression:
867
  Enabled: true
868

869 870 871 872 873 874
# 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.
875 876 877
Lint/RequireParentheses:
  Enabled: false

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

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

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

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

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

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

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

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

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

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

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

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

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

937 938 939 940 941

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

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

# 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:
C
Connor Shea 已提交
957
  Enabled: true
958 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

# 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
C
Connor Shea 已提交
992

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

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


1005 1006
##################### Rails ##################################

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

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

1016 1017
# Checks the correct usage of date aware methods, such as `Date.today`,
# `Date.current`, etc.
G
Gabriel Mazetto 已提交
1018 1019 1020
Rails/Date:
  Enabled: false

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

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

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

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

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

1041 1042 1043 1044 1045
# 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)`.
1046 1047 1048
Rails/ReadWriteAttribute:
  Enabled: false

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

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

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