ffi-geos 2.1.0 → 2.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/main.yml +49 -0
- data/.rubocop-minitest.yml +217 -0
- data/.rubocop.yml +1344 -175
- data/.rubocop_todo.yml +99 -0
- data/FUNDING.yml +2 -0
- data/Gemfile +5 -8
- data/MIT-LICENSE +1 -1
- data/ffi-geos.gemspec +5 -0
- data/lib/ffi-geos/buffer_params.rb +1 -1
- data/lib/ffi-geos/coordinate_sequence.rb +32 -32
- data/lib/ffi-geos/geometry.rb +51 -15
- data/lib/ffi-geos/geometry_collection.rb +4 -4
- data/lib/ffi-geos/line_string.rb +10 -10
- data/lib/ffi-geos/multi_line_string.rb +1 -1
- data/lib/ffi-geos/point.rb +4 -4
- data/lib/ffi-geos/polygon.rb +4 -4
- data/lib/ffi-geos/prepared_geometry.rb +1 -1
- data/lib/ffi-geos/strtree.rb +26 -26
- data/lib/ffi-geos/utils.rb +12 -11
- data/lib/ffi-geos/version.rb +1 -1
- data/lib/ffi-geos/wkb_reader.rb +1 -1
- data/lib/ffi-geos/wkb_writer.rb +2 -2
- data/lib/ffi-geos/wkt_reader.rb +1 -1
- data/lib/ffi-geos/wkt_writer.rb +3 -6
- data/lib/ffi-geos.rb +51 -8
- data/sonar-project.properties +4 -4
- data/test/coordinate_sequence_tests.rb +8 -8
- data/test/geometry_collection_tests.rb +6 -5
- data/test/geometry_tests.rb +239 -27
- data/test/line_string_tests.rb +13 -5
- data/test/point_tests.rb +3 -3
- data/test/polygon_tests.rb +3 -3
- data/test/strtree_tests.rb +8 -7
- data/test/test_helper.rb +67 -28
- metadata +13 -9
- data/.travis.yml +0 -33
data/.rubocop.yml
CHANGED
@@ -1,3 +1,15 @@
|
|
1
|
+
|
2
|
+
inherit_from:
|
3
|
+
- .rubocop-minitest.yml
|
4
|
+
- .rubocop_todo.yml
|
5
|
+
|
6
|
+
inherit_mode:
|
7
|
+
merge:
|
8
|
+
- Exclude
|
9
|
+
|
10
|
+
require:
|
11
|
+
- rubocop-minitest
|
12
|
+
|
1
13
|
# Common configuration.
|
2
14
|
|
3
15
|
AllCops:
|
@@ -35,6 +47,7 @@ AllCops:
|
|
35
47
|
- '**/*.watchr'
|
36
48
|
- '**/.irbrc'
|
37
49
|
- '**/.pryrc'
|
50
|
+
- '**/.simplecov'
|
38
51
|
- '**/buildfile'
|
39
52
|
- '**/Appraisals'
|
40
53
|
- '**/Berksfile'
|
@@ -53,7 +66,9 @@ AllCops:
|
|
53
66
|
- '**/Podfile'
|
54
67
|
- '**/Puppetfile'
|
55
68
|
- '**/Rakefile'
|
69
|
+
- '**/rakefile'
|
56
70
|
- '**/Snapfile'
|
71
|
+
- '**/Steepfile'
|
57
72
|
- '**/Thorfile'
|
58
73
|
- '**/Vagabondfile'
|
59
74
|
- '**/Vagrantfile'
|
@@ -77,6 +92,8 @@ AllCops:
|
|
77
92
|
# When specifying style guide URLs, any paths and/or fragments will be
|
78
93
|
# evaluated relative to the base URL.
|
79
94
|
StyleGuideBaseURL: https://rubystyle.guide
|
95
|
+
# Documentation URLs will be constructed using the base URL.
|
96
|
+
DocumentationBaseURL: https://docs.rubocop.org/rubocop
|
80
97
|
# Extra details are not displayed in offense messages by default. Change
|
81
98
|
# behavior by overriding ExtraDetails, or by giving the
|
82
99
|
# `-E/--extra-details` option.
|
@@ -98,6 +115,14 @@ AllCops:
|
|
98
115
|
# to true in the same configuration.
|
99
116
|
EnabledByDefault: false
|
100
117
|
DisabledByDefault: false
|
118
|
+
# New cops introduced between major versions are set to a special pending status
|
119
|
+
# and are not enabled by default with warning message.
|
120
|
+
# Change this behavior by overriding either `NewCops: enable` or `NewCops: disable`.
|
121
|
+
# When `NewCops` is `enable`, pending cops are enabled in bulk. Can be overridden by
|
122
|
+
# the `--enable-pending-cops` command-line option.
|
123
|
+
# When `NewCops` is `disable`, pending cops are disabled in bulk. Can be overridden by
|
124
|
+
# the `--disable-pending-cops` command-line option.
|
125
|
+
NewCops: pending
|
101
126
|
# Enables the result cache if `true`. Can be overridden by the `--cache` command
|
102
127
|
# line option.
|
103
128
|
UseCache: true
|
@@ -108,6 +133,8 @@ AllCops:
|
|
108
133
|
# CacheRootDirectory is ~ (nil), which it is by default, the root will be
|
109
134
|
# taken from the environment variable `$XDG_CACHE_HOME` if it is set, or if
|
110
135
|
# `$XDG_CACHE_HOME` is not set, it will be `$HOME/.cache/`.
|
136
|
+
# The CacheRootDirectory can be overwritten by passing the `--cache-root` command
|
137
|
+
# line option or by setting `$RUBOCOP_CACHE_ROOT` environment variable.
|
111
138
|
CacheRootDirectory: ~
|
112
139
|
# It is possible for a malicious user to know the location of RuboCop's cache
|
113
140
|
# directory by looking at CacheRootDirectory, and create a symlink in its
|
@@ -119,15 +146,21 @@ AllCops:
|
|
119
146
|
# What MRI version of the Ruby interpreter is the inspected code intended to
|
120
147
|
# run on? (If there is more than one, set this to the lowest version.)
|
121
148
|
# If a value is specified for TargetRubyVersion then it is used. Acceptable
|
122
|
-
# values are
|
149
|
+
# values are specified as a float (i.e. 3.0); the teeny version of Ruby
|
123
150
|
# should not be included. If the project specifies a Ruby version in the
|
124
|
-
# .ruby-version
|
125
|
-
# the desired version of Ruby by inspecting the
|
126
|
-
#
|
127
|
-
#
|
128
|
-
# from the lock file.) If the
|
129
|
-
#
|
151
|
+
# .tool-versions or .ruby-version files, Gemfile or gems.rb file, RuboCop will
|
152
|
+
# try to determine the desired version of Ruby by inspecting the
|
153
|
+
# .tool-versions file first, then .ruby-version, followed by the Gemfile.lock
|
154
|
+
# or gems.locked file. (Although the Ruby version is specified in the Gemfile
|
155
|
+
# or gems.rb file, RuboCop reads the final value from the lock file.) If the
|
156
|
+
# Ruby version is still unresolved, RuboCop will use the oldest officially
|
157
|
+
# supported Ruby version (currently Ruby 2.5).
|
130
158
|
TargetRubyVersion: ~
|
159
|
+
# Determines if a notification for extension libraries should be shown when
|
160
|
+
# rubocop is run. Keys are the name of the extension, and values are an array
|
161
|
+
# of gems in the Gemfile that the extension is suggested for, if not already
|
162
|
+
# included.
|
163
|
+
SuggestExtensions: false
|
131
164
|
|
132
165
|
#################### Bundler ###############################
|
133
166
|
|
@@ -144,12 +177,41 @@ Bundler/GemComment:
|
|
144
177
|
Description: 'Add a comment describing each gem.'
|
145
178
|
Enabled: false
|
146
179
|
VersionAdded: '0.59'
|
147
|
-
VersionChanged: '0.
|
180
|
+
VersionChanged: '0.85'
|
148
181
|
Include:
|
149
182
|
- '**/*.gemfile'
|
150
183
|
- '**/Gemfile'
|
151
184
|
- '**/gems.rb'
|
152
185
|
IgnoredGems: []
|
186
|
+
OnlyFor: []
|
187
|
+
|
188
|
+
Bundler/GemFilename:
|
189
|
+
Description: 'Enforces the filename for managing gems.'
|
190
|
+
Enabled: true
|
191
|
+
VersionAdded: '1.20'
|
192
|
+
EnforcedStyle: 'Gemfile'
|
193
|
+
SupportedStyles:
|
194
|
+
- 'Gemfile'
|
195
|
+
- 'gems.rb'
|
196
|
+
Include:
|
197
|
+
- '**/Gemfile'
|
198
|
+
- '**/gems.rb'
|
199
|
+
- '**/Gemfile.lock'
|
200
|
+
- '**/gems.locked'
|
201
|
+
|
202
|
+
Bundler/GemVersion:
|
203
|
+
Description: 'Requires or forbids specifying gem versions.'
|
204
|
+
Enabled: false
|
205
|
+
VersionAdded: '1.14'
|
206
|
+
EnforcedStyle: 'required'
|
207
|
+
SupportedStyles:
|
208
|
+
- 'required'
|
209
|
+
- 'forbidden'
|
210
|
+
Include:
|
211
|
+
- '**/*.gemfile'
|
212
|
+
- '**/Gemfile'
|
213
|
+
- '**/gems.rb'
|
214
|
+
AllowedGems: []
|
153
215
|
|
154
216
|
Bundler/InsecureProtocolSource:
|
155
217
|
Description: >-
|
@@ -158,6 +220,7 @@ Bundler/InsecureProtocolSource:
|
|
158
220
|
'https://rubygems.org' if possible, or 'http://rubygems.org' if not.
|
159
221
|
Enabled: true
|
160
222
|
VersionAdded: '0.50'
|
223
|
+
AllowHttpProtocol: true
|
161
224
|
Include:
|
162
225
|
- '**/*.gemfile'
|
163
226
|
- '**/Gemfile'
|
@@ -170,6 +233,9 @@ Bundler/OrderedGems:
|
|
170
233
|
VersionAdded: '0.46'
|
171
234
|
VersionChanged: '0.47'
|
172
235
|
TreatCommentsAsGroupSeparators: true
|
236
|
+
# By default, "-" and "_" are ignored for order purposes.
|
237
|
+
# This can be overridden by setting this parameter to true.
|
238
|
+
ConsiderPunctuation: false
|
173
239
|
Include:
|
174
240
|
- '**/*.gemfile'
|
175
241
|
- '**/Gemfile'
|
@@ -177,6 +243,13 @@ Bundler/OrderedGems:
|
|
177
243
|
|
178
244
|
#################### Gemspec ###############################
|
179
245
|
|
246
|
+
Gemspec/DateAssignment:
|
247
|
+
Description: 'Checks that `date =` is not used in gemspec file, it is set automatically when the gem is packaged.'
|
248
|
+
Enabled: true
|
249
|
+
VersionAdded: '1.10'
|
250
|
+
Include:
|
251
|
+
- '**/*.gemspec'
|
252
|
+
|
180
253
|
Gemspec/DuplicatedAssignment:
|
181
254
|
Description: 'An attribute assignment method calls should be listed only once in a gemspec.'
|
182
255
|
Enabled: true
|
@@ -190,13 +263,26 @@ Gemspec/OrderedDependencies:
|
|
190
263
|
Enabled: true
|
191
264
|
VersionAdded: '0.51'
|
192
265
|
TreatCommentsAsGroupSeparators: true
|
266
|
+
# By default, "-" and "_" are ignored for order purposes.
|
267
|
+
# This can be overridden by setting this parameter to true.
|
268
|
+
ConsiderPunctuation: false
|
269
|
+
Include:
|
270
|
+
- '**/*.gemspec'
|
271
|
+
|
272
|
+
Gemspec/RequireMFA:
|
273
|
+
Description: 'Checks that the gemspec has metadata to require MFA from RubyGems.'
|
274
|
+
Enabled: true
|
275
|
+
VersionAdded: '1.23'
|
276
|
+
Reference:
|
277
|
+
- https://guides.rubygems.org/mfa-requirement-opt-in/
|
193
278
|
Include:
|
194
279
|
- '**/*.gemspec'
|
195
280
|
|
196
281
|
Gemspec/RequiredRubyVersion:
|
197
|
-
Description: 'Checks that `required_ruby_version` of gemspec and `TargetRubyVersion` of .rubocop.yml
|
282
|
+
Description: 'Checks that `required_ruby_version` of gemspec is specified and equal to `TargetRubyVersion` of .rubocop.yml.'
|
198
283
|
Enabled: true
|
199
284
|
VersionAdded: '0.52'
|
285
|
+
VersionChanged: '1.22'
|
200
286
|
Include:
|
201
287
|
- '**/*.gemspec'
|
202
288
|
|
@@ -219,8 +305,8 @@ Layout/AccessModifierIndentation:
|
|
219
305
|
SupportedStyles:
|
220
306
|
- outdent
|
221
307
|
- indent
|
222
|
-
# By default
|
223
|
-
#
|
308
|
+
# By default the indentation width from `Layout/IndentationWidth` is used,
|
309
|
+
# but it can be overridden by setting this parameter.
|
224
310
|
IndentationWidth: ~
|
225
311
|
|
226
312
|
Layout/ArgumentAlignment:
|
@@ -248,18 +334,38 @@ Layout/ArgumentAlignment:
|
|
248
334
|
SupportedStyles:
|
249
335
|
- with_first_argument
|
250
336
|
- with_fixed_indentation
|
251
|
-
# By default
|
252
|
-
#
|
337
|
+
# By default the indentation width from `Layout/IndentationWidth` is used,
|
338
|
+
# but it can be overridden by setting this parameter.
|
253
339
|
IndentationWidth: ~
|
254
340
|
|
255
341
|
Layout/ArrayAlignment:
|
256
342
|
Description: >-
|
257
343
|
Align the elements of an array literal if they span more than
|
258
344
|
one line.
|
259
|
-
StyleGuide: '#
|
345
|
+
StyleGuide: '#no-double-indent'
|
260
346
|
Enabled: true
|
261
347
|
VersionAdded: '0.49'
|
262
348
|
VersionChanged: '0.77'
|
349
|
+
# Alignment of elements of a multi-line array.
|
350
|
+
#
|
351
|
+
# The `with_first_parameter` style aligns the following lines along the same
|
352
|
+
# column as the first element.
|
353
|
+
#
|
354
|
+
# array = [1, 2, 3,
|
355
|
+
# 4, 5, 6]
|
356
|
+
#
|
357
|
+
# The `with_fixed_indentation` style aligns the following lines with one
|
358
|
+
# level of indentation relative to the start of the line with start of array.
|
359
|
+
#
|
360
|
+
# array = [1, 2, 3,
|
361
|
+
# 4, 5, 6]
|
362
|
+
EnforcedStyle: with_first_element
|
363
|
+
SupportedStyles:
|
364
|
+
- with_first_element
|
365
|
+
- with_fixed_indentation
|
366
|
+
# By default the indentation width from `Layout/IndentationWidth` is used,
|
367
|
+
# but it can be overridden by setting this parameter.
|
368
|
+
IndentationWidth: ~
|
263
369
|
|
264
370
|
Layout/AssignmentIndentation:
|
265
371
|
Description: >-
|
@@ -268,10 +374,23 @@ Layout/AssignmentIndentation:
|
|
268
374
|
Enabled: true
|
269
375
|
VersionAdded: '0.49'
|
270
376
|
VersionChanged: '0.77'
|
271
|
-
# By default
|
272
|
-
#
|
377
|
+
# By default the indentation width from `Layout/IndentationWidth` is used,
|
378
|
+
# but it can be overridden by setting this parameter.
|
273
379
|
IndentationWidth: ~
|
274
380
|
|
381
|
+
Layout/BeginEndAlignment:
|
382
|
+
Description: 'Align ends corresponding to begins correctly.'
|
383
|
+
Enabled: true
|
384
|
+
VersionAdded: '0.91'
|
385
|
+
# The value `start_of_line` means that `end` should be aligned the start of the line
|
386
|
+
# where the `begin` keyword is.
|
387
|
+
# The value `begin` means that `end` should be aligned with the `begin` keyword.
|
388
|
+
EnforcedStyleAlignWith: start_of_line
|
389
|
+
SupportedStylesAlignWith:
|
390
|
+
- start_of_line
|
391
|
+
- begin
|
392
|
+
Severity: warning
|
393
|
+
|
275
394
|
Layout/BlockAlignment:
|
276
395
|
Description: 'Align block ends correctly.'
|
277
396
|
Enabled: true
|
@@ -293,18 +412,19 @@ Layout/BlockEndNewline:
|
|
293
412
|
VersionAdded: '0.49'
|
294
413
|
|
295
414
|
Layout/CaseIndentation:
|
296
|
-
Description: 'Indentation of when in a case/when/[else/]end.'
|
415
|
+
Description: 'Indentation of when in a case/(when|in)/[else/]end.'
|
297
416
|
StyleGuide: '#indent-when-to-case'
|
298
417
|
Enabled: true
|
299
418
|
VersionAdded: '0.49'
|
419
|
+
VersionChanged: '1.16'
|
300
420
|
EnforcedStyle: end
|
301
421
|
SupportedStyles:
|
302
422
|
- case
|
303
423
|
- end
|
304
424
|
IndentOneStep: true
|
305
|
-
# By default
|
306
|
-
#
|
307
|
-
# This only matters if `IndentOneStep` is `true
|
425
|
+
# By default the indentation width from `Layout/IndentationWidth` is used,
|
426
|
+
# but it can be overridden by setting this parameter.
|
427
|
+
# This only matters if `IndentOneStep` is `true`.
|
308
428
|
IndentationWidth: ~
|
309
429
|
|
310
430
|
Layout/ClassStructure:
|
@@ -339,7 +459,11 @@ Layout/ClosingParenthesisIndentation:
|
|
339
459
|
Layout/CommentIndentation:
|
340
460
|
Description: 'Indentation of comments.'
|
341
461
|
Enabled: true
|
462
|
+
# When true, allows comments to have extra indentation if that aligns them
|
463
|
+
# with a comment on the preceding line.
|
464
|
+
AllowForAlignment: false
|
342
465
|
VersionAdded: '0.49'
|
466
|
+
VersionChanged: '1.24'
|
343
467
|
|
344
468
|
Layout/ConditionPosition:
|
345
469
|
Description: >-
|
@@ -348,6 +472,7 @@ Layout/ConditionPosition:
|
|
348
472
|
StyleGuide: '#same-line-condition'
|
349
473
|
Enabled: true
|
350
474
|
VersionAdded: '0.53'
|
475
|
+
VersionChanged: '0.83'
|
351
476
|
|
352
477
|
Layout/DefEndAlignment:
|
353
478
|
Description: 'Align ends corresponding to defs correctly.'
|
@@ -361,7 +486,6 @@ Layout/DefEndAlignment:
|
|
361
486
|
SupportedStylesAlignWith:
|
362
487
|
- start_of_line
|
363
488
|
- def
|
364
|
-
AutoCorrect: false
|
365
489
|
Severity: warning
|
366
490
|
|
367
491
|
Layout/DotPosition:
|
@@ -398,14 +522,26 @@ Layout/EmptyLineAfterMagicComment:
|
|
398
522
|
Enabled: true
|
399
523
|
VersionAdded: '0.49'
|
400
524
|
|
525
|
+
Layout/EmptyLineAfterMultilineCondition:
|
526
|
+
Description: 'Enforces empty line after multiline condition.'
|
527
|
+
# This is disabled, because this style is not very common in practice.
|
528
|
+
Enabled: false
|
529
|
+
VersionAdded: '0.90'
|
530
|
+
Reference:
|
531
|
+
- https://github.com/airbnb/ruby#multiline-if-newline
|
532
|
+
|
401
533
|
Layout/EmptyLineBetweenDefs:
|
402
|
-
Description: 'Use empty lines between defs.'
|
534
|
+
Description: 'Use empty lines between class/module/method defs.'
|
403
535
|
StyleGuide: '#empty-lines-between-methods'
|
404
536
|
Enabled: true
|
405
537
|
VersionAdded: '0.49'
|
406
|
-
|
407
|
-
|
408
|
-
|
538
|
+
VersionChanged: '1.23'
|
539
|
+
EmptyLineBetweenMethodDefs: true
|
540
|
+
EmptyLineBetweenClassDefs: true
|
541
|
+
EmptyLineBetweenModuleDefs: true
|
542
|
+
# `AllowAdjacentOneLineDefs` means that single line method definitions don't
|
543
|
+
# need an empty line between them. `true` by default.
|
544
|
+
AllowAdjacentOneLineDefs: true
|
409
545
|
# Can be array to specify minimum and maximum number of empty lines, e.g. [1, 2]
|
410
546
|
NumberOfEmptyLines: 1
|
411
547
|
|
@@ -433,6 +569,19 @@ Layout/EmptyLinesAroundArguments:
|
|
433
569
|
Enabled: true
|
434
570
|
VersionAdded: '0.52'
|
435
571
|
|
572
|
+
Layout/EmptyLinesAroundAttributeAccessor:
|
573
|
+
Description: "Keep blank lines around attribute accessors."
|
574
|
+
StyleGuide: '#empty-lines-around-attribute-accessor'
|
575
|
+
Enabled: true
|
576
|
+
VersionAdded: '0.83'
|
577
|
+
VersionChanged: '0.84'
|
578
|
+
AllowAliasSyntax: true
|
579
|
+
AllowedMethods:
|
580
|
+
- alias_method
|
581
|
+
- public
|
582
|
+
- protected
|
583
|
+
- private
|
584
|
+
|
436
585
|
Layout/EmptyLinesAroundBeginBody:
|
437
586
|
Description: "Keeps track of empty lines around begin-end bodies."
|
438
587
|
StyleGuide: '#empty-lines-around-bodies'
|
@@ -504,7 +653,6 @@ Layout/EndAlignment:
|
|
504
653
|
- keyword
|
505
654
|
- variable
|
506
655
|
- start_of_line
|
507
|
-
AutoCorrect: false
|
508
656
|
Severity: warning
|
509
657
|
|
510
658
|
Layout/EndOfLine:
|
@@ -557,8 +705,8 @@ Layout/FirstArgumentIndentation:
|
|
557
705
|
# Same as `special_for_inner_method_call` except that the special rule only
|
558
706
|
# applies if the outer method call encloses its arguments in parentheses.
|
559
707
|
- special_for_inner_method_call_in_parentheses
|
560
|
-
# By default
|
561
|
-
#
|
708
|
+
# By default the indentation width from `Layout/IndentationWidth` is used,
|
709
|
+
# but it can be overridden by setting this parameter.
|
562
710
|
IndentationWidth: ~
|
563
711
|
|
564
712
|
Layout/FirstArrayElementIndentation:
|
@@ -584,8 +732,8 @@ Layout/FirstArrayElementIndentation:
|
|
584
732
|
- special_inside_parentheses
|
585
733
|
- consistent
|
586
734
|
- align_brackets
|
587
|
-
# By default
|
588
|
-
#
|
735
|
+
# By default the indentation width from `Layout/IndentationWidth` is used,
|
736
|
+
# but it can be overridden by setting this parameter.
|
589
737
|
IndentationWidth: ~
|
590
738
|
|
591
739
|
Layout/FirstArrayElementLineBreak:
|
@@ -616,8 +764,8 @@ Layout/FirstHashElementIndentation:
|
|
616
764
|
- special_inside_parentheses
|
617
765
|
- consistent
|
618
766
|
- align_braces
|
619
|
-
# By default
|
620
|
-
#
|
767
|
+
# By default the indentation width from `Layout/IndentationWidth` is used,
|
768
|
+
# but it can be overridden by setting this parameter.
|
621
769
|
IndentationWidth: ~
|
622
770
|
|
623
771
|
Layout/FirstHashElementLineBreak:
|
@@ -652,8 +800,8 @@ Layout/FirstParameterIndentation:
|
|
652
800
|
SupportedStyles:
|
653
801
|
- consistent
|
654
802
|
- align_parentheses
|
655
|
-
# By default
|
656
|
-
#
|
803
|
+
# By default the indentation width from `Layout/IndentationWidth` is used,
|
804
|
+
# but it can be overridden by setting this parameter.
|
657
805
|
IndentationWidth: ~
|
658
806
|
|
659
807
|
Layout/HashAlignment:
|
@@ -663,7 +811,7 @@ Layout/HashAlignment:
|
|
663
811
|
Enabled: true
|
664
812
|
AllowMultipleStyles: true
|
665
813
|
VersionAdded: '0.49'
|
666
|
-
VersionChanged: '
|
814
|
+
VersionChanged: '1.16'
|
667
815
|
# Alignment of entries using hash rocket as separator. Valid values are:
|
668
816
|
#
|
669
817
|
# key - left alignment of keys
|
@@ -747,13 +895,7 @@ Layout/HeredocIndentation:
|
|
747
895
|
StyleGuide: '#squiggly-heredocs'
|
748
896
|
Enabled: true
|
749
897
|
VersionAdded: '0.49'
|
750
|
-
VersionChanged: '0.
|
751
|
-
EnforcedStyle: squiggly
|
752
|
-
SupportedStyles:
|
753
|
-
- squiggly
|
754
|
-
- active_support
|
755
|
-
- powerpack
|
756
|
-
- unindent
|
898
|
+
VersionChanged: '0.85'
|
757
899
|
|
758
900
|
Layout/IndentationConsistency:
|
759
901
|
Description: 'Keep indentation straight.'
|
@@ -774,6 +916,22 @@ Layout/IndentationConsistency:
|
|
774
916
|
# A reference to `EnforcedStyle: indented_internal_methods`.
|
775
917
|
- https://edgeguides.rubyonrails.org/contributing_to_ruby_on_rails.html#follow-the-coding-conventions
|
776
918
|
|
919
|
+
Layout/IndentationStyle:
|
920
|
+
Description: 'Consistent indentation either with tabs only or spaces only.'
|
921
|
+
StyleGuide: '#spaces-indentation'
|
922
|
+
Enabled: true
|
923
|
+
VersionAdded: '0.49'
|
924
|
+
VersionChanged: '0.82'
|
925
|
+
# By default the indentation width from `Layout/IndentationWidth` is used,
|
926
|
+
# but it can be overridden by setting this parameter.
|
927
|
+
# It is used during auto-correction to determine how many spaces should
|
928
|
+
# replace each tab.
|
929
|
+
IndentationWidth: ~
|
930
|
+
EnforcedStyle: spaces
|
931
|
+
SupportedStyles:
|
932
|
+
- spaces
|
933
|
+
- tabs
|
934
|
+
|
777
935
|
Layout/IndentationWidth:
|
778
936
|
Description: 'Use 2 spaces for indentation.'
|
779
937
|
StyleGuide: '#spaces-indentation'
|
@@ -796,6 +954,7 @@ Layout/LeadingCommentSpace:
|
|
796
954
|
VersionAdded: '0.49'
|
797
955
|
VersionChanged: '0.73'
|
798
956
|
AllowDoxygenCommentStyle: false
|
957
|
+
AllowGemfileRubyComment: false
|
799
958
|
|
800
959
|
Layout/LeadingEmptyLines:
|
801
960
|
Description: Check for unnecessary blank lines at the beginning of a file.
|
@@ -803,13 +962,26 @@ Layout/LeadingEmptyLines:
|
|
803
962
|
VersionAdded: '0.57'
|
804
963
|
VersionChanged: '0.77'
|
805
964
|
|
965
|
+
Layout/LineEndStringConcatenationIndentation:
|
966
|
+
Description: >-
|
967
|
+
Checks the indentation of the next line after a line that
|
968
|
+
ends with a string literal and a backslash.
|
969
|
+
Enabled: true
|
970
|
+
VersionAdded: '1.18'
|
971
|
+
EnforcedStyle: aligned
|
972
|
+
SupportedStyles:
|
973
|
+
- aligned
|
974
|
+
- indented
|
975
|
+
# By default the indentation width from `Layout/IndentationWidth` is used,
|
976
|
+
# but it can be overridden by setting this parameter.
|
977
|
+
IndentationWidth: ~
|
978
|
+
|
806
979
|
Layout/LineLength:
|
807
|
-
Description: '
|
808
|
-
StyleGuide: '#
|
980
|
+
Description: 'Checks that line length does not exceed the configured limit.'
|
981
|
+
StyleGuide: '#max-line-length'
|
809
982
|
Enabled: true
|
810
983
|
VersionAdded: '0.25'
|
811
|
-
VersionChanged: '
|
812
|
-
AutoCorrect: false
|
984
|
+
VersionChanged: '1.4'
|
813
985
|
Max: 300
|
814
986
|
# To make it possible to copy or click on URIs in the code, we allow lines
|
815
987
|
# containing a URI to be longer than Max.
|
@@ -933,8 +1105,8 @@ Layout/MultilineMethodCallIndentation:
|
|
933
1105
|
- aligned
|
934
1106
|
- indented
|
935
1107
|
- indented_relative_to_receiver
|
936
|
-
# By default
|
937
|
-
#
|
1108
|
+
# By default the indentation width from `Layout/IndentationWidth` is used,
|
1109
|
+
# but it can be overridden by setting this parameter.
|
938
1110
|
IndentationWidth: ~
|
939
1111
|
|
940
1112
|
Layout/MultilineMethodDefinitionBraceLayout:
|
@@ -963,8 +1135,8 @@ Layout/MultilineOperationIndentation:
|
|
963
1135
|
SupportedStyles:
|
964
1136
|
- aligned
|
965
1137
|
- indented
|
966
|
-
# By default
|
967
|
-
#
|
1138
|
+
# By default the indentation width from `Layout/IndentationWidth` is used,
|
1139
|
+
# but it can be overridden by setting this parameter.
|
968
1140
|
IndentationWidth: ~
|
969
1141
|
|
970
1142
|
Layout/ParameterAlignment:
|
@@ -992,15 +1164,28 @@ Layout/ParameterAlignment:
|
|
992
1164
|
SupportedStyles:
|
993
1165
|
- with_first_parameter
|
994
1166
|
- with_fixed_indentation
|
995
|
-
# By default
|
996
|
-
#
|
1167
|
+
# By default the indentation width from `Layout/IndentationWidth` is used,
|
1168
|
+
# but it can be overridden by setting this parameter.
|
997
1169
|
IndentationWidth: ~
|
998
1170
|
|
1171
|
+
Layout/RedundantLineBreak:
|
1172
|
+
Description: >-
|
1173
|
+
Do not break up an expression into multiple lines when it fits
|
1174
|
+
on a single line.
|
1175
|
+
Enabled: false
|
1176
|
+
InspectBlocks: false
|
1177
|
+
VersionAdded: '1.13'
|
1178
|
+
|
999
1179
|
Layout/RescueEnsureAlignment:
|
1000
1180
|
Description: 'Align rescues and ensures correctly.'
|
1001
1181
|
Enabled: true
|
1002
1182
|
VersionAdded: '0.49'
|
1003
1183
|
|
1184
|
+
Layout/SingleLineBlockChain:
|
1185
|
+
Description: 'Put method call on a separate line if chained to a single line block.'
|
1186
|
+
Enabled: false
|
1187
|
+
VersionAdded: '1.14'
|
1188
|
+
|
1004
1189
|
Layout/SpaceAfterColon:
|
1005
1190
|
Description: 'Use spaces after colons.'
|
1006
1191
|
StyleGuide: '#spaces-operators'
|
@@ -1060,6 +1245,11 @@ Layout/SpaceAroundKeyword:
|
|
1060
1245
|
Enabled: true
|
1061
1246
|
VersionAdded: '0.49'
|
1062
1247
|
|
1248
|
+
Layout/SpaceAroundMethodCallOperator:
|
1249
|
+
Description: 'Checks method call operators to not have spaces around them.'
|
1250
|
+
Enabled: true
|
1251
|
+
VersionAdded: '0.82'
|
1252
|
+
|
1063
1253
|
Layout/SpaceAroundOperators:
|
1064
1254
|
Description: 'Use a single space around operators.'
|
1065
1255
|
StyleGuide: '#spaces-operators'
|
@@ -1088,7 +1278,13 @@ Layout/SpaceBeforeBlockBraces:
|
|
1088
1278
|
SupportedStylesForEmptyBraces:
|
1089
1279
|
- space
|
1090
1280
|
- no_space
|
1091
|
-
VersionChanged: '0.52
|
1281
|
+
VersionChanged: '0.52'
|
1282
|
+
|
1283
|
+
Layout/SpaceBeforeBrackets:
|
1284
|
+
Description: 'Checks for receiver with a space before the opening brackets.'
|
1285
|
+
StyleGuide: '#space-in-brackets-access'
|
1286
|
+
Enabled: true
|
1287
|
+
VersionAdded: '1.7'
|
1092
1288
|
|
1093
1289
|
Layout/SpaceBeforeComma:
|
1094
1290
|
Description: 'No spaces before commas.'
|
@@ -1168,7 +1364,7 @@ Layout/SpaceInsideBlockBraces:
|
|
1168
1364
|
|
1169
1365
|
Layout/SpaceInsideHashLiteralBraces:
|
1170
1366
|
Description: "Use spaces inside hash literal braces - or don't."
|
1171
|
-
StyleGuide: '#spaces-
|
1367
|
+
StyleGuide: '#spaces-braces'
|
1172
1368
|
Enabled: true
|
1173
1369
|
VersionAdded: '0.49'
|
1174
1370
|
EnforcedStyle: space
|
@@ -1189,10 +1385,11 @@ Layout/SpaceInsideParens:
|
|
1189
1385
|
StyleGuide: '#spaces-braces'
|
1190
1386
|
Enabled: true
|
1191
1387
|
VersionAdded: '0.49'
|
1192
|
-
VersionChanged: '
|
1388
|
+
VersionChanged: '1.22'
|
1193
1389
|
EnforcedStyle: no_space
|
1194
1390
|
SupportedStyles:
|
1195
1391
|
- space
|
1392
|
+
- compact
|
1196
1393
|
- no_space
|
1197
1394
|
|
1198
1395
|
Layout/SpaceInsidePercentLiteralDelimiters:
|
@@ -1230,18 +1427,6 @@ Layout/SpaceInsideStringInterpolation:
|
|
1230
1427
|
- space
|
1231
1428
|
- no_space
|
1232
1429
|
|
1233
|
-
Layout/Tab:
|
1234
|
-
Description: 'No hard tabs.'
|
1235
|
-
StyleGuide: '#spaces-indentation'
|
1236
|
-
Enabled: true
|
1237
|
-
VersionAdded: '0.49'
|
1238
|
-
VersionChanged: '0.51'
|
1239
|
-
# By default, the indentation width from Layout/IndentationWidth is used
|
1240
|
-
# But it can be overridden by setting this parameter
|
1241
|
-
# It is used during auto-correction to determine how many spaces should
|
1242
|
-
# replace each tab.
|
1243
|
-
IndentationWidth: ~
|
1244
|
-
|
1245
1430
|
Layout/TrailingEmptyLines:
|
1246
1431
|
Description: 'Checks trailing blank lines and final newline.'
|
1247
1432
|
StyleGuide: '#newline-eof'
|
@@ -1258,12 +1443,17 @@ Layout/TrailingWhitespace:
|
|
1258
1443
|
StyleGuide: '#no-trailing-whitespace'
|
1259
1444
|
Enabled: true
|
1260
1445
|
VersionAdded: '0.49'
|
1261
|
-
VersionChanged: '0
|
1446
|
+
VersionChanged: '1.0'
|
1262
1447
|
AllowInHeredoc: false
|
1263
1448
|
|
1264
1449
|
#################### Lint ##################################
|
1265
1450
|
### Warnings
|
1266
1451
|
|
1452
|
+
Lint/AmbiguousAssignment:
|
1453
|
+
Description: 'Checks for mistyped shorthand assignments.'
|
1454
|
+
Enabled: true
|
1455
|
+
VersionAdded: '1.7'
|
1456
|
+
|
1267
1457
|
Lint/AmbiguousBlockAssociation:
|
1268
1458
|
Description: >-
|
1269
1459
|
Checks for ambiguous block association with method when param passed without
|
@@ -1271,6 +1461,8 @@ Lint/AmbiguousBlockAssociation:
|
|
1271
1461
|
StyleGuide: '#syntax'
|
1272
1462
|
Enabled: true
|
1273
1463
|
VersionAdded: '0.48'
|
1464
|
+
VersionChanged: '1.13'
|
1465
|
+
IgnoredMethods: []
|
1274
1466
|
|
1275
1467
|
Lint/AmbiguousOperator:
|
1276
1468
|
Description: >-
|
@@ -1279,6 +1471,21 @@ Lint/AmbiguousOperator:
|
|
1279
1471
|
StyleGuide: '#method-invocation-parens'
|
1280
1472
|
Enabled: true
|
1281
1473
|
VersionAdded: '0.17'
|
1474
|
+
VersionChanged: '0.83'
|
1475
|
+
|
1476
|
+
Lint/AmbiguousOperatorPrecedence:
|
1477
|
+
Description: >-
|
1478
|
+
Checks for expressions containing multiple binary operations with
|
1479
|
+
ambiguous precedence.
|
1480
|
+
Enabled: true
|
1481
|
+
VersionAdded: '1.21'
|
1482
|
+
|
1483
|
+
Lint/AmbiguousRange:
|
1484
|
+
Description: Checks for ranges with ambiguous boundaries.
|
1485
|
+
Enabled: true
|
1486
|
+
VersionAdded: '1.19'
|
1487
|
+
SafeAutoCorrect: false
|
1488
|
+
RequireParenthesesForMethodChains: false
|
1282
1489
|
|
1283
1490
|
Lint/AmbiguousRegexpLiteral:
|
1284
1491
|
Description: >-
|
@@ -1286,6 +1493,7 @@ Lint/AmbiguousRegexpLiteral:
|
|
1286
1493
|
a method invocation without parentheses.
|
1287
1494
|
Enabled: true
|
1288
1495
|
VersionAdded: '0.17'
|
1496
|
+
VersionChanged: '0.83'
|
1289
1497
|
|
1290
1498
|
Lint/AssignmentInCondition:
|
1291
1499
|
Description: "Don't use assignment in conditions."
|
@@ -1299,38 +1507,149 @@ Lint/BigDecimalNew:
|
|
1299
1507
|
Enabled: true
|
1300
1508
|
VersionAdded: '0.53'
|
1301
1509
|
|
1510
|
+
Lint/BinaryOperatorWithIdenticalOperands:
|
1511
|
+
Description: 'This cop checks for places where binary operator has identical operands.'
|
1512
|
+
Enabled: true
|
1513
|
+
Safe: false
|
1514
|
+
VersionAdded: '0.89'
|
1515
|
+
VersionChanged: '1.7'
|
1516
|
+
|
1302
1517
|
Lint/BooleanSymbol:
|
1303
1518
|
Description: 'Check for `:true` and `:false` symbols.'
|
1304
1519
|
Enabled: true
|
1520
|
+
SafeAutoCorrect: false
|
1305
1521
|
VersionAdded: '0.50'
|
1522
|
+
VersionChanged: '1.22'
|
1306
1523
|
|
1307
1524
|
Lint/CircularArgumentReference:
|
1308
1525
|
Description: "Default values in optional keyword arguments and optional ordinal arguments should not refer back to the name of the argument."
|
1309
1526
|
Enabled: true
|
1310
1527
|
VersionAdded: '0.33'
|
1311
1528
|
|
1529
|
+
Lint/ConstantDefinitionInBlock:
|
1530
|
+
Description: 'Do not define constants within a block.'
|
1531
|
+
StyleGuide: '#no-constant-definition-in-block'
|
1532
|
+
Enabled: true
|
1533
|
+
VersionAdded: '0.91'
|
1534
|
+
VersionChanged: '1.3'
|
1535
|
+
# `enums` for Typed Enums via T::Enum in Sorbet.
|
1536
|
+
# https://sorbet.org/docs/tenum
|
1537
|
+
AllowedMethods:
|
1538
|
+
- enums
|
1539
|
+
|
1540
|
+
Lint/ConstantResolution:
|
1541
|
+
Description: 'Check that constants are fully qualified with `::`.'
|
1542
|
+
Enabled: false
|
1543
|
+
VersionAdded: '0.86'
|
1544
|
+
# Restrict this cop to only looking at certain names
|
1545
|
+
Only: []
|
1546
|
+
# Restrict this cop from only looking at certain names
|
1547
|
+
Ignore: []
|
1548
|
+
|
1312
1549
|
Lint/Debugger:
|
1313
1550
|
Description: 'Check for debugger calls.'
|
1314
1551
|
Enabled: true
|
1315
1552
|
VersionAdded: '0.14'
|
1316
|
-
VersionChanged: '
|
1553
|
+
VersionChanged: '1.10'
|
1554
|
+
#DebuggerReceivers: [] # deprecated
|
1555
|
+
DebuggerMethods:
|
1556
|
+
# Groups are available so that a specific group can be disabled in
|
1557
|
+
# a user's configuration, but are otherwise not significant.
|
1558
|
+
Kernel:
|
1559
|
+
- binding.irb
|
1560
|
+
Byebug:
|
1561
|
+
- byebug
|
1562
|
+
- remote_byebug
|
1563
|
+
- Kernel.byebug
|
1564
|
+
- Kernel.remote_byebug
|
1565
|
+
Capybara:
|
1566
|
+
- save_and_open_page
|
1567
|
+
- save_and_open_screenshot
|
1568
|
+
debug.rb:
|
1569
|
+
- binding.b
|
1570
|
+
- binding.break
|
1571
|
+
- Kernel.binding.b
|
1572
|
+
- Kernel.binding.break
|
1573
|
+
Pry:
|
1574
|
+
- binding.pry
|
1575
|
+
- binding.remote_pry
|
1576
|
+
- binding.pry_remote
|
1577
|
+
- Pry.rescue
|
1578
|
+
Rails:
|
1579
|
+
- debugger
|
1580
|
+
- Kernel.debugger
|
1581
|
+
RubyJard:
|
1582
|
+
- jard
|
1583
|
+
WebConsole:
|
1584
|
+
- binding.console
|
1317
1585
|
|
1318
1586
|
Lint/DeprecatedClassMethods:
|
1319
1587
|
Description: 'Check for deprecated class method calls.'
|
1320
1588
|
Enabled: true
|
1321
1589
|
VersionAdded: '0.19'
|
1322
1590
|
|
1591
|
+
Lint/DeprecatedConstants:
|
1592
|
+
Description: 'Checks for deprecated constants.'
|
1593
|
+
Enabled: true
|
1594
|
+
VersionAdded: '1.8'
|
1595
|
+
VersionChanged: '1.22'
|
1596
|
+
# You can configure deprecated constants.
|
1597
|
+
# If there is an alternative method, you can set alternative value as `Alternative`.
|
1598
|
+
# And you can set the deprecated version as `DeprecatedVersion`.
|
1599
|
+
# These options can be omitted if they are not needed.
|
1600
|
+
#
|
1601
|
+
# DeprecatedConstants:
|
1602
|
+
# 'DEPRECATED_CONSTANT':
|
1603
|
+
# Alternative: 'alternative_value'
|
1604
|
+
# DeprecatedVersion: 'deprecated_version'
|
1605
|
+
#
|
1606
|
+
DeprecatedConstants:
|
1607
|
+
'NIL':
|
1608
|
+
Alternative: 'nil'
|
1609
|
+
DeprecatedVersion: '2.4'
|
1610
|
+
'TRUE':
|
1611
|
+
Alternative: 'true'
|
1612
|
+
DeprecatedVersion: '2.4'
|
1613
|
+
'FALSE':
|
1614
|
+
Alternative: 'false'
|
1615
|
+
DeprecatedVersion: '2.4'
|
1616
|
+
'Net::HTTPServerException':
|
1617
|
+
Alternative: 'Net::HTTPClientException'
|
1618
|
+
DeprecatedVersion: '2.6'
|
1619
|
+
'Random::DEFAULT':
|
1620
|
+
Alternative: 'Random.new'
|
1621
|
+
DeprecatedVersion: '3.0'
|
1622
|
+
|
1623
|
+
Lint/DeprecatedOpenSSLConstant:
|
1624
|
+
Description: "Don't use algorithm constants for `OpenSSL::Cipher` and `OpenSSL::Digest`."
|
1625
|
+
Enabled: true
|
1626
|
+
VersionAdded: '0.84'
|
1627
|
+
|
1323
1628
|
Lint/DisjunctiveAssignmentInConstructor:
|
1324
1629
|
Description: 'In constructor, plain assignment is preferred over disjunctive.'
|
1325
1630
|
Enabled: true
|
1326
1631
|
Safe: false
|
1327
1632
|
VersionAdded: '0.62'
|
1633
|
+
VersionChanged: '0.88'
|
1634
|
+
|
1635
|
+
Lint/DuplicateBranch:
|
1636
|
+
Description: Checks that there are no repeated bodies within `if/unless`, `case-when` and `rescue` constructs.
|
1637
|
+
Enabled: true
|
1638
|
+
VersionAdded: '1.3'
|
1639
|
+
VersionChanged: '1.7'
|
1640
|
+
IgnoreLiteralBranches: false
|
1641
|
+
IgnoreConstantBranches: false
|
1328
1642
|
|
1329
1643
|
Lint/DuplicateCaseCondition:
|
1330
1644
|
Description: 'Do not repeat values in case conditionals.'
|
1331
1645
|
Enabled: true
|
1332
1646
|
VersionAdded: '0.45'
|
1333
1647
|
|
1648
|
+
Lint/DuplicateElsifCondition:
|
1649
|
+
Description: 'Do not repeat conditions used in if `elsif`.'
|
1650
|
+
Enabled: true
|
1651
|
+
VersionAdded: '0.88'
|
1652
|
+
|
1334
1653
|
Lint/DuplicateHashKey:
|
1335
1654
|
Description: 'Check for duplicate keys in hash literals.'
|
1336
1655
|
Enabled: true
|
@@ -1342,6 +1661,21 @@ Lint/DuplicateMethods:
|
|
1342
1661
|
Enabled: true
|
1343
1662
|
VersionAdded: '0.29'
|
1344
1663
|
|
1664
|
+
Lint/DuplicateRegexpCharacterClassElement:
|
1665
|
+
Description: 'Checks for duplicate elements in Regexp character classes.'
|
1666
|
+
Enabled: true
|
1667
|
+
VersionAdded: '1.1'
|
1668
|
+
|
1669
|
+
Lint/DuplicateRequire:
|
1670
|
+
Description: 'Check for duplicate `require`s and `require_relative`s.'
|
1671
|
+
Enabled: true
|
1672
|
+
VersionAdded: '0.90'
|
1673
|
+
|
1674
|
+
Lint/DuplicateRescueException:
|
1675
|
+
Description: 'Checks that there are no repeated exceptions used in `rescue` expressions.'
|
1676
|
+
Enabled: true
|
1677
|
+
VersionAdded: '0.89'
|
1678
|
+
|
1345
1679
|
Lint/EachWithObjectArgument:
|
1346
1680
|
Description: 'Check for immutable argument given to each_with_object.'
|
1347
1681
|
Enabled: true
|
@@ -1351,19 +1685,51 @@ Lint/ElseLayout:
|
|
1351
1685
|
Description: 'Check for odd code arrangement in an else block.'
|
1352
1686
|
Enabled: true
|
1353
1687
|
VersionAdded: '0.17'
|
1688
|
+
VersionChanged: '1.2'
|
1689
|
+
|
1690
|
+
Lint/EmptyBlock:
|
1691
|
+
Description: 'This cop checks for blocks without a body.'
|
1692
|
+
Enabled: true
|
1693
|
+
VersionAdded: '1.1'
|
1694
|
+
VersionChanged: '1.15'
|
1695
|
+
AllowComments: true
|
1696
|
+
AllowEmptyLambdas: true
|
1697
|
+
|
1698
|
+
Lint/EmptyClass:
|
1699
|
+
Description: 'Checks for classes and metaclasses without a body.'
|
1700
|
+
Enabled: true
|
1701
|
+
VersionAdded: '1.3'
|
1702
|
+
AllowComments: false
|
1703
|
+
|
1704
|
+
Lint/EmptyConditionalBody:
|
1705
|
+
Description: 'This cop checks for the presence of `if`, `elsif` and `unless` branches without a body.'
|
1706
|
+
Enabled: true
|
1707
|
+
AllowComments: true
|
1708
|
+
VersionAdded: '0.89'
|
1354
1709
|
|
1355
1710
|
Lint/EmptyEnsure:
|
1356
1711
|
Description: 'Checks for empty ensure block.'
|
1357
1712
|
Enabled: true
|
1358
1713
|
VersionAdded: '0.10'
|
1359
1714
|
VersionChanged: '0.48'
|
1360
|
-
AutoCorrect: false
|
1361
1715
|
|
1362
1716
|
Lint/EmptyExpression:
|
1363
1717
|
Description: 'Checks for empty expressions.'
|
1364
1718
|
Enabled: true
|
1365
1719
|
VersionAdded: '0.45'
|
1366
1720
|
|
1721
|
+
Lint/EmptyFile:
|
1722
|
+
Description: 'Enforces that Ruby source files are not empty.'
|
1723
|
+
Enabled: true
|
1724
|
+
AllowComments: true
|
1725
|
+
VersionAdded: '0.90'
|
1726
|
+
|
1727
|
+
Lint/EmptyInPattern:
|
1728
|
+
Description: 'Checks for the presence of `in` pattern branches without a body.'
|
1729
|
+
Enabled: true
|
1730
|
+
AllowComments: true
|
1731
|
+
VersionAdded: '1.16'
|
1732
|
+
|
1367
1733
|
Lint/EmptyInterpolation:
|
1368
1734
|
Description: 'Checks for empty string interpolation.'
|
1369
1735
|
Enabled: true
|
@@ -1373,18 +1739,16 @@ Lint/EmptyInterpolation:
|
|
1373
1739
|
Lint/EmptyWhen:
|
1374
1740
|
Description: 'Checks for `when` branches with empty bodies.'
|
1375
1741
|
Enabled: true
|
1742
|
+
AllowComments: true
|
1376
1743
|
VersionAdded: '0.45'
|
1377
|
-
|
1378
|
-
Lint/EndInMethod:
|
1379
|
-
Description: 'END blocks should not be placed inside method definitions.'
|
1380
|
-
Enabled: true
|
1381
|
-
VersionAdded: '0.9'
|
1744
|
+
VersionChanged: '0.83'
|
1382
1745
|
|
1383
1746
|
Lint/EnsureReturn:
|
1384
1747
|
Description: 'Do not use return in an ensure block.'
|
1385
1748
|
StyleGuide: '#no-return-ensure'
|
1386
1749
|
Enabled: true
|
1387
1750
|
VersionAdded: '0.9'
|
1751
|
+
VersionChanged: '0.83'
|
1388
1752
|
|
1389
1753
|
Lint/ErbNewArguments:
|
1390
1754
|
Description: 'Use `:trim_mode` and `:eoutvar` keyword arguments to `ERB.new`.'
|
@@ -1397,6 +1761,12 @@ Lint/FlipFlop:
|
|
1397
1761
|
Enabled: true
|
1398
1762
|
VersionAdded: '0.16'
|
1399
1763
|
|
1764
|
+
Lint/FloatComparison:
|
1765
|
+
Description: 'Checks for the presence of precise comparison of floating point numbers.'
|
1766
|
+
StyleGuide: '#float-comparison'
|
1767
|
+
Enabled: true
|
1768
|
+
VersionAdded: '0.89'
|
1769
|
+
|
1400
1770
|
Lint/FloatOutOfRange:
|
1401
1771
|
Description: >-
|
1402
1772
|
Catches floating-point literals too large or small for Ruby to
|
@@ -1409,6 +1779,13 @@ Lint/FormatParameterMismatch:
|
|
1409
1779
|
Enabled: true
|
1410
1780
|
VersionAdded: '0.33'
|
1411
1781
|
|
1782
|
+
Lint/HashCompareByIdentity:
|
1783
|
+
Description: 'Prefer using `Hash#compare_by_identity` than using `object_id` for keys.'
|
1784
|
+
StyleGuide: '#identity-comparison'
|
1785
|
+
Enabled: true
|
1786
|
+
Safe: false
|
1787
|
+
VersionAdded: '0.93'
|
1788
|
+
|
1412
1789
|
Lint/HeredocMethodCallPosition:
|
1413
1790
|
Description: >-
|
1414
1791
|
Checks for the ordering of a method call where
|
@@ -1417,6 +1794,12 @@ Lint/HeredocMethodCallPosition:
|
|
1417
1794
|
StyleGuide: '#heredoc-method-calls'
|
1418
1795
|
VersionAdded: '0.68'
|
1419
1796
|
|
1797
|
+
Lint/IdentityComparison:
|
1798
|
+
Description: 'Prefer `equal?` over `==` when comparing `object_id`.'
|
1799
|
+
Enabled: true
|
1800
|
+
StyleGuide: '#identity-comparison'
|
1801
|
+
VersionAdded: '0.91'
|
1802
|
+
|
1420
1803
|
Lint/ImplicitStringConcatenation:
|
1421
1804
|
Description: >-
|
1422
1805
|
Checks for adjacent string literals on the same line, which
|
@@ -1424,6 +1807,13 @@ Lint/ImplicitStringConcatenation:
|
|
1424
1807
|
Enabled: true
|
1425
1808
|
VersionAdded: '0.36'
|
1426
1809
|
|
1810
|
+
Lint/IncompatibleIoSelectWithFiberScheduler:
|
1811
|
+
Description: 'Checks for `IO.select` that is incompatible with Fiber Scheduler.'
|
1812
|
+
Enabled: true
|
1813
|
+
SafeAutoCorrect: false
|
1814
|
+
VersionAdded: '1.21'
|
1815
|
+
VersionChanged: '1.24'
|
1816
|
+
|
1427
1817
|
Lint/IneffectiveAccessModifier:
|
1428
1818
|
Description: >-
|
1429
1819
|
Checks for attempts to use `private` or `protected` to set
|
@@ -1444,7 +1834,14 @@ Lint/InheritException:
|
|
1444
1834
|
Lint/InterpolationCheck:
|
1445
1835
|
Description: 'Raise warning for interpolation in single q strs.'
|
1446
1836
|
Enabled: true
|
1837
|
+
Safe: false
|
1447
1838
|
VersionAdded: '0.50'
|
1839
|
+
VersionChanged: '0.87'
|
1840
|
+
|
1841
|
+
Lint/LambdaWithoutLiteralBlock:
|
1842
|
+
Description: 'Checks uses of lambda without a literal block.'
|
1843
|
+
Enabled: true
|
1844
|
+
VersionAdded: '1.8'
|
1448
1845
|
|
1449
1846
|
Lint/LiteralAsCondition:
|
1450
1847
|
Description: 'Checks of literals used in conditions.'
|
@@ -1464,6 +1861,8 @@ Lint/Loop:
|
|
1464
1861
|
StyleGuide: '#loop-with-break'
|
1465
1862
|
Enabled: true
|
1466
1863
|
VersionAdded: '0.9'
|
1864
|
+
VersionChanged: '1.3'
|
1865
|
+
Safe: false
|
1467
1866
|
|
1468
1867
|
Lint/MissingCopEnableDirective:
|
1469
1868
|
Description: 'Checks for a `# rubocop:enable` after `# rubocop:disable`.'
|
@@ -1478,11 +1877,24 @@ Lint/MissingCopEnableDirective:
|
|
1478
1877
|
# .inf for any size
|
1479
1878
|
MaximumRangeSize: .inf
|
1480
1879
|
|
1880
|
+
Lint/MissingSuper:
|
1881
|
+
Description: >-
|
1882
|
+
This cop checks for the presence of constructors and lifecycle callbacks
|
1883
|
+
without calls to `super`'.
|
1884
|
+
Enabled: true
|
1885
|
+
VersionAdded: '0.89'
|
1886
|
+
VersionChanged: '1.4'
|
1887
|
+
|
1888
|
+
Lint/MixedRegexpCaptureTypes:
|
1889
|
+
Description: 'Do not mix named captures and numbered captures in a Regexp literal.'
|
1890
|
+
Enabled: true
|
1891
|
+
VersionAdded: '0.85'
|
1892
|
+
|
1481
1893
|
Lint/MultipleComparison:
|
1482
1894
|
Description: "Use `&&` operator to compare multiple values."
|
1483
1895
|
Enabled: true
|
1484
1896
|
VersionAdded: '0.47'
|
1485
|
-
VersionChanged: '
|
1897
|
+
VersionChanged: '1.1'
|
1486
1898
|
|
1487
1899
|
Lint/NestedMethodDefinition:
|
1488
1900
|
Description: 'Do not use nested method definitions.'
|
@@ -1502,6 +1914,11 @@ Lint/NextWithoutAccumulator:
|
|
1502
1914
|
Enabled: true
|
1503
1915
|
VersionAdded: '0.36'
|
1504
1916
|
|
1917
|
+
Lint/NoReturnInBeginEndBlocks:
|
1918
|
+
Description: 'Do not `return` inside `begin..end` blocks in assignment contexts.'
|
1919
|
+
Enabled: true
|
1920
|
+
VersionAdded: '1.2'
|
1921
|
+
|
1505
1922
|
Lint/NonDeterministicRequireOrder:
|
1506
1923
|
Description: 'Always sort arrays returned by Dir.glob when requiring files.'
|
1507
1924
|
Enabled: true
|
@@ -1517,14 +1934,35 @@ Lint/NumberConversion:
|
|
1517
1934
|
Description: 'Checks unsafe usage of number conversion methods.'
|
1518
1935
|
Enabled: false
|
1519
1936
|
VersionAdded: '0.53'
|
1520
|
-
VersionChanged: '
|
1937
|
+
VersionChanged: '1.1'
|
1521
1938
|
SafeAutoCorrect: false
|
1939
|
+
IgnoredMethods: []
|
1940
|
+
IgnoredClasses:
|
1941
|
+
- Time
|
1942
|
+
- DateTime
|
1943
|
+
|
1944
|
+
Lint/NumberedParameterAssignment:
|
1945
|
+
Description: 'Checks for uses of numbered parameter assignment.'
|
1946
|
+
Enabled: true
|
1947
|
+
VersionAdded: '1.9'
|
1948
|
+
|
1949
|
+
Lint/OrAssignmentToConstant:
|
1950
|
+
Description: 'Checks unintended or-assignment to constant.'
|
1951
|
+
Enabled: true
|
1952
|
+
Safe: false
|
1953
|
+
VersionAdded: '1.9'
|
1522
1954
|
|
1523
1955
|
Lint/OrderedMagicComments:
|
1524
1956
|
Description: 'Checks the proper ordering of magic comments and whether a magic comment is not placed before a shebang.'
|
1525
1957
|
Enabled: true
|
1526
1958
|
VersionAdded: '0.53'
|
1527
1959
|
|
1960
|
+
Lint/OutOfRangeRegexpRef:
|
1961
|
+
Description: 'Checks for out of range reference for Regexp because it always returns nil.'
|
1962
|
+
Enabled: true
|
1963
|
+
Safe: false
|
1964
|
+
VersionAdded: '0.89'
|
1965
|
+
|
1528
1966
|
Lint/ParenthesesAsGroupedExpression:
|
1529
1967
|
Description: >-
|
1530
1968
|
Checks for method calls with a space before the opening
|
@@ -1532,6 +1970,7 @@ Lint/ParenthesesAsGroupedExpression:
|
|
1532
1970
|
StyleGuide: '#parens-no-spaces'
|
1533
1971
|
Enabled: true
|
1534
1972
|
VersionAdded: '0.12'
|
1973
|
+
VersionChanged: '0.83'
|
1535
1974
|
|
1536
1975
|
Lint/PercentStringArray:
|
1537
1976
|
Description: >-
|
@@ -1546,6 +1985,16 @@ Lint/PercentSymbolArray:
|
|
1546
1985
|
Enabled: true
|
1547
1986
|
VersionAdded: '0.41'
|
1548
1987
|
|
1988
|
+
Lint/RaiseException:
|
1989
|
+
Description: Checks for `raise` or `fail` statements which are raising `Exception` class.
|
1990
|
+
StyleGuide: '#raise-exception'
|
1991
|
+
Enabled: true
|
1992
|
+
Safe: false
|
1993
|
+
VersionAdded: '0.81'
|
1994
|
+
VersionChanged: '0.86'
|
1995
|
+
AllowedImplicitNamespaces:
|
1996
|
+
- 'Gem'
|
1997
|
+
|
1549
1998
|
Lint/RandOne:
|
1550
1999
|
Description: >-
|
1551
2000
|
Checks for `rand(1)` calls. Such calls always return `0`
|
@@ -1566,15 +2015,35 @@ Lint/RedundantCopEnableDirective:
|
|
1566
2015
|
Enabled: true
|
1567
2016
|
VersionAdded: '0.76'
|
1568
2017
|
|
2018
|
+
Lint/RedundantDirGlobSort:
|
2019
|
+
Description: 'Checks for redundant `sort` method to `Dir.glob` and `Dir[]`.'
|
2020
|
+
Enabled: true
|
2021
|
+
VersionAdded: '1.8'
|
2022
|
+
|
1569
2023
|
Lint/RedundantRequireStatement:
|
1570
2024
|
Description: 'Checks for unnecessary `require` statement.'
|
1571
2025
|
Enabled: true
|
1572
2026
|
VersionAdded: '0.76'
|
1573
2027
|
|
2028
|
+
Lint/RedundantSafeNavigation:
|
2029
|
+
Description: 'Checks for redundant safe navigation calls.'
|
2030
|
+
Enabled: true
|
2031
|
+
VersionAdded: '0.93'
|
2032
|
+
AllowedMethods:
|
2033
|
+
- instance_of?
|
2034
|
+
- kind_of?
|
2035
|
+
- is_a?
|
2036
|
+
- eql?
|
2037
|
+
- respond_to?
|
2038
|
+
- equal?
|
2039
|
+
Safe: false
|
2040
|
+
|
1574
2041
|
Lint/RedundantSplatExpansion:
|
1575
2042
|
Description: 'Checks for splat unnecessarily being called on literals.'
|
1576
2043
|
Enabled: true
|
1577
|
-
|
2044
|
+
VersionAdded: '0.76'
|
2045
|
+
VersionChanged: '1.7'
|
2046
|
+
AllowPercentLiteralArrayArgument: true
|
1578
2047
|
|
1579
2048
|
Lint/RedundantStringCoercion:
|
1580
2049
|
Description: 'Checks for Object#to_s usage in string interpolation.'
|
@@ -1599,6 +2068,7 @@ Lint/RegexpAsCondition:
|
|
1599
2068
|
The regexp literal matches `$_` implicitly.
|
1600
2069
|
Enabled: true
|
1601
2070
|
VersionAdded: '0.51'
|
2071
|
+
VersionChanged: '0.86'
|
1602
2072
|
|
1603
2073
|
Lint/RequireParentheses:
|
1604
2074
|
Description: >-
|
@@ -1607,12 +2077,17 @@ Lint/RequireParentheses:
|
|
1607
2077
|
Enabled: true
|
1608
2078
|
VersionAdded: '0.18'
|
1609
2079
|
|
2080
|
+
Lint/RequireRelativeSelfPath:
|
2081
|
+
Description: 'Checks for uses a file requiring itself with `require_relative`.'
|
2082
|
+
Enabled: true
|
2083
|
+
VersionAdded: '1.22'
|
2084
|
+
|
1610
2085
|
Lint/RescueException:
|
1611
2086
|
Description: 'Avoid rescuing the Exception class.'
|
1612
2087
|
StyleGuide: '#no-blind-rescues'
|
1613
2088
|
Enabled: true
|
1614
2089
|
VersionAdded: '0.9'
|
1615
|
-
VersionChanged: '0.27
|
2090
|
+
VersionChanged: '0.27'
|
1616
2091
|
|
1617
2092
|
Lint/RescueType:
|
1618
2093
|
Description: 'Avoid rescuing from non constants that could result in a `TypeError`.'
|
@@ -1635,6 +2110,7 @@ Lint/SafeNavigationChain:
|
|
1635
2110
|
- presence
|
1636
2111
|
- try
|
1637
2112
|
- try!
|
2113
|
+
- in?
|
1638
2114
|
|
1639
2115
|
Lint/SafeNavigationConsistency:
|
1640
2116
|
Description: >-
|
@@ -1655,6 +2131,7 @@ Lint/SafeNavigationWithEmpty:
|
|
1655
2131
|
Description: 'Avoid `foo&.empty?` in conditionals.'
|
1656
2132
|
Enabled: true
|
1657
2133
|
VersionAdded: '0.62'
|
2134
|
+
VersionChanged: '0.87'
|
1658
2135
|
|
1659
2136
|
Lint/ScriptPermission:
|
1660
2137
|
Description: 'Grant script file execute permission.'
|
@@ -1662,6 +2139,11 @@ Lint/ScriptPermission:
|
|
1662
2139
|
VersionAdded: '0.49'
|
1663
2140
|
VersionChanged: '0.50'
|
1664
2141
|
|
2142
|
+
Lint/SelfAssignment:
|
2143
|
+
Description: 'Checks for self-assignments.'
|
2144
|
+
Enabled: true
|
2145
|
+
VersionAdded: '0.89'
|
2146
|
+
|
1665
2147
|
Lint/SendWithMixinArgument:
|
1666
2148
|
Description: 'Checks for `send` method when using mixin.'
|
1667
2149
|
Enabled: true
|
@@ -1688,23 +2170,59 @@ Lint/ShadowingOuterLocalVariable:
|
|
1688
2170
|
Enabled: true
|
1689
2171
|
VersionAdded: '0.9'
|
1690
2172
|
|
2173
|
+
Lint/StructNewOverride:
|
2174
|
+
Description: 'Disallow overriding the `Struct` built-in methods via `Struct.new`.'
|
2175
|
+
Enabled: true
|
2176
|
+
VersionAdded: '0.81'
|
2177
|
+
|
1691
2178
|
Lint/SuppressedException:
|
1692
2179
|
Description: "Don't suppress exceptions."
|
1693
2180
|
StyleGuide: '#dont-hide-exceptions'
|
1694
2181
|
Enabled: true
|
1695
|
-
AllowComments:
|
2182
|
+
AllowComments: true
|
2183
|
+
AllowNil: true
|
1696
2184
|
VersionAdded: '0.9'
|
1697
|
-
VersionChanged: '
|
2185
|
+
VersionChanged: '1.12'
|
2186
|
+
|
2187
|
+
Lint/SymbolConversion:
|
2188
|
+
Description: 'Checks for unnecessary symbol conversions.'
|
2189
|
+
Enabled: true
|
2190
|
+
VersionAdded: '1.9'
|
2191
|
+
VersionChanged: '1.16'
|
2192
|
+
EnforcedStyle: strict
|
2193
|
+
SupportedStyles:
|
2194
|
+
- strict
|
2195
|
+
- consistent
|
1698
2196
|
|
1699
2197
|
Lint/Syntax:
|
1700
|
-
Description: 'Checks syntax
|
2198
|
+
Description: 'Checks for syntax errors.'
|
1701
2199
|
Enabled: true
|
1702
2200
|
VersionAdded: '0.9'
|
1703
2201
|
|
2202
|
+
Lint/ToEnumArguments:
|
2203
|
+
Description: 'This cop ensures that `to_enum`/`enum_for`, called for the current method, has correct arguments.'
|
2204
|
+
Enabled: true
|
2205
|
+
VersionAdded: '1.1'
|
1704
2206
|
|
1705
2207
|
Lint/ToJSON:
|
1706
2208
|
Description: 'Ensure #to_json includes an optional argument.'
|
1707
2209
|
Enabled: true
|
2210
|
+
VersionAdded: '0.66'
|
2211
|
+
|
2212
|
+
Lint/TopLevelReturnWithArgument:
|
2213
|
+
Description: 'This cop detects top level return statements with argument.'
|
2214
|
+
Enabled: true
|
2215
|
+
VersionAdded: '0.89'
|
2216
|
+
|
2217
|
+
Lint/TrailingCommaInAttributeDeclaration:
|
2218
|
+
Description: 'This cop checks for trailing commas in attribute declarations.'
|
2219
|
+
Enabled: true
|
2220
|
+
VersionAdded: '0.90'
|
2221
|
+
|
2222
|
+
Lint/TripleQuotes:
|
2223
|
+
Description: 'Checks for useless triple quote constructs.'
|
2224
|
+
Enabled: true
|
2225
|
+
VersionAdded: '1.9'
|
1708
2226
|
|
1709
2227
|
Lint/UnderscorePrefixedVariableName:
|
1710
2228
|
Description: 'Do not use prefix `_` for a variable that is used.'
|
@@ -1712,16 +2230,49 @@ Lint/UnderscorePrefixedVariableName:
|
|
1712
2230
|
VersionAdded: '0.21'
|
1713
2231
|
AllowKeywordBlockArguments: false
|
1714
2232
|
|
2233
|
+
Lint/UnexpectedBlockArity:
|
2234
|
+
Description: 'Looks for blocks that have fewer arguments that the calling method expects.'
|
2235
|
+
Enabled: true
|
2236
|
+
Safe: false
|
2237
|
+
VersionAdded: '1.5'
|
2238
|
+
Methods:
|
2239
|
+
chunk_while: 2
|
2240
|
+
each_with_index: 2
|
2241
|
+
each_with_object: 2
|
2242
|
+
inject: 2
|
2243
|
+
max: 2
|
2244
|
+
min: 2
|
2245
|
+
minmax: 2
|
2246
|
+
reduce: 2
|
2247
|
+
slice_when: 2
|
2248
|
+
sort: 2
|
2249
|
+
|
1715
2250
|
Lint/UnifiedInteger:
|
1716
2251
|
Description: 'Use Integer instead of Fixnum or Bignum.'
|
1717
2252
|
Enabled: true
|
1718
2253
|
VersionAdded: '0.43'
|
1719
2254
|
|
2255
|
+
Lint/UnmodifiedReduceAccumulator:
|
2256
|
+
Description: Checks for `reduce` or `inject` blocks that do not update the accumulator each iteration.
|
2257
|
+
Enabled: true
|
2258
|
+
VersionAdded: '1.1'
|
2259
|
+
VersionChanged: '1.5'
|
2260
|
+
|
1720
2261
|
Lint/UnreachableCode:
|
1721
2262
|
Description: 'Unreachable code.'
|
1722
2263
|
Enabled: true
|
1723
2264
|
VersionAdded: '0.9'
|
1724
2265
|
|
2266
|
+
Lint/UnreachableLoop:
|
2267
|
+
Description: 'This cop checks for loops that will have at most one iteration.'
|
2268
|
+
Enabled: true
|
2269
|
+
VersionAdded: '0.89'
|
2270
|
+
VersionChanged: '1.7'
|
2271
|
+
IgnoredPatterns:
|
2272
|
+
# RSpec uses `times` in its message expectations
|
2273
|
+
# eg. `exactly(2).times`
|
2274
|
+
- !ruby/regexp /(exactly|at_least|at_most)\(\d+\)\.times/
|
2275
|
+
|
1725
2276
|
Lint/UnusedBlockArgument:
|
1726
2277
|
Description: 'Checks for unused block arguments.'
|
1727
2278
|
StyleGuide: '#underscore-unused-vars'
|
@@ -1736,9 +2287,10 @@ Lint/UnusedMethodArgument:
|
|
1736
2287
|
StyleGuide: '#underscore-unused-vars'
|
1737
2288
|
Enabled: true
|
1738
2289
|
VersionAdded: '0.21'
|
1739
|
-
VersionChanged: '0.
|
2290
|
+
VersionChanged: '0.81'
|
1740
2291
|
AllowUnusedKeywordArguments: false
|
1741
2292
|
IgnoreEmptyMethods: true
|
2293
|
+
IgnoreNotImplementedMethods: true
|
1742
2294
|
|
1743
2295
|
Lint/UriEscapeUnescape:
|
1744
2296
|
Description: >-
|
@@ -1760,7 +2312,7 @@ Lint/UselessAccessModifier:
|
|
1760
2312
|
Description: 'Checks for useless access modifiers.'
|
1761
2313
|
Enabled: true
|
1762
2314
|
VersionAdded: '0.20'
|
1763
|
-
VersionChanged: '0.
|
2315
|
+
VersionChanged: '0.83'
|
1764
2316
|
ContextCreatingMethods: []
|
1765
2317
|
MethodCreatingMethods: []
|
1766
2318
|
|
@@ -1770,20 +2322,36 @@ Lint/UselessAssignment:
|
|
1770
2322
|
Enabled: true
|
1771
2323
|
VersionAdded: '0.11'
|
1772
2324
|
|
1773
|
-
Lint/UselessComparison:
|
1774
|
-
Description: 'Checks for comparison of something with itself.'
|
1775
|
-
Enabled: true
|
1776
|
-
VersionAdded: '0.11'
|
1777
|
-
|
1778
2325
|
Lint/UselessElseWithoutRescue:
|
1779
2326
|
Description: 'Checks for useless `else` in `begin..end` without `rescue`.'
|
1780
2327
|
Enabled: true
|
1781
2328
|
VersionAdded: '0.17'
|
1782
2329
|
|
2330
|
+
Lint/UselessMethodDefinition:
|
2331
|
+
Description: 'Checks for useless method definitions.'
|
2332
|
+
Enabled: true
|
2333
|
+
VersionAdded: '0.90'
|
2334
|
+
Safe: false
|
2335
|
+
AllowComments: true
|
2336
|
+
|
2337
|
+
Lint/UselessRuby2Keywords:
|
2338
|
+
Description: 'Finds unnecessary uses of `ruby2_keywords`.'
|
2339
|
+
Enabled: true
|
2340
|
+
VersionAdded: '1.23'
|
2341
|
+
|
1783
2342
|
Lint/UselessSetterCall:
|
1784
2343
|
Description: 'Checks for useless setter call to a local variable.'
|
1785
2344
|
Enabled: true
|
2345
|
+
SafeAutoCorrect: false
|
1786
2346
|
VersionAdded: '0.13'
|
2347
|
+
VersionChanged: '1.2'
|
2348
|
+
Safe: false
|
2349
|
+
|
2350
|
+
Lint/UselessTimes:
|
2351
|
+
Description: 'Checks for useless `Integer#times` calls.'
|
2352
|
+
Enabled: true
|
2353
|
+
VersionAdded: '0.91'
|
2354
|
+
Safe: false
|
1787
2355
|
|
1788
2356
|
Lint/Void:
|
1789
2357
|
Description: 'Possible use of operator/literal/variable in void context.'
|
@@ -1802,19 +2370,23 @@ Metrics/AbcSize:
|
|
1802
2370
|
- https://en.wikipedia.org/wiki/ABC_Software_Metric
|
1803
2371
|
Enabled: true
|
1804
2372
|
VersionAdded: '0.27'
|
1805
|
-
VersionChanged: '
|
2373
|
+
VersionChanged: '1.5'
|
1806
2374
|
# The ABC size is a calculated magnitude, so this number can be an Integer or
|
1807
2375
|
# a Float.
|
2376
|
+
IgnoredMethods: []
|
2377
|
+
CountRepeatedAttributes: true
|
1808
2378
|
Max: 30
|
1809
2379
|
|
1810
2380
|
Metrics/BlockLength:
|
1811
2381
|
Description: 'Avoid long blocks with many lines.'
|
1812
2382
|
Enabled: true
|
1813
2383
|
VersionAdded: '0.44'
|
1814
|
-
VersionChanged: '
|
2384
|
+
VersionChanged: '1.5'
|
1815
2385
|
CountComments: false # count full line comments?
|
1816
2386
|
Max: 50
|
1817
|
-
|
2387
|
+
CountAsOne: []
|
2388
|
+
#ExcludedMethods: [] # deprecated, retained for backwards compatibility
|
2389
|
+
IgnoredMethods:
|
1818
2390
|
# By default, exclude the `#refine` method, as it tends to have larger
|
1819
2391
|
# associated blocks.
|
1820
2392
|
- refine
|
@@ -1834,8 +2406,10 @@ Metrics/ClassLength:
|
|
1834
2406
|
Description: 'Avoid classes longer than 100 lines of code.'
|
1835
2407
|
Enabled: true
|
1836
2408
|
VersionAdded: '0.25'
|
2409
|
+
VersionChanged: '0.87'
|
1837
2410
|
CountComments: false # count full line comments?
|
1838
2411
|
Max: 300
|
2412
|
+
CountAsOne: []
|
1839
2413
|
|
1840
2414
|
# Avoid complex methods.
|
1841
2415
|
Metrics/CyclomaticComplexity:
|
@@ -1844,6 +2418,8 @@ Metrics/CyclomaticComplexity:
|
|
1844
2418
|
of test cases needed to validate a method.
|
1845
2419
|
Enabled: true
|
1846
2420
|
VersionAdded: '0.25'
|
2421
|
+
VersionChanged: '0.81'
|
2422
|
+
IgnoredMethods: []
|
1847
2423
|
Max: 10
|
1848
2424
|
|
1849
2425
|
Metrics/MethodLength:
|
@@ -1851,25 +2427,31 @@ Metrics/MethodLength:
|
|
1851
2427
|
StyleGuide: '#short-methods'
|
1852
2428
|
Enabled: true
|
1853
2429
|
VersionAdded: '0.25'
|
1854
|
-
VersionChanged: '
|
2430
|
+
VersionChanged: '1.5'
|
1855
2431
|
CountComments: false # count full line comments?
|
1856
2432
|
Max: 50
|
1857
|
-
|
2433
|
+
CountAsOne: []
|
2434
|
+
#ExcludedMethods: [] # deprecated, retained for backwards compatibility
|
2435
|
+
IgnoredMethods: []
|
1858
2436
|
|
1859
2437
|
Metrics/ModuleLength:
|
1860
2438
|
Description: 'Avoid modules longer than 100 lines of code.'
|
1861
2439
|
Enabled: true
|
1862
2440
|
VersionAdded: '0.31'
|
2441
|
+
VersionChanged: '0.87'
|
1863
2442
|
CountComments: false # count full line comments?
|
1864
2443
|
Max: 300
|
2444
|
+
CountAsOne: []
|
1865
2445
|
|
1866
2446
|
Metrics/ParameterLists:
|
1867
2447
|
Description: 'Avoid parameter lists longer than three or four parameters.'
|
1868
2448
|
StyleGuide: '#too-many-params'
|
1869
2449
|
Enabled: true
|
1870
2450
|
VersionAdded: '0.25'
|
2451
|
+
VersionChanged: '1.5'
|
1871
2452
|
Max: 5
|
1872
2453
|
CountKeywordArgs: true
|
2454
|
+
MaxOptionalParameters: 3
|
1873
2455
|
|
1874
2456
|
Metrics/PerceivedComplexity:
|
1875
2457
|
Description: >-
|
@@ -1877,7 +2459,9 @@ Metrics/PerceivedComplexity:
|
|
1877
2459
|
human reader.
|
1878
2460
|
Enabled: true
|
1879
2461
|
VersionAdded: '0.25'
|
1880
|
-
|
2462
|
+
VersionChanged: '0.81'
|
2463
|
+
IgnoredMethods: []
|
2464
|
+
Max: 8
|
1881
2465
|
|
1882
2466
|
################## Migration #############################
|
1883
2467
|
|
@@ -1885,7 +2469,8 @@ Migration/DepartmentName:
|
|
1885
2469
|
Description: >-
|
1886
2470
|
Check that cop names in rubocop:disable (etc) comments are
|
1887
2471
|
given with department name.
|
1888
|
-
Enabled:
|
2472
|
+
Enabled: true
|
2473
|
+
VersionAdded: '0.75'
|
1889
2474
|
|
1890
2475
|
#################### Naming ##############################
|
1891
2476
|
|
@@ -1896,16 +2481,28 @@ Naming/AccessorMethodName:
|
|
1896
2481
|
VersionAdded: '0.50'
|
1897
2482
|
|
1898
2483
|
Naming/AsciiIdentifiers:
|
1899
|
-
Description: 'Use only ascii symbols in identifiers.'
|
2484
|
+
Description: 'Use only ascii symbols in identifiers and constants.'
|
1900
2485
|
StyleGuide: '#english-identifiers'
|
1901
2486
|
Enabled: true
|
1902
2487
|
VersionAdded: '0.50'
|
2488
|
+
VersionChanged: '0.87'
|
2489
|
+
AsciiConstants: true
|
1903
2490
|
|
1904
2491
|
Naming/BinaryOperatorParameterName:
|
1905
2492
|
Description: 'When defining binary operators, name the argument other.'
|
1906
2493
|
StyleGuide: '#other-arg'
|
1907
2494
|
Enabled: true
|
1908
2495
|
VersionAdded: '0.50'
|
2496
|
+
VersionChanged: '1.2'
|
2497
|
+
|
2498
|
+
Naming/BlockForwarding:
|
2499
|
+
Description: 'Use anonymous block forwarding.'
|
2500
|
+
Enabled: true
|
2501
|
+
VersionAdded: '1.24'
|
2502
|
+
EnforcedStyle: anonymous
|
2503
|
+
SupportedStyles:
|
2504
|
+
- anonymous
|
2505
|
+
- explicit
|
1909
2506
|
|
1910
2507
|
Naming/BlockParameterName:
|
1911
2508
|
Description: >-
|
@@ -1927,6 +2524,11 @@ Naming/ClassAndModuleCamelCase:
|
|
1927
2524
|
StyleGuide: '#camelcase-classes'
|
1928
2525
|
Enabled: true
|
1929
2526
|
VersionAdded: '0.50'
|
2527
|
+
VersionChanged: '0.85'
|
2528
|
+
# Allowed class/module names can be specified here.
|
2529
|
+
# These can be full or part of the name.
|
2530
|
+
AllowedNames:
|
2531
|
+
- module_parent
|
1930
2532
|
|
1931
2533
|
Naming/ConstantName:
|
1932
2534
|
Description: 'Constants should use SCREAMING_SNAKE_CASE.'
|
@@ -1947,6 +2549,17 @@ Naming/FileName:
|
|
1947
2549
|
# It further expects it to be nested inside modules which match the names
|
1948
2550
|
# of subdirectories in its path.
|
1949
2551
|
ExpectMatchingDefinition: false
|
2552
|
+
# When `false`, changes the behavior of ExpectMatchingDefinition to match only
|
2553
|
+
# whether each source file's class or module name matches the file name --
|
2554
|
+
# not whether the nested module hierarchy matches the subdirectory path.
|
2555
|
+
CheckDefinitionPathHierarchy: true
|
2556
|
+
# paths that are considered root directories, for example "lib" in most ruby projects
|
2557
|
+
# or "app/models" in rails projects
|
2558
|
+
CheckDefinitionPathHierarchyRoots:
|
2559
|
+
- lib
|
2560
|
+
- spec
|
2561
|
+
- test
|
2562
|
+
- src
|
1950
2563
|
# If non-`nil`, expect all source file names to match the following regex.
|
1951
2564
|
# Only the file name itself is matched, not the entire file path.
|
1952
2565
|
# Use anchors as necessary if you want to match the entire name rather than
|
@@ -2003,6 +2616,7 @@ Naming/HeredocDelimiterCase:
|
|
2003
2616
|
StyleGuide: '#heredoc-delimiters'
|
2004
2617
|
Enabled: true
|
2005
2618
|
VersionAdded: '0.50'
|
2619
|
+
VersionChanged: '1.2'
|
2006
2620
|
EnforcedStyle: uppercase
|
2007
2621
|
SupportedStyles:
|
2008
2622
|
- lowercase
|
@@ -2016,17 +2630,45 @@ Naming/HeredocDelimiterNaming:
|
|
2016
2630
|
ForbiddenDelimiters:
|
2017
2631
|
- !ruby/regexp '/(^|\s)(EO[A-Z]{1}|END)(\s|$)/'
|
2018
2632
|
|
2633
|
+
Naming/InclusiveLanguage:
|
2634
|
+
Description: 'Recommend the use of inclusive language instead of problematic terms.'
|
2635
|
+
Enabled: false
|
2636
|
+
VersionAdded: '1.18'
|
2637
|
+
VersionChanged: '1.21'
|
2638
|
+
CheckIdentifiers: true
|
2639
|
+
CheckConstants: true
|
2640
|
+
CheckVariables: true
|
2641
|
+
CheckStrings: false
|
2642
|
+
CheckSymbols: true
|
2643
|
+
CheckComments: true
|
2644
|
+
CheckFilepaths: true
|
2645
|
+
FlaggedTerms:
|
2646
|
+
whitelist:
|
2647
|
+
Regex: !ruby/regexp '/white[-_\s]?list/'
|
2648
|
+
Suggestions:
|
2649
|
+
- allowlist
|
2650
|
+
- permit
|
2651
|
+
blacklist:
|
2652
|
+
Regex: !ruby/regexp '/black[-_\s]?list/'
|
2653
|
+
Suggestions:
|
2654
|
+
- denylist
|
2655
|
+
- block
|
2656
|
+
slave:
|
2657
|
+
WholeWord: true
|
2658
|
+
Suggestions: ['replica', 'secondary', 'follower']
|
2659
|
+
|
2019
2660
|
Naming/MemoizedInstanceVariableName:
|
2020
2661
|
Description: >-
|
2021
2662
|
Memoized method name should match memo instance variable name.
|
2022
2663
|
Enabled: true
|
2023
2664
|
VersionAdded: '0.53'
|
2024
|
-
VersionChanged: '
|
2665
|
+
VersionChanged: '1.2'
|
2025
2666
|
EnforcedStyleForLeadingUnderscores: disallowed
|
2026
2667
|
SupportedStylesForLeadingUnderscores:
|
2027
2668
|
- disallowed
|
2028
2669
|
- required
|
2029
2670
|
- optional
|
2671
|
+
Safe: false
|
2030
2672
|
|
2031
2673
|
Naming/MethodName:
|
2032
2674
|
Description: 'Use the configured style when naming methods.'
|
@@ -2057,16 +2699,18 @@ Naming/MethodParameterName:
|
|
2057
2699
|
AllowNamesEndingInNumbers: true
|
2058
2700
|
# Allowed names that will not register an offense
|
2059
2701
|
AllowedNames:
|
2060
|
-
-
|
2061
|
-
- id
|
2062
|
-
- to
|
2702
|
+
- at
|
2063
2703
|
- by
|
2064
|
-
-
|
2704
|
+
- db
|
2705
|
+
- id
|
2065
2706
|
- in
|
2066
|
-
-
|
2707
|
+
- io
|
2067
2708
|
- ip
|
2068
|
-
-
|
2709
|
+
- of
|
2710
|
+
- 'on'
|
2069
2711
|
- os
|
2712
|
+
- pp
|
2713
|
+
- to
|
2070
2714
|
# Forbidden names that will register an offense
|
2071
2715
|
ForbiddenNames: []
|
2072
2716
|
|
@@ -2111,20 +2755,33 @@ Naming/VariableName:
|
|
2111
2755
|
StyleGuide: '#snake-case-symbols-methods-vars'
|
2112
2756
|
Enabled: true
|
2113
2757
|
VersionAdded: '0.50'
|
2758
|
+
VersionChanged: '1.8'
|
2114
2759
|
EnforcedStyle: snake_case
|
2115
2760
|
SupportedStyles:
|
2116
2761
|
- snake_case
|
2117
2762
|
- camelCase
|
2763
|
+
AllowedIdentifiers: []
|
2118
2764
|
|
2119
2765
|
Naming/VariableNumber:
|
2120
|
-
Description: 'Use the configured style when numbering variables.'
|
2766
|
+
Description: 'Use the configured style when numbering symbols, methods and variables.'
|
2767
|
+
StyleGuide: '#snake-case-symbols-methods-vars-with-numbers'
|
2121
2768
|
Enabled: true
|
2122
2769
|
VersionAdded: '0.50'
|
2770
|
+
VersionChanged: '1.4'
|
2123
2771
|
EnforcedStyle: snake_case
|
2124
2772
|
SupportedStyles:
|
2125
2773
|
- snake_case
|
2126
2774
|
- normalcase
|
2127
2775
|
- non_integer
|
2776
|
+
CheckMethodNames: true
|
2777
|
+
CheckSymbols: true
|
2778
|
+
AllowedIdentifiers:
|
2779
|
+
- capture3 # Open3.capture3
|
2780
|
+
- iso8601 # Time#iso8601
|
2781
|
+
- rfc1123_date # CGI.rfc1123_date
|
2782
|
+
- rfc822 # Time#rfc822
|
2783
|
+
- rfc2822 # Time#rfc2822
|
2784
|
+
- rfc3339 # DateTime.rfc3339
|
2128
2785
|
|
2129
2786
|
#################### Security ##############################
|
2130
2787
|
|
@@ -2133,38 +2790,46 @@ Security/Eval:
|
|
2133
2790
|
Enabled: true
|
2134
2791
|
VersionAdded: '0.47'
|
2135
2792
|
|
2793
|
+
Security/IoMethods:
|
2794
|
+
Description: >-
|
2795
|
+
Checks for the first argument to `IO.read`, `IO.binread`, `IO.write`, `IO.binwrite`,
|
2796
|
+
`IO.foreach`, and `IO.readlines`.
|
2797
|
+
Enabled: true
|
2798
|
+
Safe: false
|
2799
|
+
VersionAdded: '1.22'
|
2800
|
+
|
2136
2801
|
Security/JSONLoad:
|
2137
2802
|
Description: >-
|
2138
2803
|
Prefer usage of `JSON.parse` over `JSON.load` due to potential
|
2139
2804
|
security issues. See reference for more information.
|
2140
|
-
Reference: 'https://ruby-doc.org/stdlib-2.
|
2805
|
+
Reference: 'https://ruby-doc.org/stdlib-2.7.0/libdoc/json/rdoc/JSON.html#method-i-load'
|
2141
2806
|
Enabled: true
|
2142
2807
|
VersionAdded: '0.43'
|
2143
|
-
VersionChanged: '
|
2808
|
+
VersionChanged: '1.22'
|
2144
2809
|
# Autocorrect here will change to a method that may cause crashes depending
|
2145
2810
|
# on the value of the argument.
|
2146
|
-
AutoCorrect: false
|
2147
2811
|
SafeAutoCorrect: false
|
2148
2812
|
|
2149
2813
|
Security/MarshalLoad:
|
2150
2814
|
Description: >-
|
2151
2815
|
Avoid using of `Marshal.load` or `Marshal.restore` due to potential
|
2152
2816
|
security issues. See reference for more information.
|
2153
|
-
Reference: 'https://ruby-doc.org/core-2.
|
2817
|
+
Reference: 'https://ruby-doc.org/core-2.7.0/Marshal.html#module-Marshal-label-Security+considerations'
|
2154
2818
|
Enabled: true
|
2155
2819
|
VersionAdded: '0.47'
|
2156
2820
|
|
2157
2821
|
Security/Open:
|
2158
|
-
Description: 'The use of Kernel#open
|
2822
|
+
Description: 'The use of `Kernel#open` and `URI.open` represent a serious security risk.'
|
2159
2823
|
Enabled: true
|
2160
2824
|
VersionAdded: '0.53'
|
2825
|
+
VersionChanged: '1.0'
|
2161
2826
|
Safe: false
|
2162
2827
|
|
2163
2828
|
Security/YAMLLoad:
|
2164
2829
|
Description: >-
|
2165
2830
|
Prefer usage of `YAML.safe_load` over `YAML.load` due to potential
|
2166
2831
|
security issues. See reference for more information.
|
2167
|
-
Reference: 'https://ruby-doc.org/stdlib-2.
|
2832
|
+
Reference: 'https://ruby-doc.org/stdlib-2.7.0/libdoc/yaml/rdoc/YAML.html#module-YAML-label-Security'
|
2168
2833
|
Enabled: true
|
2169
2834
|
VersionAdded: '0.47'
|
2170
2835
|
SafeAutoCorrect: false
|
@@ -2175,10 +2840,23 @@ Style/AccessModifierDeclarations:
|
|
2175
2840
|
Description: 'Checks style of how access modifiers are used.'
|
2176
2841
|
Enabled: true
|
2177
2842
|
VersionAdded: '0.57'
|
2843
|
+
VersionChanged: '0.81'
|
2178
2844
|
EnforcedStyle: group
|
2179
2845
|
SupportedStyles:
|
2180
2846
|
- inline
|
2181
2847
|
- group
|
2848
|
+
AllowModifiersOnSymbols: true
|
2849
|
+
|
2850
|
+
Style/AccessorGrouping:
|
2851
|
+
Description: 'Checks for grouping of accessors in `class` and `module` bodies.'
|
2852
|
+
Enabled: true
|
2853
|
+
VersionAdded: '0.87'
|
2854
|
+
EnforcedStyle: grouped
|
2855
|
+
SupportedStyles:
|
2856
|
+
# separated: each accessor goes in a separate statement.
|
2857
|
+
# grouped: accessors are grouped into a single statement.
|
2858
|
+
- separated
|
2859
|
+
- grouped
|
2182
2860
|
|
2183
2861
|
Style/Alias:
|
2184
2862
|
Description: 'Use alias instead of alias_method.'
|
@@ -2195,8 +2873,9 @@ Style/AndOr:
|
|
2195
2873
|
Description: 'Use &&/|| instead of and/or.'
|
2196
2874
|
StyleGuide: '#no-and-or-or'
|
2197
2875
|
Enabled: true
|
2876
|
+
SafeAutoCorrect: false
|
2198
2877
|
VersionAdded: '0.9'
|
2199
|
-
VersionChanged: '
|
2878
|
+
VersionChanged: '1.21'
|
2200
2879
|
# Whether `and` and `or` are banned only in conditionals (conditionals)
|
2201
2880
|
# or completely (always).
|
2202
2881
|
EnforcedStyle: conditionals
|
@@ -2204,6 +2883,22 @@ Style/AndOr:
|
|
2204
2883
|
- always
|
2205
2884
|
- conditionals
|
2206
2885
|
|
2886
|
+
Style/ArgumentsForwarding:
|
2887
|
+
Description: 'Use arguments forwarding.'
|
2888
|
+
StyleGuide: '#arguments-forwarding'
|
2889
|
+
Enabled: true
|
2890
|
+
AllowOnlyRestArgument: true
|
2891
|
+
VersionAdded: '1.1'
|
2892
|
+
|
2893
|
+
Style/ArrayCoercion:
|
2894
|
+
Description: >-
|
2895
|
+
Use Array() instead of explicit Array check or [*var], when dealing
|
2896
|
+
with a variable you want to treat as an Array, but you're not certain it's an array.
|
2897
|
+
StyleGuide: '#array-coercion'
|
2898
|
+
Safe: false
|
2899
|
+
Enabled: true
|
2900
|
+
VersionAdded: '0.88'
|
2901
|
+
|
2207
2902
|
Style/ArrayJoin:
|
2208
2903
|
Description: 'Use Array#join instead of Array#*.'
|
2209
2904
|
StyleGuide: '#array-join'
|
@@ -2216,8 +2911,9 @@ Style/AsciiComments:
|
|
2216
2911
|
StyleGuide: '#english-comments'
|
2217
2912
|
Enabled: true
|
2218
2913
|
VersionAdded: '0.9'
|
2219
|
-
VersionChanged: '
|
2220
|
-
AllowedChars:
|
2914
|
+
VersionChanged: '1.21'
|
2915
|
+
AllowedChars:
|
2916
|
+
- ©
|
2221
2917
|
|
2222
2918
|
Style/Attr:
|
2223
2919
|
Description: 'Checks for uses of Module#attr.'
|
@@ -2247,6 +2943,13 @@ Style/BeginBlock:
|
|
2247
2943
|
Enabled: true
|
2248
2944
|
VersionAdded: '0.9'
|
2249
2945
|
|
2946
|
+
Style/BisectedAttrAccessor:
|
2947
|
+
Description: >-
|
2948
|
+
Checks for places where `attr_reader` and `attr_writer`
|
2949
|
+
for the same method can be combined into single `attr_accessor`.
|
2950
|
+
Enabled: true
|
2951
|
+
VersionAdded: '0.87'
|
2952
|
+
|
2250
2953
|
Style/BlockComments:
|
2251
2954
|
Description: 'Do not use block comments.'
|
2252
2955
|
StyleGuide: '#no-block-comments'
|
@@ -2357,30 +3060,35 @@ Style/BlockDelimiters:
|
|
2357
3060
|
# # also good
|
2358
3061
|
# collection.each do |element| puts element end
|
2359
3062
|
AllowBracesOnProceduralOneLiners: false
|
2360
|
-
|
2361
|
-
|
2362
|
-
|
2363
|
-
|
2364
|
-
|
2365
|
-
|
2366
|
-
EnforcedStyle: no_braces
|
2367
|
-
SupportedStyles:
|
2368
|
-
# The `braces` style enforces braces around all method parameters that are
|
2369
|
-
# hashes.
|
2370
|
-
- braces
|
2371
|
-
# The `no_braces` style checks that the last parameter doesn't have braces
|
2372
|
-
# around it.
|
2373
|
-
- no_braces
|
2374
|
-
# The `context_dependent` style checks that the last parameter doesn't have
|
2375
|
-
# braces around it, but requires braces if the second to last parameter is
|
2376
|
-
# also a hash literal.
|
2377
|
-
- context_dependent
|
3063
|
+
# The BracesRequiredMethods overrides all other configurations except
|
3064
|
+
# IgnoredMethods. It can be used to enforce that all blocks for specific
|
3065
|
+
# methods use braces. For example, you can use this to enforce Sorbet
|
3066
|
+
# signatures use braces even when the rest of your codebase enforces
|
3067
|
+
# the `line_count_based` style.
|
3068
|
+
BracesRequiredMethods: []
|
2378
3069
|
|
2379
3070
|
Style/CaseEquality:
|
2380
3071
|
Description: 'Avoid explicit use of the case equality operator(===).'
|
2381
3072
|
StyleGuide: '#no-case-equality'
|
2382
3073
|
Enabled: true
|
2383
3074
|
VersionAdded: '0.9'
|
3075
|
+
VersionChanged: '0.89'
|
3076
|
+
# If `AllowOnConstant` option is enabled, the cop will ignore violations when the receiver of
|
3077
|
+
# the case equality operator is a constant.
|
3078
|
+
#
|
3079
|
+
# # bad
|
3080
|
+
# /string/ === "string"
|
3081
|
+
#
|
3082
|
+
# # good
|
3083
|
+
# String === "string"
|
3084
|
+
AllowOnConstant: false
|
3085
|
+
|
3086
|
+
Style/CaseLikeIf:
|
3087
|
+
Description: 'This cop identifies places where `if-elsif` constructions can be replaced with `case-when`.'
|
3088
|
+
StyleGuide: '#case-vs-if-else'
|
3089
|
+
Enabled: true
|
3090
|
+
Safe: false
|
3091
|
+
VersionAdded: '0.88'
|
2384
3092
|
|
2385
3093
|
Style/CharacterLiteral:
|
2386
3094
|
Description: 'Checks for uses of character literals.'
|
@@ -2397,7 +3105,6 @@ Style/ClassAndModuleChildren:
|
|
2397
3105
|
# have the knowledge to perform either operation safely and thus requires
|
2398
3106
|
# manual oversight.
|
2399
3107
|
SafeAutoCorrect: false
|
2400
|
-
AutoCorrect: false
|
2401
3108
|
Enabled: true
|
2402
3109
|
VersionAdded: '0.19'
|
2403
3110
|
#
|
@@ -2421,6 +3128,7 @@ Style/ClassAndModuleChildren:
|
|
2421
3128
|
|
2422
3129
|
Style/ClassCheck:
|
2423
3130
|
Description: 'Enforces consistent use of `Object#is_a?` or `Object#kind_of?`.'
|
3131
|
+
StyleGuide: '#is-a-vs-kind-of'
|
2424
3132
|
Enabled: true
|
2425
3133
|
VersionAdded: '0.24'
|
2426
3134
|
EnforcedStyle: is_a?
|
@@ -2428,6 +3136,16 @@ Style/ClassCheck:
|
|
2428
3136
|
- is_a?
|
2429
3137
|
- kind_of?
|
2430
3138
|
|
3139
|
+
Style/ClassEqualityComparison:
|
3140
|
+
Description: 'Enforces the use of `Object#instance_of?` instead of class comparison for equality.'
|
3141
|
+
StyleGuide: '#instance-of-vs-class-comparison'
|
3142
|
+
Enabled: true
|
3143
|
+
VersionAdded: '0.93'
|
3144
|
+
IgnoredMethods:
|
3145
|
+
- ==
|
3146
|
+
- equal?
|
3147
|
+
- eql?
|
3148
|
+
|
2431
3149
|
Style/ClassMethods:
|
2432
3150
|
Description: 'Use self when defining module/class methods.'
|
2433
3151
|
StyleGuide: '#def-self-class-methods'
|
@@ -2435,19 +3153,36 @@ Style/ClassMethods:
|
|
2435
3153
|
VersionAdded: '0.9'
|
2436
3154
|
VersionChanged: '0.20'
|
2437
3155
|
|
3156
|
+
Style/ClassMethodsDefinitions:
|
3157
|
+
Description: 'Enforces using `def self.method_name` or `class << self` to define class methods.'
|
3158
|
+
StyleGuide: '#def-self-class-methods'
|
3159
|
+
Enabled: false
|
3160
|
+
VersionAdded: '0.89'
|
3161
|
+
EnforcedStyle: def_self
|
3162
|
+
SupportedStyles:
|
3163
|
+
- def_self
|
3164
|
+
- self_class
|
3165
|
+
|
2438
3166
|
Style/ClassVars:
|
2439
3167
|
Description: 'Avoid the use of class variables.'
|
2440
3168
|
StyleGuide: '#no-class-vars'
|
2441
3169
|
Enabled: true
|
2442
3170
|
VersionAdded: '0.13'
|
2443
3171
|
|
3172
|
+
Style/CollectionCompact:
|
3173
|
+
Description: 'Use `{Array,Hash}#{compact,compact!}` instead of custom logic to reject nils.'
|
3174
|
+
Enabled: true
|
3175
|
+
Safe: false
|
3176
|
+
VersionAdded: '1.2'
|
3177
|
+
VersionChanged: '1.3'
|
3178
|
+
|
2444
3179
|
# Align with the style guide.
|
2445
3180
|
Style/CollectionMethods:
|
2446
3181
|
Description: 'Preferred collection methods.'
|
2447
|
-
StyleGuide: '#map-find-select-reduce-size'
|
3182
|
+
StyleGuide: '#map-find-select-reduce-include-size'
|
2448
3183
|
Enabled: false
|
2449
3184
|
VersionAdded: '0.9'
|
2450
|
-
VersionChanged: '
|
3185
|
+
VersionChanged: '1.7'
|
2451
3186
|
Safe: false
|
2452
3187
|
# Mapping from undesired method to desired method
|
2453
3188
|
# e.g. to use `detect` over `find`:
|
@@ -2461,6 +3196,12 @@ Style/CollectionMethods:
|
|
2461
3196
|
inject: 'reduce'
|
2462
3197
|
detect: 'find'
|
2463
3198
|
find_all: 'select'
|
3199
|
+
member?: 'include?'
|
3200
|
+
# Methods in this array accept a final symbol as an implicit block
|
3201
|
+
# eg. `inject(:+)`
|
3202
|
+
MethodsAcceptingSymbol:
|
3203
|
+
- inject
|
3204
|
+
- reduce
|
2464
3205
|
|
2465
3206
|
Style/ColonMethodCall:
|
2466
3207
|
Description: 'Do not use :: for method call.'
|
@@ -2474,6 +3215,14 @@ Style/ColonMethodDefinition:
|
|
2474
3215
|
Enabled: true
|
2475
3216
|
VersionAdded: '0.52'
|
2476
3217
|
|
3218
|
+
Style/CombinableLoops:
|
3219
|
+
Description: >-
|
3220
|
+
Checks for places where multiple consecutive loops over the same data
|
3221
|
+
can be combined into a single loop.
|
3222
|
+
Enabled: true
|
3223
|
+
Safe: false
|
3224
|
+
VersionAdded: '0.90'
|
3225
|
+
|
2477
3226
|
Style/CommandLiteral:
|
2478
3227
|
Description: 'Use `` or %x around command literals.'
|
2479
3228
|
StyleGuide: '#percent-x'
|
@@ -2495,22 +3244,26 @@ Style/CommandLiteral:
|
|
2495
3244
|
Style/CommentAnnotation:
|
2496
3245
|
Description: >-
|
2497
3246
|
Checks formatting of special comments
|
2498
|
-
(TODO, FIXME, OPTIMIZE, HACK, REVIEW).
|
3247
|
+
(TODO, FIXME, OPTIMIZE, HACK, REVIEW, NOTE).
|
2499
3248
|
StyleGuide: '#annotate-keywords'
|
2500
3249
|
Enabled: true
|
2501
3250
|
VersionAdded: '0.10'
|
2502
|
-
VersionChanged: '
|
3251
|
+
VersionChanged: '1.20'
|
2503
3252
|
Keywords:
|
2504
3253
|
- TODO
|
2505
3254
|
- FIXME
|
2506
3255
|
- OPTIMIZE
|
2507
3256
|
- HACK
|
2508
3257
|
- REVIEW
|
3258
|
+
- NOTE
|
3259
|
+
RequireColon: true
|
2509
3260
|
|
2510
3261
|
Style/CommentedKeyword:
|
2511
3262
|
Description: 'Do not place comments on the same line as certain keywords.'
|
2512
3263
|
Enabled: true
|
3264
|
+
SafeAutoCorrect: false
|
2513
3265
|
VersionAdded: '0.51'
|
3266
|
+
VersionChanged: '1.19'
|
2514
3267
|
|
2515
3268
|
Style/ConditionalAssignment:
|
2516
3269
|
Description: >-
|
@@ -2539,6 +3292,8 @@ Style/ConstantVisibility:
|
|
2539
3292
|
visibility declarations.
|
2540
3293
|
Enabled: false
|
2541
3294
|
VersionAdded: '0.66'
|
3295
|
+
VersionChanged: '1.10'
|
3296
|
+
IgnoreModules: false
|
2542
3297
|
|
2543
3298
|
# Checks that you have put a copyright in a comment before any code.
|
2544
3299
|
#
|
@@ -2570,7 +3325,8 @@ Style/DateTime:
|
|
2570
3325
|
StyleGuide: '#date--time'
|
2571
3326
|
Enabled: false
|
2572
3327
|
VersionAdded: '0.51'
|
2573
|
-
VersionChanged: '0.
|
3328
|
+
VersionChanged: '0.92'
|
3329
|
+
SafeAutoCorrect: false
|
2574
3330
|
AllowCoercion: false
|
2575
3331
|
|
2576
3332
|
Style/DefWithParentheses:
|
@@ -2587,10 +3343,28 @@ Style/Dir:
|
|
2587
3343
|
Enabled: true
|
2588
3344
|
VersionAdded: '0.50'
|
2589
3345
|
|
3346
|
+
Style/DisableCopsWithinSourceCodeDirective:
|
3347
|
+
Description: >-
|
3348
|
+
Forbids disabling/enabling cops within source code.
|
3349
|
+
Enabled: false
|
3350
|
+
VersionAdded: '0.82'
|
3351
|
+
VersionChanged: '1.9'
|
3352
|
+
AllowedCops: []
|
3353
|
+
|
3354
|
+
Style/DocumentDynamicEvalDefinition:
|
3355
|
+
Description: >-
|
3356
|
+
When using `class_eval` (or other `eval`) with string interpolation,
|
3357
|
+
add a comment block showing its appearance if interpolated.
|
3358
|
+
StyleGuide: '#eval-comment-docs'
|
3359
|
+
Enabled: false
|
3360
|
+
VersionAdded: '1.1'
|
3361
|
+
VersionChanged: '1.3'
|
3362
|
+
|
2590
3363
|
Style/Documentation:
|
2591
3364
|
Description: 'Document classes and non-namespace modules.'
|
2592
3365
|
Enabled: false
|
2593
3366
|
VersionAdded: '0.9'
|
3367
|
+
AllowedConstants: []
|
2594
3368
|
Exclude:
|
2595
3369
|
- 'spec/**/*'
|
2596
3370
|
- 'test/**/*'
|
@@ -2614,6 +3388,12 @@ Style/DoubleNegation:
|
|
2614
3388
|
StyleGuide: '#no-bang-bang'
|
2615
3389
|
Enabled: false
|
2616
3390
|
VersionAdded: '0.19'
|
3391
|
+
VersionChanged: '1.2'
|
3392
|
+
EnforcedStyle: allowed_in_returns
|
3393
|
+
SafeAutoCorrect: false
|
3394
|
+
SupportedStyles:
|
3395
|
+
- allowed_in_returns
|
3396
|
+
- forbidden
|
2617
3397
|
|
2618
3398
|
Style/EachForSimpleLoop:
|
2619
3399
|
Description: >-
|
@@ -2686,6 +3466,18 @@ Style/EndBlock:
|
|
2686
3466
|
StyleGuide: '#no-END-blocks'
|
2687
3467
|
Enabled: true
|
2688
3468
|
VersionAdded: '0.9'
|
3469
|
+
VersionChanged: '0.81'
|
3470
|
+
|
3471
|
+
Style/EndlessMethod:
|
3472
|
+
Description: 'Avoid the use of multi-lined endless method definitions.'
|
3473
|
+
StyleGuide: '#endless-methods'
|
3474
|
+
Enabled: true
|
3475
|
+
VersionAdded: '1.8'
|
3476
|
+
EnforcedStyle: allow_single_line
|
3477
|
+
SupportedStyles:
|
3478
|
+
- allow_single_line
|
3479
|
+
- allow_always
|
3480
|
+
- disallow
|
2689
3481
|
|
2690
3482
|
Style/EvalWithLocation:
|
2691
3483
|
Description: 'Pass `__FILE__` and `__LINE__` to `eval` method, as they are used by backtraces.'
|
@@ -2704,12 +3496,46 @@ Style/ExpandPathArguments:
|
|
2704
3496
|
Enabled: true
|
2705
3497
|
VersionAdded: '0.53'
|
2706
3498
|
|
3499
|
+
Style/ExplicitBlockArgument:
|
3500
|
+
Description: >-
|
3501
|
+
Consider using explicit block argument to avoid writing block literal
|
3502
|
+
that just passes its arguments to another block.
|
3503
|
+
StyleGuide: '#block-argument'
|
3504
|
+
Enabled: true
|
3505
|
+
VersionAdded: '0.89'
|
3506
|
+
VersionChanged: '1.8'
|
3507
|
+
|
3508
|
+
Style/ExponentialNotation:
|
3509
|
+
Description: 'When using exponential notation, favor a mantissa between 1 (inclusive) and 10 (exclusive).'
|
3510
|
+
StyleGuide: '#exponential-notation'
|
3511
|
+
Enabled: true
|
3512
|
+
VersionAdded: '0.82'
|
3513
|
+
EnforcedStyle: scientific
|
3514
|
+
SupportedStyles:
|
3515
|
+
- scientific
|
3516
|
+
- engineering
|
3517
|
+
- integral
|
3518
|
+
|
3519
|
+
Style/FileRead:
|
3520
|
+
Description: 'Favor `File.(bin)read` convenience methods.'
|
3521
|
+
StyleGuide: '#file-read'
|
3522
|
+
Enabled: true
|
3523
|
+
VersionAdded: '1.24'
|
3524
|
+
|
3525
|
+
Style/FileWrite:
|
3526
|
+
Description: 'Favor `File.(bin)write` convenience methods.'
|
3527
|
+
StyleGuide: '#file-write'
|
3528
|
+
Enabled: true
|
3529
|
+
VersionAdded: '1.24'
|
3530
|
+
|
2707
3531
|
Style/FloatDivision:
|
2708
3532
|
Description: 'For performing float division, coerce one side only.'
|
2709
3533
|
StyleGuide: '#float-division'
|
2710
|
-
Reference: 'https://
|
3534
|
+
Reference: 'https://blog.rubystyle.guide/ruby/2019/06/21/float-division.html'
|
2711
3535
|
Enabled: true
|
2712
3536
|
VersionAdded: '0.72'
|
3537
|
+
VersionChanged: '1.9'
|
3538
|
+
Safe: false
|
2713
3539
|
EnforcedStyle: single_coerce
|
2714
3540
|
SupportedStyles:
|
2715
3541
|
- left_coerce
|
@@ -2751,8 +3577,13 @@ Style/FormatStringToken:
|
|
2751
3577
|
# Prefer simple looking "template" style tokens like `%{name}`, `%{age}`
|
2752
3578
|
- template
|
2753
3579
|
- unannotated
|
3580
|
+
# `MaxUnannotatedPlaceholdersAllowed` defines the number of `unannotated`
|
3581
|
+
# style token in a format string to be allowed when enforced style is not
|
3582
|
+
# `unannotated`.
|
3583
|
+
MaxUnannotatedPlaceholdersAllowed: 1
|
2754
3584
|
VersionAdded: '0.49'
|
2755
|
-
VersionChanged: '0
|
3585
|
+
VersionChanged: '1.0'
|
3586
|
+
IgnoredMethods: []
|
2756
3587
|
|
2757
3588
|
Style/FrozenStringLiteralComment:
|
2758
3589
|
Description: >-
|
@@ -2765,13 +3596,23 @@ Style/FrozenStringLiteralComment:
|
|
2765
3596
|
SupportedStyles:
|
2766
3597
|
# `always` will always add the frozen string literal comment to a file
|
2767
3598
|
# regardless of the Ruby version or if `freeze` or `<<` are called on a
|
2768
|
-
# string literal.
|
2769
|
-
# possible that this will create errors in Ruby 2.3.0+.
|
3599
|
+
# string literal. It is possible that this will create errors.
|
2770
3600
|
- always
|
3601
|
+
# `always_true` will add the frozen string literal comment to a file,
|
3602
|
+
# similarly to the `always` style, but will also change any disabled
|
3603
|
+
# comments (e.g. `# frozen_string_literal: false`) to be enabled.
|
3604
|
+
- always_true
|
2771
3605
|
# `never` will enforce that the frozen string literal comment does not
|
2772
3606
|
# exist in a file.
|
2773
3607
|
- never
|
2774
|
-
|
3608
|
+
SafeAutoCorrect: false
|
3609
|
+
|
3610
|
+
Style/GlobalStdStream:
|
3611
|
+
Description: 'Enforces the use of `$stdout/$stderr/$stdin` instead of `STDOUT/STDERR/STDIN`.'
|
3612
|
+
StyleGuide: '#global-stdout'
|
3613
|
+
Enabled: true
|
3614
|
+
VersionAdded: '0.89'
|
3615
|
+
SafeAutoCorrect: false
|
2775
3616
|
|
2776
3617
|
Style/GlobalVars:
|
2777
3618
|
Description: 'Do not introduce global variables.'
|
@@ -2792,6 +3633,52 @@ Style/GuardClause:
|
|
2792
3633
|
# needs to have to trigger this cop
|
2793
3634
|
MinBodyLength: 1
|
2794
3635
|
|
3636
|
+
Style/HashAsLastArrayItem:
|
3637
|
+
Description: >-
|
3638
|
+
Checks for presence or absence of braces around hash literal as a last
|
3639
|
+
array item depending on configuration.
|
3640
|
+
StyleGuide: '#hash-literal-as-last-array-item'
|
3641
|
+
Enabled: true
|
3642
|
+
VersionAdded: '0.88'
|
3643
|
+
EnforcedStyle: braces
|
3644
|
+
SupportedStyles:
|
3645
|
+
- braces
|
3646
|
+
- no_braces
|
3647
|
+
|
3648
|
+
Style/HashConversion:
|
3649
|
+
Description: 'Avoid Hash[] in favor of ary.to_h or literal hashes.'
|
3650
|
+
StyleGuide: '#avoid-hash-constructor'
|
3651
|
+
Enabled: true
|
3652
|
+
VersionAdded: '1.10'
|
3653
|
+
VersionChanged: '1.11'
|
3654
|
+
AllowSplatArgument: true
|
3655
|
+
|
3656
|
+
Style/HashEachMethods:
|
3657
|
+
Description: 'Use Hash#each_key and Hash#each_value.'
|
3658
|
+
StyleGuide: '#hash-each'
|
3659
|
+
Enabled: true
|
3660
|
+
Safe: false
|
3661
|
+
VersionAdded: '0.80'
|
3662
|
+
VersionChanged: '1.16'
|
3663
|
+
AllowedReceivers: []
|
3664
|
+
|
3665
|
+
Style/HashExcept:
|
3666
|
+
Description: >-
|
3667
|
+
Checks for usages of `Hash#reject`, `Hash#select`, and `Hash#filter` methods
|
3668
|
+
that can be replaced with `Hash#except` method.
|
3669
|
+
Enabled: true
|
3670
|
+
VersionAdded: '1.7'
|
3671
|
+
|
3672
|
+
Style/HashLikeCase:
|
3673
|
+
Description: >-
|
3674
|
+
Checks for places where `case-when` represents a simple 1:1
|
3675
|
+
mapping and can be replaced with a hash lookup.
|
3676
|
+
Enabled: true
|
3677
|
+
VersionAdded: '0.88'
|
3678
|
+
# `MinBranchesCount` defines the number of branches `case` needs to have
|
3679
|
+
# to trigger this cop
|
3680
|
+
MinBranchesCount: 3
|
3681
|
+
|
2795
3682
|
Style/HashSyntax:
|
2796
3683
|
Description: >-
|
2797
3684
|
Prefer Ruby 1.9 hash syntax { a: 1, b: 2 } over 1.8 syntax
|
@@ -2799,7 +3686,7 @@ Style/HashSyntax:
|
|
2799
3686
|
StyleGuide: '#hash-literals'
|
2800
3687
|
Enabled: true
|
2801
3688
|
VersionAdded: '0.9'
|
2802
|
-
VersionChanged: '
|
3689
|
+
VersionChanged: '1.24'
|
2803
3690
|
EnforcedStyle: ruby19
|
2804
3691
|
SupportedStyles:
|
2805
3692
|
# checks for 1.9 syntax (e.g. {a: 1}) for all symbol keys
|
@@ -2810,24 +3697,48 @@ Style/HashSyntax:
|
|
2810
3697
|
- no_mixed_keys
|
2811
3698
|
# enforces both ruby19 and no_mixed_keys styles
|
2812
3699
|
- ruby19_no_mixed_keys
|
3700
|
+
# Force hashes that have a hash value omission
|
3701
|
+
EnforcedShorthandSyntax: always
|
3702
|
+
SupportedShorthandSyntax:
|
3703
|
+
# forces use of the 3.1 syntax (e.g. {foo:}) when the hash key and value are the same.
|
3704
|
+
- always
|
3705
|
+
# forces use of explicit hash literal value.
|
3706
|
+
- never
|
2813
3707
|
# Force hashes that have a symbol value to use hash rockets
|
2814
3708
|
UseHashRocketsWithSymbolValues: false
|
2815
3709
|
# Do not suggest { a?: 1 } over { :a? => 1 } in ruby19 style
|
2816
3710
|
PreferHashRocketsForNonAlnumEndingSymbols: false
|
2817
3711
|
|
3712
|
+
Style/HashTransformKeys:
|
3713
|
+
Description: 'Prefer `transform_keys` over `each_with_object`, `map`, or `to_h`.'
|
3714
|
+
Enabled: true
|
3715
|
+
VersionAdded: '0.80'
|
3716
|
+
VersionChanged: '0.90'
|
3717
|
+
Safe: false
|
3718
|
+
|
3719
|
+
Style/HashTransformValues:
|
3720
|
+
Description: 'Prefer `transform_values` over `each_with_object`, `map`, or `to_h`.'
|
3721
|
+
Enabled: true
|
3722
|
+
VersionAdded: '0.80'
|
3723
|
+
VersionChanged: '0.90'
|
3724
|
+
Safe: false
|
3725
|
+
|
2818
3726
|
Style/IdenticalConditionalBranches:
|
2819
3727
|
Description: >-
|
2820
3728
|
Checks that conditional statements do not have an identical
|
2821
3729
|
line at the end of each branch, which can validly be moved
|
2822
3730
|
out of the conditional.
|
2823
3731
|
Enabled: true
|
3732
|
+
SafeAutoCorrect: false
|
2824
3733
|
VersionAdded: '0.36'
|
3734
|
+
VersionChanged: '1.19'
|
2825
3735
|
|
2826
3736
|
Style/IfInsideElse:
|
2827
3737
|
Description: 'Finds if nodes inside else, which can be converted to elsif.'
|
2828
3738
|
Enabled: true
|
2829
3739
|
AllowIfModifier: false
|
2830
3740
|
VersionAdded: '0.36'
|
3741
|
+
VersionChanged: '1.3'
|
2831
3742
|
|
2832
3743
|
Style/IfUnlessModifier:
|
2833
3744
|
Description: >-
|
@@ -2843,12 +3754,22 @@ Style/IfUnlessModifierOfIfUnless:
|
|
2843
3754
|
Avoid modifier if/unless usage on conditionals.
|
2844
3755
|
Enabled: true
|
2845
3756
|
VersionAdded: '0.39'
|
3757
|
+
VersionChanged: '0.87'
|
3758
|
+
|
3759
|
+
Style/IfWithBooleanLiteralBranches:
|
3760
|
+
Description: 'Checks for redundant `if` with boolean literal branches.'
|
3761
|
+
Enabled: true
|
3762
|
+
VersionAdded: '1.9'
|
3763
|
+
SafeAutoCorrect: false
|
3764
|
+
AllowedMethods:
|
3765
|
+
- nonzero?
|
2846
3766
|
|
2847
3767
|
Style/IfWithSemicolon:
|
2848
3768
|
Description: 'Do not use if x; .... Use the ternary operator instead.'
|
2849
3769
|
StyleGuide: '#no-semicolon-ifs'
|
2850
3770
|
Enabled: true
|
2851
3771
|
VersionAdded: '0.9'
|
3772
|
+
VersionChanged: '0.83'
|
2852
3773
|
|
2853
3774
|
Style/ImplicitRuntimeError:
|
2854
3775
|
Description: >-
|
@@ -2857,13 +3778,21 @@ Style/ImplicitRuntimeError:
|
|
2857
3778
|
Enabled: false
|
2858
3779
|
VersionAdded: '0.41'
|
2859
3780
|
|
3781
|
+
Style/InPatternThen:
|
3782
|
+
Description: 'Checks for `in;` uses in `case` expressions.'
|
3783
|
+
StyleGuide: '#no-in-pattern-semicolons'
|
3784
|
+
Enabled: true
|
3785
|
+
VersionAdded: '1.16'
|
3786
|
+
|
2860
3787
|
Style/InfiniteLoop:
|
2861
|
-
Description:
|
3788
|
+
Description: >-
|
3789
|
+
Use Kernel#loop for infinite loops.
|
3790
|
+
This cop is unsafe if the body may raise a `StopIteration` exception.
|
3791
|
+
Safe: false
|
2862
3792
|
StyleGuide: '#infinite-loop'
|
2863
3793
|
Enabled: true
|
2864
3794
|
VersionAdded: '0.26'
|
2865
3795
|
VersionChanged: '0.61'
|
2866
|
-
SafeAutoCorrect: true
|
2867
3796
|
|
2868
3797
|
Style/InlineComment:
|
2869
3798
|
Description: 'Avoid trailing inline comments.'
|
@@ -2901,11 +3830,23 @@ Style/IpAddresses:
|
|
2901
3830
|
Description: "Don't include literal IP addresses in code."
|
2902
3831
|
Enabled: false
|
2903
3832
|
VersionAdded: '0.58'
|
2904
|
-
VersionChanged: '0.
|
3833
|
+
VersionChanged: '0.91'
|
2905
3834
|
# Allow addresses to be permitted
|
2906
3835
|
AllowedAddresses:
|
2907
3836
|
- "::"
|
2908
3837
|
# :: is a valid IPv6 address, but could potentially be legitimately in code
|
3838
|
+
Exclude:
|
3839
|
+
- '**/*.gemfile'
|
3840
|
+
- '**/Gemfile'
|
3841
|
+
- '**/gems.rb'
|
3842
|
+
- '**/*.gemspec'
|
3843
|
+
|
3844
|
+
Style/KeywordParametersOrder:
|
3845
|
+
Description: 'Enforces that optional keyword parameters are placed at the end of the parameters list.'
|
3846
|
+
StyleGuide: '#keyword-parameters-order'
|
3847
|
+
Enabled: true
|
3848
|
+
VersionAdded: '0.90'
|
3849
|
+
VersionChanged: '1.7'
|
2909
3850
|
|
2910
3851
|
Style/Lambda:
|
2911
3852
|
Description: 'Use the new lambda literal syntax for single-line blocks.'
|
@@ -2923,7 +3864,7 @@ Style/LambdaCall:
|
|
2923
3864
|
Description: 'Use lambda.call(...) instead of lambda.(...).'
|
2924
3865
|
StyleGuide: '#proc-call'
|
2925
3866
|
Enabled: true
|
2926
|
-
VersionAdded: '0.13
|
3867
|
+
VersionAdded: '0.13'
|
2927
3868
|
VersionChanged: '0.14'
|
2928
3869
|
EnforcedStyle: call
|
2929
3870
|
SupportedStyles:
|
@@ -2939,12 +3880,18 @@ Style/LineEndConcatenation:
|
|
2939
3880
|
VersionAdded: '0.18'
|
2940
3881
|
VersionChanged: '0.64'
|
2941
3882
|
|
3883
|
+
Style/MapToHash:
|
3884
|
+
Description: 'Prefer `to_h` with a block over `map.to_h`.'
|
3885
|
+
Enabled: true
|
3886
|
+
VersionAdded: '1.24'
|
3887
|
+
Safe: false
|
3888
|
+
|
2942
3889
|
Style/MethodCallWithArgsParentheses:
|
2943
3890
|
Description: 'Use parentheses for method calls with arguments.'
|
2944
3891
|
StyleGuide: '#method-invocation-parens'
|
2945
3892
|
Enabled: false
|
2946
3893
|
VersionAdded: '0.47'
|
2947
|
-
VersionChanged: '
|
3894
|
+
VersionChanged: '1.7'
|
2948
3895
|
IgnoreMacros: true
|
2949
3896
|
IgnoredMethods: []
|
2950
3897
|
IgnoredPatterns: []
|
@@ -2952,6 +3899,7 @@ Style/MethodCallWithArgsParentheses:
|
|
2952
3899
|
AllowParenthesesInMultilineCall: false
|
2953
3900
|
AllowParenthesesInChaining: false
|
2954
3901
|
AllowParenthesesInCamelCaseMethod: false
|
3902
|
+
AllowParenthesesInStringInterpolation: false
|
2955
3903
|
EnforcedStyle: require_parentheses
|
2956
3904
|
SupportedStyles:
|
2957
3905
|
- require_parentheses
|
@@ -2978,19 +3926,13 @@ Style/MethodDefParentheses:
|
|
2978
3926
|
StyleGuide: '#method-parens'
|
2979
3927
|
Enabled: true
|
2980
3928
|
VersionAdded: '0.16'
|
2981
|
-
VersionChanged: '
|
3929
|
+
VersionChanged: '1.7'
|
2982
3930
|
EnforcedStyle: require_parentheses
|
2983
3931
|
SupportedStyles:
|
2984
3932
|
- require_parentheses
|
2985
3933
|
- require_no_parentheses
|
2986
3934
|
- require_no_parentheses_except_multiline
|
2987
3935
|
|
2988
|
-
Style/MethodMissingSuper:
|
2989
|
-
Description: Checks for `method_missing` to call `super`.
|
2990
|
-
StyleGuide: '#no-method-missing'
|
2991
|
-
Enabled: true
|
2992
|
-
VersionAdded: '0.56'
|
2993
|
-
|
2994
3936
|
Style/MinMax:
|
2995
3937
|
Description: >-
|
2996
3938
|
Use `Enumerable#minmax` instead of `Enumerable#min`
|
@@ -3053,6 +3995,7 @@ Style/ModuleFunction:
|
|
3053
3995
|
SupportedStyles:
|
3054
3996
|
- module_function
|
3055
3997
|
- extend_self
|
3998
|
+
- forbidden
|
3056
3999
|
Autocorrect: false
|
3057
4000
|
SafeAutoCorrect: false
|
3058
4001
|
|
@@ -3075,6 +4018,12 @@ Style/MultilineIfThen:
|
|
3075
4018
|
VersionAdded: '0.9'
|
3076
4019
|
VersionChanged: '0.26'
|
3077
4020
|
|
4021
|
+
Style/MultilineInPatternThen:
|
4022
|
+
Description: 'Do not use `then` for multi-line `in` statement.'
|
4023
|
+
StyleGuide: '#no-then'
|
4024
|
+
Enabled: true
|
4025
|
+
VersionAdded: '1.16'
|
4026
|
+
|
3078
4027
|
Style/MultilineMemoization:
|
3079
4028
|
Description: 'Wrap multiline memoizations in a `begin` and `end` block.'
|
3080
4029
|
Enabled: true
|
@@ -3089,6 +4038,7 @@ Style/MultilineMethodSignature:
|
|
3089
4038
|
Description: 'Avoid multi-line method signatures.'
|
3090
4039
|
Enabled: false
|
3091
4040
|
VersionAdded: '0.59'
|
4041
|
+
VersionChanged: '1.7'
|
3092
4042
|
|
3093
4043
|
Style/MultilineTernaryOperator:
|
3094
4044
|
Description: >-
|
@@ -3097,6 +4047,7 @@ Style/MultilineTernaryOperator:
|
|
3097
4047
|
StyleGuide: '#no-multiline-ternary'
|
3098
4048
|
Enabled: true
|
3099
4049
|
VersionAdded: '0.9'
|
4050
|
+
VersionChanged: '0.86'
|
3100
4051
|
|
3101
4052
|
Style/MultilineWhenThen:
|
3102
4053
|
Description: 'Do not use then for multi-line when statement.'
|
@@ -3110,12 +4061,15 @@ Style/MultipleComparison:
|
|
3110
4061
|
use Array#include? instead.
|
3111
4062
|
Enabled: true
|
3112
4063
|
VersionAdded: '0.49'
|
4064
|
+
VersionChanged: '1.1'
|
4065
|
+
AllowMethodComparison: true
|
3113
4066
|
|
3114
4067
|
Style/MutableConstant:
|
3115
4068
|
Description: 'Do not assign mutable objects to constants.'
|
3116
4069
|
Enabled: true
|
3117
4070
|
VersionAdded: '0.34'
|
3118
|
-
VersionChanged: '
|
4071
|
+
VersionChanged: '1.8'
|
4072
|
+
SafeAutoCorrect: false
|
3119
4073
|
EnforcedStyle: literals
|
3120
4074
|
SupportedStyles:
|
3121
4075
|
# literals: freeze literals assigned to constants
|
@@ -3144,6 +4098,13 @@ Style/NegatedIf:
|
|
3144
4098
|
- prefix
|
3145
4099
|
- postfix
|
3146
4100
|
|
4101
|
+
Style/NegatedIfElseCondition:
|
4102
|
+
Description: >-
|
4103
|
+
This cop checks for uses of `if-else` and ternary operators with a negated condition
|
4104
|
+
which can be simplified by inverting condition and swapping branches.
|
4105
|
+
Enabled: true
|
4106
|
+
VersionAdded: '1.2'
|
4107
|
+
|
3147
4108
|
Style/NegatedUnless:
|
3148
4109
|
Description: 'Favor if over unless for negative conditions.'
|
3149
4110
|
StyleGuide: '#if-for-negatives'
|
@@ -3201,6 +4162,7 @@ Style/NestedTernaryOperator:
|
|
3201
4162
|
StyleGuide: '#no-nested-ternary'
|
3202
4163
|
Enabled: true
|
3203
4164
|
VersionAdded: '0.9'
|
4165
|
+
VersionChanged: '0.86'
|
3204
4166
|
|
3205
4167
|
Style/Next:
|
3206
4168
|
Description: 'Use `next` to skip iteration instead of a condition at the end.'
|
@@ -3230,6 +4192,12 @@ Style/NilComparison:
|
|
3230
4192
|
- predicate
|
3231
4193
|
- comparison
|
3232
4194
|
|
4195
|
+
Style/NilLambda:
|
4196
|
+
Description: 'Prefer `-> {}` to `-> { nil }`.'
|
4197
|
+
Enabled: true
|
4198
|
+
VersionAdded: '1.3'
|
4199
|
+
VersionChanged: '1.15'
|
4200
|
+
|
3233
4201
|
Style/NonNilCheck:
|
3234
4202
|
Description: 'Checks for redundant nil checks.'
|
3235
4203
|
StyleGuide: '#no-non-nil-checks'
|
@@ -3251,6 +4219,21 @@ Style/Not:
|
|
3251
4219
|
VersionAdded: '0.9'
|
3252
4220
|
VersionChanged: '0.20'
|
3253
4221
|
|
4222
|
+
Style/NumberedParameters:
|
4223
|
+
Description: 'Restrict the usage of numbered parameters.'
|
4224
|
+
Enabled: true
|
4225
|
+
VersionAdded: '1.22'
|
4226
|
+
EnforcedStyle: allow_single_line
|
4227
|
+
SupportedStyles:
|
4228
|
+
- allow_single_line
|
4229
|
+
- disallow
|
4230
|
+
|
4231
|
+
Style/NumberedParametersLimit:
|
4232
|
+
Description: 'Avoid excessive numbered params in a single block.'
|
4233
|
+
Enabled: true
|
4234
|
+
VersionAdded: '1.22'
|
4235
|
+
Max: 1
|
4236
|
+
|
3254
4237
|
Style/NumericLiteralPrefix:
|
3255
4238
|
Description: 'Use smallcase prefixes for numeric literals.'
|
3256
4239
|
StyleGuide: '#numeric-literal-prefixes'
|
@@ -3261,7 +4244,6 @@ Style/NumericLiteralPrefix:
|
|
3261
4244
|
- zero_with_o
|
3262
4245
|
- zero_only
|
3263
4246
|
|
3264
|
-
|
3265
4247
|
Style/NumericLiterals:
|
3266
4248
|
Description: >-
|
3267
4249
|
Add underscores to large numeric literals to improve their
|
@@ -3272,6 +4254,8 @@ Style/NumericLiterals:
|
|
3272
4254
|
VersionChanged: '0.48'
|
3273
4255
|
MinDigits: 5
|
3274
4256
|
Strict: false
|
4257
|
+
# You can specify allowed numbers. (e.g. port number 3000, 8080, and etc)
|
4258
|
+
AllowedNumbers: []
|
3275
4259
|
|
3276
4260
|
Style/NumericPredicate:
|
3277
4261
|
Description: >-
|
@@ -3283,7 +4267,6 @@ Style/NumericPredicate:
|
|
3283
4267
|
# object. Switching these methods has to be done with knowledge of the types
|
3284
4268
|
# of the variables which rubocop doesn't have.
|
3285
4269
|
SafeAutoCorrect: false
|
3286
|
-
AutoCorrect: false
|
3287
4270
|
Enabled: true
|
3288
4271
|
VersionAdded: '0.42'
|
3289
4272
|
VersionChanged: '0.59'
|
@@ -3299,12 +4282,23 @@ Style/NumericPredicate:
|
|
3299
4282
|
|
3300
4283
|
Style/OneLineConditional:
|
3301
4284
|
Description: >-
|
3302
|
-
Favor the ternary operator(?:) over
|
3303
|
-
if/then/else/end constructs.
|
4285
|
+
Favor the ternary operator (?:) or multi-line constructs over
|
4286
|
+
single-line if/then/else/end constructs.
|
3304
4287
|
StyleGuide: '#ternary-operator'
|
3305
4288
|
Enabled: true
|
4289
|
+
AlwaysCorrectToMultiline: false
|
3306
4290
|
VersionAdded: '0.9'
|
3307
|
-
VersionChanged: '0.
|
4291
|
+
VersionChanged: '0.90'
|
4292
|
+
|
4293
|
+
Style/OpenStructUse:
|
4294
|
+
Description: >-
|
4295
|
+
Avoid using OpenStruct. As of Ruby 3.0, use is officially discouraged due to performance,
|
4296
|
+
version compatibility, and potential security issues.
|
4297
|
+
Reference:
|
4298
|
+
- https://docs.ruby-lang.org/en/3.0.0/OpenStruct.html#class-OpenStruct-label-Caveats
|
4299
|
+
|
4300
|
+
Enabled: true
|
4301
|
+
VersionAdded: '1.23'
|
3308
4302
|
|
3309
4303
|
Style/OptionHash:
|
3310
4304
|
Description: "Don't use option hashes when you can use keyword arguments."
|
@@ -3318,6 +4312,7 @@ Style/OptionHash:
|
|
3318
4312
|
- args
|
3319
4313
|
- params
|
3320
4314
|
- parameters
|
4315
|
+
Allowlist: []
|
3321
4316
|
|
3322
4317
|
Style/OptionalArguments:
|
3323
4318
|
Description: >-
|
@@ -3325,7 +4320,18 @@ Style/OptionalArguments:
|
|
3325
4320
|
of the argument list.
|
3326
4321
|
StyleGuide: '#optional-arguments'
|
3327
4322
|
Enabled: true
|
4323
|
+
Safe: false
|
3328
4324
|
VersionAdded: '0.33'
|
4325
|
+
VersionChanged: '0.83'
|
4326
|
+
|
4327
|
+
Style/OptionalBooleanParameter:
|
4328
|
+
Description: 'Use keyword arguments when defining method with boolean argument.'
|
4329
|
+
StyleGuide: '#boolean-keyword-arguments'
|
4330
|
+
Enabled: true
|
4331
|
+
Safe: false
|
4332
|
+
VersionAdded: '0.89'
|
4333
|
+
AllowedMethods:
|
4334
|
+
- respond_to_missing?
|
3329
4335
|
|
3330
4336
|
Style/OrAssignment:
|
3331
4337
|
Description: 'Recommend usage of double pipe equals (||=) where applicable.'
|
@@ -3372,7 +4378,7 @@ Style/PercentLiteralDelimiters:
|
|
3372
4378
|
'%w': '{}'
|
3373
4379
|
'%W': '{}'
|
3374
4380
|
'%x': '{}'
|
3375
|
-
VersionChanged: '0.48
|
4381
|
+
VersionChanged: '0.48'
|
3376
4382
|
|
3377
4383
|
Style/PercentQLiterals:
|
3378
4384
|
Description: 'Checks if uses of %Q/%q match the configured preference.'
|
@@ -3408,16 +4414,27 @@ Style/Proc:
|
|
3408
4414
|
VersionAdded: '0.9'
|
3409
4415
|
VersionChanged: '0.18'
|
3410
4416
|
|
4417
|
+
Style/QuotedSymbols:
|
4418
|
+
Description: 'Use a consistent style for quoted symbols.'
|
4419
|
+
Enabled: true
|
4420
|
+
VersionAdded: '1.16'
|
4421
|
+
EnforcedStyle: same_as_string_literals
|
4422
|
+
SupportedStyles:
|
4423
|
+
- same_as_string_literals
|
4424
|
+
- single_quotes
|
4425
|
+
- double_quotes
|
4426
|
+
|
3411
4427
|
Style/RaiseArgs:
|
3412
4428
|
Description: 'Checks the arguments passed to raise/fail.'
|
3413
4429
|
StyleGuide: '#exception-class-messages'
|
3414
4430
|
Enabled: true
|
3415
4431
|
VersionAdded: '0.14'
|
3416
|
-
VersionChanged: '
|
4432
|
+
VersionChanged: '1.2'
|
3417
4433
|
EnforcedStyle: exploded
|
3418
4434
|
SupportedStyles:
|
3419
4435
|
- compact # raise Exception.new(msg)
|
3420
4436
|
- exploded # raise Exception, msg
|
4437
|
+
AllowedCompactTypes: []
|
3421
4438
|
|
3422
4439
|
Style/RandomWithOffset:
|
3423
4440
|
Description: >-
|
@@ -3427,6 +4444,27 @@ Style/RandomWithOffset:
|
|
3427
4444
|
Enabled: true
|
3428
4445
|
VersionAdded: '0.52'
|
3429
4446
|
|
4447
|
+
Style/RedundantArgument:
|
4448
|
+
Description: 'Check for a redundant argument passed to certain methods.'
|
4449
|
+
Enabled: true
|
4450
|
+
Safe: false
|
4451
|
+
VersionAdded: '1.4'
|
4452
|
+
VersionChanged: '1.7'
|
4453
|
+
Methods:
|
4454
|
+
# Array#join
|
4455
|
+
join: ''
|
4456
|
+
# String#split
|
4457
|
+
split: ' '
|
4458
|
+
# String#chomp
|
4459
|
+
chomp: "\n"
|
4460
|
+
# String#chomp!
|
4461
|
+
chomp!: "\n"
|
4462
|
+
|
4463
|
+
Style/RedundantAssignment:
|
4464
|
+
Description: 'Checks for redundant assignment before returning.'
|
4465
|
+
Enabled: true
|
4466
|
+
VersionAdded: '0.87'
|
4467
|
+
|
3430
4468
|
Style/RedundantBegin:
|
3431
4469
|
Description: "Don't use begin blocks when they are not needed."
|
3432
4470
|
StyleGuide: '#begin-implicit'
|
@@ -3456,6 +4494,27 @@ Style/RedundantException:
|
|
3456
4494
|
VersionAdded: '0.14'
|
3457
4495
|
VersionChanged: '0.29'
|
3458
4496
|
|
4497
|
+
Style/RedundantFetchBlock:
|
4498
|
+
Description: >-
|
4499
|
+
Use `fetch(key, value)` instead of `fetch(key) { value }`
|
4500
|
+
when value has Numeric, Rational, Complex, Symbol or String type, `false`, `true`, `nil` or is a constant.
|
4501
|
+
Reference: 'https://github.com/JuanitoFatas/fast-ruby#hashfetch-with-argument-vs-hashfetch--block-code'
|
4502
|
+
Enabled: true
|
4503
|
+
Safe: false
|
4504
|
+
# If enabled, this cop will autocorrect usages of
|
4505
|
+
# `fetch` being called with block returning a constant.
|
4506
|
+
# This can be dangerous since constants will not be defined at that moment.
|
4507
|
+
SafeForConstants: false
|
4508
|
+
VersionAdded: '0.86'
|
4509
|
+
|
4510
|
+
Style/RedundantFileExtensionInRequire:
|
4511
|
+
Description: >-
|
4512
|
+
Checks for the presence of superfluous `.rb` extension in
|
4513
|
+
the filename provided to `require` and `require_relative`.
|
4514
|
+
StyleGuide: '#no-explicit-rb-to-require'
|
4515
|
+
Enabled: true
|
4516
|
+
VersionAdded: '0.88'
|
4517
|
+
|
3459
4518
|
Style/RedundantFreeze:
|
3460
4519
|
Description: "Checks usages of Object#freeze on immutable objects."
|
3461
4520
|
Enabled: true
|
@@ -3478,6 +4537,16 @@ Style/RedundantPercentQ:
|
|
3478
4537
|
Enabled: true
|
3479
4538
|
VersionAdded: '0.76'
|
3480
4539
|
|
4540
|
+
Style/RedundantRegexpCharacterClass:
|
4541
|
+
Description: 'Checks for unnecessary single-element Regexp character classes.'
|
4542
|
+
Enabled: true
|
4543
|
+
VersionAdded: '0.85'
|
4544
|
+
|
4545
|
+
Style/RedundantRegexpEscape:
|
4546
|
+
Description: 'Checks for redundant escapes in Regexps.'
|
4547
|
+
Enabled: true
|
4548
|
+
VersionAdded: '0.85'
|
4549
|
+
|
3481
4550
|
Style/RedundantReturn:
|
3482
4551
|
Description: "Don't use return where it's not required."
|
3483
4552
|
StyleGuide: '#no-explicit-return'
|
@@ -3494,12 +4563,25 @@ Style/RedundantSelf:
|
|
3494
4563
|
VersionAdded: '0.10'
|
3495
4564
|
VersionChanged: '0.13'
|
3496
4565
|
|
4566
|
+
Style/RedundantSelfAssignment:
|
4567
|
+
Description: 'Checks for places where redundant assignments are made for in place modification methods.'
|
4568
|
+
Enabled: true
|
4569
|
+
Safe: false
|
4570
|
+
VersionAdded: '0.90'
|
4571
|
+
|
4572
|
+
Style/RedundantSelfAssignmentBranch:
|
4573
|
+
Description: 'Checks for places where conditional branch makes redundant self-assignment.'
|
4574
|
+
Enabled: true
|
4575
|
+
VersionAdded: '1.19'
|
4576
|
+
|
3497
4577
|
Style/RedundantSort:
|
3498
4578
|
Description: >-
|
3499
4579
|
Use `min` instead of `sort.first`,
|
3500
4580
|
`max_by` instead of `sort_by...last`, etc.
|
3501
4581
|
Enabled: true
|
3502
4582
|
VersionAdded: '0.76'
|
4583
|
+
VersionChanged: '1.22'
|
4584
|
+
Safe: false
|
3503
4585
|
|
3504
4586
|
Style/RedundantSortBy:
|
3505
4587
|
Description: 'Use `sort` instead of `sort_by { |x| x }`.'
|
@@ -3556,6 +4638,8 @@ Style/SafeNavigation:
|
|
3556
4638
|
This cop transforms usages of a method call safeguarded by
|
3557
4639
|
a check for the existence of the object to
|
3558
4640
|
safe navigation (`&.`).
|
4641
|
+
Auto-correction is unsafe as it assumes the object will
|
4642
|
+
be `nil` or truthy, but never `false`.
|
3559
4643
|
Enabled: true
|
3560
4644
|
VersionAdded: '0.43'
|
3561
4645
|
VersionChanged: '0.77'
|
@@ -3568,6 +4652,7 @@ Style/SafeNavigation:
|
|
3568
4652
|
- presence
|
3569
4653
|
- try
|
3570
4654
|
- try!
|
4655
|
+
SafeAutoCorrect: false
|
3571
4656
|
|
3572
4657
|
Style/Sample:
|
3573
4658
|
Description: >-
|
@@ -3577,6 +4662,12 @@ Style/Sample:
|
|
3577
4662
|
Enabled: true
|
3578
4663
|
VersionAdded: '0.30'
|
3579
4664
|
|
4665
|
+
Style/SelectByRegexp:
|
4666
|
+
Description: 'Prefer grep/grep_v to select/reject with a regexp match.'
|
4667
|
+
Enabled: true
|
4668
|
+
SafeAutoCorrect: false
|
4669
|
+
VersionAdded: '1.22'
|
4670
|
+
|
3580
4671
|
Style/SelfAssignment:
|
3581
4672
|
Description: >-
|
3582
4673
|
Checks for places where self-assignment shorthand should have
|
@@ -3613,11 +4704,17 @@ Style/SignalException:
|
|
3613
4704
|
- only_fail
|
3614
4705
|
- semantic
|
3615
4706
|
|
4707
|
+
Style/SingleArgumentDig:
|
4708
|
+
Description: 'Avoid using single argument dig method.'
|
4709
|
+
Enabled: true
|
4710
|
+
VersionAdded: '0.89'
|
4711
|
+
Safe: false
|
4712
|
+
|
3616
4713
|
Style/SingleLineBlockParams:
|
3617
4714
|
Description: 'Enforces the names of some block params.'
|
3618
4715
|
Enabled: false
|
3619
4716
|
VersionAdded: '0.16'
|
3620
|
-
VersionChanged: '
|
4717
|
+
VersionChanged: '1.6'
|
3621
4718
|
Methods:
|
3622
4719
|
- reduce:
|
3623
4720
|
- acc
|
@@ -3631,9 +4728,24 @@ Style/SingleLineMethods:
|
|
3631
4728
|
StyleGuide: '#no-single-line-methods'
|
3632
4729
|
Enabled: true
|
3633
4730
|
VersionAdded: '0.9'
|
3634
|
-
VersionChanged: '
|
4731
|
+
VersionChanged: '1.8'
|
3635
4732
|
AllowIfMethodIsEmpty: true
|
3636
4733
|
|
4734
|
+
Style/SlicingWithRange:
|
4735
|
+
Description: 'Checks array slicing is done with endless ranges when suitable.'
|
4736
|
+
Enabled: true
|
4737
|
+
VersionAdded: '0.83'
|
4738
|
+
Safe: false
|
4739
|
+
|
4740
|
+
Style/SoleNestedConditional:
|
4741
|
+
Description: >-
|
4742
|
+
Finds sole nested conditional nodes
|
4743
|
+
which can be merged into outer conditional node.
|
4744
|
+
Enabled: true
|
4745
|
+
VersionAdded: '0.89'
|
4746
|
+
VersionChanged: '1.5'
|
4747
|
+
AllowModifier: false
|
4748
|
+
|
3637
4749
|
Style/SpecialGlobalVars:
|
3638
4750
|
Description: 'Avoid Perl-style global variables.'
|
3639
4751
|
StyleGuide: '#no-cryptic-perlisms'
|
@@ -3641,6 +4753,7 @@ Style/SpecialGlobalVars:
|
|
3641
4753
|
VersionAdded: '0.13'
|
3642
4754
|
VersionChanged: '0.36'
|
3643
4755
|
SafeAutoCorrect: false
|
4756
|
+
RequireEnglish: true
|
3644
4757
|
EnforcedStyle: use_english_names
|
3645
4758
|
SupportedStyles:
|
3646
4759
|
- use_perl_names
|
@@ -3656,12 +4769,35 @@ Style/StabbyLambdaParentheses:
|
|
3656
4769
|
- require_parentheses
|
3657
4770
|
- require_no_parentheses
|
3658
4771
|
|
4772
|
+
Style/StaticClass:
|
4773
|
+
Description: 'Prefer modules to classes with only class methods.'
|
4774
|
+
StyleGuide: '#modules-vs-classes'
|
4775
|
+
Enabled: false
|
4776
|
+
Safe: false
|
4777
|
+
VersionAdded: '1.3'
|
4778
|
+
|
3659
4779
|
Style/StderrPuts:
|
3660
4780
|
Description: 'Use `warn` instead of `$stderr.puts`.'
|
3661
4781
|
StyleGuide: '#warn'
|
3662
4782
|
Enabled: true
|
3663
4783
|
VersionAdded: '0.51'
|
3664
4784
|
|
4785
|
+
Style/StringChars:
|
4786
|
+
Description: 'Checks for uses of `String#split` with empty string or regexp literal argument.'
|
4787
|
+
StyleGuide: '#string-chars'
|
4788
|
+
Enabled: true
|
4789
|
+
Safe: false
|
4790
|
+
VersionAdded: '1.12'
|
4791
|
+
|
4792
|
+
Style/StringConcatenation:
|
4793
|
+
Description: 'Checks for places where string concatenation can be replaced with string interpolation.'
|
4794
|
+
StyleGuide: '#string-interpolation'
|
4795
|
+
Enabled: true
|
4796
|
+
Safe: false
|
4797
|
+
VersionAdded: '0.89'
|
4798
|
+
VersionChanged: '1.18'
|
4799
|
+
Mode: aggressive
|
4800
|
+
|
3665
4801
|
Style/StringHashKeys:
|
3666
4802
|
Description: 'Prefer symbols instead of strings as hash keys.'
|
3667
4803
|
StyleGuide: '#symbols-as-keys'
|
@@ -3699,7 +4835,7 @@ Style/StringMethods:
|
|
3699
4835
|
Description: 'Checks if configured preferred methods are used over non-preferred.'
|
3700
4836
|
Enabled: false
|
3701
4837
|
VersionAdded: '0.34'
|
3702
|
-
VersionChanged: '0.34
|
4838
|
+
VersionChanged: '0.34'
|
3703
4839
|
# Mapping from undesired method to desired_method
|
3704
4840
|
# e.g. to use `to_sym` over `intern`:
|
3705
4841
|
#
|
@@ -3718,7 +4854,16 @@ Style/StructInheritance:
|
|
3718
4854
|
Description: 'Checks for inheritance from Struct.new.'
|
3719
4855
|
StyleGuide: '#no-extend-struct-new'
|
3720
4856
|
Enabled: true
|
4857
|
+
SafeAutoCorrect: false
|
3721
4858
|
VersionAdded: '0.29'
|
4859
|
+
VersionChanged: '1.20'
|
4860
|
+
|
4861
|
+
Style/SwapValues:
|
4862
|
+
Description: 'This cop enforces the use of shorthand-style swapping of 2 variables.'
|
4863
|
+
StyleGuide: '#values-swapping'
|
4864
|
+
Enabled: true
|
4865
|
+
VersionAdded: '1.1'
|
4866
|
+
SafeAutoCorrect: false
|
3722
4867
|
|
3723
4868
|
Style/SymbolArray:
|
3724
4869
|
Description: 'Use %i or %I for arrays of symbols.'
|
@@ -3740,9 +4885,10 @@ Style/SymbolLiteral:
|
|
3740
4885
|
Style/SymbolProc:
|
3741
4886
|
Description: 'Use symbols as procs instead of blocks when possible.'
|
3742
4887
|
Enabled: true
|
3743
|
-
|
4888
|
+
Safe: false
|
3744
4889
|
VersionAdded: '0.26'
|
3745
|
-
VersionChanged: '
|
4890
|
+
VersionChanged: '1.5'
|
4891
|
+
AllowMethodsWithArguments: false
|
3746
4892
|
# A list of method names to be ignored by the check.
|
3747
4893
|
# The names should be fairly unique, otherwise you'll end up ignoring lots of code.
|
3748
4894
|
IgnoredMethods:
|
@@ -3761,6 +4907,12 @@ Style/TernaryParentheses:
|
|
3761
4907
|
- require_parentheses_when_complex
|
3762
4908
|
AllowSafeAssignment: true
|
3763
4909
|
|
4910
|
+
Style/TopLevelMethodDefinition:
|
4911
|
+
Description: 'This cop looks for top-level method definitions.'
|
4912
|
+
StyleGuide: '#top-level-methods'
|
4913
|
+
Enabled: false
|
4914
|
+
VersionAdded: '1.15'
|
4915
|
+
|
3764
4916
|
Style/TrailingBodyOnClass:
|
3765
4917
|
Description: 'Class body goes below class statement.'
|
3766
4918
|
Enabled: true
|
@@ -3796,22 +4948,29 @@ Style/TrailingCommaInArrayLiteral:
|
|
3796
4948
|
StyleGuide: '#no-trailing-array-commas'
|
3797
4949
|
Enabled: true
|
3798
4950
|
VersionAdded: '0.53'
|
4951
|
+
# If `comma`, the cop requires a comma after the last item in an array,
|
3799
4952
|
# but only when each item is on its own line.
|
3800
4953
|
# If `consistent_comma`, the cop requires a comma after the last item of all
|
3801
|
-
# non-empty array literals.
|
4954
|
+
# non-empty, multiline array literals.
|
3802
4955
|
EnforcedStyleForMultiline: no_comma
|
3803
4956
|
SupportedStylesForMultiline:
|
3804
4957
|
- comma
|
3805
4958
|
- consistent_comma
|
3806
4959
|
- no_comma
|
3807
4960
|
|
4961
|
+
Style/TrailingCommaInBlockArgs:
|
4962
|
+
Description: 'Checks for useless trailing commas in block arguments.'
|
4963
|
+
Enabled: false
|
4964
|
+
Safe: false
|
4965
|
+
VersionAdded: '0.81'
|
4966
|
+
|
3808
4967
|
Style/TrailingCommaInHashLiteral:
|
3809
4968
|
Description: 'Checks for trailing comma in hash literals.'
|
3810
4969
|
Enabled: true
|
3811
4970
|
# If `comma`, the cop requires a comma after the last item in a hash,
|
3812
4971
|
# but only when each item is on its own line.
|
3813
4972
|
# If `consistent_comma`, the cop requires a comma after the last item of all
|
3814
|
-
# non-empty hash literals.
|
4973
|
+
# non-empty, multiline hash literals.
|
3815
4974
|
EnforcedStyleForMultiline: no_comma
|
3816
4975
|
SupportedStylesForMultiline:
|
3817
4976
|
- comma
|
@@ -3840,7 +4999,7 @@ Style/TrivialAccessors:
|
|
3840
4999
|
StyleGuide: '#attr_family'
|
3841
5000
|
Enabled: true
|
3842
5001
|
VersionAdded: '0.9'
|
3843
|
-
VersionChanged: '
|
5002
|
+
VersionChanged: '1.15'
|
3844
5003
|
# When set to `false` the cop will suggest the use of accessor methods
|
3845
5004
|
# in situations like:
|
3846
5005
|
#
|
@@ -3859,7 +5018,7 @@ Style/TrivialAccessors:
|
|
3859
5018
|
# on_exception :restart
|
3860
5019
|
#
|
3861
5020
|
# Commonly used in DSLs
|
3862
|
-
AllowDSLWriters:
|
5021
|
+
AllowDSLWriters: true
|
3863
5022
|
IgnoreClassMethods: false
|
3864
5023
|
AllowedMethods:
|
3865
5024
|
- to_ary
|
@@ -3888,6 +5047,16 @@ Style/UnlessElse:
|
|
3888
5047
|
Enabled: true
|
3889
5048
|
VersionAdded: '0.9'
|
3890
5049
|
|
5050
|
+
Style/UnlessLogicalOperators:
|
5051
|
+
Description: >-
|
5052
|
+
Checks for use of logical operators in an unless condition.
|
5053
|
+
Enabled: false
|
5054
|
+
VersionAdded: '1.11'
|
5055
|
+
EnforcedStyle: forbid_mixed_logical_operators
|
5056
|
+
SupportedStyles:
|
5057
|
+
- forbid_mixed_logical_operators
|
5058
|
+
- forbid_logical_operators
|
5059
|
+
|
3891
5060
|
Style/UnpackFirst:
|
3892
5061
|
Description: >-
|
3893
5062
|
Checks for accessing the first element of `String#unpack`
|
@@ -3906,7 +5075,7 @@ Style/VariableInterpolation:
|
|
3906
5075
|
|
3907
5076
|
Style/WhenThen:
|
3908
5077
|
Description: 'Use when x then ... for one-line cases.'
|
3909
|
-
StyleGuide: '#
|
5078
|
+
StyleGuide: '#no-when-semicolons'
|
3910
5079
|
Enabled: true
|
3911
5080
|
VersionAdded: '0.9'
|
3912
5081
|
|
@@ -3930,7 +5099,7 @@ Style/WordArray:
|
|
3930
5099
|
StyleGuide: '#percent-w'
|
3931
5100
|
Enabled: false
|
3932
5101
|
VersionAdded: '0.9'
|
3933
|
-
VersionChanged: '
|
5102
|
+
VersionChanged: '1.19'
|
3934
5103
|
EnforcedStyle: percent
|
3935
5104
|
SupportedStyles:
|
3936
5105
|
# percent style: %w(word1 word2)
|