.rubocop.yml 25.5 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
    - 'generator_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:
D
Dmitriy Zaporozhets 已提交
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:
D
Dmitriy Zaporozhets 已提交
109
  Enabled: true
110

111
# Use CamelCase for classes and modules.'
112
Style/ClassAndModuleCamelCase:
D
Dmitriy Zaporozhets 已提交
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:
D
Dmitriy Zaporozhets 已提交
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
Style/DefWithParentheses:
155
  Enabled: true
156

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
G
Gabriel Mazetto 已提交
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
Style/InfiniteLoop:
302
  Enabled: true
303

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

412
# Checks for redundant nil checks.
413
Style/NonNilCheck:
414
  Enabled: true
415

416
# Use ! instead of not.
417
Style/Not:
418
  Enabled: true
419

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

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

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

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

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

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

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

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

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

457
# Use proc instead of Proc.new.
458 459 460
Style/Proc:
  Enabled: false

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

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

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

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

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

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

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

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

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

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

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

516
# Avoid single-line methods.
517 518 519
Style/SingleLineMethods:
  Enabled: false

520
# Use spaces after colons.
521 522 523
Style/SpaceAfterColon:
  Enabled: false

524
# Use spaces after commas.
525 526 527
Style/SpaceAfterComma:
  Enabled: false

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

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

537
# Use spaces after semicolons.
538 539 540
Style/SpaceAfterSemicolon:
  Enabled: false

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

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

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

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

558 559
# No spaces before commas.
Style/SpaceBeforeComma:
560 561
  Enabled: false

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

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

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

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

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

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

593
# No spaces inside range literals.
594 595 596
Style/SpaceInsideRangeLiteral:
  Enabled: false

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

# Avoid Perl-style global variables.
602 603 604
Style/SpecialGlobalVars:
  Enabled: false

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

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

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

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

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

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

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

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

# Avoid trailing whitespace.
647 648 649
Style/TrailingWhitespace:
  Enabled: false

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

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

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

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

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

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

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

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

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

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

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

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


706 707
#################### Metrics ################################

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

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

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

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

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

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

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


752 753
#################### Lint ################################

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

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

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

768
# Align block ends correctly.
769 770 771
Lint/BlockAlignment:
  Enabled: false

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

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

781
# Check for debugger calls.
782
Lint/Debugger:
783
  Enabled: true
784

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

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

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

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

809
# Checks for empty ensure block.
810
Lint/EmptyEnsure:
811
  Enabled: true
812

813
# Checks for empty string interpolation.
814 815 816
Lint/EmptyInterpolation:
  Enabled: false

817
# Align ends correctly.
818
Lint/EndAlignment:
819
  Enabled: true
820

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

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

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

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

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

# Don't suppress exception.
842 843 844
Lint/HandleExceptions:
  Enabled: false

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

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

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

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

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

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

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

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

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

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

895
# Avoid rescuing the Exception class.
896
Lint/RescueException:
897
  Enabled: true
898

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

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

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

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

922
# Checks for unused method arguments.
923 924 925
Lint/UnusedMethodArgument:
  Enabled: false

926
# Unreachable code.
927
Lint/UnreachableCode:
928
  Enabled: true
929

930
# Checks for useless access modifiers.
931 932 933
Lint/UselessAccessModifier:
  Enabled: false

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

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

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

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

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

954 955 956 957 958

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

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

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

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

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

# 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:
999
  Enabled: true
1000 1001 1002 1003

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

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

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


1018 1019
##################### Rails ##################################

1020 1021 1022 1023 1024
# Enables Rails cops.
Rails:
  Enabled: true

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

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

1034 1035
# Prefer delegate method for delegations.
Rails/Delegate:
1036 1037
  Enabled: false

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

# Prefer `all.find_each` over `all.find`.
Rails/FindEach:
1044
  Enabled: true
1045

1046
# Prefer has_many :through to has_and_belongs_to_many.
1047
Rails/HasAndBelongsToMany:
1048
  Enabled: true
1049

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

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

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

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

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

1071
# Use validates :attribute, hash of validations.
1072 1073
Rails/Validation:
  Enabled: false