.rubocop.yml 21.7 KB
Newer Older
1 2 3
require:
  - rubocop-rspec
  - ./rubocop/rubocop
R
Robert Speicher 已提交
4

Z
Z.J. van de Weg 已提交
5 6
inherit_from: .rubocop_todo.yml

7
AllCops:
Z
Z.J. van de Weg 已提交
8
  TargetRubyVersion: 2.3
Z
Z.J. van de Weg 已提交
9
  # Cop names are not d§splayed in offense messages by default. Change behavior
10 11 12 13 14 15 16 17 18 19
  # 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/**/*'
M
Mike Greiling 已提交
20
    - 'node_modules/**/*'
S
Sean McGivern 已提交
21 22
    - 'db/*'
    - 'db/fixtures/**/*'
23 24
    - 'tmp/**/*'
    - 'bin/**/*'
25
    - 'generator_templates/**/*'
26

27
# Style #######################################################################
28 29

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

C
Connor Shea 已提交
33 34 35 36
# Check the naming of accessor methods for get_/set_.
Style/AccessorMethodName:
  Enabled: false

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

D
Douwe Maan 已提交
50 51 52 53 54
# Whether `and` and `or` are banned only in conditionals (conditionals)
# or completely (always).
Style/AndOr:
  Enabled: true

55
# Use `Array#join` instead of `Array#*`.
56
Style/ArrayJoin:
57
  Enabled: true
58

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

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

67
# Checks for uses of Module#attr.
68
Style/Attr:
69
  Enabled: true
70

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

75
# Do not use block comments.
76
Style/BlockComments:
77
  Enabled: true
78

79
# Put end statement of multiline block on its own line.
80
Style/BlockEndNewline:
81
  Enabled: true
82

83 84
# Avoid using {...} for multi-line blocks (multiline chaining is # always
# ugly). Prefer {...} over do...end for single-line blocks.
85
Style/BlockDelimiters:
86
  Enabled: true
87

88
# Indentation of when in a case/when/[else/]end.
89
Style/CaseIndentation:
90
  Enabled: true
91

92
# Checks for uses of character literals.
93
Style/CharacterLiteral:
D
Dmitriy Zaporozhets 已提交
94
  Enabled: true
95

96
# Use CamelCase for classes and modules.'
97
Style/ClassAndModuleCamelCase:
D
Dmitriy Zaporozhets 已提交
98
  Enabled: true
99

100
# Checks style of children classes and modules.
101 102 103
Style/ClassAndModuleChildren:
  Enabled: false

104
# Enforces consistent use of `Object#is_a?` or `Object#kind_of?`.
105
Style/ClassCheck:
D
Douwe Maan 已提交
106
  Enabled: true
107

108
# Use self when defining module/class methods.
109
Style/ClassMethods:
110
  Enabled: true
111

112
# Avoid the use of class variables.
113
Style/ClassVars:
D
Dmitriy Zaporozhets 已提交
114
  Enabled: true
115

116
# Indentation of comments.
117
Style/CommentIndentation:
118
  Enabled: true
119

120
# Constants should use SCREAMING_SNAKE_CASE.
121
Style/ConstantName:
122
  Enabled: true
123

124
# Use def with parentheses when there are arguments.
125
Style/DefWithParentheses:
126
  Enabled: true
127

128
# Document classes and non-namespace modules.
129 130 131
Style/Documentation:
  Enabled: false

D
Douwe Maan 已提交
132 133
Style/DotPosition:
  Enabled: true
134
  EnforcedStyle: leading
D
Douwe Maan 已提交
135

136
# Align elses and elsifs correctly.
137
Style/ElseAlignment:
138
  Enabled: true
139

140
# Use empty lines between defs.
141
Style/EmptyLineBetweenDefs:
D
Douwe Maan 已提交
142
  Enabled: true
143

144
# Don't use several empty lines in a row.
145
Style/EmptyLines:
146
  Enabled: true
147

148
# Keep blank lines around access modifiers.
149
Style/EmptyLinesAroundAccessModifier:
150
  Enabled: true
151

152
# Keeps track of empty lines around block bodies.
153
Style/EmptyLinesAroundBlockBody:
154
  Enabled: true
