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

3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
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'
26
    - 'generator_templates/**/*'
27 28 29 30 31


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

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

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

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

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

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

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

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

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

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

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

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

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

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

84
# Do not use block comments.
85 86 87
Style/BlockComments:
  Enabled: false

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

239
# Checks for flip flops.
240 241 242
Style/FlipFlop:
  Enabled: false

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

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

251
# Do not introduce global variables.
252 253 254
Style/GlobalVars:
  Enabled: false

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

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

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

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

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

# Keep indentation straight.
287
Style/IndentationConsistency:
288
  Enabled: true
289

290
# Use 2 spaces for indentation.
291
Style/IndentationWidth:
292
  Enabled: true
293

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

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

302
# Use Kernel#loop for infinite loops.
303
Style/InfiniteLoop:
304
  Enabled: true
305

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

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

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

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

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

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

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

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

R
Robert Speicher 已提交
338 339 340 341 342 343
# 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

344
# Avoid multi-line chains of blocks.
345 346 347
Style/MultilineBlockChain:
  Enabled: false

348
# Ensures newlines after multiline block do statements.
349
Style/MultilineBlockLayout:
350
  Enabled: true
351

R
Robert Speicher 已提交
352 353 354 355 356 357
# 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

358
# Do not use then for multi-line if/unless.
359 360 361
Style/MultilineIfThen:
  Enabled: false

R
Robert Speicher 已提交
362 363 364 365 366 367
# 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

368 369 370 371 372 373
# 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.
374 375 376
Style/MultilineOperationIndentation:
  Enabled: false

377
# Avoid multi-line `? :` (the ternary operator), use if/unless instead.
378 379 380
Style/MultilineTernaryOperator:
  Enabled: false

381 382 383 384 385
# Do not assign mutable objects to constants.
Style/MutableConstant:
  Enabled: false

# Favor unless over if for negative conditions (or control flow or).
386 387 388
Style/NegatedIf:
  Enabled: false

389
# Favor until over while for negative conditions.
390 391 392
Style/NegatedWhile:
  Enabled: false

393 394 395 396 397 398 399 400 401 402
# 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.
403
Style/NestedTernaryOperator:
404
  Enabled: true
405

406
# Use `next` to skip iteration instead of a condition at the end.
407 408 409
Style/Next:
  Enabled: false

410
# Prefer x.nil? to x == nil.
411
Style/NilComparison:
412
  Enabled: true
413

414
# Checks for redundant nil checks.
415
Style/NonNilCheck:
416
  Enabled: true
417

418
# Use ! instead of not.
419
Style/Not:
420
  Enabled: true
421

422
# Add underscores to large numeric literals to improve their readability.
423 424 425
Style/NumericLiterals:
  Enabled: false

426
# Favor the ternary operator(?:) over if/then/else/end constructs.
427
Style/OneLineConditional:
428
  Enabled: true
429

430
# When defining binary operators, name the argument other.
431 432 433
Style/OpMethod:
  Enabled: false

434 435
# Check for simple usages of parallel assignment. It will only warn when
# the number of variables matches on both sides of the assignment.
436 437 438
Style/ParallelAssignment:
  Enabled: false

439
# Don't use parentheses around the condition of an if/unless/while.
440
Style/ParenthesesAroundCondition:
441
  Enabled: true
442

443
# Use `%`-literal delimiters consistently.
444 445 446
Style/PercentLiteralDelimiters:
  Enabled: false

447
# Checks if uses of %Q/%q match the configured preference.
448 449 450
Style/PercentQLiterals:
  Enabled: false

451
# Avoid Perl-style regex back references.
452 453 454
Style/PerlBackrefs:
  Enabled: false

455
# Check the names of predicate methods.
456 457 458
Style/PredicateName:
  Enabled: false

459
# Use proc instead of Proc.new.
460 461 462
Style/Proc:
  Enabled: false

463
# Checks the arguments passed to raise/fail.
464 465 466
Style/RaiseArgs:
  Enabled: false

467
# Don't use begin blocks when they are not needed.
468 469 470
Style/RedundantBegin:
  Enabled: false

471
# Checks for an obsolete RuntimeException argument in raise/fail.
472 473 474
Style/RedundantException:
  Enabled: false

475 476 477 478 479 480 481 482 483 484
# 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.
485
Style/RedundantReturn:
486
  Enabled: true
487

