BigW Consortium Gitlab

.rubocop.yml 27.3 KB
Newer Older
1 2 3
require:
  - rubocop-rspec
  - ./rubocop/rubocop
Robert Speicher committed
4

5 6 7 8 9 10 11 12 13 14 15 16 17
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/**/*'
18 19
    - 'db/*'
    - 'db/fixtures/**/*'
20 21 22 23 24 25 26 27 28
    - 'tmp/**/*'
    - 'bin/**/*'
    - 'lib/backup/**/*'
    - 'lib/ci/backup/**/*'
    - 'lib/tasks/**/*'
    - 'lib/ci/migrate/**/*'
    - 'lib/email_validator.rb'
    - 'lib/gitlab/upgrader.rb'
    - 'lib/gitlab/seeder.rb'
29
    - 'generator_templates/**/*'
30 31 32 33 34


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

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

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

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

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

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

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

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

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

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

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

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

79
# Avoid the use of BEGIN blocks.
80
Style/BeginBlock:
81
  Enabled: true
82

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

87
# Do not use block comments.
88
Style/BlockComments:
89
  Enabled: true
90

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

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

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

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

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

112
# Checks for uses of character literals.
113
Style/CharacterLiteral:
114
  Enabled: true
115

116
# Use CamelCase for classes and modules.'
117
Style/ClassAndModuleCamelCase:
118
  Enabled: true
119

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

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

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

132
# Avoid the use of class variables.
133
Style/ClassVars:
134
  Enabled: true
135

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

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

144
# Indentation of comments.
145
Style/CommentIndentation:
146
  Enabled: true
147

148 149 150 151 152 153 154
# 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.
155
Style/ConstantName:
156
  Enabled: true
157

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

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

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

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

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

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

182
# Align elses and elsifs correctly.
183
Style/ElseAlignment:
184
  Enabled: true
185

186
# Avoid empty else-clauses.
187 188 189
Style/EmptyElse:
  Enabled: false

190
# Use empty lines between defs.
191 192 193
Style/EmptyLineBetweenDefs:
  Enabled: false

194
# Don't use several empty lines in a row.
195
Style/EmptyLines:
196
  Enabled: true
197

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

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

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

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

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

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

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

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

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

234
# Do not use unnecessary spacing.
235 236 237
Style/ExtraSpacing:
  Enabled: false

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

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

247
# Checks for flip flops.
248
Style/FlipFlop:
249
  Enabled: true
250

251
# Checks use of for or each in multiline loops.
252
Style/For:
253
  Enabled: true
254

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

259
# Do not introduce global variables.
260
Style/GlobalVars:
261
  Enabled: true
262

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

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

272 273 274 275 276
# 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.
277 278 279
Style/IfUnlessModifier:
  Enabled: false

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

284 285 286
# 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:
287
  Enabled: true
288 289

# Checks the indentation of the first line of the right-hand-side of a
290
# multi-line assignment.
291
Style/IndentAssignment:
292
  Enabled: true
293 294

# Keep indentation straight.
295
Style/IndentationConsistency:
296
  Enabled: true
297

298
# Use 2 spaces for indentation.
299
Style/IndentationWidth:
300
  Enabled: true
301

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

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

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

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

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

322
# Comments should start with a space.
323
Style/LeadingCommentSpace:
324
  Enabled: true
325

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

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

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

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

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

346 347 348 349 350 351
# 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

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

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

360 361 362 363 364 365
# 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

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

370 371 372 373 374 375
# 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

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

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

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

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

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

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

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

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

# 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.
416
Style/NestedTernaryOperator:
417
  Enabled: true
418

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

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

427
# Checks for redundant nil checks.
428
Style/NonNilCheck:
429
  Enabled: true
430

431
# Use ! instead of not.
432
Style/Not:
433
  Enabled: true
434

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

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

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

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

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

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

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

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

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

472
# Use proc instead of Proc.new.
473 474 475
Style/Proc:
  Enabled: false

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

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

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

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

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

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

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

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

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

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

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

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

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

531
# Avoid single-line methods.
532 533 534
Style/SingleLineMethods:
  Enabled: false

535
# Use spaces after colons.
536
Style/SpaceAfterColon:
537
  Enabled: true
538

539
# Use spaces after commas.
540
Style/SpaceAfterComma:
541
  Enabled: true
542

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

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

552
# Use spaces after semicolons.
553
Style/SpaceAfterSemicolon:
554
  Enabled: true
555

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

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

565 566
# Use a single space around operators.
Style/SpaceAroundOperators:
567
  Enabled: true
568

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

573 574
# No spaces before commas.
Style/SpaceBeforeComma:
575
  Enabled: true
576

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

581 582 583 584 585 586 587
# 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:
588
  Enabled: true
589

590 591 592 593
# 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:
594 595
  Enabled: false

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

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

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

608
# No spaces inside range literals.
609
Style/SpaceInsideRangeLiteral:
610
  Enabled: true
611

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

# Avoid Perl-style global variables.
618 619 620
Style/SpecialGlobalVars:
  Enabled: false

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

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

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

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

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

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

649
# No hard tabs.
650
Style/Tab:
Dmitriy Zaporozhets committed
651
  Enabled: true
652

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

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

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

# Avoid trailing whitespace.
666 667 668
Style/TrailingWhitespace:
  Enabled: false

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

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

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

682
# Checks for %W when interpolation is not needed.
683
Style/UnneededCapitalW:
684
  Enabled: true
685

686 687 688 689 690 691
# 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.
692 693 694
Style/UnneededPercentQ:
  Enabled: false

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

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

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

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

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

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

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


726 727
#################### Metrics ################################

728 729
# A calculated magnitude based on number of assignments,
# branches, and conditions.
730
Metrics/AbcSize:
731
  Enabled: true
