.rubocop.yml 21.6 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 25 26 27 28 29 30 31
    - 'tmp/**/*'
    - 'bin/**/*'
    - 'lib/backup/**/*'
    - 'lib/ci/backup/**/*'
    - 'lib/tasks/**/*'
    - 'lib/ci/migrate/**/*'
    - 'lib/email_validator.rb'
    - 'lib/gitlab/upgrader.rb'
    - 'lib/gitlab/seeder.rb'
32
    - 'generator_templates/**/*'
33

34
# Style #######################################################################
35 36

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

C
Connor Shea 已提交
40 41 42 43
# Check the naming of accessor methods for get_/set_.
Style/AccessorMethodName:
  Enabled: false

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

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

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

D
Douwe Maan 已提交
57 58 59 60 61
# Whether `and` and `or` are banned only in conditionals (conditionals)
# or completely (always).
Style/AndOr:
  Enabled: true

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

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

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

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

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

82
# Do not use block comments.
83
Style/BlockComments:
84
  Enabled: true
85

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
# Indentation of when in a case/when/[else/]end.
96
Style/CaseIndentation:
97
  Enabled: true
98

99
# Checks for uses of character literals.
100
Style/CharacterLiteral:
D
Dmitriy Zaporozhets 已提交
101
  Enabled: true
102

103
# Use CamelCase for classes and modules.'
104
Style/ClassAndModuleCamelCase:
D
Dmitriy Zaporozhets 已提交
105
  Enabled: true
106

107
# Checks style of children classes and modules.
108 109 110
Style/ClassAndModuleChildren:
  Enabled: false

111
# Enforces consistent use of `Object#is_a?` or `Object#kind_of?`.
112
Style/ClassCheck:
D
Douwe Maan 已提交
113
  Enabled: true
114

115
# Use self when defining module/class methods.
116
Style/ClassMethods:
117
  Enabled: true
118

119
# Avoid the use of class variables.
120
Style/ClassVars:
D
Dmitriy Zaporozhets 已提交
121
  Enabled: true
122

123
# Indentation of comments.
124
Style/CommentIndentation:
125
  Enabled: true
126

127
# Constants should use SCREAMING_SNAKE_CASE.
128
Style/ConstantName:
129
  Enabled: true
130

131
# Use def with parentheses when there are arguments.
132
Style/DefWithParentheses:
133
  Enabled: true
134

135
# Document classes and non-namespace modules.
136 137 138
Style/Documentation:
  Enabled: false

D
Douwe Maan 已提交
139 140
Style/DotPosition:
  Enabled: true
141
  EnforcedStyle: leading
D
Douwe Maan 已提交
142

143
# Align elses and elsifs correctly.
144
Style/ElseAlignment:
145
  Enabled: true
146

147
# Use empty lines between defs.
148
Style/EmptyLineBetweenDefs:
D
Douwe Maan 已提交
149
  Enabled: true
150

151
# Don't use several empty lines in a row.
152
Style/EmptyLines:
153
  Enabled: true
154

155
# Keep blank lines around access modifiers.
156
Style/EmptyLinesAroundAccessModifier:
157
  Enabled: true
158

159
# Keeps track of empty lines around block bodies.
160
Style/EmptyLinesAroundBlockBody:
161
  Enabled: true
162

163
# Keeps track of empty lines around class bodies.
164
Style/EmptyLinesAroundClassBody:
165
  Enabled: true
166

167
# Keeps track of empty lines around module bodies.
168
Style/EmptyLinesAroundModuleBody:
169
  Enabled: true
170

171
# Keeps track of empty lines around method bodies.
172
Style/EmptyLinesAroundMethodBody:
173
  Enabled: true
174

175
# Avoid the use of END blocks.
176
Style/EndBlock:
177
  Enabled: true
178

179
# Use Unix-style line endings.
180
Style/EndOfLine:
181
  Enabled: true
182

183
# Favor the use of Fixnum#even? && Fixnum#odd?
184
Style/EvenOdd:
185
  Enabled: true
186

187
# Use snake_case for source file names.
188
Style/FileName:
189 190 191
  Enabled: true

# Checks for a line break before the first parameter in a multi-line method
192
# parameter definition.
193 194
Style/FirstMethodParameterLineBreak:
  Enabled: true
195

196
# Checks for flip flops.
197
Style/FlipFlop:
198
  Enabled: true
199

200
# Checks use of for or each in multiline loops.
201
Style/For:
G
Grzegorz Bizon 已提交
202
  Enabled: true