488
# Don't use self where it's not needed.
489 490 491
Style/RedundantSelf:
  Enabled: false

492 493 494
# Use %r for regular expressions matching more than `MaxSlashes` '/'
# characters. Use %r only for regular expressions matching more
# than `MaxSlashes` '/' character.
495 496 497
Style/RegexpLiteral:
  Enabled: false

498
# Avoid using rescue in its modifier form.
499 500 501
Style/RescueModifier:
  Enabled: false

502
# Checks for places where self-assignment shorthand should have been used.
503 504 505
Style/SelfAssignment:
  Enabled: false

506
# Don't use semicolons to terminate expressions.
507 508 509
Style/Semicolon:
  Enabled: false

510
# Checks for proper usage of fail and raise.
511 512 513
Style/SignalException:
  Enabled: false

514
# Enforces the names of some block params.
515 516 517
Style/SingleLineBlockParams:
  Enabled: false

518
# Avoid single-line methods.
519 520 521
Style/SingleLineMethods:
  Enabled: false

522
# Use spaces after colons.
523 524 525
Style/SpaceAfterColon:
  Enabled: false

526
# Use spaces after commas.
527 528 529
Style/SpaceAfterComma:
  Enabled: false

530 531
# Do not put a space between a method name and the opening parenthesis in a
# method definition.
532 533 534
Style/SpaceAfterMethodName:
  Enabled: false

535
# Tracks redundant space after the ! operator.
536 537 538
Style/SpaceAfterNot:
  Enabled: false

539
# Use spaces after semicolons.
540 541 542
Style/SpaceAfterSemicolon:
  Enabled: false

543 544 545
# Checks that the equals signs in parameter default assignments have or don't
# have surrounding space depending on configuration.
Style/SpaceAroundEqualsInParameterDefault:
546 547
  Enabled: false

548 549
# Use a space around keywords if appropriate.
Style/SpaceAroundKeyword:
550
  Enabled: true
551

552 553
# Use a single space around operators.
Style/SpaceAroundOperators:
G
Gabriel Mazetto 已提交
554
  Enabled: true
555

556 557
# Checks that the left block brace has or doesn't have space before it.
Style/SpaceBeforeBlockBraces:
558 559
  Enabled: false

560 561
# No spaces before commas.
Style/SpaceBeforeComma:
562 563
  Enabled: false

564 565
# Checks for missing space between code and a comment on the same line.
Style/SpaceBeforeComment:
566 567
  Enabled: false

568 569 570 571 572 573 574
# 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:
575 576
  Enabled: false

577 578 579 580
# 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:
581 582
  Enabled: false

583
# No spaces after [ or before ].
584 585 586
Style/SpaceInsideBrackets:
  Enabled: false

587
# Use spaces inside hash literal braces - or don't.
588
Style/SpaceInsideHashLiteralBraces:
589
  Enabled: true
590

591
# No spaces after ( or before ).
592 593 594
Style/SpaceInsideParens:
  Enabled: false

595
# No spaces inside range literals.
596 597 598
Style/SpaceInsideRangeLiteral:
  Enabled: false

599 600 601 602 603
# Checks for padding/surrounding spaces inside string interpolation.
Style/SpaceInsideStringInterpolation:
  Enabled: false

# Avoid Perl-style global variables.
604 605 606
Style/SpecialGlobalVars:
  Enabled: false

607 608 609 610 611
# Check for the usage of parentheses around stabby lambda arguments.
Style/StabbyLambdaParentheses:
  Enabled: false

# Checks if uses of quotes match the configured preference.
612 613 614
Style/StringLiterals:
  Enabled: false

615 616
# Checks if uses of quotes inside expressions in interpolated strings match the
# configured preference.
617 618 619
Style/StringLiteralsInInterpolation:
  Enabled: false

620 621 622 623 624 625 626 627 628
# 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.
629 630 631
Style/SymbolProc:
  Enabled: false

632
# No hard tabs.
633
Style/Tab:
D
Dmitriy Zaporozhets 已提交
634
  Enabled: true
635

636
# Checks trailing blank lines and final newline.
637
Style/TrailingBlankLines:
638
  Enabled: true
639

640 641
# Checks for trailing comma in array and hash literals.
Style/TrailingCommaInLiteral:
642 643
  Enabled: false

644 645 646 647 648
# Checks for trailing comma in argument lists.
Style/TrailingCommaInArguments:
  Enabled: false