732
  Max: 60
733

734
# Avoid excessive block nesting.
735
Metrics/BlockNesting:
736 737
  Enabled: true
  Max: 4
738

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

743 744 745 746 747 748 749
# 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.
750 751 752
Metrics/LineLength:
  Enabled: false

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

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

761 762 763 764 765 766 767 768
# 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
769
  Max: 18
770 771


772 773
#################### Lint ################################

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

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

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

788
# Align block ends correctly.
789
Lint/BlockAlignment:
790
  Enabled: true
791

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

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

801
# Check for debugger calls.
802
Lint/Debugger:
803
  Enabled: true
804

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

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

813 814 815 816 817 818 819 820 821 822
# 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:
823
  Enabled: true
824 825

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

829
# Checks for empty ensure block.
830
Lint/EmptyEnsure:
831
  Enabled: true
832

833
# Checks for empty string interpolation.
834 835 836
Lint/EmptyInterpolation:
  Enabled: false

837
# Align ends correctly.
838
Lint/EndAlignment:
839
  Enabled: true
840

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

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

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

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

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

# Don't suppress exception.
862 863 864
Lint/HandleExceptions:
  Enabled: false

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

# 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.
878
Lint/InvalidCharacterLiteral:
879
  Enabled: true
880

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

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

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

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

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

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

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

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

915
# Avoid rescuing the Exception class.
916
Lint/RescueException:
917
  Enabled: true
918

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

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

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

932 933 934 935 936 937 938
# 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.
939 940 941
Lint/UnusedBlockArgument:
  Enabled: false

942
# Checks for unused method arguments.
943 944 945
Lint/UnusedMethodArgument:
  Enabled: false

946
# Unreachable code.
947
Lint/UnreachableCode:
948
  Enabled: true
949

950
# Checks for useless access modifiers.
951 952 953
Lint/UselessAccessModifier:
  Enabled: false

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

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

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

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

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

974 975 976 977 978

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

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

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

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

# Use `strip` instead of `lstrip.rstrip`.
Performance/LstripRstrip:
Connor Shea committed
993
  Enabled: true
994 995 996

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

# 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:
1019
  Enabled: true
1020 1021 1022 1023

# Use `start_with?` instead of a regex match anchored to the beginning of a
# string.
Performance/StartWith:
1024
  Enabled: true
1025

1026 1027 1028 1029
# 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:
1030
  Enabled: true
1031 1032 1033

# Checks for `.times.map` calls.
Performance/TimesMap:
1034
  Enabled: true
1035 1036


1037 1038
##################### Rails ##################################

1039 1040 1041 1042 1043
# Enables Rails cops.
Rails:
  Enabled: true

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

1048 1049
# Checks the correct usage of date aware methods, such as `Date.today`,
# `Date.current`, etc.
1050 1051 1052
Rails/Date:
  Enabled: false

1053 1054
# Prefer delegate method for delegations.
Rails/Delegate:
1055 1056
  Enabled: false

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

# Prefer `all.find_each` over `all.find`.
Rails/FindEach:
1063
  Enabled: true
1064

1065
# Prefer has_many :through to has_and_belongs_to_many.
1066
Rails/HasAndBelongsToMany:
1067
  Enabled: true
1068

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

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

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

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

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

1090
# Use validates :attribute, hash of validations.
1091 1092
Rails/Validation:
  Enabled: false
Robert Speicher committed
1093

1094 1095 1096
Rails/UniqBeforePluck:
  Enabled: false

Robert Speicher committed
1097 1098
##################### RSpec ##################################

1099
# Check that instances are not being stubbed globally.
Robert Speicher committed
1100 1101 1102
RSpec/AnyInstance:
  Enabled: false

1103 1104
# Check that the first argument to the top level describe is the tested class or
# module.
Robert Speicher committed
1105 1106 1107
RSpec/DescribeClass:
  Enabled: false

1108
# Use `described_class` for tested class / module.
Robert Speicher committed
1109 1110 1111
RSpec/DescribeMethod:
  Enabled: false

1112 1113
# Checks that the second argument to top level describe is the tested method
# name.
Robert Speicher committed
1114 1115 1116
RSpec/DescribedClass:
  Enabled: false

1117
# Checks for long example.
Robert Speicher committed
1118 1119 1120 1121
RSpec/ExampleLength:
  Enabled: false
  Max: 5

1122
# Do not use should when describing your tests.
Robert Speicher committed
1123 1124 1125 1126 1127 1128 1129 1130
RSpec/ExampleWording:
  Enabled: false
  CustomTransform:
    be: is
    have: has
    not: does not
  IgnoredWords: []

1131
# Checks the file and folder naming of the spec file.
Robert Speicher committed
1132 1133 1134 1135 1136 1137
RSpec/FilePath:
  Enabled: false
  CustomTransform:
    RuboCop: rubocop
    RSpec: rspec

1138
# Checks if there are focused specs.
Robert Speicher committed
1139 1140 1141
RSpec/Focus:
  Enabled: true

1142
# Checks for the usage of instance variables.
Robert Speicher committed
1143 1144 1145
RSpec/InstanceVariable:
  Enabled: false

1146
# Checks for multiple top-level describes.
Robert Speicher committed
1147 1148 1149
RSpec/MultipleDescribes:
  Enabled: false

1150
# Enforces the usage of the same method on all negative message expectations.
Robert Speicher committed
1151 1152
RSpec/NotToNot:
  EnforcedStyle: not_to
1153
  Enabled: true
Robert Speicher committed
1154

1155
# Prefer using verifying doubles over normal doubles.
Robert Speicher committed
1156 1157
RSpec/VerifiedDoubles:
  Enabled: false