203

Z
Z.J. van de Weg 已提交
204 205 206
# Checks if there is a magic comment to enforce string literals
Style/FrozenStringLiteralComment:
  Enabled: false
207

208
# Do not introduce global variables.
209
Style/GlobalVars:
210
  Enabled: true
211

212 213
# Prefer Ruby 1.9 hash syntax `{ a: 1, b: 2 }`
# over 1.8 syntax `{ :a => 1, :b => 2 }`.
214
Style/HashSyntax:
215
  Enabled: true
216

217
# Do not use if x; .... Use the ternary operator instead.
218
Style/IfWithSemicolon:
219
  Enabled: true
220

221 222 223
# 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:
224
  Enabled: true
225 226

# Checks the indentation of the first line of the right-hand-side of a
G
Gabriel Mazetto 已提交
227
# multi-line assignment.
228
Style/IndentAssignment:
229
  Enabled: true
230 231

# Keep indentation straight.
232
Style/IndentationConsistency:
233
  Enabled: true
234

235
# Use 2 spaces for indentation.
236
Style/IndentationWidth:
237
  Enabled: true
238

239
# Use Kernel#loop for infinite loops.
240
Style/InfiniteLoop:
241
  Enabled: true
242

243
# Use lambda.call(...) instead of lambda.(...).
244
Style/LambdaCall:
245
  Enabled: true
246

247
# Comments should start with a space.
248
Style/LeadingCommentSpace:
F
Felipe Artur 已提交
249
  Enabled: true
250

251
# Checks if the method definitions have or don't have parentheses.
252
Style/MethodDefParentheses:
253
  Enabled: true
254

255
# Use the configured style when naming methods.
256
Style/MethodName:
257
  Enabled: true
258

C
Connor Shea 已提交
259 260 261 262
# Checks for usage of `extend self` in modules.
Style/ModuleFunction:
  Enabled: false

R
Robert Speicher 已提交
263 264 265
# 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:
266
  Enabled: true
R
Robert Speicher 已提交
267 268
  EnforcedStyle: symmetrical

269
# Avoid multi-line chains of blocks.
270
Style/MultilineBlockChain:
271
  Enabled: true
272

273
# Ensures newlines after multiline block do statements.
274
Style/MultilineBlockLayout:
275
  Enabled: true
276

R
Robert Speicher 已提交
277 278 279
# 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:
280
  Enabled: true
R
Robert Speicher 已提交
281 282
  EnforcedStyle: symmetrical

283
# Do not use then for multi-line if/unless.
284
Style/MultilineIfThen:
285
  Enabled: true
286

R
Robert Speicher 已提交
287 288 289 290 291 292
# 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

293 294 295 296 297
# Checks indentation of method calls with the dot operator that span more than
# one line.
Style/MultilineMethodCallIndentation:
  Enabled: false

298 299 300 301 302
# 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

303
# Checks indentation of binary operations that span more than one line.
304
Style/MultilineOperationIndentation:
305 306
  Enabled: true
  EnforcedStyle: indented
307

308 309 310 311
# Avoid multi-line `? :` (the ternary operator), use if/unless instead.
Style/MultilineTernaryOperator:
  Enabled: true

D
Douwe Maan 已提交
312 313 314
Style/MutableConstant:
  Enabled: true

315
# Favor unless over if for negative conditions (or control flow or).
316
Style/NegatedIf:
317
  Enabled: true
318

319 320
# Avoid using nested modifiers.
Style/NestedModifier:
321
  Enabled: true
322 323

# Use one expression per branch in a ternary operator.
324
Style/NestedTernaryOperator:
325
  Enabled: true
326

327
# Prefer x.nil? to x == nil.
328
Style/NilComparison:
329
  Enabled: true
330

331
# Checks for redundant nil checks.
332
Style/NonNilCheck:
333
  Enabled: true
334

335
# Use ! instead of not.
336
Style/Not:
337
  Enabled: true
338

339
# Add underscores to large numeric literals to improve their readability.
340 341 342
Style/NumericLiterals:
  Enabled: false

343
# Favor the ternary operator(?:) over if/then/else/end constructs.
344
Style/OneLineConditional:
345
  Enabled: true
346

347
# When defining binary operators, name the argument other.
348
Style/OpMethod:
349
  Enabled: true
350

351
# Don't use parentheses around the condition of an if/unless/while.
352
Style/ParenthesesAroundCondition:
353
  Enabled: true
