-
Notifications
You must be signed in to change notification settings - Fork 53
/
.rubocop.yml
2744 lines (2557 loc) · 56.1 KB
/
.rubocop.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
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
AllCops:
DisabledByDefault: true
TargetRubyVersion: 2.3
# Disable the FileName cop as we are using RuboCop by giving it a string, for which
# the default filename is `(string)`. This file name is invalid.
#
# This is currently disabled by the above directive. If the default cops are ever
# enabled by default, this one should be explicitly disabled.
#
# Style/FileName:
# Enabled: false
# Style/MutableConstant:
# Enabled: true
# Severity: warning
# This cop checks for ambiguous operators in the first argument of a
# method invocation without parentheses.
#
# @example
# array = [1, 2, 3]
#
# # The `*` is interpreted as a splat operator but it could possibly be
# # a `*` method invocation (i.e. `do_something.*(array)`).
# do_something *array
#
# # With parentheses, there's no ambiguity.
# do_something(*array)
# Lint/AmbiguousOperator:
# Enabled: true
# Severity: warning
# This cop checks for assignments in the conditions of
# if/while/until.
# Lint/AssignmentInCondition:
# Enabled: true
# Severity: warning
# This cop checks whether the end keywords are aligned properly for do
# end blocks.
#
# Three modes are supported through the `AlignWith` configuration
# parameter:
#
# `start_of_block` : the `end` shall be aligned with the
# start of the line where the `do` appeared.
#
# `start_of_line` : the `end` shall be aligned with the
# start of the line where the expression started.
#
# `either` (which is the default) : the `end` is allowed to be in either
# location. The autofixer will default to `start_of_line`.
#
# @example
#
# # either
# variable = lambda do |i|
# i
# end
#
# # start_of_block
# foo.bar
# .each do
# baz
# end
#
# # start_of_line
# foo.bar
# .each do
# baz
# end
Lint/BlockAlignment:
Enabled: true
AlignWith: start_of_block
# This cop checks for conditions that are not on the same line as
# if/while/until.
#
# @example
#
# if
# some_condition
# do_something
# end
Lint/ConditionPosition:
Enabled: true
# This cop checks for calls to debugger or pry.
Lint/Debugger:
Enabled: true
# This cop checks whether the end keywords of method definitions are
# aligned properly.
#
# Two modes are supported through the AlignWith configuration
# parameter. If it's set to `start_of_line` (which is the default), the
# `end` shall be aligned with the start of the line where the `def`
# keyword is. If it's set to `def`, the `end` shall be aligned with the
# `def` keyword.
#
# @example
#
# private def foo
# end
Lint/DefEndAlignment:
Enabled: true
# This cop checks for uses of the deprecated class method usages.
Lint/DeprecatedClassMethods:
Enabled: true
# This cop checks for duplicated instance (or singleton) method
# definitions.
#
# @example
# @bad
# def duplicated
# 1
# end
#
# def duplicated
# 2
# end
Lint/DuplicateMethods:
Enabled: true
# This cop checks for odd else block layout - like
# having an expression on the same line as the else keyword,
# which is usually a mistake.
#
# @example
#
# if something
# ...
# else do_this
# do_that
# end
Lint/ElseLayout:
Enabled: true
# This cop checks for empty `ensure` blocks
Lint/EmptyEnsure:
Enabled: true
# This cop checks for empty interpolation.
#
# @example
#
# "result is #{}"
Lint/EmptyInterpolation:
Enabled: true
# This cop checks whether the end keywords are aligned properly.
# @example
# variable = if true
# end
Lint/EndAlignment:
Enabled: true
# This cop checks for the use of *Kernel#eval*.
Lint/Eval:
Enabled: true
# This cop identifies Float literals which are, like, really really really
# really really really really really big. Too big. No-one needs Floats
# that big. If you need a float that big, something is wrong with you.
#
# @example
# # bad
# float = 3.0e400
#
# # good
# float = 42.9
Lint/FloatOutOfRange:
Enabled: true
# This lint sees if there is a mismatch between the number of
# expected fields for format/sprintf/#% and what is actually
# passed as arguments.
#
# @example
#
# format('A value: %s and another: %i', a_value)
Lint/FormatParameterMismatch:
Enabled: true
# This cop checks for *rescue* blocks with no body.
Lint/HandleExceptions:
Enabled: true
Severity: warning
# This cop checks for implicit string concatenation of string literals
# which are on the same line.
#
# @example
# @bad
# array = ['Item 1' 'Item 2']
#
# @good
# array = ['Item 1Item 2']
# array = ['Item 1' + 'Item 2']
# array = [
# 'Item 1' \
# 'Item 2'
# ]
Lint/ImplicitStringConcatenation:
Enabled: true
# This cop checks for `private` or `protected` access modifiers which are
# applied to a singleton method. These access modifiers do not make
# singleton methods private/protected. `private_class_method` can be
# used for that.
#
# @example
# @bad
# class C
# private
#
# def self.method
# puts 'hi'
# end
# end
#
# @good
# class C
# def self.method
# puts 'hi'
# end
#
# private_class_method :method
# end
#
# class C
# class << self
# private
#
# def method
# puts 'hi'
# end
# end
# end
Lint/IneffectiveAccessModifier:
Enabled: true
Severity: warning
# This cop looks for error classes inheriting from `Exception`
# and its standard library subclasses, excluding subclasses of
# `StandardError`. It is configurable to suggest using either
# `RuntimeError` (default) or `StandardError` instead.
#
# @example
#
# # bad
#
# class C < Exception; end
#
# @example
#
# # EnforcedStyle: runtime_error (default)
#
# # good
#
# class C < RuntimeError; end
#
# @example
#
# # EnforcedStyle: standard_error
#
# # good
#
# class C < StandardError; end
Lint/InheritException:
Enabled: true
EnforcedStyle: standard_error
# This cop checks for literals used as the conditions or as
# operands in and/or expressions serving as the conditions of
# if/while/until.
#
# @example
#
# if 20
# do_something
# end
#
# if some_var && true
# do_something
# end
Lint/LiteralInCondition:
Enabled: true
# This cop checks for interpolated literals.
#
# @example
#
# "result is #{10}"
Lint/LiteralInInterpolation:
Enabled: true
# This cop checks for nested method definitions.
#
# @example
# # `bar` definition actually produces methods in the same scope
# # as the outer `foo` method. Furthermore, the `bar` method
# # will be redefined every time `foo` is invoked.
# def foo
# def bar
# end
# end
Lint/NestedMethodDefinition:
Enabled: true
# Don't omit the accumulator when calling `next` in a `reduce` block.
#
# @example
# # bad
# result = (1..4).reduce(0) do |acc, i|
# next if i.odd?
# acc + i
# end
#
# # good
# result = (1..4).reduce(0) do |acc, i|
# next acc if i.odd?
# acc + i
# end
Lint/NextWithoutAccumulator:
Enabled: true
Severity: warning
# This cop checks for quotes and commas in %w, e.g.
#
# `%w('foo', "bar")`
#
# it is more likely that the additional characters are unintended (for
# example, mistranslating an array of literals to percent string notation)
# rather than meant to be part of the resulting strings.
Lint/PercentStringArray:
Enabled: true
Severity: warning
# This cop checks for colons and commas in %i, e.g.
#
# `%i(:foo, :bar)`
#
# it is more likely that the additional characters are unintended (for
# example, mistranslating an array of literals to percent string notation)
# rather than meant to be part of the resulting symbols.
Lint/PercentSymbolArray:
Enabled: true
# This cop checks for expressions where there is a call to a predicate
# method with at least one argument, where no parentheses are used around
# the parameter list, and a boolean operator, && or ||, is used in the
# last argument.
#
# The idea behind warning for these constructs is that the user might
# be under the impression that the return value from the method call is
# an operand of &&/||.
#
# @example
#
# if day.is? :tuesday && month == :jan
# ...
# end
Lint/RequireParentheses:
Enabled: true
# This cop checks for a rescued exception that get shadowed by a
# less specific exception being rescued before a more specific
# exception is rescued.
#
# @example
#
# # bad
# begin
# something
# rescue Exception
# handle_exception
# rescue StandardError
# handle_standard_error
# end
#
# # good
# begin
# something
# rescue StandardError
# handle_standard_error
# rescue Exception
# handle_exception
# end
Lint/ShadowedException:
Enabled: true
# This cop checks for string conversion in string interpolation,
# which is redundant.
#
# @example
#
# "result is #{something.to_s}"
Lint/StringConversionInInterpolation:
Enabled: true
# This cop checks for underscore-prefixed variables that are actually
# used.
Lint/UnderscorePrefixedVariableName:
Enabled: true
# This cop checks for using Fixnum or Bignum constant.
#
# @example
# # bad
# 1.is_a?(Fixnum)
# 1.is_a?(Bignum)
#
# # good
# 1.is_a?(Integer)
Lint/UnifiedInteger:
Enabled: true
# This cop detects instances of rubocop:disable comments that can be
# removed without causing any offenses to be reported. It's implemented
# as a cop in that it inherits from the Cop base class and calls
# add_offense. The unusual part of its implementation is that it doesn't
# have any on_* methods or an investigate method. This means that it
# doesn't take part in the investigation phase when the other cops do
# their work. Instead, it waits until it's called in a later stage of the
# execution. The reason it can't be implemented as a normal cop is that
# it depends on the results of all other cops to do its work.
Lint/UnneededDisable:
Enabled: true
# This cop checks for unneeded usages of splat expansion
#
# @example
# # bad
# a = *[1, 2, 3]
# a = *'a'
# a = *1
#
# begin
# foo
# rescue *[StandardError, ApplicationError]
# bar
# end
#
# case foo
# when *[1, 2, 3]
# bar
# else
# baz
# end
#
# # good
# c = [1, 2, 3]
# a = *c
# a, b = *c
# a, *b = *c
# a = *1..10
# a = ['a']
#
# begin
# foo
# rescue StandardError, ApplicationError
# bar
# end
#
# case foo
# when *[1, 2, 3]
# bar
# else
# baz
# end
Lint/UnneededSplatExpansion:
Enabled: true
# This cop checks for unreachable code.
# The check are based on the presence of flow of control
# statement in non-final position in *begin*(implicit) blocks.
Lint/UnreachableCode:
Enabled: true
# This cop checks for unused block arguments.
#
# @example
#
# do_something do |used, unused, _unused_but_allowed|
# puts used
# end
Lint/UnusedBlockArgument:
Enabled: true
# This cop checks for unused method arguments.
#
# @example
#
# def some_method(used, unused, _unused_but_allowed)
# puts used
# end
Lint/UnusedMethodArgument:
Enabled: true
# This cop checks for every useless assignment to local variable in every
# scope.
# The basic idea for this cop was from the warning of `ruby -cw`:
#
# assigned but unused variable - foo
#
# Currently this cop has advanced logic that detects unreferenced
# reassignments and properly handles varied cases such as branch, loop,
# rescue, ensure, etc.
Lint/UselessAssignment:
Enabled: true
# This cop checks for comparison of something with itself.
#
# @example
#
# x.top >= x.top
Lint/UselessComparison:
Enabled: true
# This cop checks for useless `else` in `begin..end` without `rescue`.
#
# @example
# begin
# do_something
# else
# handle_errors # This will never be run.
# end
Lint/UselessElseWithoutRescue:
Enabled: true
# This cop checks for excessive nesting of conditional and looping
# constructs. Despite the cop's name, blocks are not considered as an
# extra level of nesting.
#
# The maximum level of nesting allowed is configurable.
# Metrics/BlockNesting:
# Enabled: true
# Max: 5
# This cop checks if the length a class exceeds some maximum value.
# Comment lines can optionally be ignored.
# The maximum allowed length is configurable.
# Metrics/ClassLength:
# Enabled: true
# Max: 100
# CountComments: false
# This cop checks the length of lines in the source code.
# The maximum length is configurable.
# Metrics/LineLength:
# Enabled: true
# Max: 100
# AllowHeredoc: true
# AllowURI: true
# This cop checks if the length of a method exceeds some maximum value.
# Comment lines can optionally be ignored.
# The maximum allowed length is configurable.
# Metrics/MethodLength:
# Enabled: true
# Max: 10
# CountComments: false
# This cop checks if the length a module exceeds some maximum value.
# Comment lines can optionally be ignored.
# The maximum allowed length is configurable.
# Metrics/ModuleLength:
# Enabled: true
# Max: 100
# CountComments: false
# This cop checks for methods with too many parameters.
# The maximum number of parameters is configurable.
# On Ruby 2.0+ keyword arguments can optionally
# be excluded from the total count.
# Metrics/ParameterLists:
# Enabled: true
# Max: 6
# This cop checks for double `#start_with?` or `#end_with?` calls
# separated by `||`. In some cases such calls can be replaced
# with an single `#start_with?`/`#end_with?` call.
#
# @example
#
# @bad
# str.start_with?("a") || str.start_with?(Some::CONST)
# str.start_with?("a", "b") || str.start_with?("c")
# var1 = ...
# var2 = ...
# str.end_with?(var1) || str.end_with?(var2)
#
# @good
# str.start_with?("a", Some::CONST)
# str.start_with?("a", "b", "c")
# var1 = ...
# var2 = ...
# str.end_with?(var1, var2)
Performance/DoubleStartEndWith:
Enabled: true
# This cop identifies unnecessary use of a regex where `String#end_with?`
# would suffice.
#
# @example
# @bad
# 'abc' =~ /bc\Z/
# 'abc'.match(/bc\Z/)
#
# @good
# 'abc' =~ /ab/
# 'abc' =~ /\w*\Z/
Performance/EndWith:
Enabled: true
# This cop is used to identify usages of
#
# @example
# # bad
# [1, 2, 3, 4].map { |e| [e, e] }.flatten(1)
# [1, 2, 3, 4].collect { |e| [e, e] }.flatten(1)
#
# # good
# [1, 2, 3, 4].flat_map { |e| [e, e] }
# [1, 2, 3, 4].map { |e| [e, e] }.flatten
# [1, 2, 3, 4].collect { |e| [e, e] }.flatten
Performance/FlatMap:
Enabled: true
# This cop identifies the use of a `&block` parameter and `block.call`
# where `yield` would do just as well.
#
# @example
# @bad
# def method(&block)
# block.call
# end
# def another(&func)
# func.call 1, 2, 3
# end
#
# @good
# def method
# yield
# end
# def another
# yield 1, 2, 3
# end
Performance/RedundantBlockCall:
Enabled: true
# This cop identifies places where `Hash#merge!` can be replaced by
# `Hash#[]=`.
#
# @example
# hash.merge!(a: 1)
# hash.merge!({'key' => 'value'})
# hash.merge!(a: 1, b: 2)
Performance/RedundantMerge:
Enabled: true
# This cop identifies places where `sort_by { ... }` can be replaced by
# `sort`.
#
# @example
# @bad
# array.sort_by { |x| x }
# array.sort_by do |var|
# var
# end
#
# @good
# array.sort
Performance/RedundantSortBy:
Enabled: true
# This cop identifies unnecessary use of a regex where
# `String#start_with?` would suffice.
#
# @example
# @bad
# 'abc' =~ /\Aab/
# 'abc'.match(/\Aab/)
#
# @good
# 'abc' =~ /ab/
# 'abc' =~ /\A\w*/
Performance/StartWith:
Enabled: true
# Modifiers should be indented as deep as method definitions, or as deep
# as the class/module keyword, depending on configuration.
Style/AccessModifierIndentation:
Enabled: true
# This cop makes sure that accessor methods are named properly.
#
# @example
# # bad
# def set_attribute(value) ...
#
# # good
# def attribute=(value)
#
# # bad
# def get_attribute ...
#
# # good
# def attribute ...
Style/AccessorMethodName:
Enabled: true
# This cop finds uses of `alias` where `alias_method` would be more
# appropriate (or is simply preferred due to configuration), and vice
# versa.
# It also finds uses of `alias :symbol` rather than `alias bareword`.
Style/Alias:
Enabled: true
EnforcedStyle: prefer_alias_method
# Here we check if the elements of a multi-line array literal are
# aligned.
Style/AlignArray:
Enabled: true
# Here we check if the keys, separators, and values of a multi-line hash
# literal are aligned.
Style/AlignHash:
Enabled: true
# Here we check if the parameters on a multi-line method call or
# definition are aligned.
Style/AlignParameters:
Enabled: true
# This cop checks for uses of *and* and *or*.
Style/AndOr:
Enabled: true
EnforcedStyle: always
# This cop checks for non-ascii (non-English) characters
# in comments.
# Style/AsciiComments:
# Enabled: true
# This cop checks for non-ascii characters in identifier names.
Style/AsciiIdentifiers:
Enabled: true
# This cop checks for uses of Module#attr.
Style/Attr:
Enabled: true
# This cop checks for BEGIN blocks.
Style/BeginBlock:
Enabled: true
# This cop looks for uses of block comments (=begin...=end).
Style/BlockComments:
Enabled: true
# Check for uses of braces or do/end around single line or
# multi-line blocks.
Style/BlockDelimiters:
Enabled: true
# This cop checks whether the end statement of a do..end block
# is on its own line.
#
# @example
# # bad
# blah do |i|
# foo(i) end
#
# # good
# blah do |i|
# foo(i)
# end
#
# # bad
# blah { |i|
# foo(i) }
#
# # good
# blah { |i|
# foo(i)
# }
Style/BlockEndNewline:
Enabled: true
# This cop checks how the *when*s of a *case* expression
# are indented in relation to its *case* or *end* keyword.
#
# It will register a separate offense for each misaligned *when*.
Style/CaseIndentation:
Enabled: true
IndentOneStep: false
# This cops checks for class and module names with
# an underscore in them.
Style/ClassAndModuleCamelCase:
Enabled: true
# This cop checks the style of children definitions at classes and
# modules. Basically there are two different styles:
#
# nested - have each child on its own line
# class Foo
# class Bar
# end
# end
#
# compact - combine definitions as much as possible
# class Foo::Bar
# end
Style/ClassAndModuleChildren:
Enabled: true
EnforcedStyle: nested
# This cop enforces consistent use of `Object#is_a?` or `Object#kind_of?`.
Style/ClassCheck:
Enabled: true
EnforcedStyle: is_a?
# This cop checks for uses of the class/module name instead of
# self, when defining class/module methods.
#
# @example
# # bad
# class SomeClass
# def SomeClass.class_method
# ...
# end
# end
#
# # good
# class SomeClass
# def self.class_method
# ...
# end
# end
Style/ClassMethods:
Enabled: true
# This cop checks for uses of class variables. Offenses
# are signaled only on assignment to class variables to
# reduced the number of offenses that would be reported.
Style/ClassVars:
Enabled: true
# This cops checks the indentation of hanging closing parentheses in
# method calls, method definitions, and grouped expressions. A hanging
# closing parenthesis means `)` preceded by a line break.
#
# @example
#
# # good: when x is on its own line, indent this way
# func(
# x,
# y
# )
#
# # good: when x follows opening parenthesis, align parentheses
# a = b * (x +
# y
# )
#
# # bad
# def func(
# x,
# y
# )
Style/ClosingParenthesisIndentation:
Enabled: true
# This cop checks for methods invoked via the :: operator instead
# of the . operator (like FileUtils::rmdir instead of FileUtils.rmdir).
Style/ColonMethodCall:
Enabled: true
# This cops checks the indentation of comments.
Style/CommentIndentation:
Enabled: true
# Check for `if` and `case` statements where each branch is used for
# assignment to the same variable when using the return of the
# condition can be used instead.
#
# @example
# EnforcedStyle: assign_to_condition
#
# # bad
# if foo
# bar = 1
# else
# bar = 2
# end
#
# case foo
# when 'a'
# bar += 1
# else
# bar += 2
# end
#
# # good
# bar = if foo
# 1
# else
# 2
# end
#
# bar += case foo
# when 'a'
# 1
# else
# 2
# end
Style/ConditionalAssignment:
Enabled: true
EnforcedStyle: assign_to_condition
# This cop checks whether constant names are written using
# SCREAMING_SNAKE_CASE.
#
# To avoid false positives, it ignores cases in which we cannot know
# for certain the type of value that would be assigned to a constant.
Style/ConstantName:
Enabled: true
# This cop checks for parentheses in the definition of a method,
# that does not take any arguments. Both instance and
# class/singleton methods are checked.
Style/DefWithParentheses:
Enabled: true
# This cop checks the . position in multi-line method calls.
Style/DotPosition:
Enabled: true
EnforcedStyle: leading
# This cop checks for loops which iterate a constant number of times,
# using a Range literal and `#each`. This can be done more readably using
# `Integer#times`.
#
# This check only applies if the block takes no parameters.
#
# @example
# @bad
# (1..5).each { }
#
# @good
# 5.times { }
#
# @example
# @bad
# (0...10).each {}
#
# @good
# 10.times {}
Style/EachForSimpleLoop:
Enabled: true
# This cop looks for inject / reduce calls where the passed in object is
# returned at the end and so could be replaced by each_with_object without
# the need to return the object at the end.
#
# However, we can't replace with each_with_object if the accumulator
# parameter is assigned to within the block.
#
# @example
# # bad
# [1, 2].inject({}) { |a, e| a[e] = e; a }
#
# # good
# [1, 2].each_with_object({}) { |e, a| a[e] = e }
Style/EachWithObject:
Enabled: true
# This cops checks the alignment of else keywords. Normally they should
# be aligned with an if/unless/while/until/begin/def keyword, but there
# are special cases when they should follow the same rules as the
# alignment of end.
Style/ElseAlignment:
Enabled: true
# This cop checks for case statements with an empty condition.
#
# @example
#
# # bad:
# case
# when x == 0
# puts 'x is 0'
# when y == 0
# puts 'y is 0'