155

156
# Keeps track of empty lines around class bodies.
157
Style/EmptyLinesAroundClassBody:
158
  Enabled: true
159

160
# Keeps track of empty lines around module bodies.
161
Style/EmptyLinesAroundModuleBody:
162
  Enabled: true
163

164
# Keeps track of empty lines around method bodies.
165
Style/EmptyLinesAroundMethodBody:
166
  Enabled: true
167

168
# Avoid the use of END blocks.
169
Style/EndBlock:
170
  Enabled: true
171

172
# Use Unix-style line endings.
173
Style/EndOfLine:
174
  Enabled: true
175

176
# Favor the use of Fixnum#even? && Fixnum#odd?
177
Style/EvenOdd:
178
  Enabled: true
179

180
# Use snake_case for source file names.
181
Style/FileName:
182 183 184
  Enabled: true

# Checks for a line break before the first parameter in a multi-line method
185
# parameter definition.
186 187
Style/FirstMethodParameterLineBreak:
  Enabled: true
188

189
# Checks for flip flops.
190
Style/FlipFlop:
191
  Enabled: true
192

193
# Checks use of for or each in multiline loops.
194
Style/For:
G
Grzegorz Bizon 已提交
195
  Enabled: true
196

Z
Z.J. van de Weg 已提交
197 198 199
# Checks if there is a magic comment to enforce string literals
Style/FrozenStringLiteralComment:
  Enabled: false
200

201
# Do not introduce global variables.
202
Style/GlobalVars:
203
  Enabled: true
204 205 206
  Exclude:
    - 'lib/backup/**/*'
    - 'lib/tasks/**/*'
207

208 209
# Prefer Ruby 1.9 hash syntax `{ a: 1, b: 2 }`
# over 1.8 syntax `{ :a => 1, :b => 2 }`.
210
Style/HashSyntax:
211
  Enabled: true
212

213
# Do not use if x; .... Use the ternary operator instead.
214
Style/IfWithSemicolon:
215
  Enabled: true
216

217 218 219
# 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:
220
  Enabled: true
221 222

# Checks the indentation of the first line of the right-hand-side of a
G
Gabriel Mazetto 已提交
223
# multi-line assignment.
224
Style/IndentAssignment:
225
  Enabled: true
226 227

# Keep indentation straight.
228
Style/IndentationConsistency:
229
  Enabled: true
230

231
# Use 2 spaces for indentation.
232
Style/IndentationWidth:
233
  Enabled: true
234

235
# Use Kernel#loop for infinite loops.
236
Style/InfiniteLoop:
237
  Enabled: true
238

239
# Use lambda.call(...) instead of lambda.(...).
240
Style/LambdaCall:
241
  Enabled: true
242

243
# Comments should start with a space.
244
Style/LeadingCommentSpace:
F
Felipe Artur 已提交
245
  Enabled: true
246

247
# Checks if the method definitions have or don't have parentheses.
248
Style/MethodDefParentheses:
249
  Enabled: true
250

251
# Use the configured style when naming methods.
252
Style/MethodName:
253
  Enabled: true
254

C
Connor Shea 已提交
255 256 257 258
# Checks for usage of `extend self` in modules.
Style/ModuleFunction:
  Enabled: false

R
Robert Speicher 已提交
259 260 261
# 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:
262
  Enabled: true
R
Robert Speicher 已提交
263 264
  EnforcedStyle: symmetrical

265
# Avoid multi-line chains of blocks.
266
Style/MultilineBlockChain:
267
  Enabled: true
268

269
# Ensures newlines after multiline block do statements.
270
Style/MultilineBlockLayout:
271
  Enabled: true
272

R
Robert Speicher 已提交
273 274 275
# 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:
276
  Enabled: true
R
Robert Speicher 已提交
277 278
  EnforcedStyle: symmetrical

279
# Do not use then for multi-line if/unless.
280
Style/MultilineIfThen:
281
  Enabled: true
282

R
Robert Speicher 已提交
283 284 285 286 287 288
# 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

289 290 291 292 293
# Checks indentation of method calls with the dot operator that span more than
# one line.
Style/MultilineMethodCallIndentation:
  Enabled: false