354

355 356 357 358
# Checks for an obsolete RuntimeException argument in raise/fail.
Style/RedundantException:
  Enabled: true

359 360
# Checks for parentheses that seem not to serve any purpose.
Style/RedundantParentheses:
361
  Enabled: true
362 363

# Don't use semicolons to terminate expressions.
364
Style/Semicolon:
365
  Enabled: true
366

367
# Checks for proper usage of fail and raise.
368
Style/SignalException:
369 370
  EnforcedStyle: only_raise
  Enabled: true
371

372
# Use spaces after colons.
373
Style/SpaceAfterColon:
374
  Enabled: true
375

376
# Use spaces after commas.
377
Style/SpaceAfterComma:
378
  Enabled: true
379

380 381
# Do not put a space between a method name and the opening parenthesis in a
# method definition.
382
Style/SpaceAfterMethodName:
383
  Enabled: true
384

385
# Tracks redundant space after the ! operator.
386
Style/SpaceAfterNot:
387
  Enabled: true
388

389
# Use spaces after semicolons.
390
Style/SpaceAfterSemicolon:
391
  Enabled: true
392

393 394 395 396
# Use space around equals in parameter default
Style/SpaceAroundEqualsInParameterDefault:
  Enabled: true

397 398
# Use a space around keywords if appropriate.
Style/SpaceAroundKeyword:
399
  Enabled: true
400

401 402
# Use a single space around operators.
Style/SpaceAroundOperators:
G
Gabriel Mazetto 已提交
403
  Enabled: true
404

405 406
# No spaces before commas.
Style/SpaceBeforeComma:
407
  Enabled: true
408

409 410
# Checks for missing space between code and a comment on the same line.
Style/SpaceBeforeComment:
411
  Enabled: true
412

413 414
# No spaces before semicolons.
Style/SpaceBeforeSemicolon:
415
  Enabled: true
416

D
Douwe Maan 已提交
417 418 419
Style/SpaceInsideBrackets:
  Enabled: true

420
# Use spaces inside hash literal braces - or don't.
421
Style/SpaceInsideHashLiteralBraces:
422
  Enabled: true
423

424
# No spaces inside range literals.
425
Style/SpaceInsideRangeLiteral:
426
  Enabled: true
427

428 429
# Checks for padding/surrounding spaces inside string interpolation.
Style/SpaceInsideStringInterpolation:
430 431
  EnforcedStyle: no_space
  Enabled: true
432 433 434

# Check for the usage of parentheses around stabby lambda arguments.
Style/StabbyLambdaParentheses:
435 436
  EnforcedStyle: require_parentheses
  Enabled: true
437 438

# Checks if uses of quotes match the configured preference.
439 440 441
Style/StringLiterals:
  Enabled: false

442 443
# Checks if configured preferred methods are used over non-preferred.
Style/StringMethods:
444 445 446
  PreferredMethods:
    intern: to_sym
  Enabled: true
447 448

# No hard tabs.
449
Style/Tab:
D
Dmitriy Zaporozhets 已提交
450
  Enabled: true
451

452
# Checks trailing blank lines and final newline.
453
Style/TrailingBlankLines:
454
  Enabled: true
455

456 457 458
Style/TrailingCommaInLiteral:
  Enabled: false

459
# Checks for %W when interpolation is not needed.
460
Style/UnneededCapitalW:
461
  Enabled: true
462

463
# Checks for %q/%Q when single quotes or double quotes would do.
464 465 466
Style/UnneededPercentQ:
  Enabled: false

467
# Don't interpolate global, instance and class variables directly in strings.
468
Style/VariableInterpolation:
469
  Enabled: true
470

471
# Use the configured style when naming variables.
472
Style/VariableName:
473 474
  EnforcedStyle: snake_case
  Enabled: true
475

476 477 478 479
# Use the configured style when numbering variables.
Style/VariableNumber:
  Enabled: false

480
# Use when x then ... for one-line cases.
481
Style/WhenThen:
482
  Enabled: true
483

484
# Checks for redundant do after while or until.
485
Style/WhileUntilDo:
486
  Enabled: true
487

488
# Favor modifier while/until usage when you have a single-line body.
489
Style/WhileUntilModifier:
490
  Enabled: true
491

492
# Use %w or %W for arrays of words.
493
Style/WordArray:
D
Douwe Maan 已提交
494
  Enabled: true
495

496
# Metrics #####################################################################
497