# Avoid trailing whitespace.
649 650 651
Style/TrailingWhitespace:
  Enabled: false

652 653
# Checks for the usage of unneeded trailing underscores at the end of
# parallel variable assignment.
654 655 656
Style/TrailingUnderscoreVariable:
  Enabled: false

657
# Prefer attr_* methods to trivial readers/writers.
658 659 660
Style/TrivialAccessors:
  Enabled: false

661
# Do not use unless with else. Rewrite these with the positive case first.
662 663 664
Style/UnlessElse:
  Enabled: false

665
# Checks for %W when interpolation is not needed.
666 667 668
Style/UnneededCapitalW:
  Enabled: false

669 670 671 672 673 674
# 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.
675 676 677
Style/UnneededPercentQ:
  Enabled: false

678
# Don't interpolate global, instance and class variables directly in strings.
679 680 681
Style/VariableInterpolation:
  Enabled: false

682
# Use the configured style when naming variables.
683 684 685
Style/VariableName:
  Enabled: false

686
# Use when x then ... for one-line cases.
687 688 689
Style/WhenThen:
  Enabled: false

690
# Checks for redundant do after while or until.
691 692 693
Style/WhileUntilDo:
  Enabled: false

694
# Favor modifier while/until usage when you have a single-line body.
695 696 697
Style/WhileUntilModifier:
  Enabled: false

698
# Use %w or %W for arrays of words.
699 700 701
Style/WordArray:
  Enabled: false

702 703 704 705 706 707
# TODO: Enable ZeroLengthPredicate Cop.
# Use #empty? when testing for objects of length 0.
Style/ZeroLengthPredicate:
  Enabled: false


708 709
#################### Metrics ################################

710 711
# A calculated magnitude based on number of assignments,
# branches, and conditions.
712
Metrics/AbcSize:
G
Grzegorz Bizon 已提交
713
  Enabled: true
714
  Max: 60
G
Grzegorz Bizon 已提交
715

716
# Avoid excessive block nesting.
717
Metrics/BlockNesting:
G
Grzegorz Bizon 已提交
718 719
  Enabled: true
  Max: 4
720

721
# Avoid classes longer than 100 lines of code.
722 723 724
Metrics/ClassLength:
  Enabled: false

725 726 727 728 729 730 731
# 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.
732 733 734
Metrics/LineLength:
  Enabled: false

735
# Avoid methods longer than 10 lines of code.
736 737 738
Metrics/MethodLength:
  Enabled: false

739
# Avoid modules longer than 100 lines of code.
740 741 742
Metrics/ModuleLength:
  Enabled: false

743 744 745 746 747 748 749 750
# 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 已提交
751
  Max: 18
752 753


754 755
#################### Lint ################################

756 757
# Checks for ambiguous operators in the first argument of a method invocation
# without parentheses.
758 759 760
Lint/AmbiguousOperator:
  Enabled: false

761 762
# Checks for ambiguous regexp literals in the first argument of a method
# invocation without parentheses.
763 764 765
Lint/AmbiguousRegexpLiteral:
  Enabled: false

766
# Don't use assignment in conditions.
767 768 769
Lint/AssignmentInCondition:
  Enabled: false

770
# Align block ends correctly.
771 772 773
Lint/BlockAlignment:
  Enabled: false

774 775 776
# Default values in optional keyword arguments and optional ordinal arguments
# should not refer back to the name of the argument.
Lint/CircularArgumentReference:
777
  Enabled: true
778 779

# Checks for condition placed in a confusing position relative to the keyword.
780
Lint/ConditionPosition:
781
  Enabled: true
782

783
# Check for debugger calls.
784
Lint/Debugger:
785
  Enabled: true
786

787
# Align ends corresponding to defs correctly.
788
Lint/DefEndAlignment:
789
  Enabled: true
790

791
# Check for deprecated class method calls.
792
Lint/DeprecatedClassMethods:
793
  Enabled: true
794

795 796 797 798 799 800 801 802 803 804
# 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:
805
  Enabled: true
806 807

# Check for odd code arrangement in an else block.
808
Lint/ElseLayout:
809
  Enabled: true
810

811
# Checks for empty ensure block.
812
Lint/EmptyEnsure:
813
  Enabled: true
814

815
# Checks for empty string interpolation.
816 817 818
Lint/EmptyInterpolation:
  Enabled: false