294 295 296 297 298
# 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

299
# Checks indentation of binary operations that span more than one line.
300
Style/MultilineOperationIndentation:
301 302
  Enabled: true
  EnforcedStyle: indented
303

304 305 306 307
# Avoid multi-line `? :` (the ternary operator), use if/unless instead.
Style/MultilineTernaryOperator:
  Enabled: true

D
Douwe Maan 已提交
308 309 310
Style/MutableConstant:
  Enabled: true

311
# Favor unless over if for negative conditions (or control flow or).
312
Style/NegatedIf:
313
  Enabled: true
314

315 316
# Avoid using nested modifiers.
Style/NestedModifier:
317
  Enabled: true
318 319

# Use one expression per branch in a ternary operator.
320
Style/NestedTernaryOperator:
321
  Enabled: true
322

323
# Prefer x.nil? to x == nil.
324
Style/NilComparison:
325
  Enabled: true
326

327
# Checks for redundant nil checks.
328
Style/NonNilCheck:
329
  Enabled: true
330

331
# Use ! instead of not.
332
Style/Not:
333
  Enabled: true
334

335
# Add underscores to large numeric literals to improve their readability.
336 337 338
Style/NumericLiterals:
  Enabled: false

339
# Favor the ternary operator(?:) over if/then/else/end constructs.
340
Style/OneLineConditional:
341
  Enabled: true
342

343
# When defining binary operators, name the argument other.
344
Style/OpMethod:
345
  Enabled: true
346

347
# Don't use parentheses around the condition of an if/unless/while.
348
Style/ParenthesesAroundCondition:
349
  Enabled: true
350

351 352 353 354
# Checks for an obsolete RuntimeException argument in raise/fail.
Style/RedundantException:
  Enabled: true

355 356
# Checks for parentheses that seem not to serve any purpose.
Style/RedundantParentheses:
357
  Enabled: true
358 359

# Don't use semicolons to terminate expressions.
360
Style/Semicolon:
361
  Enabled: true
362

363
# Checks for proper usage of fail and raise.
364
Style/SignalException:
365 366
  EnforcedStyle: only_raise
  Enabled: true
367

368
# Use spaces after colons.
369
Style/SpaceAfterColon:
370
  Enabled: true
371

372
# Use spaces after commas.
373
Style/SpaceAfterComma:
374
  Enabled: true
375

376 377
# Do not put a space between a method name and the opening parenthesis in a
# method definition.
378
Style/SpaceAfterMethodName:
379
  Enabled: true
380

381
# Tracks redundant space after the ! operator.
382
Style/SpaceAfterNot:
383
  Enabled: true
384

385
# Use spaces after semicolons.
386
Style/SpaceAfterSemicolon:
387
  Enabled: true
388

389 390 391 392
# Use space around equals in parameter default
Style/SpaceAroundEqualsInParameterDefault:
  Enabled: true

393 394
# Use a space around keywords if appropriate.
Style/SpaceAroundKeyword:
395
  Enabled: true
396

397 398
# Use a single space around operators.
Style/SpaceAroundOperators:
G
Gabriel Mazetto 已提交
399
  Enabled: true
400

401 402
# No spaces before commas.
Style/SpaceBeforeComma:
403
  Enabled: true
404

405 406
# Checks for missing space between code and a comment on the same line.
Style/SpaceBeforeComment:
407
  Enabled: true
408

409 410
# No spaces before semicolons.
Style/SpaceBeforeSemicolon:
411
  Enabled: true
412

D
Douwe Maan 已提交
413 414 415
Style/SpaceInsideBrackets:
  Enabled: true

416
# Use spaces inside hash literal braces - or don't.
417
Style/SpaceInsideHashLiteralBraces:
418
  Enabled: true
419

420
# No spaces inside range literals.
421
Style/SpaceInsideRangeLiteral:
422
  Enabled: true
423

424 425
# Checks for padding/surrounding spaces inside string interpolation.
Style/SpaceInsideStringInterpolation:
426 427
  EnforcedStyle: no_space
  Enabled: true
428 429 430