498 499
# A calculated magnitude based on number of assignments,
# branches, and conditions.
500
Metrics/AbcSize:
G
Grzegorz Bizon 已提交
501
  Enabled: true
502
  Max: 60
G
Grzegorz Bizon 已提交
503

504
# Avoid excessive block nesting.
505
Metrics/BlockNesting:
G
Grzegorz Bizon 已提交
506 507
  Enabled: true
  Max: 4
508

509
# Avoid classes longer than 100 lines of code.
510 511 512
Metrics/ClassLength:
  Enabled: false

513 514 515 516 517 518 519
# 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.
520 521 522
Metrics/LineLength:
  Enabled: false

523
# Avoid methods longer than 10 lines of code.
524 525 526
Metrics/MethodLength:
  Enabled: false

527
# Avoid modules longer than 100 lines of code.
528 529 530
Metrics/ModuleLength:
  Enabled: false

531 532 533 534 535 536 537 538
# 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 已提交
539
  Max: 18
540

541
# Lint ########################################################################
542

543 544 545 546 547 548 549 550 551
# 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

552 553
# Checks for ambiguous operators in the first argument of a method invocation
# without parentheses.
554
Lint/AmbiguousOperator:
555
  Enabled: true
556

557
# Align block ends correctly.
558
Lint/BlockAlignment:
559
  Enabled: true
560

561 562 563
# Default values in optional keyword arguments and optional ordinal arguments
# should not refer back to the name of the argument.
Lint/CircularArgumentReference:
564
  Enabled: true
565 566

# Checks for condition placed in a confusing position relative to the keyword.
567
Lint/ConditionPosition:
568
  Enabled: true
569

570
# Check for debugger calls.
571
Lint/Debugger:
572
  Enabled: true
573

574
# Align ends corresponding to defs correctly.
575
Lint/DefEndAlignment:
576
  Enabled: true
577

578
# Check for deprecated class method calls.
579
Lint/DeprecatedClassMethods:
580
  Enabled: true
581

582 583
# Check for immutable argument given to each_with_object.
Lint/EachWithObjectArgument:
584
  Enabled: true
585 586

# Check for odd code arrangement in an else block.
587
Lint/ElseLayout:
588
  Enabled: true
589

590
# Checks for empty ensure block.
591
Lint/EmptyEnsure:
592
  Enabled: true
593

594 595 596 597
# Checks for the presence of `when` branches without a body.
Lint/EmptyWhen:
  Enabled: true

598
# Align ends correctly.
599
Lint/EndAlignment:
600
  Enabled: true
601

602
# END blocks should not be placed inside method definitions.
603
Lint/EndInMethod:
604
  Enabled: true
605

606
# Do not use return in an ensure block.
607
Lint/EnsureReturn:
608
  Enabled: true
609

610
# The use of eval represents a serious security risk.
611
Lint/Eval:
612
  Enabled: true
613

614 615
# Catches floating-point literals too large or small for Ruby to represent.
Lint/FloatOutOfRange:
616
  Enabled: true
617 618 619

# The number of parameters to format/sprint must match the fields.
Lint/FormatParameterMismatch:
620
  Enabled: true
621 622 623 624

# Checks for adjacent string literals on the same line, which could better be
# represented as a single string literal.
Lint/ImplicitStringConcatenation:
625
  Enabled: true
626 627 628

# Checks for invalid character literals with a non-escaped whitespace
# character.
629
Lint/InvalidCharacterLiteral:
630
  Enabled: true
631

632
# Checks of literals used in conditions.
633
Lint/LiteralInCondition:
634
  Enabled: true
635

636
# Checks for literals used in interpolation.
637
Lint/LiteralInInterpolation:
638
  Enabled: true
639

640 641
# Do not use nested method definitions.
Lint/NestedMethodDefinition:
642
  Enabled: true
643 644 645

# Do not omit the accumulator when calling `next` in a `reduce`/`inject` block.
Lint/NextWithoutAccumulator:
646
  Enabled: true
647 648

# Checks for method calls with a space before the opening parenthesis.
649
Lint/ParenthesesAsGroupedExpression:
650
  Enabled: true
651

652 653 654
# Checks for `rand(1)` calls. Such calls always return `0` and most likely
# a mistake.
Lint/RandOne:
655
  Enabled: true
656 657

# Use parentheses in the method call to avoid confusion about precedence.
658
Lint/RequireParentheses:
659
  Enabled: true
660

661
# Avoid rescuing the Exception class.
662
Lint/RescueException:
663
  Enabled: true