819
# Align ends correctly.
820
Lint/EndAlignment:
821
  Enabled: true
822

823
# END blocks should not be placed inside method definitions.
824
Lint/EndInMethod:
825
  Enabled: true
826

827
# Do not use return in an ensure block.
828
Lint/EnsureReturn:
829
  Enabled: true
830

831
# The use of eval represents a serious security risk.
832
Lint/Eval:
833
  Enabled: true
834

835 836
# Catches floating-point literals too large or small for Ruby to represent.
Lint/FloatOutOfRange:
837
  Enabled: true
838 839 840

# The number of parameters to format/sprint must match the fields.
Lint/FormatParameterMismatch:
841
  Enabled: true
842 843

# Don't suppress exception.
844 845 846
Lint/HandleExceptions:
  Enabled: false

847 848 849
# Checks for adjacent string literals on the same line, which could better be
# represented as a single string literal.
Lint/ImplicitStringConcatenation:
850
  Enabled: true
851 852 853 854 855 856 857 858 859

# 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.
860
Lint/InvalidCharacterLiteral:
861
  Enabled: true
862

863
# Checks of literals used in conditions.
864 865 866
Lint/LiteralInCondition:
  Enabled: false

867
# Checks for literals used in interpolation.
868
Lint/LiteralInInterpolation:
869
  Enabled: true
870

871 872
# Use Kernel#loop with break rather than begin/end/until or begin/end/while
# for post-loop tests.
873 874 875
Lint/Loop:
  Enabled: false

876 877
# Do not use nested method definitions.
Lint/NestedMethodDefinition:
878
  Enabled: true
879 880 881

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

# Checks for method calls with a space before the opening parenthesis.
885
Lint/ParenthesesAsGroupedExpression:
886
  Enabled: true
887

888 889 890
# Checks for `rand(1)` calls. Such calls always return `0` and most likely
# a mistake.
Lint/RandOne:
891
  Enabled: true
892 893

# Use parentheses in the method call to avoid confusion about precedence.
894
Lint/RequireParentheses:
895
  Enabled: true
896

897
# Avoid rescuing the Exception class.
898
Lint/RescueException:
899
  Enabled: true
900

901 902
# Do not use the same name as outer local variable for block arguments
# or block local variables.
903 904 905
Lint/ShadowingOuterLocalVariable:
  Enabled: false

906
# 'Checks for Object#to_s usage in string interpolation.
907 908 909
Lint/StringConversionInInterpolation:
  Enabled: false

910
# Do not use prefix `_` for a variable that is used.
911
Lint/UnderscorePrefixedVariableName:
912
  Enabled: true
913

914 915 916 917 918 919 920
# 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.
921 922 923
Lint/UnusedBlockArgument:
  Enabled: false

924
# Checks for unused method arguments.
925 926 927
Lint/UnusedMethodArgument:
  Enabled: false

928
# Unreachable code.
929
Lint/UnreachableCode:
930
  Enabled: true
931

932
# Checks for useless access modifiers.
933 934 935
Lint/UselessAccessModifier:
  Enabled: false

936
# Checks for useless assignment to a local variable.
937
Lint/UselessAssignment:
938
  Enabled: true
939

940
# Checks for comparison of something with itself.
941
Lint/UselessComparison:
942
  Enabled: true
943

944
# Checks for useless `else` in `begin..end` without `rescue`.
945
Lint/UselessElseWithoutRescue:
946
  Enabled: true
947

948
# Checks for useless setter call to a local variable.
949
Lint/UselessSetterCall:
950
  Enabled: true
951

952
# Possible use of operator/literal/variable in void context.
953
Lint/Void:
954
  Enabled: true
955

956 957 958 959 960

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

# Use `casecmp` rather than `downcase ==`.
Performance/Casecmp:
961
  Enabled: true
962 963 964 965

# Use `str.{start,end}_with?(x, ..., y, ...)` instead of
# `str.{start,end}_with?(x, ...) || str.{start,end}_with?(y, ...)`.
Performance/DoubleStartEndWith:
966
  Enabled: true
967 968 969 970 971 972 973 974

# 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 已提交
975
  Enabled: true
976 977 978

# Use `Range#cover?` instead of `Range#include?`.
Performance/RangeInclude:
979
  Enabled: true
980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000

# 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:
1001
  Enabled: true
1002 1003 1004 1005

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