# Check for the usage of parentheses around stabby lambda arguments.
Style/StabbyLambdaParentheses:
431 432
  EnforcedStyle: require_parentheses
  Enabled: true
433 434

# Checks if uses of quotes match the configured preference.
435 436 437
Style/StringLiterals:
  Enabled: false

438 439
# Checks if configured preferred methods are used over non-preferred.
Style/StringMethods:
440 441 442
  PreferredMethods:
    intern: to_sym
  Enabled: true
443 444

# No hard tabs.
445
Style/Tab:
D
Dmitriy Zaporozhets 已提交
446
  Enabled: true
447

448
# Checks trailing blank lines and final newline.
449
Style/TrailingBlankLines:
450
  Enabled: true
451

452 453 454
Style/TrailingCommaInLiteral:
  Enabled: false

455
# Checks for %W when interpolation is not needed.
456
Style/UnneededCapitalW:
457
  Enabled: true
458

459
# Checks for %q/%Q when single quotes or double quotes would do.
460 461 462
Style/UnneededPercentQ:
  Enabled: false

463
# Don't interpolate global, instance and class variables directly in strings.
464
Style/VariableInterpolation:
465
  Enabled: true
466

467
# Use the configured style when naming variables.
468
Style/VariableName:
469 470
  EnforcedStyle: snake_case
  Enabled: true
471

472 473 474 475
# Use the configured style when numbering variables.
Style/VariableNumber:
  Enabled: false

476
# Use when x then ... for one-line cases.
477
Style/WhenThen:
478
  Enabled: true
479

480
# Checks for redundant do after while or until.
481
Style/WhileUntilDo:
482
  Enabled: true
483

484
# Favor modifier while/until usage when you have a single-line body.
485
Style/WhileUntilModifier:
486
  Enabled: true
487

488
# Use %w or %W for arrays of words.
489
Style/WordArray:
D
Douwe Maan 已提交
490
  Enabled: true
491

492
# Metrics #####################################################################
493

494 495
# A calculated magnitude based on number of assignments,
# branches, and conditions.
496
Metrics/AbcSize:
G
Grzegorz Bizon 已提交
497
  Enabled: true
498
  Max: 60
G
Grzegorz Bizon 已提交
499

500
# Avoid excessive block nesting.
501
Metrics/BlockNesting:
G
Grzegorz Bizon 已提交
502 503
  Enabled: true
  Max: 4
504

505
# Avoid classes longer than 100 lines of code.
506 507 508
Metrics/ClassLength:
  Enabled: false

509 510 511 512 513 514 515
# 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.
516 517 518
Metrics/LineLength:
  Enabled: false

519
# Avoid methods longer than 10 lines of code.
520 521 522
Metrics/MethodLength:
  Enabled: false

523
# Avoid modules longer than 100 lines of code.
524 525 526
Metrics/ModuleLength:
  Enabled: false

527 528 529 530 531 532 533 534
# 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 已提交
535
  Max: 18
536

537
# Lint ########################################################################
538

539 540 541 542 543 544 545 546 547
# Checks for useless access modifiers.
Lint/UselessAccessModifier:
  Enabled: true

# Checks for attempts to use `private` or `protected` to set the visibility
# of a class method, which does not work.
Lint/IneffectiveAccessModifier:
  Enabled: false

548 549
# Checks for ambiguous operators in the first argument of a method invocation
# without parentheses.
550
Lint/AmbiguousOperator:
551
  Enabled: true
552

553
# Align block ends correctly.
554
Lint/BlockAlignment:
555
  Enabled: true
556

557 558 559
# Default values in optional keyword arguments and optional ordinal arguments
# should not refer back to the name of the argument.
Lint/CircularArgumentReference:
560
  Enabled: true
561 562

# Checks for condition placed in a confusing position relative to the keyword.
563
Lint/ConditionPosition:
564
  Enabled: true
565

566
# Check for debugger calls.
567
Lint/Debugger:
568
  Enabled: true
569

570
# Align ends corresponding to defs correctly.
571
Lint/DefEndAlignment:
572
  Enabled: true
573

574
# Check for deprecated class method calls.
575
Lint/DeprecatedClassMethods:
576
  Enabled: true
577

