rubomatic 0.0.1.pre.rc.2 → 1.0.0.pre.rc.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.adoc +40 -0
- data/configs/brands_insurance/rubocop.yml +2 -0
- data/configs/brands_insurance/style.yml +2 -0
- data/configs/bundler.yml +80 -0
- data/configs/gemspec.yml +2 -0
- data/configs/gemspec_on.yml +71 -0
- data/configs/layout.yml +1204 -0
- data/configs/lint.yml +987 -0
- data/configs/metrics.yml +110 -0
- data/configs/migration.yml +6 -0
- data/configs/naming.yml +316 -0
- data/configs/performance.yml +128 -0
- data/configs/rails.yml +1054 -0
- data/configs/rubocop.yml +37 -0
- data/configs/security.yml +53 -0
- data/configs/style.yml +2503 -0
- data/lib/rubomatic/version.rb +1 -1
- metadata +16 -1
data/configs/style.yml
ADDED
@@ -0,0 +1,2503 @@
|
|
1
|
+
Style/AccessModifierDeclarations:
|
2
|
+
Description: 'Checks style of how access modifiers are used.'
|
3
|
+
Enabled: true
|
4
|
+
VersionAdded: '0.57'
|
5
|
+
VersionChanged: '0.81'
|
6
|
+
EnforcedStyle: group
|
7
|
+
SupportedStyles:
|
8
|
+
- inline
|
9
|
+
- group
|
10
|
+
AllowModifiersOnSymbols: true
|
11
|
+
SafeAutoCorrect: false
|
12
|
+
|
13
|
+
Style/AccessorGrouping:
|
14
|
+
Description: 'Checks for grouping of accessors in `class` and `module` bodies.'
|
15
|
+
Enabled: true
|
16
|
+
VersionAdded: '0.87'
|
17
|
+
EnforcedStyle: separated
|
18
|
+
SupportedStyles:
|
19
|
+
# separated: each accessor goes in a separate statement.
|
20
|
+
# grouped: accessors are grouped into a single statement.
|
21
|
+
- separated
|
22
|
+
- grouped
|
23
|
+
|
24
|
+
Style/Alias:
|
25
|
+
Description: 'Use alias instead of alias_method.'
|
26
|
+
StyleGuide: '#alias-method-lexically'
|
27
|
+
Enabled: true
|
28
|
+
VersionAdded: '0.9'
|
29
|
+
VersionChanged: '0.36'
|
30
|
+
EnforcedStyle: prefer_alias
|
31
|
+
SupportedStyles:
|
32
|
+
- prefer_alias
|
33
|
+
- prefer_alias_method
|
34
|
+
|
35
|
+
Style/AndOr:
|
36
|
+
Description: 'Use &&/|| instead of and/or.'
|
37
|
+
StyleGuide: '#no-and-or-or'
|
38
|
+
Enabled: true
|
39
|
+
SafeAutoCorrect: false
|
40
|
+
VersionAdded: '0.9'
|
41
|
+
VersionChanged: '1.21'
|
42
|
+
# Whether `and` and `or` are banned only in conditionals (conditionals)
|
43
|
+
# or completely (always).
|
44
|
+
EnforcedStyle: conditionals
|
45
|
+
SupportedStyles:
|
46
|
+
- always
|
47
|
+
- conditionals
|
48
|
+
|
49
|
+
Style/ArgumentsForwarding:
|
50
|
+
Description: 'Use arguments forwarding.'
|
51
|
+
StyleGuide: '#arguments-forwarding'
|
52
|
+
Enabled: true
|
53
|
+
AllowOnlyRestArgument: true
|
54
|
+
VersionAdded: '1.1'
|
55
|
+
|
56
|
+
Style/ArrayCoercion:
|
57
|
+
Description: >-
|
58
|
+
Use Array() instead of explicit Array check or [*var], when dealing
|
59
|
+
with a variable you want to treat as an Array, but you're not certain it's an array.
|
60
|
+
StyleGuide: '#array-coercion'
|
61
|
+
Safe: false
|
62
|
+
Enabled: true
|
63
|
+
VersionAdded: '0.88'
|
64
|
+
|
65
|
+
Style/ArrayIntersect:
|
66
|
+
Description: 'Use `array1.intersect?(array2)` instead of `(array1 & array2).any?`.'
|
67
|
+
Enabled: true
|
68
|
+
VersionAdded: '1.40'
|
69
|
+
|
70
|
+
Style/ArrayJoin:
|
71
|
+
Description: 'Use Array#join instead of Array#*.'
|
72
|
+
StyleGuide: '#array-join'
|
73
|
+
Enabled: true
|
74
|
+
VersionAdded: '0.20'
|
75
|
+
VersionChanged: '0.31'
|
76
|
+
|
77
|
+
Style/AsciiComments:
|
78
|
+
Description: 'Use only ascii symbols in comments.'
|
79
|
+
StyleGuide: '#english-comments'
|
80
|
+
Enabled: true
|
81
|
+
VersionAdded: '0.9'
|
82
|
+
VersionChanged: '1.21'
|
83
|
+
AllowedChars:
|
84
|
+
- ©
|
85
|
+
|
86
|
+
Style/Attr:
|
87
|
+
Description: 'Checks for uses of Module#attr.'
|
88
|
+
StyleGuide: '#attr'
|
89
|
+
Enabled: true
|
90
|
+
VersionAdded: '0.9'
|
91
|
+
VersionChanged: '0.12'
|
92
|
+
|
93
|
+
Style/AutoResourceCleanup:
|
94
|
+
Description: 'Suggests the usage of an auto resource cleanup version of a method (if available).'
|
95
|
+
Enabled: true
|
96
|
+
VersionAdded: '0.30'
|
97
|
+
|
98
|
+
Style/BarePercentLiterals:
|
99
|
+
Description: 'Checks if usage of %() or %Q() matches configuration.'
|
100
|
+
StyleGuide: '#percent-q-shorthand'
|
101
|
+
Enabled: true
|
102
|
+
VersionAdded: '0.25'
|
103
|
+
EnforcedStyle: bare_percent
|
104
|
+
SupportedStyles:
|
105
|
+
- percent_q
|
106
|
+
- bare_percent
|
107
|
+
|
108
|
+
Style/BeginBlock:
|
109
|
+
Description: 'Avoid the use of BEGIN blocks.'
|
110
|
+
StyleGuide: '#no-BEGIN-blocks'
|
111
|
+
Enabled: true
|
112
|
+
VersionAdded: '0.9'
|
113
|
+
|
114
|
+
Style/BisectedAttrAccessor:
|
115
|
+
Description: >-
|
116
|
+
Checks for places where `attr_reader` and `attr_writer`
|
117
|
+
for the same method can be combined into single `attr_accessor`.
|
118
|
+
Enabled: true
|
119
|
+
VersionAdded: '0.87'
|
120
|
+
|
121
|
+
Style/BlockComments:
|
122
|
+
Description: 'Do not use block comments.'
|
123
|
+
StyleGuide: '#no-block-comments'
|
124
|
+
Enabled: true
|
125
|
+
VersionAdded: '0.9'
|
126
|
+
VersionChanged: '0.23'
|
127
|
+
|
128
|
+
Style/BlockDelimiters:
|
129
|
+
Description: >-
|
130
|
+
Avoid using {...} for multi-line blocks (multiline chaining is
|
131
|
+
always ugly).
|
132
|
+
Prefer {...} over do...end for single-line blocks.
|
133
|
+
StyleGuide: '#single-line-blocks'
|
134
|
+
Enabled: true
|
135
|
+
VersionAdded: '0.30'
|
136
|
+
VersionChanged: '0.35'
|
137
|
+
EnforcedStyle: line_count_based
|
138
|
+
SupportedStyles:
|
139
|
+
# The `line_count_based` style enforces braces around single line blocks and
|
140
|
+
# do..end around multi-line blocks.
|
141
|
+
- line_count_based
|
142
|
+
# The `semantic` style enforces braces around functional blocks, where the
|
143
|
+
# primary purpose of the block is to return a value and do..end for
|
144
|
+
# multi-line procedural blocks, where the primary purpose of the block is
|
145
|
+
# its side-effects. Single-line procedural blocks may only use do-end,
|
146
|
+
# unless AllowBracesOnProceduralOneLiners has a truthy value (see below).
|
147
|
+
#
|
148
|
+
# This looks at the usage of a block's method to determine its type (e.g. is
|
149
|
+
# the result of a `map` assigned to a variable or passed to another
|
150
|
+
# method) but exceptions are permitted in the `ProceduralMethods`,
|
151
|
+
# `FunctionalMethods` and `AllowedMethods` sections below.
|
152
|
+
- semantic
|
153
|
+
# The `braces_for_chaining` style enforces braces around single line blocks
|
154
|
+
# and do..end around multi-line blocks, except for multi-line blocks whose
|
155
|
+
# return value is being chained with another method (in which case braces
|
156
|
+
# are enforced).
|
157
|
+
- braces_for_chaining
|
158
|
+
# The `always_braces` style always enforces braces.
|
159
|
+
- always_braces
|
160
|
+
ProceduralMethods:
|
161
|
+
# Methods that are known to be procedural in nature but look functional from
|
162
|
+
# their usage, e.g.
|
163
|
+
#
|
164
|
+
# time = Benchmark.realtime do
|
165
|
+
# foo.bar
|
166
|
+
# end
|
167
|
+
#
|
168
|
+
# Here, the return value of the block is discarded but the return value of
|
169
|
+
# `Benchmark.realtime` is used.
|
170
|
+
- benchmark
|
171
|
+
- bm
|
172
|
+
- bmbm
|
173
|
+
- create
|
174
|
+
- each_with_object
|
175
|
+
- measure
|
176
|
+
- new
|
177
|
+
- realtime
|
178
|
+
- tap
|
179
|
+
- with_object
|
180
|
+
FunctionalMethods:
|
181
|
+
# Methods that are known to be functional in nature but look procedural from
|
182
|
+
# their usage, e.g.
|
183
|
+
#
|
184
|
+
# let(:foo) { Foo.new }
|
185
|
+
#
|
186
|
+
# Here, the return value of `Foo.new` is used to define a `foo` helper but
|
187
|
+
# doesn't appear to be used from the return value of `let`.
|
188
|
+
- let
|
189
|
+
- let!
|
190
|
+
- subject
|
191
|
+
- watch
|
192
|
+
AllowedMethods:
|
193
|
+
# Methods that can be either procedural or functional and cannot be
|
194
|
+
# categorised from their usage alone, e.g.
|
195
|
+
#
|
196
|
+
# foo = lambda do |x|
|
197
|
+
# puts "Hello, #{x}"
|
198
|
+
# end
|
199
|
+
#
|
200
|
+
# foo = lambda do |x|
|
201
|
+
# x * 100
|
202
|
+
# end
|
203
|
+
#
|
204
|
+
# Here, it is impossible to tell from the return value of `lambda` whether
|
205
|
+
# the inner block's return value is significant.
|
206
|
+
- lambda
|
207
|
+
- proc
|
208
|
+
- it
|
209
|
+
AllowedPatterns: [ ]
|
210
|
+
# The AllowBracesOnProceduralOneLiners option is ignored unless the
|
211
|
+
# EnforcedStyle is set to `semantic`. If so:
|
212
|
+
#
|
213
|
+
# If AllowBracesOnProceduralOneLiners is unspecified, or set to any
|
214
|
+
# falsey value, then semantic purity is maintained, so one-line
|
215
|
+
# procedural blocks must use do-end, not braces.
|
216
|
+
#
|
217
|
+
# # bad
|
218
|
+
# collection.each { |element| puts element }
|
219
|
+
#
|
220
|
+
# # good
|
221
|
+
# collection.each do |element| puts element end
|
222
|
+
#
|
223
|
+
# If AllowBracesOnProceduralOneLiners is set to any truthy value,
|
224
|
+
# then one-line procedural blocks may use either style.
|
225
|
+
#
|
226
|
+
# # good
|
227
|
+
# collection.each { |element| puts element }
|
228
|
+
#
|
229
|
+
# # also good
|
230
|
+
# collection.each do |element| puts element end
|
231
|
+
AllowBracesOnProceduralOneLiners: false
|
232
|
+
# The BracesRequiredMethods overrides all other configurations except
|
233
|
+
# IgnoredMethods. It can be used to enforce that all blocks for specific
|
234
|
+
# methods use braces. For example, you can use this to enforce Sorbet
|
235
|
+
# signatures use braces even when the rest of your codebase enforces
|
236
|
+
# the `line_count_based` style.
|
237
|
+
BracesRequiredMethods: [ ]
|
238
|
+
|
239
|
+
Style/CaseEquality:
|
240
|
+
Description: 'Avoid explicit use of the case equality operator(===).'
|
241
|
+
StyleGuide: '#no-case-equality'
|
242
|
+
Enabled: false
|
243
|
+
VersionAdded: '0.9'
|
244
|
+
VersionChanged: '0.89'
|
245
|
+
# If `AllowOnConstant` option is enabled, the cop will ignore violations when the receiver of
|
246
|
+
# the case equality operator is a constant.
|
247
|
+
#
|
248
|
+
# # bad
|
249
|
+
# /string/ === "string"
|
250
|
+
#
|
251
|
+
# # good
|
252
|
+
# String === "string"
|
253
|
+
AllowOnConstant: false
|
254
|
+
# If `AllowOnSelfClass` option is enabled, the cop will ignore violations when the receiver of
|
255
|
+
# the case equality operator is `self.class`.
|
256
|
+
#
|
257
|
+
# # bad
|
258
|
+
# some_class === object
|
259
|
+
#
|
260
|
+
# # good
|
261
|
+
# self.class === object
|
262
|
+
AllowOnSelfClass: false
|
263
|
+
|
264
|
+
Style/CaseLikeIf:
|
265
|
+
Description: 'Identifies places where `if-elsif` constructions can be replaced with `case-when`.'
|
266
|
+
StyleGuide: '#case-vs-if-else'
|
267
|
+
Enabled: true
|
268
|
+
Safe: false
|
269
|
+
VersionAdded: '0.88'
|
270
|
+
|
271
|
+
Style/CharacterLiteral:
|
272
|
+
Description: 'Checks for uses of character literals.'
|
273
|
+
StyleGuide: '#no-character-literals'
|
274
|
+
Enabled: true
|
275
|
+
VersionAdded: '0.9'
|
276
|
+
|
277
|
+
Style/ClassAndModuleChildren:
|
278
|
+
Description: 'Checks style of children classes and modules.'
|
279
|
+
StyleGuide: '#namespace-definition'
|
280
|
+
# Moving from compact to nested children requires knowledge of whether the
|
281
|
+
# outer parent is a module or a class. Moving from nested to compact requires
|
282
|
+
# verification that the outer parent is defined elsewhere. Rubocop does not
|
283
|
+
# have the knowledge to perform either operation safely and thus requires
|
284
|
+
# manual oversight.
|
285
|
+
SafeAutoCorrect: false
|
286
|
+
Enabled: true
|
287
|
+
VersionAdded: '0.19'
|
288
|
+
#
|
289
|
+
# Basically there are two different styles:
|
290
|
+
#
|
291
|
+
# `nested` - have each child on a separate line
|
292
|
+
# class Foo
|
293
|
+
# class Bar
|
294
|
+
# end
|
295
|
+
# end
|
296
|
+
#
|
297
|
+
# `compact` - combine definitions as much as possible
|
298
|
+
# class Foo::Bar
|
299
|
+
# end
|
300
|
+
#
|
301
|
+
# The compact style is only forced, for classes or modules with one child.
|
302
|
+
EnforcedStyle: nested
|
303
|
+
SupportedStyles:
|
304
|
+
- nested
|
305
|
+
- compact
|
306
|
+
|
307
|
+
Style/ClassCheck:
|
308
|
+
Description: 'Enforces consistent use of `Object#is_a?` or `Object#kind_of?`.'
|
309
|
+
StyleGuide: '#is-a-vs-kind-of'
|
310
|
+
Enabled: true
|
311
|
+
VersionAdded: '0.24'
|
312
|
+
EnforcedStyle: is_a?
|
313
|
+
SupportedStyles:
|
314
|
+
- is_a?
|
315
|
+
- kind_of?
|
316
|
+
|
317
|
+
Style/ClassEqualityComparison:
|
318
|
+
Description: 'Enforces the use of `Object#instance_of?` instead of class comparison for equality.'
|
319
|
+
StyleGuide: '#instance-of-vs-class-comparison'
|
320
|
+
Enabled: true
|
321
|
+
VersionAdded: '0.93'
|
322
|
+
AllowedMethods:
|
323
|
+
- ==
|
324
|
+
- equal?
|
325
|
+
- eql?
|
326
|
+
AllowedPatterns: [ ]
|
327
|
+
|
328
|
+
Style/ClassMethods:
|
329
|
+
Description: 'Use self when defining module/class methods.'
|
330
|
+
StyleGuide: '#def-self-class-methods'
|
331
|
+
Enabled: true
|
332
|
+
VersionAdded: '0.9'
|
333
|
+
VersionChanged: '0.20'
|
334
|
+
|
335
|
+
Style/ClassMethodsDefinitions:
|
336
|
+
Description: 'Enforces using `def self.method_name` or `class << self` to define class methods.'
|
337
|
+
StyleGuide: '#def-self-class-methods'
|
338
|
+
Enabled: false
|
339
|
+
VersionAdded: '0.89'
|
340
|
+
EnforcedStyle: def_self
|
341
|
+
SupportedStyles:
|
342
|
+
- def_self
|
343
|
+
- self_class
|
344
|
+
|
345
|
+
Style/ClassVars:
|
346
|
+
Description: 'Avoid the use of class variables.'
|
347
|
+
StyleGuide: '#no-class-vars'
|
348
|
+
Enabled: true
|
349
|
+
VersionAdded: '0.13'
|
350
|
+
|
351
|
+
Style/CollectionCompact:
|
352
|
+
Description: 'Use `{Array,Hash}#{compact,compact!}` instead of custom logic to reject nils.'
|
353
|
+
Enabled: true
|
354
|
+
Safe: false
|
355
|
+
VersionAdded: '1.2'
|
356
|
+
VersionChanged: '1.3'
|
357
|
+
|
358
|
+
# Align with the style guide.
|
359
|
+
Style/CollectionMethods:
|
360
|
+
Description: 'Preferred collection methods.'
|
361
|
+
StyleGuide: '#map-find-select-reduce-include-size'
|
362
|
+
Enabled: true
|
363
|
+
VersionAdded: '0.9'
|
364
|
+
VersionChanged: '1.7'
|
365
|
+
Safe: false
|
366
|
+
# Mapping from undesired method to desired method
|
367
|
+
# e.g. to use `detect` over `find`:
|
368
|
+
#
|
369
|
+
# Style/CollectionMethods:
|
370
|
+
# PreferredMethods:
|
371
|
+
# find: detect
|
372
|
+
PreferredMethods:
|
373
|
+
collect: 'map'
|
374
|
+
collect!: 'map!'
|
375
|
+
inject: 'reduce'
|
376
|
+
detect: 'find'
|
377
|
+
find_all: 'select'
|
378
|
+
member?: 'include?'
|
379
|
+
length: 'size'
|
380
|
+
# Methods in this array accept a final symbol as an implicit block
|
381
|
+
# eg. `inject(:+)`
|
382
|
+
MethodsAcceptingSymbol:
|
383
|
+
- inject
|
384
|
+
- reduce
|
385
|
+
|
386
|
+
Style/ColonMethodCall:
|
387
|
+
Description: 'Do not use :: for method call.'
|
388
|
+
StyleGuide: '#double-colons'
|
389
|
+
Enabled: true
|
390
|
+
VersionAdded: '0.9'
|
391
|
+
|
392
|
+
Style/ColonMethodDefinition:
|
393
|
+
Description: 'Do not use :: for defining class methods.'
|
394
|
+
StyleGuide: '#colon-method-definition'
|
395
|
+
Enabled: true
|
396
|
+
VersionAdded: '0.52'
|
397
|
+
|
398
|
+
Style/CombinableLoops:
|
399
|
+
Description: >-
|
400
|
+
Checks for places where multiple consecutive loops over the same data
|
401
|
+
can be combined into a single loop.
|
402
|
+
Enabled: true
|
403
|
+
Safe: false
|
404
|
+
VersionAdded: '0.90'
|
405
|
+
|
406
|
+
Style/CommandLiteral:
|
407
|
+
Description: 'Use `` or %x around command literals.'
|
408
|
+
StyleGuide: '#percent-x'
|
409
|
+
Enabled: true
|
410
|
+
VersionAdded: '0.30'
|
411
|
+
EnforcedStyle: backticks
|
412
|
+
# backticks: Always use backticks.
|
413
|
+
# percent_x: Always use `%x`.
|
414
|
+
# mixed: Use backticks on single-line commands, and `%x` on multi-line commands.
|
415
|
+
SupportedStyles:
|
416
|
+
- backticks
|
417
|
+
- percent_x
|
418
|
+
- mixed
|
419
|
+
# If `false`, the cop will always recommend using `%x` if one or more backticks
|
420
|
+
# are found in the command string.
|
421
|
+
AllowInnerBackticks: false
|
422
|
+
|
423
|
+
# Checks formatting of special comments
|
424
|
+
Style/CommentAnnotation:
|
425
|
+
Description: >-
|
426
|
+
Checks formatting of special comments
|
427
|
+
(TODO, FIXME, OPTIMIZE, HACK, REVIEW, NOTE).
|
428
|
+
StyleGuide: '#annotate-keywords'
|
429
|
+
Enabled: true
|
430
|
+
VersionAdded: '0.10'
|
431
|
+
VersionChanged: '1.20'
|
432
|
+
Keywords:
|
433
|
+
- TODO
|
434
|
+
- FIXME
|
435
|
+
- OPTIMIZE
|
436
|
+
- HACK
|
437
|
+
- REVIEW
|
438
|
+
- NOTE
|
439
|
+
RequireColon: true
|
440
|
+
|
441
|
+
Style/CommentedKeyword:
|
442
|
+
Description: 'Do not place comments on the same line as certain keywords.'
|
443
|
+
Enabled: true
|
444
|
+
SafeAutoCorrect: false
|
445
|
+
VersionAdded: '0.51'
|
446
|
+
VersionChanged: '1.19'
|
447
|
+
|
448
|
+
Style/ComparableClamp:
|
449
|
+
Description: 'Enforces the use of `Comparable#clamp` instead of comparison by minimum and maximum.'
|
450
|
+
Enabled: true
|
451
|
+
VersionAdded: '1.44'
|
452
|
+
|
453
|
+
Style/ConcatArrayLiterals:
|
454
|
+
Description: 'Enforces the use of `Array#push(item)` instead of `Array#concat([item])` to avoid redundant array literals.'
|
455
|
+
Enabled: true
|
456
|
+
Safe: false
|
457
|
+
VersionAdded: '1.41'
|
458
|
+
|
459
|
+
Style/ConditionalAssignment:
|
460
|
+
Description: >-
|
461
|
+
Use the return value of `if` and `case` statements for
|
462
|
+
assignment to a variable and variable comparison instead
|
463
|
+
of assigning that variable inside of each branch.
|
464
|
+
Enabled: true
|
465
|
+
VersionAdded: '0.36'
|
466
|
+
VersionChanged: '0.47'
|
467
|
+
EnforcedStyle: assign_to_condition
|
468
|
+
SupportedStyles:
|
469
|
+
- assign_to_condition
|
470
|
+
- assign_inside_condition
|
471
|
+
# When configured to `assign_to_condition`, `SingleLineConditionsOnly`
|
472
|
+
# will only register an offense when all branches of a condition are
|
473
|
+
# a single line.
|
474
|
+
# When configured to `assign_inside_condition`, `SingleLineConditionsOnly`
|
475
|
+
# will only register an offense for assignment to a condition that has
|
476
|
+
# at least one multiline branch.
|
477
|
+
SingleLineConditionsOnly: true
|
478
|
+
IncludeTernaryExpressions: true
|
479
|
+
|
480
|
+
Style/ConstantVisibility:
|
481
|
+
Description: >-
|
482
|
+
Check that class- and module constants have
|
483
|
+
visibility declarations.
|
484
|
+
Enabled: false
|
485
|
+
VersionAdded: '0.66'
|
486
|
+
VersionChanged: '1.10'
|
487
|
+
IgnoreModules: false
|
488
|
+
|
489
|
+
# Checks that you have put a copyright in a comment before any code.
|
490
|
+
#
|
491
|
+
# You can override the default Notice in your .rubocop.yml file.
|
492
|
+
#
|
493
|
+
# In order to use autocorrect, you must supply a value for the
|
494
|
+
# `AutocorrectNotice` key that matches the regexp Notice. A blank
|
495
|
+
# `AutocorrectNotice` will cause an error during autocorrect.
|
496
|
+
#
|
497
|
+
# Autocorrect will add a copyright notice in a comment at the top
|
498
|
+
# of the file immediately after any shebang or encoding comments.
|
499
|
+
#
|
500
|
+
# Example rubocop.yml:
|
501
|
+
#
|
502
|
+
# Style/Copyright:
|
503
|
+
# Enabled: true
|
504
|
+
# Notice: 'Copyright (\(c\) )?2015 Yahoo! Inc'
|
505
|
+
# AutocorrectNotice: '# Copyright (c) 2015 Yahoo! Inc.'
|
506
|
+
#
|
507
|
+
Style/Copyright:
|
508
|
+
Description: 'Include a copyright notice in each file before any code.'
|
509
|
+
Enabled: false
|
510
|
+
VersionAdded: '0.30'
|
511
|
+
Notice: '^Copyright (\(c\) )?2[0-9]{3} .+'
|
512
|
+
AutocorrectNotice: ''
|
513
|
+
|
514
|
+
Style/DateTime:
|
515
|
+
Description: 'Use Time over DateTime.'
|
516
|
+
StyleGuide: '#date-time'
|
517
|
+
Enabled: false
|
518
|
+
VersionAdded: '0.51'
|
519
|
+
VersionChanged: '0.92'
|
520
|
+
SafeAutoCorrect: false
|
521
|
+
AllowCoercion: false
|
522
|
+
|
523
|
+
Style/DefWithParentheses:
|
524
|
+
Description: 'Use def with parentheses when there are arguments.'
|
525
|
+
StyleGuide: '#method-parens'
|
526
|
+
Enabled: true
|
527
|
+
VersionAdded: '0.9'
|
528
|
+
VersionChanged: '0.12'
|
529
|
+
|
530
|
+
Style/Dir:
|
531
|
+
Description: >-
|
532
|
+
Use the `__dir__` method to retrieve the canonicalized
|
533
|
+
absolute path to the current file.
|
534
|
+
Enabled: true
|
535
|
+
VersionAdded: '0.50'
|
536
|
+
|
537
|
+
Style/DirEmpty:
|
538
|
+
Description: >-
|
539
|
+
Prefer to use `Dir.empty?('path/to/dir')` when checking if a directory is empty.
|
540
|
+
Enabled: true
|
541
|
+
VersionAdded: '1.48'
|
542
|
+
|
543
|
+
Style/DisableCopsWithinSourceCodeDirective:
|
544
|
+
Severity: info # Or warning
|
545
|
+
Description: >-
|
546
|
+
Forbids disabling/enabling cops within source code.
|
547
|
+
Enabled: true
|
548
|
+
VersionAdded: '0.82'
|
549
|
+
VersionChanged: '1.9'
|
550
|
+
AllowedCops: # Project specific
|
551
|
+
|
552
|
+
Style/DocumentDynamicEvalDefinition:
|
553
|
+
Description: >-
|
554
|
+
When using `class_eval` (or other `eval`) with string interpolation,
|
555
|
+
add a comment block showing its appearance if interpolated.
|
556
|
+
StyleGuide: '#eval-comment-docs'
|
557
|
+
Enabled: true
|
558
|
+
VersionAdded: '1.1'
|
559
|
+
VersionChanged: '1.3'
|
560
|
+
|
561
|
+
Style/Documentation:
|
562
|
+
Description: 'Document classes and non-namespace modules.'
|
563
|
+
Enabled: false
|
564
|
+
VersionAdded: '0.9'
|
565
|
+
AllowedConstants: [ ]
|
566
|
+
Exclude:
|
567
|
+
- 'spec/**/*'
|
568
|
+
- 'test/**/*'
|
569
|
+
|
570
|
+
Style/DocumentationMethod:
|
571
|
+
Description: 'Checks for missing documentation comment for public methods.'
|
572
|
+
Enabled: true
|
573
|
+
VersionAdded: '0.43'
|
574
|
+
RequireForNonPublicMethods: true
|
575
|
+
Exclude:
|
576
|
+
- 'db/migrate/*'
|
577
|
+
- 'spec/**/*'
|
578
|
+
- 'test/**/*'
|
579
|
+
|
580
|
+
Style/DoubleCopDisableDirective:
|
581
|
+
Description: 'Checks for double rubocop:disable comments on a single line.'
|
582
|
+
Enabled: true
|
583
|
+
VersionAdded: '0.73'
|
584
|
+
|
585
|
+
Style/DoubleNegation:
|
586
|
+
Description: 'Checks for uses of double negation (!!).'
|
587
|
+
StyleGuide: '#no-bang-bang'
|
588
|
+
Enabled: true
|
589
|
+
VersionAdded: '0.19'
|
590
|
+
VersionChanged: '1.2'
|
591
|
+
EnforcedStyle: allowed_in_returns
|
592
|
+
SafeAutoCorrect: false
|
593
|
+
SupportedStyles:
|
594
|
+
- allowed_in_returns
|
595
|
+
- forbidden
|
596
|
+
|
597
|
+
Style/EachForSimpleLoop:
|
598
|
+
Description: >-
|
599
|
+
Use `Integer#times` for a simple loop which iterates a fixed
|
600
|
+
number of times.
|
601
|
+
Enabled: true
|
602
|
+
VersionAdded: '0.41'
|
603
|
+
|
604
|
+
Style/EachWithObject:
|
605
|
+
Description: 'Prefer `each_with_object` over `inject` or `reduce`.'
|
606
|
+
Enabled: true
|
607
|
+
VersionAdded: '0.22'
|
608
|
+
VersionChanged: '0.42'
|
609
|
+
|
610
|
+
Style/EmptyBlockParameter:
|
611
|
+
Description: 'Omit pipes for empty block parameters.'
|
612
|
+
Enabled: true
|
613
|
+
VersionAdded: '0.52'
|
614
|
+
|
615
|
+
Style/EmptyCaseCondition:
|
616
|
+
Description: 'Avoid empty condition in case statements.'
|
617
|
+
Enabled: true
|
618
|
+
VersionAdded: '0.40'
|
619
|
+
|
620
|
+
Style/EmptyElse:
|
621
|
+
Description: 'Avoid empty else-clauses.'
|
622
|
+
Enabled: true
|
623
|
+
VersionAdded: '0.28'
|
624
|
+
VersionChanged: '0.32'
|
625
|
+
EnforcedStyle: both
|
626
|
+
# empty - warn only on empty `else`
|
627
|
+
# nil - warn on `else` with nil in it
|
628
|
+
# both - warn on empty `else` and `else` with `nil` in it
|
629
|
+
SupportedStyles:
|
630
|
+
- empty
|
631
|
+
- nil
|
632
|
+
- both
|
633
|
+
AllowComments: false
|
634
|
+
|
635
|
+
Style/EmptyHeredoc:
|
636
|
+
Description: 'Checks for using empty heredoc to reduce redundancy.'
|
637
|
+
Enabled: true
|
638
|
+
VersionAdded: '1.32'
|
639
|
+
|
640
|
+
Style/EmptyLambdaParameter:
|
641
|
+
Description: 'Omit parens for empty lambda parameters.'
|
642
|
+
Enabled: true
|
643
|
+
VersionAdded: '0.52'
|
644
|
+
|
645
|
+
Style/EmptyLiteral:
|
646
|
+
Description: 'Prefer literals to Array.new/Hash.new/String.new.'
|
647
|
+
StyleGuide: '#literal-array-hash'
|
648
|
+
Enabled: true
|
649
|
+
VersionAdded: '0.9'
|
650
|
+
VersionChanged: '0.12'
|
651
|
+
|
652
|
+
Style/EmptyMethod:
|
653
|
+
Description: 'Checks the formatting of empty method definitions.'
|
654
|
+
StyleGuide: '#no-single-line-methods'
|
655
|
+
Enabled: true
|
656
|
+
VersionAdded: '0.46'
|
657
|
+
EnforcedStyle: expanded
|
658
|
+
SupportedStyles:
|
659
|
+
- compact
|
660
|
+
- expanded
|
661
|
+
|
662
|
+
Style/Encoding:
|
663
|
+
Description: 'Use UTF-8 as the source file encoding.'
|
664
|
+
StyleGuide: '#utf-8'
|
665
|
+
Enabled: true
|
666
|
+
VersionAdded: '0.9'
|
667
|
+
VersionChanged: '0.50'
|
668
|
+
|
669
|
+
Style/EndBlock:
|
670
|
+
Description: 'Avoid the use of END blocks.'
|
671
|
+
StyleGuide: '#no-END-blocks'
|
672
|
+
Enabled: true
|
673
|
+
VersionAdded: '0.9'
|
674
|
+
VersionChanged: '0.81'
|
675
|
+
|
676
|
+
Style/EndlessMethod:
|
677
|
+
Description: 'Avoid the use of multi-lined endless method definitions.'
|
678
|
+
StyleGuide: '#endless-methods'
|
679
|
+
Enabled: true
|
680
|
+
VersionAdded: '1.8'
|
681
|
+
EnforcedStyle: disallow
|
682
|
+
SupportedStyles:
|
683
|
+
- allow_single_line
|
684
|
+
- allow_always
|
685
|
+
- disallow
|
686
|
+
|
687
|
+
Style/EnvHome:
|
688
|
+
Description: "Checks for consistent usage of `ENV['HOME']`."
|
689
|
+
Enabled: true
|
690
|
+
Safe: false
|
691
|
+
VersionAdded: '1.29'
|
692
|
+
|
693
|
+
Style/EvalWithLocation:
|
694
|
+
Description: 'Pass `__FILE__` and `__LINE__` to `eval` method, as they are used by backtraces.'
|
695
|
+
Enabled: true
|
696
|
+
VersionAdded: '0.52'
|
697
|
+
|
698
|
+
Style/EvenOdd:
|
699
|
+
Description: 'Favor the use of `Integer#even?` && `Integer#odd?`.'
|
700
|
+
StyleGuide: '#predicate-methods'
|
701
|
+
Enabled: true
|
702
|
+
VersionAdded: '0.12'
|
703
|
+
VersionChanged: '0.29'
|
704
|
+
|
705
|
+
Style/ExpandPathArguments:
|
706
|
+
Description: "Use `expand_path(__dir__)` instead of `expand_path('..', __FILE__)`."
|
707
|
+
Enabled: true
|
708
|
+
VersionAdded: '0.53'
|
709
|
+
|
710
|
+
Style/ExplicitBlockArgument:
|
711
|
+
Description: >-
|
712
|
+
Consider using explicit block argument to avoid writing block literal
|
713
|
+
that just passes its arguments to another block.
|
714
|
+
StyleGuide: '#block-argument'
|
715
|
+
Enabled: true
|
716
|
+
VersionAdded: '0.89'
|
717
|
+
VersionChanged: '1.8'
|
718
|
+
|
719
|
+
Style/ExponentialNotation:
|
720
|
+
Description: 'When using exponential notation, favor a mantissa between 1 (inclusive) and 10 (exclusive).'
|
721
|
+
StyleGuide: '#exponential-notation'
|
722
|
+
Enabled: true
|
723
|
+
VersionAdded: '0.82'
|
724
|
+
EnforcedStyle: scientific
|
725
|
+
SupportedStyles:
|
726
|
+
- scientific
|
727
|
+
- engineering
|
728
|
+
- integral
|
729
|
+
|
730
|
+
Style/FetchEnvVar:
|
731
|
+
Description: >-
|
732
|
+
Suggests `ENV.fetch` for the replacement of `ENV[]`.
|
733
|
+
Reference:
|
734
|
+
- https://rubystyle.guide/#hash-fetch-defaults
|
735
|
+
Enabled: true
|
736
|
+
VersionAdded: '1.28'
|
737
|
+
# Environment variables to be excluded from the inspection.
|
738
|
+
AllowedVars: [ ]
|
739
|
+
|
740
|
+
Style/FileEmpty:
|
741
|
+
Description: >-
|
742
|
+
Prefer to use `File.empty?('path/to/file')` when checking if a file is empty.
|
743
|
+
Enabled: true
|
744
|
+
VersionAdded: '1.48'
|
745
|
+
|
746
|
+
Style/FileRead:
|
747
|
+
Description: 'Favor `File.(bin)read` convenience methods.'
|
748
|
+
StyleGuide: '#file-read'
|
749
|
+
Enabled: true
|
750
|
+
VersionAdded: '1.24'
|
751
|
+
|
752
|
+
Style/FileWrite:
|
753
|
+
Description: 'Favor `File.(bin)write` convenience methods.'
|
754
|
+
StyleGuide: '#file-write'
|
755
|
+
Enabled: true
|
756
|
+
VersionAdded: '1.24'
|
757
|
+
|
758
|
+
Style/FloatDivision:
|
759
|
+
Description: 'For performing float division, coerce one side only.'
|
760
|
+
StyleGuide: '#float-division'
|
761
|
+
Reference: 'https://blog.rubystyle.guide/ruby/2019/06/21/float-division.html'
|
762
|
+
Enabled: true
|
763
|
+
VersionAdded: '0.72'
|
764
|
+
VersionChanged: '1.9'
|
765
|
+
Safe: false
|
766
|
+
EnforcedStyle: single_coerce
|
767
|
+
SupportedStyles:
|
768
|
+
- left_coerce
|
769
|
+
- right_coerce
|
770
|
+
- single_coerce
|
771
|
+
- fdiv
|
772
|
+
|
773
|
+
Style/For:
|
774
|
+
Description: 'Checks use of for or each in multiline loops.'
|
775
|
+
StyleGuide: '#no-for-loops'
|
776
|
+
Enabled: true
|
777
|
+
SafeAutoCorrect: false
|
778
|
+
VersionAdded: '0.13'
|
779
|
+
VersionChanged: '1.26'
|
780
|
+
EnforcedStyle: each
|
781
|
+
SupportedStyles:
|
782
|
+
- each
|
783
|
+
- for
|
784
|
+
|
785
|
+
Style/FormatString:
|
786
|
+
Description: 'Enforce the use of Kernel#sprintf, Kernel#format or String#%.'
|
787
|
+
StyleGuide: '#sprintf'
|
788
|
+
Enabled: true
|
789
|
+
VersionAdded: '0.19'
|
790
|
+
VersionChanged: '0.49'
|
791
|
+
EnforcedStyle: format
|
792
|
+
SupportedStyles:
|
793
|
+
- format
|
794
|
+
- sprintf
|
795
|
+
- percent
|
796
|
+
|
797
|
+
Style/FormatStringToken:
|
798
|
+
Description: 'Use a consistent style for format string tokens.'
|
799
|
+
Enabled: true
|
800
|
+
EnforcedStyle: template
|
801
|
+
SupportedStyles:
|
802
|
+
# Prefer tokens which contain a sprintf like type annotation like
|
803
|
+
# `%<name>s`, `%<age>d`, `%<score>f`
|
804
|
+
- annotated
|
805
|
+
# Prefer simple looking "template" style tokens like `%{name}`, `%{age}`
|
806
|
+
- template
|
807
|
+
- unannotated
|
808
|
+
# `MaxUnannotatedPlaceholdersAllowed` defines the number of `unannotated`
|
809
|
+
# style token in a format string to be allowed when enforced style is not
|
810
|
+
# `unannotated`.
|
811
|
+
MaxUnannotatedPlaceholdersAllowed: 0
|
812
|
+
VersionAdded: '0.49'
|
813
|
+
VersionChanged: '1.0'
|
814
|
+
AllowedMethods: [ ]
|
815
|
+
AllowedPatterns: [ ]
|
816
|
+
|
817
|
+
Style/FrozenStringLiteralComment:
|
818
|
+
Description: >-
|
819
|
+
Add the frozen_string_literal comment to the top of files
|
820
|
+
to help transition to frozen string literals by default.
|
821
|
+
Enabled: true
|
822
|
+
VersionAdded: '0.36'
|
823
|
+
VersionChanged: '0.79'
|
824
|
+
EnforcedStyle: always
|
825
|
+
SupportedStyles:
|
826
|
+
# `always` will always add the frozen string literal comment to a file
|
827
|
+
# regardless of the Ruby version or if `freeze` or `<<` are called on a
|
828
|
+
# string literal. It is possible that this will create errors.
|
829
|
+
- always
|
830
|
+
# `always_true` will add the frozen string literal comment to a file,
|
831
|
+
# similarly to the `always` style, but will also change any disabled
|
832
|
+
# comments (e.g. `# frozen_string_literal: false`) to be enabled.
|
833
|
+
- always_true
|
834
|
+
# `never` will enforce that the frozen string literal comment does not
|
835
|
+
# exist in a file.
|
836
|
+
- never
|
837
|
+
SafeAutoCorrect: false
|
838
|
+
Exclude:
|
839
|
+
- 'db/migrate/*'
|
840
|
+
- './**/*.json.jbuilder'
|
841
|
+
|
842
|
+
Style/GlobalStdStream:
|
843
|
+
Description: 'Enforces the use of `$stdout/$stderr/$stdin` instead of `STDOUT/STDERR/STDIN`.'
|
844
|
+
StyleGuide: '#global-stdout'
|
845
|
+
Enabled: true
|
846
|
+
VersionAdded: '0.89'
|
847
|
+
SafeAutoCorrect: false
|
848
|
+
|
849
|
+
Style/GlobalVars:
|
850
|
+
Description: 'Do not introduce global variables.'
|
851
|
+
StyleGuide: '#instance-vars'
|
852
|
+
Reference: 'https://www.zenspider.com/ruby/quickref.html'
|
853
|
+
Enabled: true
|
854
|
+
VersionAdded: '0.13'
|
855
|
+
# Built-in global variables are allowed by default.
|
856
|
+
AllowedVariables: [ ]
|
857
|
+
|
858
|
+
Style/GuardClause:
|
859
|
+
Description: 'Check for conditionals that can be replaced with guard clauses.'
|
860
|
+
StyleGuide: '#no-nested-conditionals'
|
861
|
+
Enabled: true
|
862
|
+
VersionAdded: '0.20'
|
863
|
+
VersionChanged: '1.31'
|
864
|
+
# `MinBodyLength` defines the number of lines of the a body of an `if` or `unless`
|
865
|
+
# needs to have to trigger this cop
|
866
|
+
MinBodyLength: 1
|
867
|
+
AllowConsecutiveConditionals: false
|
868
|
+
|
869
|
+
Style/HashAsLastArrayItem:
|
870
|
+
Description: >-
|
871
|
+
Checks for presence or absence of braces around hash literal as a last
|
872
|
+
array item depending on configuration.
|
873
|
+
StyleGuide: '#hash-literal-as-last-array-item'
|
874
|
+
Enabled: true
|
875
|
+
VersionAdded: '0.88'
|
876
|
+
EnforcedStyle: braces
|
877
|
+
SupportedStyles:
|
878
|
+
- braces
|
879
|
+
- no_braces
|
880
|
+
|
881
|
+
Style/HashConversion:
|
882
|
+
Description: 'Avoid Hash[] in favor of ary.to_h or literal hashes.'
|
883
|
+
StyleGuide: '#avoid-hash-constructor'
|
884
|
+
Enabled: true
|
885
|
+
VersionAdded: '1.10'
|
886
|
+
VersionChanged: '1.11'
|
887
|
+
AllowSplatArgument: false
|
888
|
+
|
889
|
+
Style/HashEachMethods:
|
890
|
+
Description: 'Use Hash#each_key and Hash#each_value.'
|
891
|
+
StyleGuide: '#hash-each'
|
892
|
+
Enabled: true
|
893
|
+
Safe: false
|
894
|
+
VersionAdded: '0.80'
|
895
|
+
VersionChanged: '1.16'
|
896
|
+
AllowedReceivers: [ ]
|
897
|
+
|
898
|
+
Style/HashExcept:
|
899
|
+
Description: >-
|
900
|
+
Checks for usages of `Hash#reject`, `Hash#select`, and `Hash#filter` methods
|
901
|
+
that can be replaced with `Hash#except` method.
|
902
|
+
Enabled: true
|
903
|
+
Safe: false
|
904
|
+
VersionAdded: '1.7'
|
905
|
+
VersionChanged: '1.39'
|
906
|
+
|
907
|
+
Style/HashLikeCase:
|
908
|
+
Description: >-
|
909
|
+
Checks for places where `case-when` represents a simple 1:1
|
910
|
+
mapping and can be replaced with a hash lookup.
|
911
|
+
Enabled: true
|
912
|
+
VersionAdded: '0.88'
|
913
|
+
# `MinBranchesCount` defines the number of branches `case` needs to have
|
914
|
+
# to trigger this cop
|
915
|
+
MinBranchesCount: 3
|
916
|
+
|
917
|
+
Style/HashSyntax:
|
918
|
+
Description: >-
|
919
|
+
Prefer Ruby 1.9 hash syntax { a: 1, b: 2 } over 1.8 syntax
|
920
|
+
{ :a => 1, :b => 2 }.
|
921
|
+
StyleGuide: '#hash-literals'
|
922
|
+
Enabled: true
|
923
|
+
VersionAdded: '0.9'
|
924
|
+
VersionChanged: '1.24'
|
925
|
+
EnforcedStyle: ruby19_no_mixed_keys
|
926
|
+
SupportedStyles:
|
927
|
+
# checks for 1.9 syntax (e.g. {a: 1}) for all symbol keys
|
928
|
+
- ruby19
|
929
|
+
# checks for hash rocket syntax for all hashes
|
930
|
+
- hash_rockets
|
931
|
+
# forbids mixed key syntaxes (e.g. {a: 1, :b => 2})
|
932
|
+
- no_mixed_keys
|
933
|
+
# enforces both ruby19 and no_mixed_keys styles
|
934
|
+
- ruby19_no_mixed_keys
|
935
|
+
# Force hashes that have a hash value omission
|
936
|
+
EnforcedShorthandSyntax: never
|
937
|
+
SupportedShorthandSyntax:
|
938
|
+
# forces use of the 3.1 syntax (e.g. {foo:}) when the hash key and value are the same.
|
939
|
+
- always
|
940
|
+
# forces use of explicit hash literal value.
|
941
|
+
- never
|
942
|
+
# accepts both shorthand and explicit use of hash literal value.
|
943
|
+
- either
|
944
|
+
# like "either", but will avoid mixing styles in a single hash
|
945
|
+
- consistent
|
946
|
+
# Force hashes that have a symbol value to use hash rockets
|
947
|
+
UseHashRocketsWithSymbolValues: false
|
948
|
+
# Do not suggest { a?: 1 } over { :a? => 1 } in ruby19 style
|
949
|
+
PreferHashRocketsForNonAlnumEndingSymbols: false
|
950
|
+
|
951
|
+
Style/HashTransformKeys:
|
952
|
+
Description: 'Prefer `transform_keys` over `each_with_object`, `map`, or `to_h`.'
|
953
|
+
Enabled: true
|
954
|
+
VersionAdded: '0.80'
|
955
|
+
VersionChanged: '0.90'
|
956
|
+
Safe: false
|
957
|
+
|
958
|
+
Style/HashTransformValues:
|
959
|
+
Description: 'Prefer `transform_values` over `each_with_object`, `map`, or `to_h`.'
|
960
|
+
Enabled: true
|
961
|
+
VersionAdded: '0.80'
|
962
|
+
VersionChanged: '0.90'
|
963
|
+
Safe: false
|
964
|
+
|
965
|
+
Style/IdenticalConditionalBranches:
|
966
|
+
Description: >-
|
967
|
+
Checks that conditional statements do not have an identical
|
968
|
+
line at the end of each branch, which can validly be moved
|
969
|
+
out of the conditional.
|
970
|
+
Enabled: true
|
971
|
+
SafeAutoCorrect: false
|
972
|
+
VersionAdded: '0.36'
|
973
|
+
VersionChanged: '1.19'
|
974
|
+
|
975
|
+
Style/IfInsideElse:
|
976
|
+
Description: 'Finds if nodes inside else, which can be converted to elsif.'
|
977
|
+
Enabled: true
|
978
|
+
AllowIfModifier: true
|
979
|
+
VersionAdded: '0.36'
|
980
|
+
VersionChanged: '1.3'
|
981
|
+
|
982
|
+
Style/IfUnlessModifier:
|
983
|
+
Description: >-
|
984
|
+
Favor modifier if/unless usage when you have a
|
985
|
+
single-line body.
|
986
|
+
StyleGuide: '#if-as-a-modifier'
|
987
|
+
Enabled: false
|
988
|
+
VersionAdded: '0.9'
|
989
|
+
VersionChanged: '0.30'
|
990
|
+
|
991
|
+
Style/IfUnlessModifierOfIfUnless:
|
992
|
+
Description: >-
|
993
|
+
Avoid modifier if/unless usage on conditionals.
|
994
|
+
Enabled: true
|
995
|
+
VersionAdded: '0.39'
|
996
|
+
VersionChanged: '0.87'
|
997
|
+
|
998
|
+
Style/IfWithBooleanLiteralBranches:
|
999
|
+
Description: 'Checks for redundant `if` with boolean literal branches.'
|
1000
|
+
Enabled: true
|
1001
|
+
VersionAdded: '1.9'
|
1002
|
+
SafeAutoCorrect: false
|
1003
|
+
AllowedMethods:
|
1004
|
+
- nonzero?
|
1005
|
+
|
1006
|
+
Style/IfWithSemicolon:
|
1007
|
+
Description: 'Do not use if x; .... Use the ternary operator instead.'
|
1008
|
+
StyleGuide: '#no-semicolon-ifs'
|
1009
|
+
Enabled: true
|
1010
|
+
VersionAdded: '0.9'
|
1011
|
+
VersionChanged: '0.83'
|
1012
|
+
|
1013
|
+
Style/ImplicitRuntimeError:
|
1014
|
+
Description: >-
|
1015
|
+
Use `raise` or `fail` with an explicit exception class and
|
1016
|
+
message, rather than just a message.
|
1017
|
+
Enabled: false
|
1018
|
+
VersionAdded: '0.41'
|
1019
|
+
|
1020
|
+
Style/InPatternThen:
|
1021
|
+
Description: 'Checks for `in;` uses in `case` expressions.'
|
1022
|
+
StyleGuide: '#no-in-pattern-semicolons'
|
1023
|
+
Enabled: true
|
1024
|
+
VersionAdded: '1.16'
|
1025
|
+
|
1026
|
+
Style/InfiniteLoop:
|
1027
|
+
Description: >-
|
1028
|
+
Use Kernel#loop for infinite loops.
|
1029
|
+
This cop is unsafe if the body may raise a `StopIteration` exception.
|
1030
|
+
Safe: false
|
1031
|
+
StyleGuide: '#infinite-loop'
|
1032
|
+
Enabled: true
|
1033
|
+
VersionAdded: '0.26'
|
1034
|
+
VersionChanged: '0.61'
|
1035
|
+
|
1036
|
+
Style/InlineComment:
|
1037
|
+
Description: 'Avoid trailing inline comments.'
|
1038
|
+
Enabled: true
|
1039
|
+
VersionAdded: '0.23'
|
1040
|
+
|
1041
|
+
Style/InverseMethods:
|
1042
|
+
Description: >-
|
1043
|
+
Use the inverse method instead of `!.method`
|
1044
|
+
if an inverse method is defined.
|
1045
|
+
Enabled: true
|
1046
|
+
Safe: false
|
1047
|
+
VersionAdded: '0.48'
|
1048
|
+
# `InverseMethods` are methods that can be inverted by a not (`not` or `!`)
|
1049
|
+
# The relationship of inverse methods only needs to be defined in one direction.
|
1050
|
+
# Keys and values both need to be defined as symbols.
|
1051
|
+
InverseMethods:
|
1052
|
+
:any?: :none?
|
1053
|
+
:even?: :odd?
|
1054
|
+
:==: :!=
|
1055
|
+
:=~: :!~
|
1056
|
+
:<: :>=
|
1057
|
+
:>: :<=
|
1058
|
+
# `ActiveSupport` defines some common inverse methods. They are listed below,
|
1059
|
+
# and not enabled by default.
|
1060
|
+
# :present?: :blank?,
|
1061
|
+
# :include?: :exclude?
|
1062
|
+
# `InverseBlocks` are methods that are inverted by inverting the return
|
1063
|
+
# of the block that is passed to the method
|
1064
|
+
InverseBlocks:
|
1065
|
+
:select: :reject
|
1066
|
+
:select!: :reject!
|
1067
|
+
|
1068
|
+
Style/InvertibleUnlessCondition:
|
1069
|
+
Description: 'Favor `if` with inverted condition over `unless`.'
|
1070
|
+
Enabled: true
|
1071
|
+
VersionAdded: '1.44'
|
1072
|
+
# `InverseMethods` are methods that can be inverted in a `unless` condition.
|
1073
|
+
# The relationship of inverse methods needs to be defined in both directions.
|
1074
|
+
# Keys and values both need to be defined as symbols.
|
1075
|
+
InverseMethods:
|
1076
|
+
:!=: :==
|
1077
|
+
:>: :<=
|
1078
|
+
:<=: :>
|
1079
|
+
:<: :>=
|
1080
|
+
:>=: :<
|
1081
|
+
:!~: :=~
|
1082
|
+
:zero?: :nonzero?
|
1083
|
+
:nonzero?: :zero?
|
1084
|
+
:any?: :none?
|
1085
|
+
:none?: :any?
|
1086
|
+
:even?: :odd?
|
1087
|
+
:odd?: :even?
|
1088
|
+
:present?: :blank?
|
1089
|
+
:blank?: :present?
|
1090
|
+
:include?: :exclude?
|
1091
|
+
:exclude?: :include?
|
1092
|
+
# :one?: :many?
|
1093
|
+
# :many?: :one?
|
1094
|
+
|
1095
|
+
Style/IpAddresses:
|
1096
|
+
Description: "Don't include literal IP addresses in code."
|
1097
|
+
Enabled: true
|
1098
|
+
VersionAdded: '0.58'
|
1099
|
+
VersionChanged: '0.91'
|
1100
|
+
# Allow addresses to be permitted
|
1101
|
+
AllowedAddresses:
|
1102
|
+
- "::"
|
1103
|
+
# :: is a valid IPv6 address, but could potentially be legitimately in code
|
1104
|
+
Exclude:
|
1105
|
+
- '**/*.gemfile'
|
1106
|
+
- '**/Gemfile'
|
1107
|
+
- '**/gems.rb'
|
1108
|
+
- '**/*.gemspec'
|
1109
|
+
|
1110
|
+
Style/KeywordParametersOrder:
|
1111
|
+
Description: 'Enforces that optional keyword parameters are placed at the end of the parameters list.'
|
1112
|
+
StyleGuide: '#keyword-parameters-order'
|
1113
|
+
Enabled: true
|
1114
|
+
VersionAdded: '0.90'
|
1115
|
+
VersionChanged: '1.7'
|
1116
|
+
|
1117
|
+
Style/Lambda:
|
1118
|
+
Description: 'Use the new lambda literal syntax for single-line blocks.'
|
1119
|
+
StyleGuide: '#lambda-multi-line'
|
1120
|
+
Enabled: true
|
1121
|
+
VersionAdded: '0.9'
|
1122
|
+
VersionChanged: '0.40'
|
1123
|
+
EnforcedStyle: literal
|
1124
|
+
SupportedStyles:
|
1125
|
+
- line_count_dependent
|
1126
|
+
- lambda
|
1127
|
+
- literal
|
1128
|
+
|
1129
|
+
Style/LambdaCall:
|
1130
|
+
Description: 'Use lambda.call(...) instead of lambda.(...).'
|
1131
|
+
StyleGuide: '#proc-call'
|
1132
|
+
Enabled: true
|
1133
|
+
VersionAdded: '0.13'
|
1134
|
+
VersionChanged: '0.14'
|
1135
|
+
EnforcedStyle: call
|
1136
|
+
SupportedStyles:
|
1137
|
+
- call
|
1138
|
+
- braces
|
1139
|
+
|
1140
|
+
Style/LineEndConcatenation:
|
1141
|
+
Description: >-
|
1142
|
+
Use \ instead of + or << to concatenate two string literals at
|
1143
|
+
line end.
|
1144
|
+
Enabled: true
|
1145
|
+
SafeAutoCorrect: false
|
1146
|
+
VersionAdded: '0.18'
|
1147
|
+
VersionChanged: '0.64'
|
1148
|
+
|
1149
|
+
Style/MagicCommentFormat:
|
1150
|
+
Description: 'Use a consistent style for magic comments.'
|
1151
|
+
Enabled: true
|
1152
|
+
VersionAdded: '1.35'
|
1153
|
+
EnforcedStyle: snake_case
|
1154
|
+
SupportedStyles:
|
1155
|
+
# `snake` will enforce the magic comment is written
|
1156
|
+
# in snake case (words separated by underscores).
|
1157
|
+
# Eg: froze_string_literal: true
|
1158
|
+
- snake_case
|
1159
|
+
# `kebab` will enforce the magic comment is written
|
1160
|
+
# in kebab case (words separated by hyphens).
|
1161
|
+
# Eg: froze-string-literal: true
|
1162
|
+
- kebab_case
|
1163
|
+
DirectiveCapitalization: lowercase
|
1164
|
+
ValueCapitalization: lowercase
|
1165
|
+
SupportedCapitalizations:
|
1166
|
+
- lowercase
|
1167
|
+
- uppercase
|
1168
|
+
|
1169
|
+
Style/MapCompactWithConditionalBlock:
|
1170
|
+
Description: 'Prefer `select` or `reject` over `map { ... }.compact`.'
|
1171
|
+
Enabled: true
|
1172
|
+
VersionAdded: '1.30'
|
1173
|
+
|
1174
|
+
Style/MapToHash:
|
1175
|
+
Description: 'Prefer `to_h` with a block over `map.to_h`.'
|
1176
|
+
Enabled: true
|
1177
|
+
VersionAdded: '1.24'
|
1178
|
+
Safe: false
|
1179
|
+
|
1180
|
+
Style/MethodCallWithArgsParentheses:
|
1181
|
+
Description: 'Use parentheses for method calls with arguments.'
|
1182
|
+
StyleGuide: '#method-invocation-parens'
|
1183
|
+
Enabled: true
|
1184
|
+
VersionAdded: '0.47'
|
1185
|
+
VersionChanged: '1.7'
|
1186
|
+
IgnoreMacros: true
|
1187
|
+
AllowedMethods: [ ]
|
1188
|
+
AllowedPatterns: [ ]
|
1189
|
+
IncludedMacros: [ ]
|
1190
|
+
AllowParenthesesInMultilineCall: false
|
1191
|
+
AllowParenthesesInChaining: false
|
1192
|
+
AllowParenthesesInCamelCaseMethod: false
|
1193
|
+
AllowParenthesesInStringInterpolation: false
|
1194
|
+
EnforcedStyle: require_parentheses
|
1195
|
+
SupportedStyles:
|
1196
|
+
- require_parentheses
|
1197
|
+
- omit_parentheses
|
1198
|
+
Exclude:
|
1199
|
+
- 'db/migrate/*'
|
1200
|
+
|
1201
|
+
Style/MethodCallWithoutArgsParentheses:
|
1202
|
+
Description: 'Do not use parentheses for method calls with no arguments.'
|
1203
|
+
StyleGuide: '#method-invocation-parens'
|
1204
|
+
Enabled: true
|
1205
|
+
AllowedMethods: [ ]
|
1206
|
+
AllowedPatterns: [ ]
|
1207
|
+
VersionAdded: '0.47'
|
1208
|
+
VersionChanged: '0.55'
|
1209
|
+
|
1210
|
+
Style/MethodCalledOnDoEndBlock:
|
1211
|
+
Description: 'Avoid chaining a method call on a do...end block.'
|
1212
|
+
StyleGuide: '#single-line-blocks'
|
1213
|
+
Enabled: true
|
1214
|
+
VersionAdded: '0.14'
|
1215
|
+
|
1216
|
+
Style/MethodDefParentheses:
|
1217
|
+
Description: >-
|
1218
|
+
Checks if the method definitions have or don't have
|
1219
|
+
parentheses.
|
1220
|
+
StyleGuide: '#method-parens'
|
1221
|
+
Enabled: true
|
1222
|
+
VersionAdded: '0.16'
|
1223
|
+
VersionChanged: '1.7'
|
1224
|
+
EnforcedStyle: require_parentheses
|
1225
|
+
SupportedStyles:
|
1226
|
+
- require_parentheses
|
1227
|
+
- require_no_parentheses
|
1228
|
+
- require_no_parentheses_except_multiline
|
1229
|
+
|
1230
|
+
Style/MinMax:
|
1231
|
+
Description: >-
|
1232
|
+
Use `Enumerable#minmax` instead of `Enumerable#min`
|
1233
|
+
and `Enumerable#max` in conjunction.
|
1234
|
+
Enabled: true
|
1235
|
+
VersionAdded: '0.50'
|
1236
|
+
|
1237
|
+
Style/MissingElse:
|
1238
|
+
Description: >-
|
1239
|
+
Require if/case expressions to have an else branches.
|
1240
|
+
If enabled, it is recommended that
|
1241
|
+
Style/UnlessElse and Style/EmptyElse be enabled.
|
1242
|
+
This will conflict with Style/EmptyElse if
|
1243
|
+
Style/EmptyElse is configured to style "both".
|
1244
|
+
Enabled: false
|
1245
|
+
VersionAdded: '0.30'
|
1246
|
+
VersionChanged: '0.38'
|
1247
|
+
EnforcedStyle: both
|
1248
|
+
SupportedStyles:
|
1249
|
+
# if - warn when an if expression is missing an else branch
|
1250
|
+
# case - warn when a case expression is missing an else branch
|
1251
|
+
# both - warn when an if or case expression is missing an else branch
|
1252
|
+
- if
|
1253
|
+
- case
|
1254
|
+
- both
|
1255
|
+
|
1256
|
+
Style/MissingRespondToMissing:
|
1257
|
+
Description: >-
|
1258
|
+
Checks if `method_missing` is implemented
|
1259
|
+
without implementing `respond_to_missing`.
|
1260
|
+
StyleGuide: '#no-method-missing'
|
1261
|
+
Enabled: true
|
1262
|
+
VersionAdded: '0.56'
|
1263
|
+
|
1264
|
+
Style/MixinGrouping:
|
1265
|
+
Description: 'Checks for grouping of mixins in `class` and `module` bodies.'
|
1266
|
+
StyleGuide: '#mixin-grouping'
|
1267
|
+
Enabled: true
|
1268
|
+
VersionAdded: '0.48'
|
1269
|
+
VersionChanged: '0.49'
|
1270
|
+
EnforcedStyle: separated
|
1271
|
+
SupportedStyles:
|
1272
|
+
# separated: each mixed in module goes in a separate statement.
|
1273
|
+
# grouped: mixed in modules are grouped into a single statement.
|
1274
|
+
- separated
|
1275
|
+
- grouped
|
1276
|
+
|
1277
|
+
Style/MixinUsage:
|
1278
|
+
Description: 'Checks that `include`, `extend` and `prepend` exists at the top level.'
|
1279
|
+
Enabled: true
|
1280
|
+
VersionAdded: '0.51'
|
1281
|
+
Exclude:
|
1282
|
+
- './**/*.rake'
|
1283
|
+
|
1284
|
+
Style/ModuleFunction:
|
1285
|
+
Description: 'Checks for usage of `extend self` in modules.'
|
1286
|
+
StyleGuide: '#module-function'
|
1287
|
+
Enabled: true
|
1288
|
+
VersionAdded: '0.11'
|
1289
|
+
VersionChanged: '0.65'
|
1290
|
+
EnforcedStyle: module_function
|
1291
|
+
SupportedStyles:
|
1292
|
+
- module_function
|
1293
|
+
- extend_self
|
1294
|
+
- forbidden
|
1295
|
+
Autocorrect: false
|
1296
|
+
SafeAutoCorrect: false
|
1297
|
+
|
1298
|
+
Style/MultilineBlockChain:
|
1299
|
+
Description: 'Avoid multi-line chains of blocks.'
|
1300
|
+
StyleGuide: '#single-line-blocks'
|
1301
|
+
Enabled: true
|
1302
|
+
VersionAdded: '0.13'
|
1303
|
+
|
1304
|
+
Style/MultilineIfModifier:
|
1305
|
+
Description: 'Only use if/unless modifiers on single line statements.'
|
1306
|
+
StyleGuide: '#no-multiline-if-modifiers'
|
1307
|
+
Enabled: true
|
1308
|
+
VersionAdded: '0.45'
|
1309
|
+
|
1310
|
+
Style/MultilineIfThen:
|
1311
|
+
Description: 'Do not use then for multi-line if/unless.'
|
1312
|
+
StyleGuide: '#no-then'
|
1313
|
+
Enabled: true
|
1314
|
+
VersionAdded: '0.9'
|
1315
|
+
VersionChanged: '0.26'
|
1316
|
+
|
1317
|
+
Style/MultilineInPatternThen:
|
1318
|
+
Description: 'Do not use `then` for multi-line `in` statement.'
|
1319
|
+
StyleGuide: '#no-then'
|
1320
|
+
Enabled: true
|
1321
|
+
VersionAdded: '1.16'
|
1322
|
+
|
1323
|
+
Style/MultilineMemoization:
|
1324
|
+
Description: 'Wrap multiline memoizations in a `begin` and `end` block.'
|
1325
|
+
Enabled: true
|
1326
|
+
VersionAdded: '0.44'
|
1327
|
+
VersionChanged: '0.48'
|
1328
|
+
EnforcedStyle: keyword
|
1329
|
+
SupportedStyles:
|
1330
|
+
- keyword
|
1331
|
+
- braces
|
1332
|
+
|
1333
|
+
Style/MultilineMethodSignature:
|
1334
|
+
Description: 'Avoid multi-line method signatures.'
|
1335
|
+
Enabled: false
|
1336
|
+
VersionAdded: '0.59'
|
1337
|
+
VersionChanged: '1.7'
|
1338
|
+
|
1339
|
+
Style/MultilineTernaryOperator:
|
1340
|
+
Description: >-
|
1341
|
+
Avoid multi-line ?: (the ternary operator);
|
1342
|
+
use if/unless instead.
|
1343
|
+
StyleGuide: '#no-multiline-ternary'
|
1344
|
+
Enabled: true
|
1345
|
+
VersionAdded: '0.9'
|
1346
|
+
VersionChanged: '0.86'
|
1347
|
+
|
1348
|
+
Style/MultilineWhenThen:
|
1349
|
+
Description: 'Do not use then for multi-line when statement.'
|
1350
|
+
StyleGuide: '#no-then'
|
1351
|
+
Enabled: true
|
1352
|
+
VersionAdded: '0.73'
|
1353
|
+
|
1354
|
+
Style/MultipleComparison:
|
1355
|
+
Description: >-
|
1356
|
+
Avoid comparing a variable with multiple items in a conditional,
|
1357
|
+
use Array#include? instead.
|
1358
|
+
Enabled: true
|
1359
|
+
VersionAdded: '0.49'
|
1360
|
+
VersionChanged: '1.1'
|
1361
|
+
AllowMethodComparison: true
|
1362
|
+
|
1363
|
+
Style/MutableConstant:
|
1364
|
+
Description: 'Do not assign mutable objects to constants.'
|
1365
|
+
Enabled: true
|
1366
|
+
VersionAdded: '0.34'
|
1367
|
+
VersionChanged: '1.8'
|
1368
|
+
SafeAutoCorrect: false
|
1369
|
+
EnforcedStyle: literals
|
1370
|
+
SupportedStyles:
|
1371
|
+
# literals: freeze literals assigned to constants
|
1372
|
+
# strict: freeze all constants
|
1373
|
+
# Strict mode is considered an experimental feature. It has not been updated
|
1374
|
+
# with an exhaustive list of all methods that will produce frozen objects so
|
1375
|
+
# there is a decent chance of getting some false positives. Luckily, there is
|
1376
|
+
# no harm in freezing an already frozen object.
|
1377
|
+
- literals
|
1378
|
+
- strict
|
1379
|
+
|
1380
|
+
Style/NegatedIf:
|
1381
|
+
Description: >-
|
1382
|
+
Favor unless over if for negative conditions
|
1383
|
+
(or control flow or).
|
1384
|
+
StyleGuide: '#unless-for-negatives'
|
1385
|
+
Enabled: true
|
1386
|
+
VersionAdded: '0.20'
|
1387
|
+
VersionChanged: '0.48'
|
1388
|
+
EnforcedStyle: both
|
1389
|
+
SupportedStyles:
|
1390
|
+
# both: prefix and postfix negated `if` should both use `unless`
|
1391
|
+
# prefix: only use `unless` for negated `if` statements positioned before the body of the statement
|
1392
|
+
# postfix: only use `unless` for negated `if` statements positioned after the body of the statement
|
1393
|
+
- both
|
1394
|
+
- prefix
|
1395
|
+
- postfix
|
1396
|
+
|
1397
|
+
Style/NegatedIfElseCondition:
|
1398
|
+
Description: >-
|
1399
|
+
Checks for uses of `if-else` and ternary operators with a negated condition
|
1400
|
+
which can be simplified by inverting condition and swapping branches.
|
1401
|
+
Enabled: true
|
1402
|
+
VersionAdded: '1.2'
|
1403
|
+
|
1404
|
+
Style/NegatedUnless:
|
1405
|
+
Description: 'Favor if over unless for negative conditions.'
|
1406
|
+
StyleGuide: '#if-for-negatives'
|
1407
|
+
Enabled: true
|
1408
|
+
VersionAdded: '0.69'
|
1409
|
+
EnforcedStyle: both
|
1410
|
+
SupportedStyles:
|
1411
|
+
# both: prefix and postfix negated `unless` should both use `if`
|
1412
|
+
# prefix: only use `if` for negated `unless` statements positioned before the body of the statement
|
1413
|
+
# postfix: only use `if` for negated `unless` statements positioned after the body of the statement
|
1414
|
+
- both
|
1415
|
+
- prefix
|
1416
|
+
- postfix
|
1417
|
+
|
1418
|
+
Style/NegatedWhile:
|
1419
|
+
Description: 'Favor until over while for negative conditions.'
|
1420
|
+
StyleGuide: '#until-for-negatives'
|
1421
|
+
Enabled: true
|
1422
|
+
VersionAdded: '0.20'
|
1423
|
+
|
1424
|
+
Style/NestedFileDirname:
|
1425
|
+
Description: 'Checks for nested `File.dirname`.'
|
1426
|
+
Enabled: true
|
1427
|
+
VersionAdded: '1.26'
|
1428
|
+
|
1429
|
+
Style/NestedModifier:
|
1430
|
+
Description: 'Avoid using nested modifiers.'
|
1431
|
+
StyleGuide: '#no-nested-modifiers'
|
1432
|
+
Enabled: true
|
1433
|
+
VersionAdded: '0.35'
|
1434
|
+
|
1435
|
+
Style/NestedParenthesizedCalls:
|
1436
|
+
Description: >-
|
1437
|
+
Parenthesize method calls which are nested inside the
|
1438
|
+
argument list of another parenthesized method call.
|
1439
|
+
Enabled: true
|
1440
|
+
VersionAdded: '0.36'
|
1441
|
+
VersionChanged: '0.77'
|
1442
|
+
AllowedMethods:
|
1443
|
+
- be
|
1444
|
+
- be_a
|
1445
|
+
- be_an
|
1446
|
+
- be_between
|
1447
|
+
- be_falsey
|
1448
|
+
- be_kind_of
|
1449
|
+
- be_instance_of
|
1450
|
+
- be_truthy
|
1451
|
+
- be_within
|
1452
|
+
- eq
|
1453
|
+
- eql
|
1454
|
+
- end_with
|
1455
|
+
- include
|
1456
|
+
- match
|
1457
|
+
- raise_error
|
1458
|
+
- respond_to
|
1459
|
+
- start_with
|
1460
|
+
|
1461
|
+
Style/NestedTernaryOperator:
|
1462
|
+
Description: 'Use one expression per branch in a ternary operator.'
|
1463
|
+
StyleGuide: '#no-nested-ternary'
|
1464
|
+
Enabled: true
|
1465
|
+
VersionAdded: '0.9'
|
1466
|
+
VersionChanged: '0.86'
|
1467
|
+
|
1468
|
+
Style/Next:
|
1469
|
+
Description: 'Use `next` to skip iteration instead of a condition at the end.'
|
1470
|
+
StyleGuide: '#no-nested-conditionals'
|
1471
|
+
Enabled: true
|
1472
|
+
VersionAdded: '0.22'
|
1473
|
+
VersionChanged: '0.35'
|
1474
|
+
# With `always` all conditions at the end of an iteration needs to be
|
1475
|
+
# replaced by next - with `skip_modifier_ifs` the modifier if like this one
|
1476
|
+
# are ignored: [1, 2].each { |a| return 'yes' if a == 1 }
|
1477
|
+
EnforcedStyle: skip_modifier_ifs
|
1478
|
+
# `MinBodyLength` defines the number of lines of the a body of an `if` or `unless`
|
1479
|
+
# needs to have to trigger this cop
|
1480
|
+
MinBodyLength: 3
|
1481
|
+
SupportedStyles:
|
1482
|
+
- skip_modifier_ifs
|
1483
|
+
- always
|
1484
|
+
|
1485
|
+
Style/NilComparison:
|
1486
|
+
Description: 'Prefer x.nil? to x == nil.'
|
1487
|
+
StyleGuide: '#predicate-methods'
|
1488
|
+
Enabled: true
|
1489
|
+
VersionAdded: '0.12'
|
1490
|
+
VersionChanged: '0.59'
|
1491
|
+
EnforcedStyle: predicate
|
1492
|
+
SupportedStyles:
|
1493
|
+
- predicate
|
1494
|
+
- comparison
|
1495
|
+
|
1496
|
+
Style/NilLambda:
|
1497
|
+
Description: 'Prefer `-> {}` to `-> { nil }`.'
|
1498
|
+
Enabled: true
|
1499
|
+
VersionAdded: '1.3'
|
1500
|
+
VersionChanged: '1.15'
|
1501
|
+
|
1502
|
+
Style/NonNilCheck:
|
1503
|
+
Description: 'Checks for redundant nil checks.'
|
1504
|
+
StyleGuide: '#no-non-nil-checks'
|
1505
|
+
Enabled: true
|
1506
|
+
VersionAdded: '0.20'
|
1507
|
+
VersionChanged: '0.22'
|
1508
|
+
# With `IncludeSemanticChanges` set to `true`, this cop reports offenses for
|
1509
|
+
# `!x.nil?` and autocorrects that and `x != nil` to solely `x`, which is
|
1510
|
+
# **usually** OK, but might change behavior.
|
1511
|
+
#
|
1512
|
+
# With `IncludeSemanticChanges` set to `false`, this cop does not report
|
1513
|
+
# offenses for `!x.nil?` and does no changes that might change behavior.
|
1514
|
+
IncludeSemanticChanges: false
|
1515
|
+
|
1516
|
+
Style/Not:
|
1517
|
+
Description: 'Use ! instead of not.'
|
1518
|
+
StyleGuide: '#bang-not-not'
|
1519
|
+
Enabled: true
|
1520
|
+
VersionAdded: '0.9'
|
1521
|
+
VersionChanged: '0.20'
|
1522
|
+
|
1523
|
+
Style/NumberedParameters:
|
1524
|
+
Description: 'Restrict the usage of numbered parameters.'
|
1525
|
+
Enabled: true
|
1526
|
+
VersionAdded: '1.22'
|
1527
|
+
EnforcedStyle: disallow
|
1528
|
+
SupportedStyles:
|
1529
|
+
- allow_single_line
|
1530
|
+
- disallow
|
1531
|
+
|
1532
|
+
Style/NumberedParametersLimit:
|
1533
|
+
Description: 'Avoid excessive numbered params in a single block.'
|
1534
|
+
Enabled: true
|
1535
|
+
VersionAdded: '1.22'
|
1536
|
+
Max: 0
|
1537
|
+
|
1538
|
+
Style/NumericLiteralPrefix:
|
1539
|
+
Description: 'Use smallcase prefixes for numeric literals.'
|
1540
|
+
StyleGuide: '#numeric-literal-prefixes'
|
1541
|
+
Enabled: true
|
1542
|
+
VersionAdded: '0.41'
|
1543
|
+
EnforcedOctalStyle: zero_with_o
|
1544
|
+
SupportedOctalStyles:
|
1545
|
+
- zero_with_o
|
1546
|
+
- zero_only
|
1547
|
+
|
1548
|
+
Style/NumericLiterals:
|
1549
|
+
Description: >-
|
1550
|
+
Add underscores to large numeric literals to improve their
|
1551
|
+
readability.
|
1552
|
+
StyleGuide: '#underscores-in-numerics'
|
1553
|
+
Enabled: true
|
1554
|
+
VersionAdded: '0.9'
|
1555
|
+
VersionChanged: '0.48'
|
1556
|
+
Strict: true
|
1557
|
+
MinDigits: 4
|
1558
|
+
# You can specify allowed numbers. (e.g. port number 3000, 8080, and etc)
|
1559
|
+
AllowedNumbers:
|
1560
|
+
- 3000
|
1561
|
+
- 3306
|
1562
|
+
- 3035
|
1563
|
+
- 5432
|
1564
|
+
- 6379
|
1565
|
+
- 8080
|
1566
|
+
- 11211
|
1567
|
+
AllowedPatterns: [ ]
|
1568
|
+
|
1569
|
+
Style/NumericPredicate:
|
1570
|
+
Description: >-
|
1571
|
+
Checks for the use of predicate- or comparison methods for
|
1572
|
+
numeric comparisons.
|
1573
|
+
StyleGuide: '#predicate-methods'
|
1574
|
+
Safe: false
|
1575
|
+
# This will change to a new method call which isn't guaranteed to be on the
|
1576
|
+
# object. Switching these methods has to be done with knowledge of the types
|
1577
|
+
# of the variables which rubocop doesn't have.
|
1578
|
+
SafeAutoCorrect: false
|
1579
|
+
Enabled: false
|
1580
|
+
VersionAdded: '0.42'
|
1581
|
+
VersionChanged: '0.59'
|
1582
|
+
EnforcedStyle: predicate
|
1583
|
+
SupportedStyles:
|
1584
|
+
- predicate
|
1585
|
+
- comparison
|
1586
|
+
AllowedMethods: [ ]
|
1587
|
+
AllowedPatterns: [ ]
|
1588
|
+
# Exclude RSpec specs because assertions like `expect(1).to be > 0` cause
|
1589
|
+
# false positives.
|
1590
|
+
Exclude:
|
1591
|
+
- 'spec/**/*'
|
1592
|
+
|
1593
|
+
Style/ObjectThen:
|
1594
|
+
Description: 'Enforces the use of consistent method names `Object#yield_self` or `Object#then`.'
|
1595
|
+
StyleGuide: '#object-yield-self-vs-object-then'
|
1596
|
+
Enabled: true
|
1597
|
+
VersionAdded: '1.28'
|
1598
|
+
# Use `Object#yield_self` or `Object#then`?
|
1599
|
+
# Prefer `Object#yield_self` to `Object#then` (yield_self)
|
1600
|
+
# Prefer `Object#then` to `Object#yield_self` (then)
|
1601
|
+
EnforcedStyle: yield_self
|
1602
|
+
SupportedStyles:
|
1603
|
+
- then
|
1604
|
+
- yield_self
|
1605
|
+
|
1606
|
+
Style/OneLineConditional:
|
1607
|
+
Description: >-
|
1608
|
+
Favor the ternary operator (?:) or multi-line constructs over
|
1609
|
+
single-line if/then/else/end constructs.
|
1610
|
+
StyleGuide: '#ternary-operator'
|
1611
|
+
Enabled: true
|
1612
|
+
AlwaysCorrectToMultiline: false
|
1613
|
+
VersionAdded: '0.9'
|
1614
|
+
VersionChanged: '0.90'
|
1615
|
+
|
1616
|
+
Style/OpenStructUse:
|
1617
|
+
Description: >-
|
1618
|
+
Avoid using OpenStruct. As of Ruby 3.0, use is officially discouraged due to performance,
|
1619
|
+
version compatibility, and potential security issues.
|
1620
|
+
Reference:
|
1621
|
+
- https://docs.ruby-lang.org/en/3.0.0/OpenStruct.html#class-OpenStruct-label-Caveats
|
1622
|
+
Enabled: true
|
1623
|
+
VersionAdded: '1.23'
|
1624
|
+
|
1625
|
+
Style/OperatorMethodCall:
|
1626
|
+
Description: 'Checks for redundant dot before operator method call.'
|
1627
|
+
StyleGuide: '#operator-method-call'
|
1628
|
+
Enabled: true
|
1629
|
+
VersionAdded: '1.37'
|
1630
|
+
|
1631
|
+
Style/OptionHash:
|
1632
|
+
Description: "Don't use option hashes when you can use keyword arguments."
|
1633
|
+
Enabled: false
|
1634
|
+
VersionAdded: '0.33'
|
1635
|
+
VersionChanged: '0.34'
|
1636
|
+
# A list of parameter names that will be flagged by this cop.
|
1637
|
+
SuspiciousParamNames:
|
1638
|
+
- options
|
1639
|
+
- opts
|
1640
|
+
- args
|
1641
|
+
- params
|
1642
|
+
- parameters
|
1643
|
+
Allowlist: [ ]
|
1644
|
+
|
1645
|
+
Style/OptionalArguments:
|
1646
|
+
Description: >-
|
1647
|
+
Checks for optional arguments that do not appear at the end
|
1648
|
+
of the argument list.
|
1649
|
+
StyleGuide: '#optional-arguments'
|
1650
|
+
Enabled: true
|
1651
|
+
Safe: false
|
1652
|
+
VersionAdded: '0.33'
|
1653
|
+
VersionChanged: '0.83'
|
1654
|
+
|
1655
|
+
Style/OptionalBooleanParameter:
|
1656
|
+
Description: 'Use keyword arguments when defining method with boolean argument.'
|
1657
|
+
StyleGuide: '#boolean-keyword-arguments'
|
1658
|
+
Enabled: false
|
1659
|
+
Safe: false
|
1660
|
+
VersionAdded: '0.89'
|
1661
|
+
AllowedMethods:
|
1662
|
+
- respond_to_missing?
|
1663
|
+
|
1664
|
+
Style/OrAssignment:
|
1665
|
+
Description: 'Recommend usage of double pipe equals (||=) where applicable.'
|
1666
|
+
StyleGuide: '#double-pipe-for-uninit'
|
1667
|
+
Enabled: true
|
1668
|
+
VersionAdded: '0.50'
|
1669
|
+
|
1670
|
+
Style/ParallelAssignment:
|
1671
|
+
Description: >-
|
1672
|
+
Check for simple usages of parallel assignment.
|
1673
|
+
It will only warn when the number of variables
|
1674
|
+
matches on both sides of the assignment.
|
1675
|
+
StyleGuide: '#parallel-assignment'
|
1676
|
+
Enabled: true
|
1677
|
+
VersionAdded: '0.32'
|
1678
|
+
|
1679
|
+
Style/ParenthesesAroundCondition:
|
1680
|
+
Description: >-
|
1681
|
+
Don't use parentheses around the condition of an
|
1682
|
+
if/unless/while.
|
1683
|
+
StyleGuide: '#no-parens-around-condition'
|
1684
|
+
Enabled: true
|
1685
|
+
VersionAdded: '0.9'
|
1686
|
+
VersionChanged: '0.56'
|
1687
|
+
AllowSafeAssignment: true
|
1688
|
+
AllowInMultilineConditions: false
|
1689
|
+
|
1690
|
+
Style/PercentLiteralDelimiters:
|
1691
|
+
Description: 'Use `%`-literal delimiters consistently.'
|
1692
|
+
StyleGuide: '#percent-literal-braces'
|
1693
|
+
Enabled: true
|
1694
|
+
VersionAdded: '0.19'
|
1695
|
+
# Specify the default preferred delimiter for all types with the 'default' key
|
1696
|
+
# Override individual delimiters (even with default specified) by specifying
|
1697
|
+
# an individual key
|
1698
|
+
PreferredDelimiters:
|
1699
|
+
default: '[]'
|
1700
|
+
VersionChanged: '0.48'
|
1701
|
+
|
1702
|
+
Style/PercentQLiterals:
|
1703
|
+
Description: 'Checks if uses of %Q/%q match the configured preference.'
|
1704
|
+
Enabled: true
|
1705
|
+
VersionAdded: '0.25'
|
1706
|
+
EnforcedStyle: lower_case_q
|
1707
|
+
SupportedStyles:
|
1708
|
+
- lower_case_q # Use `%q` when possible, `%Q` when necessary
|
1709
|
+
- upper_case_q # Always use `%Q`
|
1710
|
+
|
1711
|
+
Style/PerlBackrefs:
|
1712
|
+
Description: 'Avoid Perl-style regex back references.'
|
1713
|
+
StyleGuide: '#no-perl-regexp-last-matchers'
|
1714
|
+
Enabled: true
|
1715
|
+
VersionAdded: '0.13'
|
1716
|
+
|
1717
|
+
Style/PreferredHashMethods:
|
1718
|
+
Description: 'Checks use of `has_key?` and `has_value?` Hash methods.'
|
1719
|
+
StyleGuide: '#hash-key'
|
1720
|
+
Enabled: false
|
1721
|
+
Safe: false
|
1722
|
+
VersionAdded: '0.41'
|
1723
|
+
VersionChanged: '0.70'
|
1724
|
+
EnforcedStyle: short
|
1725
|
+
SupportedStyles:
|
1726
|
+
- short
|
1727
|
+
- verbose
|
1728
|
+
|
1729
|
+
Style/Proc:
|
1730
|
+
Description: 'Use proc instead of Proc.new.'
|
1731
|
+
StyleGuide: '#proc'
|
1732
|
+
Enabled: true
|
1733
|
+
VersionAdded: '0.9'
|
1734
|
+
VersionChanged: '0.18'
|
1735
|
+
|
1736
|
+
Style/QuotedSymbols:
|
1737
|
+
Description: 'Use a consistent style for quoted symbols.'
|
1738
|
+
Enabled: true
|
1739
|
+
VersionAdded: '1.16'
|
1740
|
+
EnforcedStyle: same_as_string_literals
|
1741
|
+
SupportedStyles:
|
1742
|
+
- same_as_string_literals
|
1743
|
+
- single_quotes
|
1744
|
+
- double_quotes
|
1745
|
+
|
1746
|
+
Style/RaiseArgs:
|
1747
|
+
Description: 'Checks the arguments passed to raise/fail.'
|
1748
|
+
StyleGuide: '#exception-class-messages'
|
1749
|
+
Enabled: true
|
1750
|
+
VersionAdded: '0.14'
|
1751
|
+
VersionChanged: '1.2'
|
1752
|
+
EnforcedStyle: exploded
|
1753
|
+
SupportedStyles:
|
1754
|
+
- compact # raise Exception.new(msg)
|
1755
|
+
- exploded # raise Exception, msg
|
1756
|
+
AllowedCompactTypes: [ ]
|
1757
|
+
|
1758
|
+
Style/RandomWithOffset:
|
1759
|
+
Description: >-
|
1760
|
+
Prefer to use ranges when generating random numbers instead of
|
1761
|
+
integers with offsets.
|
1762
|
+
StyleGuide: '#random-numbers'
|
1763
|
+
Enabled: true
|
1764
|
+
VersionAdded: '0.52'
|
1765
|
+
|
1766
|
+
Style/RedundantArgument:
|
1767
|
+
Description: 'Check for a redundant argument passed to certain methods.'
|
1768
|
+
Enabled: true
|
1769
|
+
Safe: false
|
1770
|
+
VersionAdded: '1.4'
|
1771
|
+
VersionChanged: '1.40'
|
1772
|
+
Methods:
|
1773
|
+
# Array#sum
|
1774
|
+
sum: 0
|
1775
|
+
join:
|
1776
|
+
split:
|
1777
|
+
chomp:
|
1778
|
+
chomp!:
|
1779
|
+
|
1780
|
+
Style/RedundantAssignment:
|
1781
|
+
Description: 'Checks for redundant assignment before returning.'
|
1782
|
+
Enabled: true
|
1783
|
+
VersionAdded: '0.87'
|
1784
|
+
|
1785
|
+
Style/RedundantBegin:
|
1786
|
+
Description: "Don't use begin blocks when they are not needed."
|
1787
|
+
StyleGuide: '#begin-implicit'
|
1788
|
+
Enabled: true
|
1789
|
+
VersionAdded: '0.10'
|
1790
|
+
VersionChanged: '0.21'
|
1791
|
+
|
1792
|
+
Style/RedundantCapitalW:
|
1793
|
+
Description: 'Checks for %W when interpolation is not needed.'
|
1794
|
+
Enabled: true
|
1795
|
+
VersionAdded: '0.76'
|
1796
|
+
|
1797
|
+
Style/RedundantCondition:
|
1798
|
+
Description: 'Checks for unnecessary conditional expressions.'
|
1799
|
+
Enabled: true
|
1800
|
+
VersionAdded: '0.76'
|
1801
|
+
|
1802
|
+
Style/RedundantConditional:
|
1803
|
+
Description: "Don't return true/false from a conditional."
|
1804
|
+
Enabled: true
|
1805
|
+
VersionAdded: '0.50'
|
1806
|
+
|
1807
|
+
Style/RedundantConstantBase:
|
1808
|
+
Description: Avoid redundant `::` prefix on constant.
|
1809
|
+
Enabled: true
|
1810
|
+
VersionAdded: '1.40'
|
1811
|
+
|
1812
|
+
Style/RedundantDoubleSplatHashBraces:
|
1813
|
+
Description: 'Checks for redundant uses of double splat hash braces.'
|
1814
|
+
Enabled: true
|
1815
|
+
VersionAdded: '1.41'
|
1816
|
+
|
1817
|
+
Style/RedundantEach:
|
1818
|
+
Description: 'Checks for redundant `each`.'
|
1819
|
+
Enabled: true
|
1820
|
+
Safe: false
|
1821
|
+
VersionAdded: '1.38'
|
1822
|
+
|
1823
|
+
Style/RedundantException:
|
1824
|
+
Description: "Checks for an obsolete RuntimeException argument in raise/fail."
|
1825
|
+
StyleGuide: '#no-explicit-runtimeerror'
|
1826
|
+
Enabled: true
|
1827
|
+
VersionAdded: '0.14'
|
1828
|
+
VersionChanged: '0.29'
|
1829
|
+
|
1830
|
+
Style/RedundantFetchBlock:
|
1831
|
+
Description: >-
|
1832
|
+
Use `fetch(key, value)` instead of `fetch(key) { value }`
|
1833
|
+
when value has Numeric, Rational, Complex, Symbol or String type, `false`, `true`, `nil` or is a constant.
|
1834
|
+
Reference: 'https://github.com/JuanitoFatas/fast-ruby#hashfetch-with-argument-vs-hashfetch--block-code'
|
1835
|
+
Enabled: true
|
1836
|
+
Safe: false
|
1837
|
+
# If enabled, this cop will autocorrect usages of
|
1838
|
+
# `fetch` being called with block returning a constant.
|
1839
|
+
# This can be dangerous since constants will not be defined at that moment.
|
1840
|
+
SafeForConstants: false
|
1841
|
+
VersionAdded: '0.86'
|
1842
|
+
|
1843
|
+
Style/RedundantFileExtensionInRequire:
|
1844
|
+
Description: >-
|
1845
|
+
Checks for the presence of superfluous `.rb` extension in
|
1846
|
+
the filename provided to `require` and `require_relative`.
|
1847
|
+
StyleGuide: '#no-explicit-rb-to-require'
|
1848
|
+
Enabled: true
|
1849
|
+
VersionAdded: '0.88'
|
1850
|
+
|
1851
|
+
Style/RedundantFreeze:
|
1852
|
+
Description: "Checks usages of Object#freeze on immutable objects."
|
1853
|
+
Enabled: true
|
1854
|
+
VersionAdded: '0.34'
|
1855
|
+
VersionChanged: '0.66'
|
1856
|
+
|
1857
|
+
Style/RedundantHeredocDelimiterQuotes:
|
1858
|
+
Description: 'Checks for redundant heredoc delimiter quotes.'
|
1859
|
+
Enabled: true
|
1860
|
+
VersionAdded: '1.45'
|
1861
|
+
|
1862
|
+
Style/RedundantInitialize:
|
1863
|
+
Description: 'Checks for redundant `initialize` methods.'
|
1864
|
+
Enabled: true
|
1865
|
+
Safe: false
|
1866
|
+
AllowComments: true
|
1867
|
+
VersionAdded: '1.27'
|
1868
|
+
VersionChanged: '1.28'
|
1869
|
+
|
1870
|
+
Style/RedundantInterpolation:
|
1871
|
+
Description: 'Checks for strings that are just an interpolated expression.'
|
1872
|
+
Enabled: true
|
1873
|
+
SafeAutoCorrect: false
|
1874
|
+
VersionAdded: '0.76'
|
1875
|
+
VersionChanged: '1.30'
|
1876
|
+
|
1877
|
+
Style/RedundantParentheses:
|
1878
|
+
Description: "Checks for parentheses that seem not to serve any purpose."
|
1879
|
+
Enabled: true
|
1880
|
+
VersionAdded: '0.36'
|
1881
|
+
|
1882
|
+
Style/RedundantPercentQ:
|
1883
|
+
Description: 'Checks for %q/%Q when single quotes or double quotes would do.'
|
1884
|
+
StyleGuide: '#percent-q'
|
1885
|
+
Enabled: true
|
1886
|
+
VersionAdded: '0.76'
|
1887
|
+
|
1888
|
+
Style/RedundantRegexpCharacterClass:
|
1889
|
+
Description: 'Checks for unnecessary single-element Regexp character classes.'
|
1890
|
+
Enabled: true
|
1891
|
+
VersionAdded: '0.85'
|
1892
|
+
|
1893
|
+
Style/RedundantRegexpEscape:
|
1894
|
+
Description: 'Checks for redundant escapes in Regexps.'
|
1895
|
+
Enabled: true
|
1896
|
+
VersionAdded: '0.85'
|
1897
|
+
|
1898
|
+
Style/RedundantReturn:
|
1899
|
+
Description: "Don't use return where it's not required."
|
1900
|
+
StyleGuide: '#no-explicit-return'
|
1901
|
+
Enabled: false
|
1902
|
+
VersionAdded: '0.10'
|
1903
|
+
VersionChanged: '0.14'
|
1904
|
+
# When `true` allows code like `return x, y`.
|
1905
|
+
AllowMultipleReturnValues: false
|
1906
|
+
|
1907
|
+
Style/RedundantSelf:
|
1908
|
+
Description: "Don't use self where it's not needed."
|
1909
|
+
StyleGuide: '#no-self-unless-required'
|
1910
|
+
Enabled: true
|
1911
|
+
VersionAdded: '0.10'
|
1912
|
+
VersionChanged: '0.13'
|
1913
|
+
|
1914
|
+
Style/RedundantSelfAssignment:
|
1915
|
+
Description: 'Checks for places where redundant assignments are made for in place modification methods.'
|
1916
|
+
Enabled: true
|
1917
|
+
Safe: false
|
1918
|
+
VersionAdded: '0.90'
|
1919
|
+
|
1920
|
+
Style/RedundantSelfAssignmentBranch:
|
1921
|
+
Description: 'Checks for places where conditional branch makes redundant self-assignment.'
|
1922
|
+
Enabled: true
|
1923
|
+
VersionAdded: '1.19'
|
1924
|
+
|
1925
|
+
Style/RedundantSort:
|
1926
|
+
Description: >-
|
1927
|
+
Use `min` instead of `sort.first`,
|
1928
|
+
`max_by` instead of `sort_by...last`, etc.
|
1929
|
+
Enabled: true
|
1930
|
+
VersionAdded: '0.76'
|
1931
|
+
VersionChanged: '1.22'
|
1932
|
+
Safe: false
|
1933
|
+
|
1934
|
+
Style/RedundantSortBy:
|
1935
|
+
Description: 'Use `sort` instead of `sort_by { |x| x }`.'
|
1936
|
+
Enabled: true
|
1937
|
+
VersionAdded: '0.36'
|
1938
|
+
|
1939
|
+
Style/RedundantStringEscape:
|
1940
|
+
Description: 'Checks for redundant escapes in string literals.'
|
1941
|
+
Enabled: true
|
1942
|
+
VersionAdded: '1.37'
|
1943
|
+
|
1944
|
+
Style/RegexpLiteral:
|
1945
|
+
Description: 'Use / or %r around regular expressions.'
|
1946
|
+
StyleGuide: '#percent-r'
|
1947
|
+
Enabled: true
|
1948
|
+
VersionAdded: '0.9'
|
1949
|
+
VersionChanged: '0.30'
|
1950
|
+
EnforcedStyle: slashes
|
1951
|
+
# slashes: Always use slashes.
|
1952
|
+
# percent_r: Always use `%r`.
|
1953
|
+
# mixed: Use slashes on single-line regexes, and `%r` on multi-line regexes.
|
1954
|
+
SupportedStyles:
|
1955
|
+
- slashes
|
1956
|
+
- percent_r
|
1957
|
+
- mixed
|
1958
|
+
# If `false`, the cop will always recommend using `%r` if one or more slashes
|
1959
|
+
# are found in the regexp string.
|
1960
|
+
AllowInnerSlashes: false
|
1961
|
+
|
1962
|
+
Style/RequireOrder:
|
1963
|
+
Description: Sort `require` and `require_relative` in alphabetical order.
|
1964
|
+
Enabled: true
|
1965
|
+
SafeAutoCorrect: false
|
1966
|
+
VersionAdded: '1.40'
|
1967
|
+
|
1968
|
+
Style/RescueModifier:
|
1969
|
+
Description: 'Avoid using rescue in its modifier form.'
|
1970
|
+
StyleGuide: '#no-rescue-modifiers'
|
1971
|
+
Enabled: true
|
1972
|
+
VersionAdded: '0.9'
|
1973
|
+
VersionChanged: '0.34'
|
1974
|
+
|
1975
|
+
Style/RescueStandardError:
|
1976
|
+
Description: 'Avoid rescuing without specifying an error class.'
|
1977
|
+
Enabled: true
|
1978
|
+
VersionAdded: '0.52'
|
1979
|
+
EnforcedStyle: implicit
|
1980
|
+
# implicit: Do not include the error class, `rescue`
|
1981
|
+
# explicit: Require an error class `rescue StandardError`
|
1982
|
+
SupportedStyles:
|
1983
|
+
- implicit
|
1984
|
+
- explicit
|
1985
|
+
|
1986
|
+
Style/ReturnNil:
|
1987
|
+
Description: 'Use return instead of return nil.'
|
1988
|
+
Enabled: false
|
1989
|
+
EnforcedStyle: return
|
1990
|
+
SupportedStyles:
|
1991
|
+
- return
|
1992
|
+
- return_nil
|
1993
|
+
VersionAdded: '0.50'
|
1994
|
+
|
1995
|
+
Style/SafeNavigation:
|
1996
|
+
Description: >-
|
1997
|
+
Transforms usages of a method call safeguarded by
|
1998
|
+
a check for the existence of the object to
|
1999
|
+
safe navigation (`&.`).
|
2000
|
+
Autocorrection is unsafe as it assumes the object will
|
2001
|
+
be `nil` or truthy, but never `false`.
|
2002
|
+
Enabled: true
|
2003
|
+
VersionAdded: '0.43'
|
2004
|
+
VersionChanged: '1.27'
|
2005
|
+
# Safe navigation may cause a statement to start returning `nil` in addition
|
2006
|
+
# to whatever it used to return.
|
2007
|
+
ConvertCodeThatCanStartToReturnNil: false
|
2008
|
+
AllowedMethods:
|
2009
|
+
- present?
|
2010
|
+
- blank?
|
2011
|
+
- presence
|
2012
|
+
- try
|
2013
|
+
- try!
|
2014
|
+
SafeAutoCorrect: false
|
2015
|
+
# Maximum length of method chains for register an offense.
|
2016
|
+
MaxChainLength: 2
|
2017
|
+
|
2018
|
+
Style/Sample:
|
2019
|
+
Description: >-
|
2020
|
+
Use `sample` instead of `shuffle.first`,
|
2021
|
+
`shuffle.last`, and `shuffle[Integer]`.
|
2022
|
+
Reference: 'https://github.com/JuanitoFatas/fast-ruby#arrayshufflefirst-vs-arraysample-code'
|
2023
|
+
Enabled: true
|
2024
|
+
VersionAdded: '0.30'
|
2025
|
+
|
2026
|
+
Style/SelectByRegexp:
|
2027
|
+
Description: 'Prefer grep/grep_v to select/reject with a regexp match.'
|
2028
|
+
Enabled: true
|
2029
|
+
SafeAutoCorrect: false
|
2030
|
+
VersionAdded: '1.22'
|
2031
|
+
|
2032
|
+
Style/SelfAssignment:
|
2033
|
+
Description: >-
|
2034
|
+
Checks for places where self-assignment shorthand should have
|
2035
|
+
been used.
|
2036
|
+
StyleGuide: '#self-assignment'
|
2037
|
+
Enabled: true
|
2038
|
+
VersionAdded: '0.19'
|
2039
|
+
VersionChanged: '0.29'
|
2040
|
+
|
2041
|
+
Style/Semicolon:
|
2042
|
+
Description: "Don't use semicolons to terminate expressions."
|
2043
|
+
StyleGuide: '#no-semicolon'
|
2044
|
+
Enabled: true
|
2045
|
+
VersionAdded: '0.9'
|
2046
|
+
VersionChanged: '0.19'
|
2047
|
+
# Allow `;` to separate several expressions on the same line.
|
2048
|
+
AllowAsExpressionSeparator: false
|
2049
|
+
|
2050
|
+
Style/Send:
|
2051
|
+
Description: 'Prefer `Object#__send__` or `Object#public_send` to `send`, as `send` may overlap with existing methods.'
|
2052
|
+
StyleGuide: '#prefer-public-send'
|
2053
|
+
Enabled: true
|
2054
|
+
VersionAdded: '0.33'
|
2055
|
+
|
2056
|
+
Style/SignalException:
|
2057
|
+
Description: 'Checks for proper usage of fail and raise.'
|
2058
|
+
StyleGuide: '#prefer-raise-over-fail'
|
2059
|
+
Enabled: true
|
2060
|
+
VersionAdded: '0.11'
|
2061
|
+
VersionChanged: '0.37'
|
2062
|
+
EnforcedStyle: only_raise
|
2063
|
+
SupportedStyles:
|
2064
|
+
- only_raise
|
2065
|
+
- only_fail
|
2066
|
+
- semantic
|
2067
|
+
|
2068
|
+
Style/SingleArgumentDig:
|
2069
|
+
Description: 'Avoid using single argument dig method.'
|
2070
|
+
Enabled: false
|
2071
|
+
VersionAdded: '0.89'
|
2072
|
+
Safe: false
|
2073
|
+
|
2074
|
+
Style/SingleLineBlockParams:
|
2075
|
+
Description: 'Enforces the names of some block params.'
|
2076
|
+
Enabled: false
|
2077
|
+
VersionAdded: '0.16'
|
2078
|
+
VersionChanged: '1.6'
|
2079
|
+
Methods:
|
2080
|
+
- reduce:
|
2081
|
+
- acc
|
2082
|
+
- elem
|
2083
|
+
- inject:
|
2084
|
+
- acc
|
2085
|
+
- elem
|
2086
|
+
|
2087
|
+
Style/SingleLineMethods:
|
2088
|
+
Description: 'Avoid single-line methods.'
|
2089
|
+
StyleGuide: '#no-single-line-methods'
|
2090
|
+
Enabled: true
|
2091
|
+
VersionAdded: '0.9'
|
2092
|
+
VersionChanged: '1.8'
|
2093
|
+
AllowIfMethodIsEmpty: true
|
2094
|
+
|
2095
|
+
Style/SlicingWithRange:
|
2096
|
+
Description: 'Checks array slicing is done with endless ranges when suitable.'
|
2097
|
+
Enabled: true
|
2098
|
+
VersionAdded: '0.83'
|
2099
|
+
Safe: false
|
2100
|
+
|
2101
|
+
Style/SoleNestedConditional:
|
2102
|
+
Description: >-
|
2103
|
+
Finds sole nested conditional nodes
|
2104
|
+
which can be merged into outer conditional node.
|
2105
|
+
Enabled: true
|
2106
|
+
VersionAdded: '0.89'
|
2107
|
+
VersionChanged: '1.5'
|
2108
|
+
AllowModifier: true
|
2109
|
+
|
2110
|
+
Style/SpecialGlobalVars:
|
2111
|
+
Description: 'Avoid Perl-style global variables.'
|
2112
|
+
StyleGuide: '#no-cryptic-perlisms'
|
2113
|
+
Enabled: true
|
2114
|
+
VersionAdded: '0.13'
|
2115
|
+
VersionChanged: '0.36'
|
2116
|
+
SafeAutoCorrect: false
|
2117
|
+
RequireEnglish: true
|
2118
|
+
EnforcedStyle: use_english_names
|
2119
|
+
SupportedStyles:
|
2120
|
+
- use_perl_names
|
2121
|
+
- use_english_names
|
2122
|
+
- use_builtin_english_names
|
2123
|
+
|
2124
|
+
Style/StabbyLambdaParentheses:
|
2125
|
+
Description: 'Check for the usage of parentheses around stabby lambda arguments.'
|
2126
|
+
StyleGuide: '#stabby-lambda-with-args'
|
2127
|
+
Enabled: true
|
2128
|
+
VersionAdded: '0.35'
|
2129
|
+
EnforcedStyle: require_parentheses
|
2130
|
+
SupportedStyles:
|
2131
|
+
- require_parentheses
|
2132
|
+
- require_no_parentheses
|
2133
|
+
|
2134
|
+
Style/StaticClass:
|
2135
|
+
Description: 'Prefer modules to classes with only class methods.'
|
2136
|
+
StyleGuide: '#modules-vs-classes'
|
2137
|
+
Enabled: true
|
2138
|
+
Safe: false
|
2139
|
+
VersionAdded: '1.3'
|
2140
|
+
|
2141
|
+
Style/StderrPuts:
|
2142
|
+
Description: 'Use `warn` instead of `$stderr.puts`.'
|
2143
|
+
StyleGuide: '#warn'
|
2144
|
+
Enabled: true
|
2145
|
+
VersionAdded: '0.51'
|
2146
|
+
|
2147
|
+
Style/StringChars:
|
2148
|
+
Description: 'Checks for uses of `String#split` with empty string or regexp literal argument.'
|
2149
|
+
StyleGuide: '#string-chars'
|
2150
|
+
Enabled: true
|
2151
|
+
Safe: false
|
2152
|
+
VersionAdded: '1.12'
|
2153
|
+
|
2154
|
+
Style/StringConcatenation:
|
2155
|
+
Description: 'Checks for places where string concatenation can be replaced with string interpolation.'
|
2156
|
+
StyleGuide: '#string-interpolation'
|
2157
|
+
Enabled: true
|
2158
|
+
Safe: false
|
2159
|
+
VersionAdded: '0.89'
|
2160
|
+
VersionChanged: '1.18'
|
2161
|
+
Mode: aggressive
|
2162
|
+
|
2163
|
+
Style/StringHashKeys:
|
2164
|
+
Description: 'Prefer symbols instead of strings as hash keys.'
|
2165
|
+
StyleGuide: '#symbols-as-keys'
|
2166
|
+
Enabled: false
|
2167
|
+
VersionAdded: '0.52'
|
2168
|
+
VersionChanged: '0.75'
|
2169
|
+
Safe: false
|
2170
|
+
|
2171
|
+
Style/StringLiterals:
|
2172
|
+
Description: 'Checks if uses of quotes match the configured preference.'
|
2173
|
+
StyleGuide: '#consistent-string-literals'
|
2174
|
+
Enabled: true
|
2175
|
+
VersionAdded: '0.9'
|
2176
|
+
VersionChanged: '0.36'
|
2177
|
+
EnforcedStyle: single_quotes
|
2178
|
+
SupportedStyles:
|
2179
|
+
- single_quotes
|
2180
|
+
- double_quotes
|
2181
|
+
# If `true`, strings which span multiple lines using `\` for continuation must
|
2182
|
+
# use the same type of quotes on each line.
|
2183
|
+
ConsistentQuotesInMultiline: false
|
2184
|
+
|
2185
|
+
Style/StringLiteralsInInterpolation:
|
2186
|
+
Description: >-
|
2187
|
+
Checks if uses of quotes inside expressions in interpolated
|
2188
|
+
strings match the configured preference.
|
2189
|
+
Enabled: true
|
2190
|
+
VersionAdded: '0.27'
|
2191
|
+
EnforcedStyle: single_quotes
|
2192
|
+
SupportedStyles:
|
2193
|
+
- single_quotes
|
2194
|
+
- double_quotes
|
2195
|
+
|
2196
|
+
Style/StringMethods:
|
2197
|
+
Description: 'Checks if configured preferred methods are used over non-preferred.'
|
2198
|
+
Enabled: true
|
2199
|
+
VersionAdded: '0.34'
|
2200
|
+
VersionChanged: '0.34'
|
2201
|
+
# Mapping from undesired method to desired_method
|
2202
|
+
# e.g. to use `to_sym` over `intern`:
|
2203
|
+
#
|
2204
|
+
# StringMethods:
|
2205
|
+
# PreferredMethods:
|
2206
|
+
# intern: to_sym
|
2207
|
+
PreferredMethods:
|
2208
|
+
intern: to_sym
|
2209
|
+
|
2210
|
+
Style/Strip:
|
2211
|
+
Description: 'Use `strip` instead of `lstrip.rstrip`.'
|
2212
|
+
Enabled: true
|
2213
|
+
VersionAdded: '0.36'
|
2214
|
+
|
2215
|
+
Style/StructInheritance:
|
2216
|
+
Description: 'Checks for inheritance from Struct.new.'
|
2217
|
+
StyleGuide: '#no-extend-struct-new'
|
2218
|
+
Enabled: true
|
2219
|
+
SafeAutoCorrect: false
|
2220
|
+
VersionAdded: '0.29'
|
2221
|
+
VersionChanged: '1.20'
|
2222
|
+
|
2223
|
+
Style/SwapValues:
|
2224
|
+
Description: 'Enforces the use of shorthand-style swapping of 2 variables.'
|
2225
|
+
StyleGuide: '#values-swapping'
|
2226
|
+
Enabled: true
|
2227
|
+
VersionAdded: '1.1'
|
2228
|
+
SafeAutoCorrect: false
|
2229
|
+
|
2230
|
+
Style/SymbolArray:
|
2231
|
+
Description: 'Use %i or %I for arrays of symbols.'
|
2232
|
+
StyleGuide: '#percent-i'
|
2233
|
+
Enabled: true
|
2234
|
+
VersionAdded: '0.9'
|
2235
|
+
VersionChanged: '0.49'
|
2236
|
+
EnforcedStyle: percent
|
2237
|
+
MinSize: 2
|
2238
|
+
SupportedStyles:
|
2239
|
+
- percent
|
2240
|
+
- brackets
|
2241
|
+
|
2242
|
+
Style/SymbolLiteral:
|
2243
|
+
Description: 'Use plain symbols instead of string symbols when possible.'
|
2244
|
+
Enabled: true
|
2245
|
+
VersionAdded: '0.30'
|
2246
|
+
|
2247
|
+
Style/SymbolProc:
|
2248
|
+
Description: 'Use symbols as procs instead of blocks when possible.'
|
2249
|
+
Enabled: true
|
2250
|
+
Safe: false
|
2251
|
+
VersionAdded: '0.26'
|
2252
|
+
VersionChanged: '1.40'
|
2253
|
+
AllowMethodsWithArguments: false
|
2254
|
+
# A list of method names to be always allowed by the check.
|
2255
|
+
# The names should be fairly unique, otherwise you'll end up ignoring lots of code.
|
2256
|
+
AllowedMethods:
|
2257
|
+
- define_method
|
2258
|
+
AllowedPatterns: [ ]
|
2259
|
+
IgnoredMethods: [ ] # deprecated
|
2260
|
+
AllowComments: false
|
2261
|
+
|
2262
|
+
Style/TernaryParentheses:
|
2263
|
+
Description: 'Checks for use of parentheses around ternary conditions.'
|
2264
|
+
Enabled: true
|
2265
|
+
VersionAdded: '0.42'
|
2266
|
+
VersionChanged: '0.46'
|
2267
|
+
EnforcedStyle: require_parentheses_when_complex
|
2268
|
+
SupportedStyles:
|
2269
|
+
- require_parentheses
|
2270
|
+
- require_no_parentheses
|
2271
|
+
- require_parentheses_when_complex
|
2272
|
+
AllowSafeAssignment: false
|
2273
|
+
|
2274
|
+
Style/TopLevelMethodDefinition:
|
2275
|
+
Description: 'Looks for top-level method definitions.'
|
2276
|
+
StyleGuide: '#top-level-methods'
|
2277
|
+
Enabled: false
|
2278
|
+
VersionAdded: '1.15'
|
2279
|
+
|
2280
|
+
Style/TrailingBodyOnClass:
|
2281
|
+
Description: 'Class body goes below class statement.'
|
2282
|
+
Enabled: true
|
2283
|
+
VersionAdded: '0.53'
|
2284
|
+
|
2285
|
+
Style/TrailingBodyOnMethodDefinition:
|
2286
|
+
Description: 'Method body goes below definition.'
|
2287
|
+
Enabled: true
|
2288
|
+
VersionAdded: '0.52'
|
2289
|
+
|
2290
|
+
Style/TrailingBodyOnModule:
|
2291
|
+
Description: 'Module body goes below module statement.'
|
2292
|
+
Enabled: true
|
2293
|
+
VersionAdded: '0.53'
|
2294
|
+
|
2295
|
+
Style/TrailingCommaInArguments:
|
2296
|
+
Description: 'Checks for trailing comma in argument lists.'
|
2297
|
+
StyleGuide: '#no-trailing-params-comma'
|
2298
|
+
Enabled: true
|
2299
|
+
VersionAdded: '0.36'
|
2300
|
+
# If `comma`, the cop requires a comma after the last argument, but only for
|
2301
|
+
# parenthesized method calls where each argument is on its own line.
|
2302
|
+
# If `consistent_comma`, the cop requires a comma after the last argument,
|
2303
|
+
# for all parenthesized method calls with arguments.
|
2304
|
+
EnforcedStyleForMultiline: no_comma
|
2305
|
+
SupportedStylesForMultiline:
|
2306
|
+
- comma
|
2307
|
+
- consistent_comma
|
2308
|
+
- no_comma
|
2309
|
+
|
2310
|
+
Style/TrailingCommaInArrayLiteral:
|
2311
|
+
Description: 'Checks for trailing comma in array literals.'
|
2312
|
+
StyleGuide: '#no-trailing-array-commas'
|
2313
|
+
Enabled: true
|
2314
|
+
VersionAdded: '0.53'
|
2315
|
+
# If `comma`, the cop requires a comma after the last item in an array,
|
2316
|
+
# but only when each item is on its own line.
|
2317
|
+
# If `consistent_comma`, the cop requires a comma after the last item of all
|
2318
|
+
# non-empty, multiline array literals.
|
2319
|
+
EnforcedStyleForMultiline: no_comma
|
2320
|
+
SupportedStylesForMultiline:
|
2321
|
+
- comma
|
2322
|
+
- consistent_comma
|
2323
|
+
- no_comma
|
2324
|
+
|
2325
|
+
Style/TrailingCommaInBlockArgs:
|
2326
|
+
Description: 'Checks for useless trailing commas in block arguments.'
|
2327
|
+
Enabled: true
|
2328
|
+
Safe: false
|
2329
|
+
VersionAdded: '0.81'
|
2330
|
+
|
2331
|
+
Style/TrailingCommaInHashLiteral:
|
2332
|
+
Description: 'Checks for trailing comma in hash literals.'
|
2333
|
+
Enabled: true
|
2334
|
+
# If `comma`, the cop requires a comma after the last item in a hash,
|
2335
|
+
# but only when each item is on its own line.
|
2336
|
+
# If `consistent_comma`, the cop requires a comma after the last item of all
|
2337
|
+
# non-empty, multiline hash literals.
|
2338
|
+
EnforcedStyleForMultiline: no_comma
|
2339
|
+
SupportedStylesForMultiline:
|
2340
|
+
- comma
|
2341
|
+
- consistent_comma
|
2342
|
+
- no_comma
|
2343
|
+
VersionAdded: '0.53'
|
2344
|
+
|
2345
|
+
Style/TrailingMethodEndStatement:
|
2346
|
+
Description: 'Checks for trailing end statement on line of method body.'
|
2347
|
+
Enabled: true
|
2348
|
+
VersionAdded: '0.52'
|
2349
|
+
|
2350
|
+
Style/TrailingUnderscoreVariable:
|
2351
|
+
Description: >-
|
2352
|
+
Checks for the usage of unneeded trailing underscores at the
|
2353
|
+
end of parallel variable assignment.
|
2354
|
+
AllowNamedUnderscoreVariables: true
|
2355
|
+
Enabled: true
|
2356
|
+
VersionAdded: '0.31'
|
2357
|
+
VersionChanged: '0.35'
|
2358
|
+
|
2359
|
+
# `TrivialAccessors` requires exact name matches and doesn't allow
|
2360
|
+
# predicated methods by default.
|
2361
|
+
Style/TrivialAccessors:
|
2362
|
+
Description: 'Prefer attr_* methods to trivial readers/writers.'
|
2363
|
+
StyleGuide: '#attr_family'
|
2364
|
+
Enabled: true
|
2365
|
+
VersionAdded: '0.9'
|
2366
|
+
VersionChanged: '1.15'
|
2367
|
+
# When set to `false` the cop will suggest the use of accessor methods
|
2368
|
+
# in situations like:
|
2369
|
+
#
|
2370
|
+
# def name
|
2371
|
+
# @other_name
|
2372
|
+
# end
|
2373
|
+
#
|
2374
|
+
# This way you can uncover "hidden" attributes in your code.
|
2375
|
+
ExactNameMatch: true
|
2376
|
+
AllowPredicates: true
|
2377
|
+
# Allows trivial writers that don't end in an equal sign. e.g.
|
2378
|
+
#
|
2379
|
+
# def on_exception(action)
|
2380
|
+
# @on_exception=action
|
2381
|
+
# end
|
2382
|
+
# on_exception :restart
|
2383
|
+
#
|
2384
|
+
# Commonly used in DSLs
|
2385
|
+
AllowDSLWriters: true
|
2386
|
+
IgnoreClassMethods: false
|
2387
|
+
AllowedMethods:
|
2388
|
+
- to_ary
|
2389
|
+
- to_a
|
2390
|
+
- to_c
|
2391
|
+
- to_enum
|
2392
|
+
- to_h
|
2393
|
+
- to_hash
|
2394
|
+
- to_i
|
2395
|
+
- to_int
|
2396
|
+
- to_io
|
2397
|
+
- to_open
|
2398
|
+
- to_path
|
2399
|
+
- to_proc
|
2400
|
+
- to_r
|
2401
|
+
- to_regexp
|
2402
|
+
- to_str
|
2403
|
+
- to_s
|
2404
|
+
- to_sym
|
2405
|
+
|
2406
|
+
Style/UnlessElse:
|
2407
|
+
Description: >-
|
2408
|
+
Do not use unless with else. Rewrite these with the positive
|
2409
|
+
case first.
|
2410
|
+
StyleGuide: '#no-else-with-unless'
|
2411
|
+
Enabled: true
|
2412
|
+
VersionAdded: '0.9'
|
2413
|
+
|
2414
|
+
Style/UnlessLogicalOperators:
|
2415
|
+
Description: >-
|
2416
|
+
Checks for use of logical operators in an unless condition.
|
2417
|
+
Enabled: true
|
2418
|
+
VersionAdded: '1.11'
|
2419
|
+
EnforcedStyle: forbid_logical_operators
|
2420
|
+
SupportedStyles:
|
2421
|
+
- forbid_mixed_logical_operators
|
2422
|
+
- forbid_logical_operators
|
2423
|
+
|
2424
|
+
Style/UnpackFirst:
|
2425
|
+
Description: >-
|
2426
|
+
Checks for accessing the first element of `String#unpack`
|
2427
|
+
instead of using `unpack1`.
|
2428
|
+
Enabled: true
|
2429
|
+
VersionAdded: '0.54'
|
2430
|
+
|
2431
|
+
Style/VariableInterpolation:
|
2432
|
+
Description: >-
|
2433
|
+
Don't interpolate global, instance and class variables
|
2434
|
+
directly in strings.
|
2435
|
+
StyleGuide: '#curlies-interpolate'
|
2436
|
+
Enabled: true
|
2437
|
+
VersionAdded: '0.9'
|
2438
|
+
VersionChanged: '0.20'
|
2439
|
+
|
2440
|
+
Style/WhenThen:
|
2441
|
+
Description: 'Use when x then ... for one-line cases.'
|
2442
|
+
StyleGuide: '#no-when-semicolons'
|
2443
|
+
Enabled: true
|
2444
|
+
VersionAdded: '0.9'
|
2445
|
+
|
2446
|
+
Style/WhileUntilDo:
|
2447
|
+
Description: 'Checks for redundant do after while or until.'
|
2448
|
+
StyleGuide: '#no-multiline-while-do'
|
2449
|
+
Enabled: true
|
2450
|
+
VersionAdded: '0.9'
|
2451
|
+
|
2452
|
+
Style/WhileUntilModifier:
|
2453
|
+
Description: >-
|
2454
|
+
Favor modifier while/until usage when you have a
|
2455
|
+
single-line body.
|
2456
|
+
StyleGuide: '#while-as-a-modifier'
|
2457
|
+
Enabled: false
|
2458
|
+
VersionAdded: '0.9'
|
2459
|
+
VersionChanged: '0.30'
|
2460
|
+
|
2461
|
+
Style/WordArray:
|
2462
|
+
Description: 'Use %w or %W for arrays of words.'
|
2463
|
+
StyleGuide: '#percent-w'
|
2464
|
+
Enabled: true
|
2465
|
+
VersionAdded: '0.9'
|
2466
|
+
VersionChanged: '1.19'
|
2467
|
+
EnforcedStyle: percent
|
2468
|
+
SupportedStyles:
|
2469
|
+
# percent style: %w(word1 word2)
|
2470
|
+
- percent
|
2471
|
+
# bracket style: ['word1', 'word2']
|
2472
|
+
- brackets
|
2473
|
+
# The `MinSize` option causes the `WordArray` rule to be ignored for arrays
|
2474
|
+
# smaller than a certain size. The rule is only applied to arrays
|
2475
|
+
# whose element count is greater than or equal to `MinSize`.
|
2476
|
+
MinSize: 2
|
2477
|
+
# The regular expression `WordRegex` decides what is considered a word.
|
2478
|
+
WordRegex: !ruby/regexp '/\A(?:\p{Word}|\p{Word}-\p{Word}|\n|\t)+\z/'
|
2479
|
+
|
2480
|
+
Style/YodaCondition:
|
2481
|
+
Description: 'Forbid or enforce yoda conditions.'
|
2482
|
+
Reference: 'https://en.wikipedia.org/wiki/Yoda_conditions'
|
2483
|
+
Enabled: false
|
2484
|
+
EnforcedStyle: forbid_for_all_comparison_operators
|
2485
|
+
SupportedStyles:
|
2486
|
+
# check all comparison operators
|
2487
|
+
- forbid_for_all_comparison_operators
|
2488
|
+
# check only equality operators: `!=` and `==`
|
2489
|
+
- forbid_for_equality_operators_only
|
2490
|
+
# enforce yoda for all comparison operators
|
2491
|
+
- require_for_all_comparison_operators
|
2492
|
+
# enforce yoda only for equality operators: `!=` and `==`
|
2493
|
+
- require_for_equality_operators_only
|
2494
|
+
Safe: false
|
2495
|
+
VersionAdded: '0.49'
|
2496
|
+
VersionChanged: '0.75'
|
2497
|
+
|
2498
|
+
Style/ZeroLengthPredicate:
|
2499
|
+
Description: 'Use #empty? when testing for objects of length 0.'
|
2500
|
+
Enabled: true
|
2501
|
+
Safe: false
|
2502
|
+
VersionAdded: '0.37'
|
2503
|
+
VersionChanged: '0.39'
|