664

C
Connor Shea 已提交
665 666
# Checks for the order which exceptions are rescued to avoid rescueing a less specific exception before a more specific exception.
Lint/ShadowedException:
667 668
  Enabled: false

669 670 671 672
# Checks for Object#to_s usage in string interpolation.
Lint/StringConversionInInterpolation:
  Enabled: true

673
# Do not use prefix `_` for a variable that is used.
674
Lint/UnderscorePrefixedVariableName:
675
  Enabled: true
676

677 678 679 680 681 682 683
# 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.
684
Lint/UnreachableCode:
685
  Enabled: true
686

D
Douwe Maan 已提交
687 688 689
Lint/UnusedMethodArgument:
  Enabled: false

690
# Checks for useless assignment to a local variable.
691
Lint/UselessAssignment:
692
  Enabled: true
693

694
# Checks for comparison of something with itself.
695
Lint/UselessComparison:
696
  Enabled: true
697

698
# Checks for useless `else` in `begin..end` without `rescue`.
699
Lint/UselessElseWithoutRescue:
700
  Enabled: true
701

702
# Checks for useless setter call to a local variable.
703
Lint/UselessSetterCall:
704
  Enabled: true
705

706
# Possible use of operator/literal/variable in void context.
707
Lint/Void:
708
  Enabled: true
709

710
# Performance #################################################################
711 712 713

# Use `casecmp` rather than `downcase ==`.
Performance/Casecmp:
714
  Enabled: true
715 716 717 718

# Use `str.{start,end}_with?(x, ..., y, ...)` instead of
# `str.{start,end}_with?(x, ...) || str.{start,end}_with?(y, ...)`.
Performance/DoubleStartEndWith:
719
  Enabled: true
720 721 722

# Use `strip` instead of `lstrip.rstrip`.
Performance/LstripRstrip:
C
Connor Shea 已提交
723
  Enabled: true
724 725 726

# Use `Range#cover?` instead of `Range#include?`.
Performance/RangeInclude:
727
  Enabled: true
728 729 730

# Use `sort` instead of `sort_by { |x| x }`.
Performance/RedundantSortBy:
731
  Enabled: true
732 733 734 735

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

738 739 740 741
# 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 已提交
742
  Enabled: true
743 744 745

# Checks for `.times.map` calls.
Performance/TimesMap:
746
  Enabled: true
747

748
# Rails #######################################################################
749

750 751 752 753 754
# Enables Rails cops.
Rails:
  Enabled: true

# Enforces consistent use of action filter methods.
755
Rails/ActionFilter:
756
  Enabled: true
757
  EnforcedStyle: action
758

759 760
# Checks the correct usage of date aware methods, such as `Date.today`,
# `Date.current`, etc.
G
Gabriel Mazetto 已提交
761 762 763
Rails/Date:
  Enabled: false

764 765
# Prefer delegate method for delegations.
Rails/Delegate:
D
Douwe Maan 已提交
766
  Enabled: true
767

768 769
# Prefer `find_by` over `where.first`.
Rails/FindBy:
770
  Enabled: true
771 772 773

# Prefer `all.find_each` over `all.find`.
Rails/FindEach:
774
  Enabled: true
775

776
# Prefer has_many :through to has_and_belongs_to_many.
777
Rails/HasAndBelongsToMany:
778
  Enabled: true
779

780
# Checks for calls to puts, print, etc.
781
Rails/Output:
782
  Enabled: true
783

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

RSpec/MultipleExpectations:
  Enabled: false

RSpec/NamedSubject:
  Enabled: false

RSpec/NestedGroups:
  Enabled: false

RSpec/LeadingSubject:
  Enabled: false

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

Bundler/OrderedGems:
  Enabled: false

Lint/HandleExceptions:
  Enabled: false

Lint/Loop:
  Enabled: false

Metrics/BlockLength:
  Enabled: false

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

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

RSpec/MessageChain:
  Enabled: false

RSpec/MessageSpies:
  Enabled: false

RSpec/RepeatedDescription:
  Enabled: false

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

Lint/UnifiedInteger:
  Enabled: true

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

Lint/AssignmentInCondition:
  Enabled: false

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

Lint/UnusedBlockArgument:
  Enabled: false

927 928 929
Performance/RedundantBlockCall:
  Enabled: true

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

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

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

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

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

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

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

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

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

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

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

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

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

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

D
Douwe Maan 已提交
972 973
Style/DoubleNegation:
  Enabled: false