578 579
# Check for immutable argument given to each_with_object.
Lint/EachWithObjectArgument:
580
  Enabled: true
581 582

# Check for odd code arrangement in an else block.
583
Lint/ElseLayout:
584
  Enabled: true
585

586
# Checks for empty ensure block.
587
Lint/EmptyEnsure:
588
  Enabled: true
589

590 591 592 593
# Checks for the presence of `when` branches without a body.
Lint/EmptyWhen:
  Enabled: true

594
# Align ends correctly.
595
Lint/EndAlignment:
596
  Enabled: true
597

598
# END blocks should not be placed inside method definitions.
599
Lint/EndInMethod:
600
  Enabled: true
601

602
# Do not use return in an ensure block.
603
Lint/EnsureReturn:
604
  Enabled: true
605

606
# The use of eval represents a serious security risk.
607
Lint/Eval:
608
  Enabled: true
609

610 611
# Catches floating-point literals too large or small for Ruby to represent.
Lint/FloatOutOfRange:
612
  Enabled: true
613 614 615

# The number of parameters to format/sprint must match the fields.
Lint/FormatParameterMismatch:
616
  Enabled: true
617 618 619 620

# Checks for adjacent string literals on the same line, which could better be
# represented as a single string literal.
Lint/ImplicitStringConcatenation:
621
  Enabled: true
622 623 624

# Checks for invalid character literals with a non-escaped whitespace
# character.
625
Lint/InvalidCharacterLiteral:
626
  Enabled: true
627

628
# Checks of literals used in conditions.
629
Lint/LiteralInCondition:
630
  Enabled: true
631

632
# Checks for literals used in interpolation.
633
Lint/LiteralInInterpolation:
634
  Enabled: true
635

636 637
# Do not use nested method definitions.
Lint/NestedMethodDefinition:
638
  Enabled: true
639 640 641

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

# Checks for method calls with a space before the opening parenthesis.
645
Lint/ParenthesesAsGroupedExpression:
646
  Enabled: true
647

648 649 650
# Checks for `rand(1)` calls. Such calls always return `0` and most likely
# a mistake.
Lint/RandOne:
651
  Enabled: true
652 653

# Use parentheses in the method call to avoid confusion about precedence.
654
Lint/RequireParentheses:
655
  Enabled: true
656

657
# Avoid rescuing the Exception class.
658
Lint/RescueException:
659
  Enabled: true
660

C
Connor Shea 已提交
661 662
# Checks for the order which exceptions are rescued to avoid rescueing a less specific exception before a more specific exception.
Lint/ShadowedException:
663 664
  Enabled: false

665 666 667 668
# Checks for Object#to_s usage in string interpolation.
Lint/StringConversionInInterpolation:
  Enabled: true

669
# Do not use prefix `_` for a variable that is used.
670
Lint/UnderscorePrefixedVariableName:
671
  Enabled: true
672

673 674 675 676 677 678 679
# 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

# Unreachable code.
680
Lint/UnreachableCode:
681
  Enabled: true
682

D
Douwe Maan 已提交
683 684 685
Lint/UnusedMethodArgument:
  Enabled: false

686
# Checks for useless assignment to a local variable.
687
Lint/UselessAssignment:
688
  Enabled: true
689

690
# Checks for comparison of something with itself.
691
Lint/UselessComparison:
692
  Enabled: true
693

694
# Checks for useless `else` in `begin..end` without `rescue`.
695
Lint/UselessElseWithoutRescue:
696
  Enabled: true
697

698
# Checks for useless setter call to a local variable.
699
Lint/UselessSetterCall:
700
  Enabled: true
701

702
# Possible use of operator/literal/variable in void context.
703
Lint/Void:
704
  Enabled: true
705

706
# Performance #################################################################
707 708 709

# Use `casecmp` rather than `downcase ==`.
Performance/Casecmp:
710
  Enabled: true
711 712 713 714

# Use `str.{start,end}_with?(x, ..., y, ...)` instead of
# `str.{start,end}_with?(x, ...) || str.{start,end}_with?(y, ...)`.
Performance/DoubleStartEndWith:
715
  Enabled: true
716 717 718

