This repository has been archived by the owner on Jul 29, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.rubocop_defaults.yml
718 lines (576 loc) · 15.3 KB
/
.rubocop_defaults.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
# Common configuration.
AllCops:
# Include common Ruby source files.
Include:
- '**/*.rb'
- '**/*.axlsx'
- '**/*.gemspec'
- '**/*.podspec'
- '**/*.jbuilder'
- '**/*.rake'
- '**/*.opal'
- '**/config.ru'
- '**/Gemfile'
- '**/Rakefile'
- '**/Capfile'
- '**/Guardfile'
- '**/Podfile'
- '**/Thorfile'
- '**/Vagrantfile'
- '**/Berksfile'
- '**/Cheffile'
- '**/Vagabondfile'
Exclude:
- '_ignore/**/*'
- 'vendor/**/*'
- 'appember/**/*'
- 'node_modules/**/*'
- 'snippets/**/*'
- 'test/monkey_patches/**/*'
- 'app/controllers/api/v3/docs/generated/**/*'
# Cop names are 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
# Additional cops that do not reference a style guide rule may be enabled by
# default. Change behavior by overriding StyleGuideCopsOnly, or by giving
# the --only-guide-cops option.
StyleGuideCopsOnly: false
TargetRubyVersion: 2.6
Layout/ElseAlignment:
Enabled: false
Naming/UncommunicativeMethodParamName:
Enabled: false
Bundler/OrderedGems:
Enabled: false
Layout/ClosingHeredocIndentation:
Enabled: false
Layout/RescueEnsureAlignment:
Enabled: false
Lint/RescueException:
Enabled: false
Lint/UselessAssignment:
Enabled: false
Metrics/BlockLength:
Enabled: false
# Align the elements of a hash literal if they span more than one line.
Layout/AlignHash:
Enabled: false
Naming/PredicateName:
Enabled: false
# We don't want this Rubocoping up our builds until Ruby 3.0
Style/FrozenStringLiteralComment:
Enabled: false
Style/FormatStringToken:
Enabled: false
# Indent private/protected/public as deep as method definitions
Layout/AccessModifierIndentation:
EnforcedStyle: indent
SupportedStyles:
- outdent
- indent
Layout/AlignParameters:
Enabled: false
Style/AndOr:
Enabled: false
Style/AsciiComments:
Enabled: false
Style/BlockComments:
Enabled: false
# Checks if usage of %() or %Q() matches configuration.
Style/BarePercentLiterals:
EnforcedStyle: bare_percent
SupportedStyles:
- percent_q
- bare_percent
Style/Alias:
Enabled: false
Style/BlockDelimiters:
EnforcedStyle: line_count_based
SupportedStyles:
# The `line_count_based` style enforces braces around single line blocks and
# do..end around multi-line blocks.
- line_count_based
# The `semantic` style enforces braces around functional blocks, where the
# primary purpose of the block is to return a value and do..end for
# procedural blocks, where the primary purpose of the block is its
# side-effects.
#
# This looks at the usage of a block's method to determine its type (e.g. is
# the result of a `map` assigned to a variable or passed to another
# method) but exceptions are permitted in the `ProceduralMethods`,
# `FunctionalMethods` and `IgnoredMethods` sections below.
- semantic
ProceduralMethods:
# Methods that are known to be procedural in nature but look functional from
# their usage, e.g.
#
# time = Benchmark.realtime do
# foo.bar
# end
#
# Here, the return value of the block is discarded but the return value of
# `Benchmark.realtime` is used.
- benchmark
- bm
- bmbm
- create
- each_with_object
- measure
- new
- realtime
- tap
- with_object
FunctionalMethods:
# Methods that are known to be functional in nature but look procedural from
# their usage, e.g.
#
# let(:foo) { Foo.new }
#
# Here, the return value of `Foo.new` is used to define a `foo` helper but
# doesn't appear to be used from the return value of `let`.
- let
- let!
- subject
- watch
IgnoredMethods:
# Methods that can be either procedural or functional and cannot be
# categorised from their usage alone, e.g.
#
# foo = lambda do |x|
# puts "Hello, #{x}"
# end
#
# foo = lambda do |x|
# x * 100
# end
#
# Here, it is impossible to tell from the return value of `lambda` whether
# the inner block's return value is significant.
- lambda
- proc
- it
Style/BracesAroundHashParameters:
Enabled: false
# Indentation of `when`.
Layout/CaseIndentation:
Enabled: false
Style/ClassAndModuleChildren:
Enabled: false
Layout/ClosingParenthesisIndentation:
Enabled: false
Style/ConditionalAssignment:
Enabled: false
Style/DateTime:
Enabled: false
Style/Documentation:
Enabled: false
Style/DoubleNegation:
Enabled: false
Style/EachWithObject:
Enabled: false
Layout/EmptyLines:
Enabled: false
Layout/ExtraSpacing:
Enabled: false
Style/ClassCheck:
EnforcedStyle: is_a?
SupportedStyles:
- is_a?
- kind_of?
# Align with the style guide.
Style/CollectionMethods:
# Mapping from undesired method to desired_method
# e.g. to use `detect` over `find`:
#
# CollectionMethods:
# PreferredMethods:
# find: detect
PreferredMethods:
collect: 'map'
collect!: 'map!'
inject: 'reduce'
detect: 'find'
find_all: 'select'
# Use ` or %x around command literals.
Style/CommandLiteral:
EnforcedStyle: backticks
# backticks: Always use backticks.
# percent_x: Always use %x.
# mixed: Use backticks on single-line commands, and %x on multi-line commands.
SupportedStyles:
- backticks
- percent_x
- mixed
# If false, the cop will always recommend using %x if one or more backticks
# are found in the command string.
AllowInnerBackticks: false
# Checks formatting of special comments
Style/CommentAnnotation:
Keywords:
- TODO
- FIXME
- OPTIMIZE
- HACK
- REVIEW
# Checks that you have put a copyright in a comment before any code.
#
# You can override the default Notice in your .rubocop.yml file.
#
# In order to use autocorrect, you must supply a value for the
# AutocorrectNotice key that matches the regexp Notice. A blank
# AutocorrectNotice will cause an error during autocorrect.
#
# Autocorrect will add a copyright notice in a comment at the top
# of the file immediately after any shebang or encoding comments.
#
# Example rubocop.yml:
#
# Style/Copyright:
# Enabled: true
# Notice: 'Copyright (\(c\) )?2015 Yahoo! Inc'
# AutocorrectNotice: '# Copyright (c) 2015 Yahoo! Inc.'
#
Style/Copyright:
Notice: '^Copyright (\(c\) )?2[0-9]{3} .+'
AutocorrectNotice: ''
# Multi-line method chaining should be done with leading dots.
Layout/DotPosition:
EnforcedStyle: leading
SupportedStyles:
- leading
- trailing
# Warn on empty else statements
# empty - warn only on empty else
# nil - warn on else with nil in it
# both - warn on empty else and else with nil in it
Style/EmptyElse:
EnforcedStyle: both
SupportedStyles:
- empty
- nil
- both
Layout/EmptyLinesAroundBlockBody:
Enabled: false
Layout/EmptyLinesAroundClassBody:
Enabled: false
Layout/EmptyLinesAroundModuleBody:
Enabled: false
# Checks whether the source file has a utf-8 encoding comment or not
# AutoCorrectEncodingComment must match the regex
# /#.*coding\s?[:=]\s?(?:UTF|utf)-8/
Style/Encoding:
Exclude: []
Naming/FileName:
# File names listed in AllCops:Include are excluded by default. Add extra
# excludes here.
Exclude: []
Layout/IndentFirstArgument:
EnforcedStyle: special_for_inner_method_call_in_parentheses
SupportedStyles:
# The first parameter should always be indented one step more than the
# preceding line.
- consistent
# The first parameter should normally be indented one step more than the
# preceding line, but if it's a parameter for a method call that is itself
# a parameter in a method call, then the inner parameter should be indented
# relative to the inner method.
- special_for_inner_method_call
# Same as special_for_inner_method_call except that the special rule only
# applies if the outer method call encloses its arguments in parentheses.
- special_for_inner_method_call_in_parentheses
# Checks use of for or each in multiline loops.
Style/For:
EnforcedStyle: each
SupportedStyles:
- for
- each
# `MinBodyLength` defines the number of lines of the a body of an if / unless
# needs to have to trigger this cop
Style/GuardClause:
MinBodyLength: 1
Style/HashSyntax:
Enabled: false
Layout/IndentationConsistency:
Enabled: false
Layout/IndentationWidth:
Enabled: false
# Checks the indentation of the first key in a hash literal.
Layout/IndentFirstHashElement:
Enabled: false
Layout/IndentHeredoc:
Enabled: false
Layout/IndentFirstArrayElement:
Enabled: false
Style/LambdaCall:
EnforcedStyle: call
SupportedStyles:
- call
- braces
Style/Next:
Enabled: false
Style/NonNilCheck:
# With `IncludeSemanticChanges` set to `true`, this cop reports offenses for
# `!x.nil?` and autocorrects that and `x != nil` to solely `x`, which is
# **usually** OK, but might change behavior.
#
# With `IncludeSemanticChanges` set to `false`, this cop does not report
# offenses for `!x.nil?` and does no changes that might change behavior.
IncludeSemanticChanges: false
Style/MethodDefParentheses:
Enabled: false
Naming/MethodName:
Enabled: false
Layout/MultilineOperationIndentation:
Enabled: false
Style/NumericLiterals:
MinDigits: 5
# Allow safe assignment in conditions.
Style/ParenthesesAroundCondition:
Enabled: false
Style/PercentLiteralDelimiters:
PreferredDelimiters:
'%': ()
'%i': ()
'%q': ()
'%Q': ()
'%r': '{}'
'%s': ()
'%w': ()
'%W': ()
'%x': ()
Style/PercentQLiterals:
EnforcedStyle: lower_case_q
SupportedStyles:
- lower_case_q # Use %q when possible, %Q when necessary
- upper_case_q # Always use %Q
Style/RaiseArgs:
Enabled: false
Style/RedundantReturn:
Enabled: false
Style/RegexpLiteral:
Enabled: false
Style/Semicolon:
Enabled: false
Style/SignalException:
Enabled: false
Style/SingleLineBlockParams:
Enabled: false
Style/SingleLineMethods:
AllowIfMethodIsEmpty: true
Style/StringLiterals:
Enabled: false
Style/StringLiteralsInInterpolation:
Enabled: false
Layout/SpaceAroundBlockParameters:
EnforcedStyleInsidePipes: no_space
Layout/SpaceAroundEqualsInParameterDefault:
Enabled: false
Layout/SpaceBeforeBlockBraces:
Enabled: false
Layout/SpaceInsideBlockBraces:
Enabled: false
Layout/SpaceInsideHashLiteralBraces:
Enabled: false
Style/SymbolArray:
Enabled: false
Style/SymbolProc:
Enabled: false
Layout/TrailingBlankLines:
EnforcedStyle: final_newline
SupportedStyles:
- final_newline
- final_blank_line
# TrivialAccessors requires exact name matches and doesn't allow
# predicated methods by default.
Style/TrivialAccessors:
# When set to false the cop will suggest the use of accessor methods
# in situations like:
#
# def name
# @other_name
# end
#
# This way you can uncover "hidden" attributes in your code.
ExactNameMatch: true
AllowPredicates: true
# Allows trivial writers that don't end in an equal sign. e.g.
#
# def on_exception(action)
# @on_exception=action
# end
# on_exception :restart
#
# Commonly used in DSLs
AllowDSLWriters: false
IgnoreClassMethods: false
Whitelist:
- to_ary
- to_a
- to_c
- to_enum
- to_h
- to_hash
- to_i
- to_int
- to_io
- to_open
- to_path
- to_proc
- to_r
- to_regexp
- to_str
- to_s
- to_sym
Naming/VariableName:
EnforcedStyle: snake_case
SupportedStyles:
- snake_case
- camelCase
# IMHO, we should skip this one. It encourages intermediate variables, and functional programming style
# is to have a pipeline of operations rather than this. RP
Style/MultilineBlockChain:
Enabled: false
##################### Metrics ##################################
Metrics/AbcSize:
# The ABC size is a calculated magnitude, so this number can be a Fixnum or
# a Float.
Max: 50
Metrics/BlockNesting:
Max: 6
Metrics/ClassLength:
CountComments: false # count full line comments?
Max: 500
Metrics/ModuleLength:
CountComments: false # count full line comments?
Max: 500
# Avoid complex methods.
Metrics/CyclomaticComplexity:
Max: 15
Metrics/LineLength:
Max: 120
# To make it possible to copy or click on URIs in the code, we allow lines
# contaning a URI to be longer than Max.
AllowURI: true
URISchemes:
- http
- https
Metrics/MethodLength:
CountComments: false # count full line comments?
Max: 50
Metrics/ParameterLists:
Max: 5
CountKeywordArgs: true
Metrics/PerceivedComplexity:
Max: 20
# Align ends correctly.
Layout/EndAlignment:
Enabled: false
Layout/DefEndAlignment:
# The value `def` means that `end` should be aligned with the def keyword.
# The value `start_of_line` means that `end` should be aligned with method
# calls like `private`, `public`, etc, if present in front of the `def`
# keyword on the same line.
EnforcedStyleAlignWith: start_of_line
AutoCorrect: false
##################### Lint ##################################
Lint/EmptyWhen:
Exclude:
- 'lib/capistrano/tasks/crontab.rake'
- 'test/test_helper.rb'
Lint/AmbiguousBlockAssociation:
Enabled: false
Lint/AmbiguousOperator:
Enabled: false
Lint/AmbiguousRegexpLiteral:
Enabled: false
Lint/AssignmentInCondition:
Enabled: false
Style/WordArray:
Enabled: false
# The % operator for interpolation is in the language by design
Style/FormatString:
Enabled: false
Style/WhileUntilModifier:
Enabled: false
Lint/RedundantCopDisableDirective:
Enabled: false
# I think we know about globals and their issues and why why might want one, e.g. $debug
Style/GlobalVars:
Enabled: false
Naming/MemoizedInstanceVariableName:
Enabled: false
Security/MarshalLoad:
Enabled: false
Security/YAMLLoad:
Enabled: false
Style/NumericPredicate:
Enabled: false
Style/ZeroLengthPredicate:
Enabled: false
Style/MethodMissingSuper:
Enabled: false
Style/MissingRespondToMissing:
Enabled: false
Layout/MultilineMethodCallBraceLayout:
Enabled: false
Layout/MultilineHashBraceLayout:
Enabled: false
Layout/MultilineArrayBraceLayout:
Enabled: false
Style/EmptyCaseCondition:
Enabled: false
Style/NumericLiteralPrefix:
Enabled: false
Style/TernaryParentheses:
Enabled: false
Naming/VariableNumber:
Enabled: false
Style/SafeNavigation:
Enabled: false
Layout/SpaceInsideParens:
Enabled: false
Layout/SpaceInsideRangeLiteral:
Enabled: false
Layout/SpaceInsideStringInterpolation:
Enabled: false
Style/UnlessElse:
Enabled: false
Style/RedundantInterpolation:
Enabled: false
Layout/SpaceAroundOperators:
Enabled: false
Layout/SpaceAfterComma:
Enabled: false
Style/RedundantBegin:
Enabled: false
Style/RedundantParentheses:
Enabled: false
Style/RedundantSelf:
Enabled: false
Style/RescueModifier:
Enabled: false
Style/NestedTernaryOperator:
Enabled: false
Layout/MultilineMethodCallIndentation:
Enabled: false
Style/MultilineTernaryOperator:
Enabled: false
Style/MutableConstant:
Enabled: false
Style/NegatedIf:
Enabled: false
Style/IfInsideElse:
Enabled: false
Style/IfUnlessModifier:
Enabled: false
Style/Lambda:
Enabled: false
Layout/LeadingCommentSpace:
Enabled: false
Naming/AsciiIdentifiers:
Enabled: false