1008 1009 1010 1011
# 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 已提交
1012
  Enabled: true
1013 1014 1015 1016 1017 1018 1019

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


1020 1021
##################### Rails ##################################

1022 1023 1024 1025 1026
# Enables Rails cops.
Rails:
  Enabled: true

# Enforces consistent use of action filter methods.
1027
Rails/ActionFilter:
1028
  Enabled: true
1029
  EnforcedStyle: action
1030

1031 1032
# Checks the correct usage of date aware methods, such as `Date.today`,
# `Date.current`, etc.
G
Gabriel Mazetto 已提交
1033 1034 1035
Rails/Date:
  Enabled: false

1036 1037
# Prefer delegate method for delegations.
Rails/Delegate:
1038 1039
  Enabled: false

1040 1041
# Prefer `find_by` over `where.first`.
Rails/FindBy:
1042
  Enabled: true
1043 1044 1045

# Prefer `all.find_each` over `all.find`.
Rails/FindEach:
1046
  Enabled: true
1047

1048
# Prefer has_many :through to has_and_belongs_to_many.
1049
Rails/HasAndBelongsToMany:
1050
  Enabled: true
1051

1052
# Checks for calls to puts, print, etc.
1053
Rails/Output:
1054
  Enabled: true
1055

1056 1057
# Checks for incorrect grammar when using methods like `3.day.ago`.
Rails/PluralizationGrammar:
1058
  Enabled: true
1059 1060

# Checks for `read_attribute(:attr)` and `write_attribute(:attr, val)`.
1061 1062 1063
Rails/ReadWriteAttribute:
  Enabled: false

1064
# Checks the arguments of ActiveRecord scopes.
1065
Rails/ScopeArgs:
1066
  Enabled: true
1067

1068 1069
# Checks the correct usage of time zone aware methods.
# http://danilenko.org/2012/7/6/rails_timezones
1070 1071 1072
Rails/TimeZone:
  Enabled: false

1073
# Use validates :attribute, hash of validations.
1074 1075
Rails/Validation:
  Enabled: false
R
Robert Speicher 已提交
1076 1077 1078

##################### RSpec ##################################

1079
# Check that instances are not being stubbed globally.
R
Robert Speicher 已提交
1080 1081 1082
RSpec/AnyInstance:
  Enabled: false

1083 1084
# Check that the first argument to the top level describe is the tested class or
# module.
R
Robert Speicher 已提交
1085 1086 1087
RSpec/DescribeClass:
  Enabled: false

1088
# Use `described_class` for tested class / module.
R
Robert Speicher 已提交
1089 1090 1091
RSpec/DescribeMethod:
  Enabled: false

1092 1093
# Checks that the second argument to top level describe is the tested method
# name.
R
Robert Speicher 已提交
1094 1095 1096
RSpec/DescribedClass:
  Enabled: false

1097
# Checks for long example.
R
Robert Speicher 已提交
1098 1099 1100 1101
RSpec/ExampleLength:
  Enabled: false
  Max: 5

1102
# Do not use should when describing your tests.
R
Robert Speicher 已提交
1103 1104 1105 1106 1107 1108 1109 1110
RSpec/ExampleWording:
  Enabled: false
  CustomTransform:
    be: is
    have: has
    not: does not
  IgnoredWords: []

1111
# Checks the file and folder naming of the spec file.
R
Robert Speicher 已提交
1112 1113 1114 1115 1116 1117
RSpec/FilePath:
  Enabled: false
  CustomTransform:
    RuboCop: rubocop
    RSpec: rspec

1118
# Checks if there are focused specs.
R
Robert Speicher 已提交
1119 1120 1121
RSpec/Focus:
  Enabled: true

1122
# Checks for the usage of instance variables.
R
Robert Speicher 已提交
1123 1124 1125
RSpec/InstanceVariable:
  Enabled: false

1126
# Checks for multiple top-level describes.
R
Robert Speicher 已提交
1127 1128 1129
RSpec/MultipleDescribes:
  Enabled: false

1130
# Enforces the usage of the same method on all negative message expectations.
R
Robert Speicher 已提交
1131 1132 1133 1134
RSpec/NotToNot:
  EnforcedStyle: not_to
  Enabled: false

1135
# Prefer using verifying doubles over normal doubles.
R
Robert Speicher 已提交
1136 1137
RSpec/VerifiedDoubles:
  Enabled: false