# Use `strip` instead of `lstrip.rstrip`.
Performance/LstripRstrip:
C
Connor Shea 已提交
719
  Enabled: true
720 721 722

# Use `Range#cover?` instead of `Range#include?`.
Performance/RangeInclude:
723
  Enabled: true
724 725 726

# Use `sort` instead of `sort_by { |x| x }`.
Performance/RedundantSortBy:
727
  Enabled: true
728 729 730 731

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

734 735 736 737
# 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 已提交
738
  Enabled: true
739 740 741

# Checks for `.times.map` calls.
Performance/TimesMap:
742
  Enabled: true
743

744
# Rails #######################################################################
745

746 747 748 749 750
# Enables Rails cops.
Rails:
  Enabled: true

# Enforces consistent use of action filter methods.
751
Rails/ActionFilter:
752
  Enabled: true
753
  EnforcedStyle: action
754

755 756
# Checks the correct usage of date aware methods, such as `Date.today`,
# `Date.current`, etc.
G
Gabriel Mazetto 已提交
757 758 759
Rails/Date:
  Enabled: false

760 761
# Prefer delegate method for delegations.
Rails/Delegate:
D
Douwe Maan 已提交
762
  Enabled: true
763

764 765
# Prefer `find_by` over `where.first`.
Rails/FindBy:
766
  Enabled: true
767 768 769

# Prefer `all.find_each` over `all.find`.
Rails/FindEach:
770
  Enabled: true
771

772
# Prefer has_many :through to has_and_belongs_to_many.
773
Rails/HasAndBelongsToMany:
774
  Enabled: true
775

776
# Checks for calls to puts, print, etc.
777
Rails/Output:
778
  Enabled: true
779 780 781 782 783
  Exclude:
    - lib/gitlab/seeder.rb
    - lib/gitlab/upgrader.rb
    - 'lib/backup/**/*'
    - 'lib/tasks/**/*'
784

785 786
# Checks for incorrect grammar when using methods like `3.day.ago`.
Rails/PluralizationGrammar:
787
  Enabled: true
788 789

# Checks for `read_attribute(:attr)` and `write_attribute(:attr, val)`.
790 791 792
Rails/ReadWriteAttribute:
  Enabled: false

793
# Checks the arguments of ActiveRecord scopes.
794
Rails/ScopeArgs:
795
  Enabled: true
796

797
# RSpec #######################################################################
R
Robert Speicher 已提交
798

799
# Check that instances are not being stubbed globally.
R
Robert Speicher 已提交
800 801 802
RSpec/AnyInstance:
  Enabled: false

803 804 805 806
# Check for expectations where `be(...)` can replace `eql(...)`.
RSpec/BeEql:
  Enabled: false

807 808
# Check that the first argument to the top level describe is the tested class or
# module.
R
Robert Speicher 已提交
809 810 811
RSpec/DescribeClass:
  Enabled: false

812
# Use `described_class` for tested class / module.
R
Robert Speicher 已提交
813 814 815
RSpec/DescribeMethod:
  Enabled: false

816 817 818
# Checks that the second argument to top level describe is the tested method
# name.
RSpec/DescribedClass:
R
Robert Speicher 已提交
819 820
  Enabled: false

821
# Checks for long example.
R
Robert Speicher 已提交
822 823 824 825
RSpec/ExampleLength:
  Enabled: false
  Max: 5

826
# Do not use should when describing your tests.
R
Robert Speicher 已提交
827 828 829 830 831 832 833 834
RSpec/ExampleWording:
  Enabled: false
  CustomTransform:
    be: is
    have: has
    not: does not
  IgnoredWords: []

835 836 837 838
# Checks for `expect(...)` calls containing literal values.
RSpec/ExpectActual:
  Enabled: true

839
# Checks the file and folder naming of the spec file.
R
Robert Speicher 已提交
840 841 842 843 844 845
RSpec/FilePath:
  Enabled: false
  CustomTransform:
    RuboCop: rubocop
    RSpec: rspec

846
# Checks if there are focused specs.
R
Robert Speicher 已提交
847 848 849
RSpec/Focus:
  Enabled: true

850
# Checks for the usage of instance variables.
R
Robert Speicher 已提交
851 852 853
RSpec/InstanceVariable:
  Enabled: false

854
# Checks for multiple top-level describes.
R
Robert Speicher 已提交
855 856 857
RSpec/MultipleDescribes:
  Enabled: false

858
# Enforces the usage of the same method on all negative message expectations.
R
Robert Speicher 已提交
859 860
RSpec/NotToNot:
  EnforcedStyle: not_to
861
  Enabled: true
R
Robert Speicher 已提交
862

863
# Prefer using verifying doubles over normal doubles.
R
Robert Speicher 已提交
864 865
RSpec/VerifiedDoubles:
  Enabled: false
D
Douwe Maan 已提交
866 867 868 869 870 871 872 873 874 875 876 877 878

RSpec/MultipleExpectations:
  Enabled: false

RSpec/NamedSubject:
  Enabled: false

RSpec/NestedGroups:
  Enabled: false

RSpec/LeadingSubject:
  Enabled: false

D
Douwe Maan 已提交
879 880 881 882 883 884 885 886 887 888 889 890 891 892 893
Lint/AmbiguousRegexpLiteral:
  Enabled: false

Bundler/OrderedGems:
  Enabled: false

Lint/HandleExceptions:
  Enabled: false

Lint/Loop:
  Enabled: false

Metrics/BlockLength:
  Enabled: false

D
Douwe Maan 已提交
894 895 896 897
Performance/RedundantMerge:
  Enabled: true
  MaxKeyValuePairs: 1

D
Douwe Maan 已提交
898 899 900 901 902 903 904 905 906 907 908 909 910 911
RSpec/LetSetup:
  Enabled: false

RSpec/MessageChain:
  Enabled: false

RSpec/MessageSpies:
  Enabled: false

RSpec/RepeatedDescription:
  Enabled: false

RSpec/SubjectStub:
  Enabled: false
D
Douwe Maan 已提交
912 913 914 915

Lint/UnifiedInteger:
  Enabled: true

D
Douwe Maan 已提交
916 917 918 919 920 921
Lint/ShadowingOuterLocalVariable:
  Enabled: false

Lint/AssignmentInCondition:
  Enabled: false

D
Douwe Maan 已提交
922 923
Lint/UnneededSplatExpansion:
  Enabled: false
D
Douwe Maan 已提交
924 925 926 927

Lint/UnusedBlockArgument:
  Enabled: false

928 929 930
Performance/RedundantBlockCall:
  Enabled: true

D
Douwe Maan 已提交
931 932 933
Performance/RedundantMatch:
  Enabled: true

D
Douwe Maan 已提交
934 935 936
Rails/DynamicFindBy:
  Enabled: false

D
Douwe Maan 已提交
937 938 939
Rails/HttpPositionalArguments:
  Enabled: false

D
Douwe Maan 已提交
940 941 942
Rails/OutputSafety:
  Enabled: false

D
Douwe Maan 已提交
943 944 945
Rails/TimeZone:
  Enabled: false

D
Douwe Maan 已提交
946 947 948
Rails/Validation:
  Enabled: true

D
Douwe Maan 已提交
949 950 951
Security/JSONLoad:
  Enabled: true

D
Douwe Maan 已提交
952 953 954
Style/AlignParameters:
  Enabled: false

D
Douwe Maan 已提交
955 956
Style/BarePercentLiterals:
  Enabled: true
957 958 959

Style/BracesAroundHashParameters:
  Enabled: false
D
Douwe Maan 已提交
960

D
Douwe Maan 已提交
961 962 963
Style/CaseEquality:
  Enabled: false

D
Douwe Maan 已提交
964 965 966
Style/ColonMethodCall:
  Enabled: true

D
Douwe Maan 已提交
967 968 969
Style/CommentAnnotation:
  Enabled: false

D
Douwe Maan 已提交
970 971 972
Style/ConditionalAssignment:
  Enabled: true

D
Douwe Maan 已提交
973 974
Style/DoubleNegation:
  Enabled: false
975 976 977 978 979 980

Rails/Exit:
  Enabled: true
  Exclude:
    - lib/gitlab/upgrader.rb
    - 'lib/backup/**/*'