makandra-rubocop 5.4.0 → 6.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +11 -0
- data/Gemfile.lock +34 -31
- data/README.md +16 -8
- data/config/default.yml +910 -132
- data/config/ext/rails.yml +225 -12
- data/config/ext/rspec.yml +155 -27
- data/lib/makandra_rubocop/version.rb +1 -1
- data/makandra-rubocop.gemspec +3 -3
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3eaef81475b2680b90574634f544234f515ce30d424ff9929e8fb9d9b0172084
|
4
|
+
data.tar.gz: 8d48cf9e5ff40dfdeb9781a50ded7d8fa8f7b2efe01c97463b9ead845426aaba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1191158f7a02dcc9e5ca6112d039be59693aafdf1c5dfcf1c9e1e9063a2aac3af8bd72fa79b702518291f8f7c4dc82d6adf3ea1ff1fc0870026379c6b1ba4a86
|
7
|
+
data.tar.gz: 74064c3c5351f6a39f049e465d777b131e0dd67941611dc96fef444045de3122fa40525c96d6e0afed80e48245e700f090c6057d8a573946d89c89ec51733ec9
|
data/CHANGELOG.md
CHANGED
@@ -9,6 +9,17 @@ This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html
|
|
9
9
|
### Compatible changes
|
10
10
|
|
11
11
|
|
12
|
+
## 6.0.0 - 2021-02-25
|
13
|
+
|
14
|
+
### Breaking changes
|
15
|
+
|
16
|
+
- Upgrade `rubocop` from version `0.81.0` to `1.9.1`
|
17
|
+
- Re-enable `Layout/RescueEnsureAlignment` as the bug seems to be fixed in `1.9.1`
|
18
|
+
- Add most of the new cops from `1.9.1`
|
19
|
+
- Upgrade `rubocop-rails` from version `2.5.1` to `2.9.1`
|
20
|
+
- Upgrade `rubocop-rspec` from version `2.2.0` to `1.40.0`
|
21
|
+
|
22
|
+
|
12
23
|
## 5.4.0 - 2020-08-05
|
13
24
|
|
14
25
|
### Breaking changes
|
data/Gemfile.lock
CHANGED
@@ -1,53 +1,56 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
makandra-rubocop (
|
5
|
-
rubocop (~>
|
6
|
-
rubocop-rails (~> 2.
|
7
|
-
rubocop-rspec (~>
|
4
|
+
makandra-rubocop (6.0.0)
|
5
|
+
rubocop (~> 1.9.1)
|
6
|
+
rubocop-rails (~> 2.9.1)
|
7
|
+
rubocop-rspec (~> 2.2.0)
|
8
8
|
|
9
9
|
GEM
|
10
10
|
remote: https://rubygems.org/
|
11
11
|
specs:
|
12
|
-
activesupport (6.
|
12
|
+
activesupport (6.1.3)
|
13
13
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
14
|
-
i18n (>=
|
15
|
-
minitest (
|
16
|
-
tzinfo (~>
|
17
|
-
zeitwerk (~> 2.
|
18
|
-
ast (2.4.
|
19
|
-
concurrent-ruby (1.1.
|
20
|
-
i18n (1.8.
|
14
|
+
i18n (>= 1.6, < 2)
|
15
|
+
minitest (>= 5.1)
|
16
|
+
tzinfo (~> 2.0)
|
17
|
+
zeitwerk (~> 2.3)
|
18
|
+
ast (2.4.2)
|
19
|
+
concurrent-ruby (1.1.8)
|
20
|
+
i18n (1.8.9)
|
21
21
|
concurrent-ruby (~> 1.0)
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
parser (2.7.1.4)
|
22
|
+
minitest (5.14.4)
|
23
|
+
parallel (1.20.1)
|
24
|
+
parser (3.0.0.0)
|
26
25
|
ast (~> 2.4.1)
|
27
26
|
rack (2.2.3)
|
28
27
|
rainbow (3.0.0)
|
29
28
|
rake (12.3.2)
|
29
|
+
regexp_parser (2.1.1)
|
30
30
|
rexml (3.2.4)
|
31
|
-
rubocop (
|
32
|
-
jaro_winkler (~> 1.5.1)
|
31
|
+
rubocop (1.9.1)
|
33
32
|
parallel (~> 1.10)
|
34
|
-
parser (>=
|
33
|
+
parser (>= 3.0.0.0)
|
35
34
|
rainbow (>= 2.2.2, < 4.0)
|
35
|
+
regexp_parser (>= 1.8, < 3.0)
|
36
36
|
rexml
|
37
|
+
rubocop-ast (>= 1.2.0, < 2.0)
|
37
38
|
ruby-progressbar (~> 1.7)
|
38
|
-
unicode-display_width (>= 1.4.0, <
|
39
|
-
rubocop-
|
40
|
-
|
39
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
40
|
+
rubocop-ast (1.4.1)
|
41
|
+
parser (>= 2.7.1.5)
|
42
|
+
rubocop-rails (2.9.1)
|
43
|
+
activesupport (>= 4.2.0)
|
41
44
|
rack (>= 1.1)
|
42
|
-
rubocop (>= 0.
|
43
|
-
rubocop-rspec (
|
44
|
-
rubocop (
|
45
|
-
|
46
|
-
|
47
|
-
tzinfo (
|
48
|
-
|
49
|
-
unicode-display_width (
|
50
|
-
zeitwerk (2.
|
45
|
+
rubocop (>= 0.90.0, < 2.0)
|
46
|
+
rubocop-rspec (2.2.0)
|
47
|
+
rubocop (~> 1.0)
|
48
|
+
rubocop-ast (>= 1.1.0)
|
49
|
+
ruby-progressbar (1.11.0)
|
50
|
+
tzinfo (2.0.4)
|
51
|
+
concurrent-ruby (~> 1.0)
|
52
|
+
unicode-display_width (2.0.0)
|
53
|
+
zeitwerk (2.4.2)
|
51
54
|
|
52
55
|
PLATFORMS
|
53
56
|
ruby
|
data/README.md
CHANGED
@@ -13,11 +13,15 @@ gem 'makandra-rubocop'
|
|
13
13
|
|
14
14
|
And then execute:
|
15
15
|
|
16
|
-
|
16
|
+
```
|
17
|
+
$ bundle
|
18
|
+
```
|
17
19
|
|
18
20
|
Or install it yourself as:
|
19
21
|
|
20
|
-
|
22
|
+
```
|
23
|
+
$ gem install makandra-rubocop
|
24
|
+
```
|
21
25
|
|
22
26
|
## Usage
|
23
27
|
|
@@ -67,7 +71,7 @@ Layout/MultilineArrayLineBreaks:
|
|
67
71
|
It also might be desired to set `inherit_mode`, which specifies which configuration keys that have
|
68
72
|
array values should be merged together instead of overriding the inherited value:
|
69
73
|
|
70
|
-
```
|
74
|
+
```yaml
|
71
75
|
inherit_mode:
|
72
76
|
merge:
|
73
77
|
- Exclude
|
@@ -85,7 +89,7 @@ You can follow [this guide](https://makandracards.com/makandra/400093-adding-mak
|
|
85
89
|
We recommend you add an RSpec test that runs rubocop automatically and confirms that there are no offenses.
|
86
90
|
This gem provides one. Simply add `spec/rubocop_spec.rb` to your project with the following code.
|
87
91
|
|
88
|
-
```
|
92
|
+
```ruby
|
89
93
|
require 'makandra_rubocop/support/rubocop_spec'
|
90
94
|
```
|
91
95
|
|
@@ -95,13 +99,17 @@ Some of our defaults might not fit your project. You can disable specific cops o
|
|
95
99
|
|
96
100
|
- Disable cops for specific lines using [Ruby comments in your code](https://github.com/rubocop-hq/rubocop/blob/master/manual/configuration.md#disabling-cops-within-source-code), like so:
|
97
101
|
|
98
|
-
|
102
|
+
```ruby
|
103
|
+
for x in (0..19) # rubocop:disable Style/For
|
104
|
+
```
|
99
105
|
|
100
106
|
- Disable entire files by [adding exclusions](https://github.com/rubocop-hq/rubocop/blob/master/manual/configuration.md#cop-specific-include-and-exclude) to `.rubocop.yml`, like so:
|
101
107
|
|
102
|
-
|
103
|
-
|
104
|
-
|
108
|
+
```yaml
|
109
|
+
Style/For:
|
110
|
+
Exclude:
|
111
|
+
- app/models/example.rb
|
112
|
+
```
|
105
113
|
|
106
114
|
See [Rubocop's configuration manual](https://github.com/rubocop-hq/rubocop/blob/master/manual/configuration.md) for more information.
|
107
115
|
|
data/config/default.yml
CHANGED
@@ -35,6 +35,7 @@ AllCops:
|
|
35
35
|
- '**/*.watchr'
|
36
36
|
- '**/.irbrc'
|
37
37
|
- '**/.pryrc'
|
38
|
+
- '**/.simplecov'
|
38
39
|
- '**/buildfile'
|
39
40
|
- '**/Appraisals'
|
40
41
|
- '**/Berksfile'
|
@@ -53,6 +54,7 @@ AllCops:
|
|
53
54
|
- '**/Podfile'
|
54
55
|
- '**/Puppetfile'
|
55
56
|
- '**/Rakefile'
|
57
|
+
- '**/rakefile'
|
56
58
|
- '**/Snapfile'
|
57
59
|
- '**/Steepfile'
|
58
60
|
- '**/Thorfile'
|
@@ -101,6 +103,14 @@ AllCops:
|
|
101
103
|
# to true in the same configuration.
|
102
104
|
EnabledByDefault: false
|
103
105
|
DisabledByDefault: false
|
106
|
+
# New cops introduced between major versions are set to a special pending status
|
107
|
+
# and are not enabled by default with warning message.
|
108
|
+
# Change this behavior by overriding either `NewCops: enable` or `NewCops: disable`.
|
109
|
+
# When `NewCops` is `enable`, pending cops are enabled in bulk. Can be overridden by
|
110
|
+
# the `--enable-pending-cops` command-line option.
|
111
|
+
# When `NewCops` is `disable`, pending cops are disabled in bulk. Can be overridden by
|
112
|
+
# the `--disable-pending-cops` command-line option.
|
113
|
+
NewCops: enable
|
104
114
|
# Enables the result cache if `true`. Can be overridden by the `--cache` command
|
105
115
|
# line option.
|
106
116
|
UseCache: true
|
@@ -111,6 +121,8 @@ AllCops:
|
|
111
121
|
# CacheRootDirectory is ~ (nil), which it is by default, the root will be
|
112
122
|
# taken from the environment variable `$XDG_CACHE_HOME` if it is set, or if
|
113
123
|
# `$XDG_CACHE_HOME` is not set, it will be `$HOME/.cache/`.
|
124
|
+
# The CacheRootDirectory can be overwritten by passing the `--cache-root` command
|
125
|
+
# line option or by setting `$RUBOCOP_CACHE_ROOT` environment variable.
|
114
126
|
CacheRootDirectory: ~
|
115
127
|
# It is possible for a malicious user to know the location of RuboCop's cache
|
116
128
|
# directory by looking at CacheRootDirectory, and create a symlink in its
|
@@ -124,13 +136,24 @@ AllCops:
|
|
124
136
|
# If a value is specified for TargetRubyVersion then it is used. Acceptable
|
125
137
|
# values are specificed as a float (i.e. 2.5); the teeny version of Ruby
|
126
138
|
# should not be included. If the project specifies a Ruby version in the
|
127
|
-
# .ruby-version
|
128
|
-
# the desired version of Ruby by inspecting the
|
129
|
-
#
|
130
|
-
#
|
131
|
-
# from the lock file.) If the
|
132
|
-
#
|
139
|
+
# .tool-versions or .ruby-version files, Gemfile or gems.rb file, RuboCop will
|
140
|
+
# try to determine the desired version of Ruby by inspecting the
|
141
|
+
# .tool-versions file first, then .ruby-version, followed by the Gemfile.lock
|
142
|
+
# or gems.locked file. (Although the Ruby version is specified in the Gemfile
|
143
|
+
# or gems.rb file, RuboCop reads the final value from the lock file.) If the
|
144
|
+
# Ruby version is still unresolved, RuboCop will use the oldest officially
|
145
|
+
# supported Ruby version (currently Ruby 2.4).
|
133
146
|
TargetRubyVersion: ~
|
147
|
+
# Determines if a notification for extension libraries should be shown when
|
148
|
+
# rubocop is run. Keys are the name of the extension, and values are an array
|
149
|
+
# of gems in the Gemfile that the extension is suggested for, if not already
|
150
|
+
# included.
|
151
|
+
SuggestExtensions:
|
152
|
+
rubocop-rails: [rails]
|
153
|
+
rubocop-rspec: [rspec, rspec-rails]
|
154
|
+
rubocop-minitest: [minitest]
|
155
|
+
rubocop-sequel: [sequel]
|
156
|
+
rubocop-rake: [rake]
|
134
157
|
|
135
158
|
#################### Bundler ###############################
|
136
159
|
|
@@ -147,12 +170,13 @@ Bundler/GemComment:
|
|
147
170
|
Description: 'Add a comment describing each gem.'
|
148
171
|
Enabled: false
|
149
172
|
VersionAdded: '0.59'
|
150
|
-
VersionChanged: '0.
|
173
|
+
VersionChanged: '0.85'
|
151
174
|
Include:
|
152
175
|
- '**/*.gemfile'
|
153
176
|
- '**/Gemfile'
|
154
177
|
- '**/gems.rb'
|
155
178
|
IgnoredGems: []
|
179
|
+
OnlyFor: []
|
156
180
|
|
157
181
|
Bundler/InsecureProtocolSource:
|
158
182
|
Description: >-
|
@@ -173,6 +197,9 @@ Bundler/OrderedGems:
|
|
173
197
|
VersionAdded: '0.46'
|
174
198
|
VersionChanged: '0.47'
|
175
199
|
TreatCommentsAsGroupSeparators: true
|
200
|
+
# By default, "-" and "_" are ignored for order purposes.
|
201
|
+
# This can be overridden by setting this parameter to true.
|
202
|
+
ConsiderPunctuation: false
|
176
203
|
Include:
|
177
204
|
- '**/*.gemfile'
|
178
205
|
- '**/Gemfile'
|
@@ -193,13 +220,17 @@ Gemspec/OrderedDependencies:
|
|
193
220
|
Enabled: false
|
194
221
|
VersionAdded: '0.51'
|
195
222
|
TreatCommentsAsGroupSeparators: true
|
223
|
+
# By default, "-" and "_" are ignored for order purposes.
|
224
|
+
# This can be overridden by setting this parameter to true.
|
225
|
+
ConsiderPunctuation: false
|
196
226
|
Include:
|
197
227
|
- '**/*.gemspec'
|
198
228
|
|
199
229
|
Gemspec/RequiredRubyVersion:
|
200
|
-
Description: 'Checks that `required_ruby_version` of gemspec and `TargetRubyVersion` of .rubocop.yml
|
230
|
+
Description: 'Checks that `required_ruby_version` of gemspec is specified and equal to `TargetRubyVersion` of .rubocop.yml.'
|
201
231
|
Enabled: true
|
202
232
|
VersionAdded: '0.52'
|
233
|
+
VersionChanged: '0.89'
|
203
234
|
Include:
|
204
235
|
- '**/*.gemspec'
|
205
236
|
|
@@ -257,8 +288,8 @@ Layout/ArgumentAlignment:
|
|
257
288
|
|
258
289
|
Layout/ArrayAlignment:
|
259
290
|
Description: >-
|
260
|
-
|
261
|
-
|
291
|
+
Align the elements of an array literal if they span more than
|
292
|
+
one line.
|
262
293
|
StyleGuide: '#no-double-indent'
|
263
294
|
Enabled: false
|
264
295
|
VersionAdded: '0.49'
|
@@ -286,8 +317,8 @@ Layout/ArrayAlignment:
|
|
286
317
|
|
287
318
|
Layout/AssignmentIndentation:
|
288
319
|
Description: >-
|
289
|
-
|
290
|
-
|
320
|
+
Checks the indentation of the first line of the
|
321
|
+
right-hand-side of a multi-line assignment.
|
291
322
|
Enabled: false # We do not want to write the assignment in the following line
|
292
323
|
VersionAdded: '0.49'
|
293
324
|
VersionChanged: '0.77'
|
@@ -295,6 +326,19 @@ Layout/AssignmentIndentation:
|
|
295
326
|
# But it can be overridden by setting this parameter
|
296
327
|
IndentationWidth: ~
|
297
328
|
|
329
|
+
Layout/BeginEndAlignment:
|
330
|
+
Description: 'Align ends corresponding to begins correctly.'
|
331
|
+
Enabled: true
|
332
|
+
VersionAdded: '0.91'
|
333
|
+
# The value `start_of_line` means that `end` should be aligned the start of the line
|
334
|
+
# where the `begin` keyword is.
|
335
|
+
# The value `begin` means that `end` should be aligned with the `begin` keyword.
|
336
|
+
EnforcedStyleAlignWith: start_of_line
|
337
|
+
SupportedStylesAlignWith:
|
338
|
+
- start_of_line
|
339
|
+
- begin
|
340
|
+
Severity: warning
|
341
|
+
|
298
342
|
Layout/BlockAlignment:
|
299
343
|
Description: 'Align block ends correctly.'
|
300
344
|
Enabled: true
|
@@ -371,6 +415,7 @@ Layout/ConditionPosition:
|
|
371
415
|
StyleGuide: '#same-line-condition'
|
372
416
|
Enabled: true
|
373
417
|
VersionAdded: '0.53'
|
418
|
+
VersionChanged: '0.83'
|
374
419
|
|
375
420
|
Layout/DefEndAlignment:
|
376
421
|
Description: 'Align ends corresponding to defs correctly.'
|
@@ -384,7 +429,6 @@ Layout/DefEndAlignment:
|
|
384
429
|
SupportedStylesAlignWith:
|
385
430
|
- start_of_line
|
386
431
|
- def
|
387
|
-
AutoCorrect: false
|
388
432
|
Severity: warning
|
389
433
|
|
390
434
|
Layout/DotPosition:
|
@@ -421,11 +465,23 @@ Layout/EmptyLineAfterMagicComment:
|
|
421
465
|
Enabled: false
|
422
466
|
VersionAdded: '0.49'
|
423
467
|
|
468
|
+
Layout/EmptyLineAfterMultilineCondition:
|
469
|
+
Description: 'Enforces empty line after multiline condition.'
|
470
|
+
# This is disabled, because this style is not very common in practice.
|
471
|
+
Enabled: false
|
472
|
+
VersionAdded: '0.90'
|
473
|
+
Reference:
|
474
|
+
- https://github.com/airbnb/ruby#multiline-if-newline
|
475
|
+
|
424
476
|
Layout/EmptyLineBetweenDefs:
|
425
|
-
Description: 'Use empty lines between defs.'
|
477
|
+
Description: 'Use empty lines between class/module/method defs.'
|
426
478
|
StyleGuide: '#empty-lines-between-methods'
|
427
479
|
Enabled: true
|
428
480
|
VersionAdded: '0.49'
|
481
|
+
VersionChanged: '1.7'
|
482
|
+
EmptyLineBetweenMethodDefs: true
|
483
|
+
EmptyLineBetweenClassDefs: true
|
484
|
+
EmptyLineBetweenModuleDefs: true
|
429
485
|
# If `true`, this parameter means that single line method definitions don't
|
430
486
|
# need an empty line between them.
|
431
487
|
AllowAdjacentOneLineDefs: false
|
@@ -456,6 +512,19 @@ Layout/EmptyLinesAroundArguments:
|
|
456
512
|
Enabled: true
|
457
513
|
VersionAdded: '0.52'
|
458
514
|
|
515
|
+
Layout/EmptyLinesAroundAttributeAccessor:
|
516
|
+
Description: "Keep blank lines around attribute accessors."
|
517
|
+
StyleGuide: '#empty-lines-around-attribute-accessor'
|
518
|
+
Enabled: true
|
519
|
+
VersionAdded: '0.83'
|
520
|
+
VersionChanged: '0.84'
|
521
|
+
AllowAliasSyntax: true
|
522
|
+
AllowedMethods:
|
523
|
+
- alias_method
|
524
|
+
- public
|
525
|
+
- protected
|
526
|
+
- private
|
527
|
+
|
459
528
|
Layout/EmptyLinesAroundBeginBody:
|
460
529
|
Description: "Keeps track of empty lines around begin-end bodies."
|
461
530
|
StyleGuide: '#empty-lines-around-bodies'
|
@@ -527,7 +596,6 @@ Layout/EndAlignment:
|
|
527
596
|
- keyword
|
528
597
|
- variable
|
529
598
|
- start_of_line
|
530
|
-
AutoCorrect: false
|
531
599
|
Severity: warning
|
532
600
|
|
533
601
|
Layout/EndOfLine:
|
@@ -613,8 +681,8 @@ Layout/FirstArrayElementIndentation:
|
|
613
681
|
|
614
682
|
Layout/FirstArrayElementLineBreak:
|
615
683
|
Description: >-
|
616
|
-
|
617
|
-
|
684
|
+
Checks for a line break before the first element in a
|
685
|
+
multi-line array.
|
618
686
|
Enabled: false
|
619
687
|
VersionAdded: '0.49'
|
620
688
|
|
@@ -645,22 +713,22 @@ Layout/FirstHashElementIndentation:
|
|
645
713
|
|
646
714
|
Layout/FirstHashElementLineBreak:
|
647
715
|
Description: >-
|
648
|
-
|
649
|
-
|
716
|
+
Checks for a line break before the first element in a
|
717
|
+
multi-line hash.
|
650
718
|
Enabled: false
|
651
719
|
VersionAdded: '0.49'
|
652
720
|
|
653
721
|
Layout/FirstMethodArgumentLineBreak:
|
654
722
|
Description: >-
|
655
|
-
|
656
|
-
|
723
|
+
Checks for a line break before the first argument in a
|
724
|
+
multi-line method call.
|
657
725
|
Enabled: false
|
658
726
|
VersionAdded: '0.49'
|
659
727
|
|
660
728
|
Layout/FirstMethodParameterLineBreak:
|
661
729
|
Description: >-
|
662
|
-
|
663
|
-
|
730
|
+
Checks for a line break before the first parameter in a
|
731
|
+
multi-line method parameter definition.
|
664
732
|
Enabled: false
|
665
733
|
VersionAdded: '0.49'
|
666
734
|
|
@@ -759,8 +827,8 @@ Layout/HashAlignment:
|
|
759
827
|
|
760
828
|
Layout/HeredocArgumentClosingParenthesis:
|
761
829
|
Description: >-
|
762
|
-
|
763
|
-
|
830
|
+
Checks for the placement of the closing parenthesis in a
|
831
|
+
method call that passes a HEREDOC string as an argument.
|
764
832
|
Enabled: false
|
765
833
|
StyleGuide: '#heredoc-argument-closing-parentheses'
|
766
834
|
VersionAdded: '0.68'
|
@@ -770,13 +838,7 @@ Layout/HeredocIndentation:
|
|
770
838
|
StyleGuide: '#squiggly-heredocs'
|
771
839
|
Enabled: true
|
772
840
|
VersionAdded: '0.49'
|
773
|
-
VersionChanged: '0.
|
774
|
-
EnforcedStyle: squiggly
|
775
|
-
SupportedStyles:
|
776
|
-
- squiggly
|
777
|
-
- active_support
|
778
|
-
- powerpack
|
779
|
-
- unindent
|
841
|
+
VersionChanged: '0.85'
|
780
842
|
|
781
843
|
Layout/IndentationConsistency:
|
782
844
|
Description: 'Keep indentation straight.'
|
@@ -797,6 +859,22 @@ Layout/IndentationConsistency:
|
|
797
859
|
# A reference to `EnforcedStyle: indented_internal_methods`.
|
798
860
|
- https://edgeguides.rubyonrails.org/contributing_to_ruby_on_rails.html#follow-the-coding-conventions
|
799
861
|
|
862
|
+
Layout/IndentationStyle:
|
863
|
+
Description: 'Consistent indentation either with tabs only or spaces only.'
|
864
|
+
StyleGuide: '#spaces-indentation'
|
865
|
+
Enabled: true
|
866
|
+
VersionAdded: '0.49'
|
867
|
+
VersionChanged: '0.82'
|
868
|
+
# By default, the indentation width from Layout/IndentationWidth is used
|
869
|
+
# But it can be overridden by setting this parameter
|
870
|
+
# It is used during auto-correction to determine how many spaces should
|
871
|
+
# replace each tab.
|
872
|
+
IndentationWidth: ~
|
873
|
+
EnforcedStyle: spaces
|
874
|
+
SupportedStyles:
|
875
|
+
- spaces
|
876
|
+
- tabs
|
877
|
+
|
800
878
|
Layout/IndentationWidth:
|
801
879
|
Description: 'Use 2 spaces for indentation.'
|
802
880
|
StyleGuide: '#spaces-indentation'
|
@@ -828,13 +906,13 @@ Layout/LeadingEmptyLines:
|
|
828
906
|
VersionChanged: '0.77'
|
829
907
|
|
830
908
|
Layout/LineLength:
|
831
|
-
Description: '
|
832
|
-
StyleGuide: '#
|
909
|
+
Description: 'Checks that line length does not exceed the configured limit.'
|
910
|
+
StyleGuide: '#max-line-length'
|
833
911
|
Enabled: false
|
834
912
|
VersionAdded: '0.25'
|
835
|
-
VersionChanged: '
|
836
|
-
AutoCorrect:
|
837
|
-
Max:
|
913
|
+
VersionChanged: '1.4'
|
914
|
+
AutoCorrect: true
|
915
|
+
Max: 120
|
838
916
|
# To make it possible to copy or click on URIs in the code, we allow lines
|
839
917
|
# containing a URI to be longer than Max.
|
840
918
|
AllowHeredoc: true
|
@@ -993,8 +1071,8 @@ Layout/MultilineOperationIndentation:
|
|
993
1071
|
|
994
1072
|
Layout/ParameterAlignment:
|
995
1073
|
Description: >-
|
996
|
-
|
997
|
-
|
1074
|
+
Align the parameters of a method definition if they span more
|
1075
|
+
than one line.
|
998
1076
|
StyleGuide: '#no-double-indent'
|
999
1077
|
Enabled: true
|
1000
1078
|
VersionAdded: '0.49'
|
@@ -1022,7 +1100,7 @@ Layout/ParameterAlignment:
|
|
1022
1100
|
|
1023
1101
|
Layout/RescueEnsureAlignment:
|
1024
1102
|
Description: 'Align rescues and ensures correctly.'
|
1025
|
-
Enabled:
|
1103
|
+
Enabled: true
|
1026
1104
|
VersionAdded: '0.49'
|
1027
1105
|
|
1028
1106
|
Layout/SpaceAfterColon:
|
@@ -1084,6 +1162,11 @@ Layout/SpaceAroundKeyword:
|
|
1084
1162
|
Enabled: true
|
1085
1163
|
VersionAdded: '0.49'
|
1086
1164
|
|
1165
|
+
Layout/SpaceAroundMethodCallOperator:
|
1166
|
+
Description: 'Checks method call operators to not have spaces around them.'
|
1167
|
+
Enabled: true
|
1168
|
+
VersionAdded: '0.82'
|
1169
|
+
|
1087
1170
|
Layout/SpaceAroundOperators:
|
1088
1171
|
Description: 'Use a single space around operators.'
|
1089
1172
|
StyleGuide: '#spaces-operators'
|
@@ -1112,7 +1195,13 @@ Layout/SpaceBeforeBlockBraces:
|
|
1112
1195
|
SupportedStylesForEmptyBraces:
|
1113
1196
|
- space
|
1114
1197
|
- no_space
|
1115
|
-
VersionChanged: '0.52
|
1198
|
+
VersionChanged: '0.52'
|
1199
|
+
|
1200
|
+
Layout/SpaceBeforeBrackets:
|
1201
|
+
Description: 'Checks for receiver with a space before the opening brackets.'
|
1202
|
+
StyleGuide: '#space-in-brackets-access'
|
1203
|
+
Enabled: true
|
1204
|
+
VersionAdded: '1.7'
|
1116
1205
|
|
1117
1206
|
Layout/SpaceBeforeComma:
|
1118
1207
|
Description: 'No spaces before commas.'
|
@@ -1192,7 +1281,7 @@ Layout/SpaceInsideBlockBraces:
|
|
1192
1281
|
|
1193
1282
|
Layout/SpaceInsideHashLiteralBraces:
|
1194
1283
|
Description: "Use spaces inside hash literal braces - or don't."
|
1195
|
-
StyleGuide: '#spaces-
|
1284
|
+
StyleGuide: '#spaces-braces'
|
1196
1285
|
Enabled: true
|
1197
1286
|
VersionAdded: '0.49'
|
1198
1287
|
EnforcedStyle: space
|
@@ -1254,18 +1343,6 @@ Layout/SpaceInsideStringInterpolation:
|
|
1254
1343
|
- space
|
1255
1344
|
- no_space
|
1256
1345
|
|
1257
|
-
Layout/Tab:
|
1258
|
-
Description: 'No hard tabs.'
|
1259
|
-
StyleGuide: '#spaces-indentation'
|
1260
|
-
Enabled: true
|
1261
|
-
VersionAdded: '0.49'
|
1262
|
-
VersionChanged: '0.51'
|
1263
|
-
# By default, the indentation width from Layout/IndentationWidth is used
|
1264
|
-
# But it can be overridden by setting this parameter
|
1265
|
-
# It is used during auto-correction to determine how many spaces should
|
1266
|
-
# replace each tab.
|
1267
|
-
IndentationWidth: ~
|
1268
|
-
|
1269
1346
|
Layout/TrailingEmptyLines:
|
1270
1347
|
Description: 'Checks trailing blank lines and final newline.'
|
1271
1348
|
StyleGuide: '#newline-eof'
|
@@ -1282,12 +1359,17 @@ Layout/TrailingWhitespace:
|
|
1282
1359
|
StyleGuide: '#no-trailing-whitespace'
|
1283
1360
|
Enabled: true
|
1284
1361
|
VersionAdded: '0.49'
|
1285
|
-
VersionChanged: '0
|
1362
|
+
VersionChanged: '1.0'
|
1286
1363
|
AllowInHeredoc: false
|
1287
1364
|
|
1288
1365
|
#################### Lint ##################################
|
1289
1366
|
### Warnings
|
1290
1367
|
|
1368
|
+
Lint/AmbiguousAssignment:
|
1369
|
+
Description: 'Checks for mistyped shorthand assignments.'
|
1370
|
+
Enabled: true
|
1371
|
+
VersionAdded: '1.7'
|
1372
|
+
|
1291
1373
|
Lint/AmbiguousBlockAssociation:
|
1292
1374
|
Description: >-
|
1293
1375
|
Checks for ambiguous block association with method when param passed without
|
@@ -1303,6 +1385,7 @@ Lint/AmbiguousOperator:
|
|
1303
1385
|
StyleGuide: '#method-invocation-parens'
|
1304
1386
|
Enabled: false
|
1305
1387
|
VersionAdded: '0.17'
|
1388
|
+
VersionChanged: '0.83'
|
1306
1389
|
|
1307
1390
|
Lint/AmbiguousRegexpLiteral:
|
1308
1391
|
Description: >-
|
@@ -1310,6 +1393,7 @@ Lint/AmbiguousRegexpLiteral:
|
|
1310
1393
|
a method invocation without parentheses.
|
1311
1394
|
Enabled: false
|
1312
1395
|
VersionAdded: '0.17'
|
1396
|
+
VersionChanged: '0.83'
|
1313
1397
|
|
1314
1398
|
Lint/AssignmentInCondition:
|
1315
1399
|
Description: "Don't use assignment in conditions."
|
@@ -1323,39 +1407,133 @@ Lint/BigDecimalNew:
|
|
1323
1407
|
Enabled: true
|
1324
1408
|
VersionAdded: '0.53'
|
1325
1409
|
|
1410
|
+
Lint/BinaryOperatorWithIdenticalOperands:
|
1411
|
+
Description: 'This cop checks for places where binary operator has identical operands.'
|
1412
|
+
Enabled: true
|
1413
|
+
Safe: false
|
1414
|
+
VersionAdded: '0.89'
|
1415
|
+
VersionChanged: '1.7'
|
1416
|
+
|
1326
1417
|
Lint/BooleanSymbol:
|
1327
1418
|
Description: 'Check for `:true` and `:false` symbols.'
|
1328
1419
|
Enabled: true
|
1420
|
+
Safe: false
|
1329
1421
|
VersionAdded: '0.50'
|
1330
|
-
VersionChanged: '0.
|
1422
|
+
VersionChanged: '0.83'
|
1331
1423
|
|
1332
1424
|
Lint/CircularArgumentReference:
|
1333
1425
|
Description: "Default values in optional keyword arguments and optional ordinal arguments should not refer back to the name of the argument."
|
1334
1426
|
Enabled: true
|
1335
1427
|
VersionAdded: '0.33'
|
1336
1428
|
|
1429
|
+
Lint/ConstantDefinitionInBlock:
|
1430
|
+
Description: 'Do not define constants within a block.'
|
1431
|
+
StyleGuide: '#no-constant-definition-in-block'
|
1432
|
+
Enabled: true
|
1433
|
+
VersionAdded: '0.91'
|
1434
|
+
VersionChanged: '1.3'
|
1435
|
+
# `enums` for Typed Enums via T::Enum in Sorbet.
|
1436
|
+
# https://sorbet.org/docs/tenum
|
1437
|
+
AllowedMethods:
|
1438
|
+
- enums
|
1439
|
+
# For specs we use this quite frequently
|
1440
|
+
Exclude:
|
1441
|
+
- 'spec/**/*'
|
1442
|
+
|
1443
|
+
Lint/ConstantResolution:
|
1444
|
+
Description: 'Check that constants are fully qualified with `::`.'
|
1445
|
+
Enabled: false
|
1446
|
+
VersionAdded: '0.86'
|
1447
|
+
# Restrict this cop to only looking at certain names
|
1448
|
+
Only: []
|
1449
|
+
# Restrict this cop from only looking at certain names
|
1450
|
+
Ignore: []
|
1451
|
+
|
1337
1452
|
Lint/Debugger:
|
1338
1453
|
Description: 'Check for debugger calls.'
|
1339
1454
|
Enabled: false
|
1340
1455
|
VersionAdded: '0.14'
|
1341
1456
|
VersionChanged: '0.49'
|
1457
|
+
DebuggerReceivers:
|
1458
|
+
- binding
|
1459
|
+
- Kernel
|
1460
|
+
- Pry
|
1461
|
+
DebuggerMethods:
|
1462
|
+
- debugger
|
1463
|
+
- byebug
|
1464
|
+
- remote_byebug
|
1465
|
+
- pry
|
1466
|
+
- remote_pry
|
1467
|
+
- pry_remote
|
1468
|
+
- console
|
1469
|
+
- rescue
|
1470
|
+
- save_and_open_page
|
1471
|
+
- save_and_open_screenshot
|
1472
|
+
- irb
|
1342
1473
|
|
1343
1474
|
Lint/DeprecatedClassMethods:
|
1344
1475
|
Description: 'Check for deprecated class method calls.'
|
1345
1476
|
Enabled: true
|
1346
1477
|
VersionAdded: '0.19'
|
1347
1478
|
|
1479
|
+
Lint/DeprecatedConstants:
|
1480
|
+
Description: 'Checks for deprecated constants.'
|
1481
|
+
Enabled: true
|
1482
|
+
VersionAdded: '1.8'
|
1483
|
+
# You can configure deprecated constants.
|
1484
|
+
# If there is an alternative method, you can set alternative value as `Alternative`.
|
1485
|
+
# And you can set the deprecated version as `DeprecatedVersion`.
|
1486
|
+
# These options can be omitted if they are not needed.
|
1487
|
+
#
|
1488
|
+
# DeprecatedConstants:
|
1489
|
+
# 'DEPRECATED_CONSTANT':
|
1490
|
+
# Alternative: 'alternative_value'
|
1491
|
+
# DeprecatedVersion: 'deprecated_version'
|
1492
|
+
#
|
1493
|
+
DeprecatedConstants:
|
1494
|
+
'NIL':
|
1495
|
+
Alternative: 'nil'
|
1496
|
+
DeprecatedVersion: '2.4'
|
1497
|
+
'TRUE':
|
1498
|
+
Alternative: 'true'
|
1499
|
+
DeprecatedVersion: '2.4'
|
1500
|
+
'FALSE':
|
1501
|
+
Alternative: 'false'
|
1502
|
+
DeprecatedVersion: '2.4'
|
1503
|
+
'Random::DEFAULT':
|
1504
|
+
Alternative: 'Random.new'
|
1505
|
+
DeprecatedVersion: '3.0'
|
1506
|
+
|
1507
|
+
Lint/DeprecatedOpenSSLConstant:
|
1508
|
+
Description: "Don't use algorithm constants for `OpenSSL::Cipher` and `OpenSSL::Digest`."
|
1509
|
+
Enabled: true
|
1510
|
+
VersionAdded: '0.84'
|
1511
|
+
|
1348
1512
|
Lint/DisjunctiveAssignmentInConstructor:
|
1349
1513
|
Description: 'In constructor, plain assignment is preferred over disjunctive.'
|
1350
1514
|
Enabled: true
|
1351
1515
|
Safe: false
|
1352
1516
|
VersionAdded: '0.62'
|
1517
|
+
VersionChanged: '0.88'
|
1518
|
+
|
1519
|
+
Lint/DuplicateBranch:
|
1520
|
+
Description: Checks that there are no repeated bodies within `if/unless`, `case-when` and `rescue` constructs.
|
1521
|
+
Enabled: false # Combining two branch conditions on a single line is often less readable
|
1522
|
+
VersionAdded: '1.3'
|
1523
|
+
VersionChanged: '1.7'
|
1524
|
+
IgnoreLiteralBranches: false
|
1525
|
+
IgnoreConstantBranches: false
|
1353
1526
|
|
1354
1527
|
Lint/DuplicateCaseCondition:
|
1355
1528
|
Description: 'Do not repeat values in case conditionals.'
|
1356
1529
|
Enabled: true
|
1357
1530
|
VersionAdded: '0.45'
|
1358
1531
|
|
1532
|
+
Lint/DuplicateElsifCondition:
|
1533
|
+
Description: 'Do not repeat conditions used in if `elsif`.'
|
1534
|
+
Enabled: true
|
1535
|
+
VersionAdded: '0.88'
|
1536
|
+
|
1359
1537
|
Lint/DuplicateHashKey:
|
1360
1538
|
Description: 'Check for duplicate keys in hash literals.'
|
1361
1539
|
Enabled: true
|
@@ -1367,6 +1545,21 @@ Lint/DuplicateMethods:
|
|
1367
1545
|
Enabled: true
|
1368
1546
|
VersionAdded: '0.29'
|
1369
1547
|
|
1548
|
+
Lint/DuplicateRegexpCharacterClassElement:
|
1549
|
+
Description: 'Checks for duplicate elements in Regexp character classes.'
|
1550
|
+
Enabled: true
|
1551
|
+
VersionAdded: '1.1'
|
1552
|
+
|
1553
|
+
Lint/DuplicateRequire:
|
1554
|
+
Description: 'Check for duplicate `require`s and `require_relative`s.'
|
1555
|
+
Enabled: true
|
1556
|
+
VersionAdded: '0.90'
|
1557
|
+
|
1558
|
+
Lint/DuplicateRescueException:
|
1559
|
+
Description: 'Checks that there are no repeated exceptions used in `rescue` expressions.'
|
1560
|
+
Enabled: true
|
1561
|
+
VersionAdded: '0.89'
|
1562
|
+
|
1370
1563
|
Lint/EachWithObjectArgument:
|
1371
1564
|
Description: 'Check for immutable argument given to each_with_object.'
|
1372
1565
|
Enabled: true
|
@@ -1376,19 +1569,45 @@ Lint/ElseLayout:
|
|
1376
1569
|
Description: 'Check for odd code arrangement in an else block.'
|
1377
1570
|
Enabled: true
|
1378
1571
|
VersionAdded: '0.17'
|
1572
|
+
VersionChanged: '1.2'
|
1573
|
+
|
1574
|
+
Lint/EmptyBlock:
|
1575
|
+
Description: 'This cop checks for blocks without a body.'
|
1576
|
+
Enabled: true
|
1577
|
+
VersionAdded: '1.1'
|
1578
|
+
VersionChanged: '1.3'
|
1579
|
+
AllowComments: true
|
1580
|
+
AllowEmptyLambdas: true
|
1581
|
+
|
1582
|
+
Lint/EmptyClass:
|
1583
|
+
Description: 'Checks for classes and metaclasses without a body.'
|
1584
|
+
Enabled: false # We need empty classes for error classes or Active Record migration models
|
1585
|
+
VersionAdded: '1.3'
|
1586
|
+
AllowComments: false
|
1587
|
+
|
1588
|
+
Lint/EmptyConditionalBody:
|
1589
|
+
Description: 'This cop checks for the presence of `if`, `elsif` and `unless` branches without a body.'
|
1590
|
+
Enabled: true
|
1591
|
+
AllowComments: true
|
1592
|
+
VersionAdded: '0.89'
|
1379
1593
|
|
1380
1594
|
Lint/EmptyEnsure:
|
1381
1595
|
Description: 'Checks for empty ensure block.'
|
1382
1596
|
Enabled: true
|
1383
1597
|
VersionAdded: '0.10'
|
1384
1598
|
VersionChanged: '0.48'
|
1385
|
-
AutoCorrect: false
|
1386
1599
|
|
1387
1600
|
Lint/EmptyExpression:
|
1388
1601
|
Description: 'Checks for empty expressions.'
|
1389
1602
|
Enabled: true
|
1390
1603
|
VersionAdded: '0.45'
|
1391
1604
|
|
1605
|
+
Lint/EmptyFile:
|
1606
|
+
Description: 'Enforces that Ruby source files are not empty.'
|
1607
|
+
Enabled: true
|
1608
|
+
AllowComments: true
|
1609
|
+
VersionAdded: '0.90'
|
1610
|
+
|
1392
1611
|
Lint/EmptyInterpolation:
|
1393
1612
|
Description: 'Checks for empty string interpolation.'
|
1394
1613
|
Enabled: true
|
@@ -1397,14 +1616,17 @@ Lint/EmptyInterpolation:
|
|
1397
1616
|
|
1398
1617
|
Lint/EmptyWhen:
|
1399
1618
|
Description: 'Checks for `when` branches with empty bodies.'
|
1400
|
-
Enabled:
|
1619
|
+
Enabled: true
|
1620
|
+
AllowComments: true
|
1401
1621
|
VersionAdded: '0.45'
|
1622
|
+
VersionChanged: '0.83'
|
1402
1623
|
|
1403
1624
|
Lint/EnsureReturn:
|
1404
1625
|
Description: 'Do not use return in an ensure block.'
|
1405
1626
|
StyleGuide: '#no-return-ensure'
|
1406
1627
|
Enabled: true
|
1407
1628
|
VersionAdded: '0.9'
|
1629
|
+
VersionChanged: '0.83'
|
1408
1630
|
|
1409
1631
|
Lint/ErbNewArguments:
|
1410
1632
|
Description: 'Use `:trim_mode` and `:eoutvar` keyword arguments to `ERB.new`.'
|
@@ -1417,6 +1639,12 @@ Lint/FlipFlop:
|
|
1417
1639
|
Enabled: true
|
1418
1640
|
VersionAdded: '0.16'
|
1419
1641
|
|
1642
|
+
Lint/FloatComparison:
|
1643
|
+
Description: 'Checks for the presence of precise comparison of floating point numbers.'
|
1644
|
+
StyleGuide: '#float-comparison'
|
1645
|
+
Enabled: true
|
1646
|
+
VersionAdded: '0.89'
|
1647
|
+
|
1420
1648
|
Lint/FloatOutOfRange:
|
1421
1649
|
Description: >-
|
1422
1650
|
Catches floating-point literals too large or small for Ruby to
|
@@ -1429,6 +1657,13 @@ Lint/FormatParameterMismatch:
|
|
1429
1657
|
Enabled: true
|
1430
1658
|
VersionAdded: '0.33'
|
1431
1659
|
|
1660
|
+
Lint/HashCompareByIdentity:
|
1661
|
+
Description: 'Prefer using `Hash#compare_by_identity` than using `object_id` for keys.'
|
1662
|
+
StyleGuide: '#identity-comparison'
|
1663
|
+
Enabled: true
|
1664
|
+
Safe: false
|
1665
|
+
VersionAdded: '0.93'
|
1666
|
+
|
1432
1667
|
Lint/HeredocMethodCallPosition:
|
1433
1668
|
Description: >-
|
1434
1669
|
Checks for the ordering of a method call where
|
@@ -1437,6 +1672,12 @@ Lint/HeredocMethodCallPosition:
|
|
1437
1672
|
StyleGuide: '#heredoc-method-calls'
|
1438
1673
|
VersionAdded: '0.68'
|
1439
1674
|
|
1675
|
+
Lint/IdentityComparison:
|
1676
|
+
Description: 'Prefer `equal?` over `==` when comparing `object_id`.'
|
1677
|
+
Enabled: true
|
1678
|
+
StyleGuide: '#identity-comparison'
|
1679
|
+
VersionAdded: '0.91'
|
1680
|
+
|
1440
1681
|
Lint/ImplicitStringConcatenation:
|
1441
1682
|
Description: >-
|
1442
1683
|
Checks for adjacent string literals on the same line, which
|
@@ -1464,7 +1705,14 @@ Lint/InheritException:
|
|
1464
1705
|
Lint/InterpolationCheck:
|
1465
1706
|
Description: 'Raise warning for interpolation in single q strs.'
|
1466
1707
|
Enabled: true
|
1708
|
+
Safe: false
|
1467
1709
|
VersionAdded: '0.50'
|
1710
|
+
VersionChanged: '0.87'
|
1711
|
+
|
1712
|
+
Lint/LambdaWithoutLiteralBlock:
|
1713
|
+
Description: 'Checks uses of lambda without a literal block.'
|
1714
|
+
Enabled: true
|
1715
|
+
VersionAdded: '1.8'
|
1468
1716
|
|
1469
1717
|
Lint/LiteralAsCondition:
|
1470
1718
|
Description: 'Checks of literals used in conditions.'
|
@@ -1484,6 +1732,8 @@ Lint/Loop:
|
|
1484
1732
|
StyleGuide: '#loop-with-break'
|
1485
1733
|
Enabled: true
|
1486
1734
|
VersionAdded: '0.9'
|
1735
|
+
VersionChanged: '1.3'
|
1736
|
+
Safe: false
|
1487
1737
|
|
1488
1738
|
Lint/MissingCopEnableDirective:
|
1489
1739
|
Description: 'Checks for a `# rubocop:enable` after `# rubocop:disable`.'
|
@@ -1498,11 +1748,25 @@ Lint/MissingCopEnableDirective:
|
|
1498
1748
|
# .inf for any size
|
1499
1749
|
MaximumRangeSize: .inf
|
1500
1750
|
|
1751
|
+
Lint/MissingSuper:
|
1752
|
+
Description: >-
|
1753
|
+
This cop checks for the presence of constructors and lifecycle callbacks
|
1754
|
+
without calls to `super`'.
|
1755
|
+
Enabled: true
|
1756
|
+
VersionAdded: '0.89'
|
1757
|
+
VersionChanged: '1.4'
|
1758
|
+
|
1759
|
+
Lint/MixedRegexpCaptureTypes:
|
1760
|
+
Description: 'Do not mix named captures and numbered captures in a Regexp literal.'
|
1761
|
+
Enabled: true
|
1762
|
+
VersionAdded: '0.85'
|
1763
|
+
|
1501
1764
|
Lint/MultipleComparison:
|
1502
1765
|
Description: "Use `&&` operator to compare multiple values."
|
1503
1766
|
Enabled: true
|
1504
1767
|
VersionAdded: '0.47'
|
1505
|
-
VersionChanged: '
|
1768
|
+
VersionChanged: '1.1'
|
1769
|
+
AllowMethodComparison: true
|
1506
1770
|
|
1507
1771
|
Lint/NestedMethodDefinition:
|
1508
1772
|
Description: 'Do not use nested method definitions.'
|
@@ -1522,6 +1786,11 @@ Lint/NextWithoutAccumulator:
|
|
1522
1786
|
Enabled: true
|
1523
1787
|
VersionAdded: '0.36'
|
1524
1788
|
|
1789
|
+
Lint/NoReturnInBeginEndBlocks:
|
1790
|
+
Description: 'Do not `return` inside `begin..end` blocks in assignment contexts.'
|
1791
|
+
Enabled: true
|
1792
|
+
VersionAdded: '1.2'
|
1793
|
+
|
1525
1794
|
Lint/NonDeterministicRequireOrder:
|
1526
1795
|
Description: 'Always sort arrays returned by Dir.glob when requiring files.'
|
1527
1796
|
Enabled: true
|
@@ -1537,14 +1806,35 @@ Lint/NumberConversion:
|
|
1537
1806
|
Description: 'Checks unsafe usage of number conversion methods.'
|
1538
1807
|
Enabled: false
|
1539
1808
|
VersionAdded: '0.53'
|
1540
|
-
VersionChanged: '
|
1809
|
+
VersionChanged: '1.1'
|
1541
1810
|
SafeAutoCorrect: false
|
1811
|
+
IgnoredMethods: []
|
1812
|
+
IgnoredClasses:
|
1813
|
+
- Time
|
1814
|
+
- DateTime
|
1815
|
+
|
1816
|
+
Lint/NumberedParameterAssignment:
|
1817
|
+
Description: 'Checks for uses of numbered parameter assignment.'
|
1818
|
+
Enabled: true # Makes it easier to upgrade to Ruby 3
|
1819
|
+
VersionAdded: '1.9'
|
1820
|
+
|
1821
|
+
Lint/OrAssignmentToConstant:
|
1822
|
+
Description: 'Checks unintended or-assignment to constant.'
|
1823
|
+
Enabled: true
|
1824
|
+
Safe: false
|
1825
|
+
VersionAdded: '1.9'
|
1542
1826
|
|
1543
1827
|
Lint/OrderedMagicComments:
|
1544
1828
|
Description: 'Checks the proper ordering of magic comments and whether a magic comment is not placed before a shebang.'
|
1545
1829
|
Enabled: true
|
1546
1830
|
VersionAdded: '0.53'
|
1547
1831
|
|
1832
|
+
Lint/OutOfRangeRegexpRef:
|
1833
|
+
Description: 'Checks for out of range reference for Regexp because it always returns nil.'
|
1834
|
+
Enabled: true
|
1835
|
+
Safe: false
|
1836
|
+
VersionAdded: '0.89'
|
1837
|
+
|
1548
1838
|
Lint/ParenthesesAsGroupedExpression:
|
1549
1839
|
Description: >-
|
1550
1840
|
Checks for method calls with a space before the opening
|
@@ -1552,6 +1842,7 @@ Lint/ParenthesesAsGroupedExpression:
|
|
1552
1842
|
StyleGuide: '#parens-no-spaces'
|
1553
1843
|
Enabled: true
|
1554
1844
|
VersionAdded: '0.12'
|
1845
|
+
VersionChanged: '0.83'
|
1555
1846
|
|
1556
1847
|
Lint/PercentStringArray:
|
1557
1848
|
Description: >-
|
@@ -1570,7 +1861,11 @@ Lint/RaiseException:
|
|
1570
1861
|
Description: Checks for `raise` or `fail` statements which are raising `Exception` class.
|
1571
1862
|
StyleGuide: '#raise-exception'
|
1572
1863
|
Enabled: true
|
1864
|
+
Safe: false
|
1573
1865
|
VersionAdded: '0.81'
|
1866
|
+
VersionChanged: '0.86'
|
1867
|
+
AllowedImplicitNamespaces:
|
1868
|
+
- 'Gem'
|
1574
1869
|
|
1575
1870
|
Lint/RandOne:
|
1576
1871
|
Description: >-
|
@@ -1592,15 +1887,35 @@ Lint/RedundantCopEnableDirective:
|
|
1592
1887
|
Enabled: true
|
1593
1888
|
VersionAdded: '0.76'
|
1594
1889
|
|
1890
|
+
Lint/RedundantDirGlobSort:
|
1891
|
+
Description: 'Checks for redundant `sort` method to `Dir.glob` and `Dir[]`.'
|
1892
|
+
Enabled: true
|
1893
|
+
VersionAdded: '1.8'
|
1894
|
+
|
1595
1895
|
Lint/RedundantRequireStatement:
|
1596
1896
|
Description: 'Checks for unnecessary `require` statement.'
|
1597
1897
|
Enabled: true
|
1598
1898
|
VersionAdded: '0.76'
|
1599
1899
|
|
1900
|
+
Lint/RedundantSafeNavigation:
|
1901
|
+
Description: 'Checks for redundant safe navigation calls.'
|
1902
|
+
Enabled: true
|
1903
|
+
VersionAdded: '0.93'
|
1904
|
+
AllowedMethods:
|
1905
|
+
- instance_of?
|
1906
|
+
- kind_of?
|
1907
|
+
- is_a?
|
1908
|
+
- eql?
|
1909
|
+
- respond_to?
|
1910
|
+
- equal?
|
1911
|
+
Safe: false
|
1912
|
+
|
1600
1913
|
Lint/RedundantSplatExpansion:
|
1601
1914
|
Description: 'Checks for splat unnecessarily being called on literals.'
|
1602
1915
|
Enabled: true
|
1603
1916
|
VersionAdded: '0.76'
|
1917
|
+
VersionChanged: '1.7'
|
1918
|
+
AllowPercentLiteralArrayArgument: true
|
1604
1919
|
|
1605
1920
|
Lint/RedundantStringCoercion:
|
1606
1921
|
Description: 'Checks for Object#to_s usage in string interpolation.'
|
@@ -1625,6 +1940,7 @@ Lint/RegexpAsCondition:
|
|
1625
1940
|
The regexp literal matches `$_` implicitly.
|
1626
1941
|
Enabled: true
|
1627
1942
|
VersionAdded: '0.51'
|
1943
|
+
VersionChanged: '0.86'
|
1628
1944
|
|
1629
1945
|
Lint/RequireParentheses:
|
1630
1946
|
Description: >-
|
@@ -1638,7 +1954,7 @@ Lint/RescueException:
|
|
1638
1954
|
StyleGuide: '#no-blind-rescues'
|
1639
1955
|
Enabled: true
|
1640
1956
|
VersionAdded: '0.9'
|
1641
|
-
VersionChanged: '0.27
|
1957
|
+
VersionChanged: '0.27'
|
1642
1958
|
|
1643
1959
|
Lint/RescueType:
|
1644
1960
|
Description: 'Avoid rescuing from non constants that could result in a `TypeError`.'
|
@@ -1661,6 +1977,7 @@ Lint/SafeNavigationChain:
|
|
1661
1977
|
- presence
|
1662
1978
|
- try
|
1663
1979
|
- try!
|
1980
|
+
- in?
|
1664
1981
|
|
1665
1982
|
Lint/SafeNavigationConsistency:
|
1666
1983
|
Description: >-
|
@@ -1681,6 +1998,7 @@ Lint/SafeNavigationWithEmpty:
|
|
1681
1998
|
Description: 'Avoid `foo&.empty?` in conditionals.'
|
1682
1999
|
Enabled: true
|
1683
2000
|
VersionAdded: '0.62'
|
2001
|
+
VersionChanged: '0.87'
|
1684
2002
|
|
1685
2003
|
Lint/ScriptPermission:
|
1686
2004
|
Description: 'Grant script file execute permission.'
|
@@ -1688,6 +2006,11 @@ Lint/ScriptPermission:
|
|
1688
2006
|
VersionAdded: '0.49'
|
1689
2007
|
VersionChanged: '0.50'
|
1690
2008
|
|
2009
|
+
Lint/SelfAssignment:
|
2010
|
+
Description: 'Checks for self-assignments.'
|
2011
|
+
Enabled: true
|
2012
|
+
VersionAdded: '0.89'
|
2013
|
+
|
1691
2014
|
Lint/SendWithMixinArgument:
|
1692
2015
|
Description: 'Checks for `send` method when using mixin.'
|
1693
2016
|
Enabled: true
|
@@ -1727,33 +2050,90 @@ Lint/SuppressedException:
|
|
1727
2050
|
VersionAdded: '0.9'
|
1728
2051
|
VersionChanged: '0.81'
|
1729
2052
|
|
2053
|
+
Lint/SymbolConversion:
|
2054
|
+
Description: 'Checks for unnecessary symbol conversions.'
|
2055
|
+
Enabled: true
|
2056
|
+
VersionAdded: '1.9'
|
2057
|
+
|
1730
2058
|
Lint/Syntax:
|
1731
|
-
Description: 'Checks syntax
|
2059
|
+
Description: 'Checks for syntax errors.'
|
1732
2060
|
Enabled: true
|
1733
2061
|
VersionAdded: '0.9'
|
1734
2062
|
|
2063
|
+
Lint/ToEnumArguments:
|
2064
|
+
Description: 'This cop ensures that `to_enum`/`enum_for`, called for the current method, has correct arguments.'
|
2065
|
+
Enabled: true
|
2066
|
+
VersionAdded: '1.1'
|
1735
2067
|
|
1736
2068
|
Lint/ToJSON:
|
1737
2069
|
Description: 'Ensure #to_json includes an optional argument.'
|
1738
2070
|
Enabled: true
|
1739
2071
|
VersionAdded: '0.66'
|
1740
2072
|
|
2073
|
+
Lint/TopLevelReturnWithArgument:
|
2074
|
+
Description: 'This cop detects top level return statements with argument.'
|
2075
|
+
Enabled: true
|
2076
|
+
VersionAdded: '0.89'
|
2077
|
+
|
2078
|
+
Lint/TrailingCommaInAttributeDeclaration:
|
2079
|
+
Description: 'This cop checks for trailing commas in attribute declarations.'
|
2080
|
+
Enabled: true
|
2081
|
+
VersionAdded: '0.90'
|
2082
|
+
|
2083
|
+
Lint/TripleQuotes:
|
2084
|
+
Description: 'Checks for useless triple quote constructs.'
|
2085
|
+
Enabled: true
|
2086
|
+
VersionAdded: '1.9'
|
2087
|
+
|
1741
2088
|
Lint/UnderscorePrefixedVariableName:
|
1742
2089
|
Description: 'Do not use prefix `_` for a variable that is used.'
|
1743
2090
|
Enabled: true
|
1744
2091
|
VersionAdded: '0.21'
|
1745
2092
|
AllowKeywordBlockArguments: false
|
1746
2093
|
|
2094
|
+
Lint/UnexpectedBlockArity:
|
2095
|
+
Description: 'Looks for blocks that have fewer arguments that the calling method expects.'
|
2096
|
+
Enabled: true
|
2097
|
+
Safe: false
|
2098
|
+
VersionAdded: '1.5'
|
2099
|
+
Methods:
|
2100
|
+
chunk_while: 2
|
2101
|
+
each_with_index: 2
|
2102
|
+
each_with_object: 2
|
2103
|
+
inject: 2
|
2104
|
+
max: 2
|
2105
|
+
min: 2
|
2106
|
+
minmax: 2
|
2107
|
+
reduce: 2
|
2108
|
+
slice_when: 2
|
2109
|
+
sort: 2
|
2110
|
+
|
1747
2111
|
Lint/UnifiedInteger:
|
1748
2112
|
Description: 'Use Integer instead of Fixnum or Bignum.'
|
1749
2113
|
Enabled: true
|
1750
2114
|
VersionAdded: '0.43'
|
1751
2115
|
|
2116
|
+
Lint/UnmodifiedReduceAccumulator:
|
2117
|
+
Description: Checks for `reduce` or `inject` blocks that do not update the accumulator each iteration.
|
2118
|
+
Enabled: true
|
2119
|
+
VersionAdded: '1.1'
|
2120
|
+
VersionChanged: '1.5'
|
2121
|
+
|
1752
2122
|
Lint/UnreachableCode:
|
1753
2123
|
Description: 'Unreachable code.'
|
1754
2124
|
Enabled: true
|
1755
2125
|
VersionAdded: '0.9'
|
1756
2126
|
|
2127
|
+
Lint/UnreachableLoop:
|
2128
|
+
Description: 'This cop checks for loops that will have at most one iteration.'
|
2129
|
+
Enabled: true
|
2130
|
+
VersionAdded: '0.89'
|
2131
|
+
VersionChanged: '1.7'
|
2132
|
+
IgnoredPatterns:
|
2133
|
+
# RSpec uses `times` in its message expectations
|
2134
|
+
# eg. `exactly(2).times`
|
2135
|
+
- !ruby/regexp /(exactly|at_least|at_most)\(\d+\)\.times/
|
2136
|
+
|
1757
2137
|
Lint/UnusedBlockArgument:
|
1758
2138
|
Description: 'Checks for unused block arguments.'
|
1759
2139
|
StyleGuide: '#underscore-unused-vars'
|
@@ -1793,19 +2173,14 @@ Lint/UselessAccessModifier:
|
|
1793
2173
|
Description: 'Checks for useless access modifiers.'
|
1794
2174
|
Enabled: true
|
1795
2175
|
VersionAdded: '0.20'
|
1796
|
-
VersionChanged: '0.
|
2176
|
+
VersionChanged: '0.83'
|
1797
2177
|
ContextCreatingMethods: []
|
1798
2178
|
MethodCreatingMethods: []
|
1799
2179
|
|
1800
2180
|
Lint/UselessAssignment:
|
1801
2181
|
Description: 'Checks for useless assignment to a local variable.'
|
1802
2182
|
StyleGuide: '#underscore-unused-vars'
|
1803
|
-
Enabled: false
|
1804
|
-
VersionAdded: '0.11'
|
1805
|
-
|
1806
|
-
Lint/UselessComparison:
|
1807
|
-
Description: 'Checks for comparison of something with itself.'
|
1808
|
-
Enabled: true
|
2183
|
+
Enabled: false # There are cases where it is easier to read if the the same body is used for different branches
|
1809
2184
|
VersionAdded: '0.11'
|
1810
2185
|
|
1811
2186
|
Lint/UselessElseWithoutRescue:
|
@@ -1813,11 +2188,25 @@ Lint/UselessElseWithoutRescue:
|
|
1813
2188
|
Enabled: true
|
1814
2189
|
VersionAdded: '0.17'
|
1815
2190
|
|
2191
|
+
Lint/UselessMethodDefinition:
|
2192
|
+
Description: 'Checks for useless method definitions.'
|
2193
|
+
Enabled: true
|
2194
|
+
VersionAdded: '0.90'
|
2195
|
+
Safe: false
|
2196
|
+
AllowComments: true
|
2197
|
+
|
1816
2198
|
Lint/UselessSetterCall:
|
1817
2199
|
Description: 'Checks for useless setter call to a local variable.'
|
1818
2200
|
Enabled: true
|
2201
|
+
SafeAutoCorrect: false
|
1819
2202
|
VersionAdded: '0.13'
|
1820
|
-
VersionChanged: '
|
2203
|
+
VersionChanged: '1.2'
|
2204
|
+
Safe: false
|
2205
|
+
|
2206
|
+
Lint/UselessTimes:
|
2207
|
+
Description: 'Checks for useless `Integer#times` calls.'
|
2208
|
+
Enabled: true
|
2209
|
+
VersionAdded: '0.91'
|
1821
2210
|
Safe: false
|
1822
2211
|
|
1823
2212
|
Lint/Void:
|
@@ -1837,20 +2226,22 @@ Metrics/AbcSize:
|
|
1837
2226
|
- https://en.wikipedia.org/wiki/ABC_Software_Metric
|
1838
2227
|
Enabled: false
|
1839
2228
|
VersionAdded: '0.27'
|
1840
|
-
VersionChanged: '
|
2229
|
+
VersionChanged: '1.5'
|
1841
2230
|
# The ABC size is a calculated magnitude, so this number can be an Integer or
|
1842
2231
|
# a Float.
|
1843
2232
|
IgnoredMethods: []
|
1844
|
-
|
2233
|
+
CountRepeatedAttributes: true
|
2234
|
+
Max: 17
|
1845
2235
|
|
1846
2236
|
Metrics/BlockLength:
|
1847
2237
|
Description: 'Avoid long blocks with many lines.'
|
1848
2238
|
Enabled: false
|
1849
2239
|
VersionAdded: '0.44'
|
1850
|
-
VersionChanged: '
|
2240
|
+
VersionChanged: '1.5'
|
1851
2241
|
CountComments: false # count full line comments?
|
1852
2242
|
Max: 25
|
1853
|
-
|
2243
|
+
CountAsOne: []
|
2244
|
+
IgnoredMethods:
|
1854
2245
|
# By default, exclude the `#refine` method, as it tends to have larger
|
1855
2246
|
# associated blocks.
|
1856
2247
|
- refine
|
@@ -1870,8 +2261,10 @@ Metrics/ClassLength:
|
|
1870
2261
|
Description: 'Avoid classes longer than 100 lines of code.'
|
1871
2262
|
Enabled: false
|
1872
2263
|
VersionAdded: '0.25'
|
2264
|
+
VersionChanged: '0.87'
|
1873
2265
|
CountComments: false # count full line comments?
|
1874
2266
|
Max: 100
|
2267
|
+
CountAsOne: []
|
1875
2268
|
|
1876
2269
|
# Avoid complex methods.
|
1877
2270
|
Metrics/CyclomaticComplexity:
|
@@ -1882,32 +2275,37 @@ Metrics/CyclomaticComplexity:
|
|
1882
2275
|
VersionAdded: '0.25'
|
1883
2276
|
VersionChanged: '0.81'
|
1884
2277
|
IgnoredMethods: []
|
1885
|
-
Max:
|
2278
|
+
Max: 7
|
1886
2279
|
|
1887
2280
|
Metrics/MethodLength:
|
1888
2281
|
Description: 'Avoid methods longer than 10 lines of code.'
|
1889
2282
|
StyleGuide: '#short-methods'
|
1890
2283
|
Enabled: false
|
1891
2284
|
VersionAdded: '0.25'
|
1892
|
-
VersionChanged: '
|
2285
|
+
VersionChanged: '1.5'
|
1893
2286
|
CountComments: false # count full line comments?
|
1894
2287
|
Max: 10
|
1895
|
-
|
2288
|
+
CountAsOne: []
|
2289
|
+
IgnoredMethods: []
|
1896
2290
|
|
1897
2291
|
Metrics/ModuleLength:
|
1898
2292
|
Description: 'Avoid modules longer than 100 lines of code.'
|
1899
2293
|
Enabled: false
|
1900
2294
|
VersionAdded: '0.31'
|
2295
|
+
VersionChanged: '0.87'
|
1901
2296
|
CountComments: false # count full line comments?
|
1902
2297
|
Max: 100
|
2298
|
+
CountAsOne: []
|
1903
2299
|
|
1904
2300
|
Metrics/ParameterLists:
|
1905
2301
|
Description: 'Avoid parameter lists longer than three or four parameters.'
|
1906
2302
|
StyleGuide: '#too-many-params'
|
1907
2303
|
Enabled: false
|
1908
2304
|
VersionAdded: '0.25'
|
2305
|
+
VersionChanged: '1.5'
|
1909
2306
|
Max: 5
|
1910
2307
|
CountKeywordArgs: true
|
2308
|
+
MaxOptionalParameters: 3
|
1911
2309
|
|
1912
2310
|
Metrics/PerceivedComplexity:
|
1913
2311
|
Description: >-
|
@@ -1917,7 +2315,7 @@ Metrics/PerceivedComplexity:
|
|
1917
2315
|
VersionAdded: '0.25'
|
1918
2316
|
VersionChanged: '0.81'
|
1919
2317
|
IgnoredMethods: []
|
1920
|
-
Max:
|
2318
|
+
Max: 8
|
1921
2319
|
|
1922
2320
|
################## Migration #############################
|
1923
2321
|
|
@@ -1937,21 +2335,24 @@ Naming/AccessorMethodName:
|
|
1937
2335
|
VersionAdded: '0.50'
|
1938
2336
|
|
1939
2337
|
Naming/AsciiIdentifiers:
|
1940
|
-
Description: 'Use only ascii symbols in identifiers.'
|
2338
|
+
Description: 'Use only ascii symbols in identifiers and constants.'
|
1941
2339
|
StyleGuide: '#english-identifiers'
|
1942
2340
|
Enabled: true
|
1943
2341
|
VersionAdded: '0.50'
|
2342
|
+
VersionChanged: '0.87'
|
2343
|
+
AsciiConstants: true
|
1944
2344
|
|
1945
2345
|
Naming/BinaryOperatorParameterName:
|
1946
2346
|
Description: 'When defining binary operators, name the argument other.'
|
1947
2347
|
StyleGuide: '#other-arg'
|
1948
2348
|
Enabled: false
|
1949
2349
|
VersionAdded: '0.50'
|
2350
|
+
VersionChanged: '1.2'
|
1950
2351
|
|
1951
2352
|
Naming/BlockParameterName:
|
1952
2353
|
Description: >-
|
1953
|
-
|
1954
|
-
|
2354
|
+
Checks for block parameter names that contain capital letters,
|
2355
|
+
end in numbers, or do not meet a minimal length.
|
1955
2356
|
Enabled: true
|
1956
2357
|
VersionAdded: '0.53'
|
1957
2358
|
VersionChanged: '0.77'
|
@@ -1968,6 +2369,11 @@ Naming/ClassAndModuleCamelCase:
|
|
1968
2369
|
StyleGuide: '#camelcase-classes'
|
1969
2370
|
Enabled: true
|
1970
2371
|
VersionAdded: '0.50'
|
2372
|
+
VersionChanged: '0.85'
|
2373
|
+
# Allowed class/module names can be specified here.
|
2374
|
+
# These can be full or part of the name.
|
2375
|
+
AllowedNames:
|
2376
|
+
- module_parent
|
1971
2377
|
|
1972
2378
|
Naming/ConstantName:
|
1973
2379
|
Description: 'Constants should use SCREAMING_SNAKE_CASE.'
|
@@ -1988,6 +2394,10 @@ Naming/FileName:
|
|
1988
2394
|
# It further expects it to be nested inside modules which match the names
|
1989
2395
|
# of subdirectories in its path.
|
1990
2396
|
ExpectMatchingDefinition: false
|
2397
|
+
# When `false`, changes the behavior of ExpectMatchingDefinition to match only
|
2398
|
+
# whether each source file's class or module name matches the file name --
|
2399
|
+
# not whether the nested module hierarchy matches the subdirectory path.
|
2400
|
+
CheckDefinitionPathHierarchy: true
|
1991
2401
|
# If non-`nil`, expect all source file names to match the following regex.
|
1992
2402
|
# Only the file name itself is matched, not the entire file path.
|
1993
2403
|
# Use anchors as necessary if you want to match the entire name rather than
|
@@ -2044,6 +2454,7 @@ Naming/HeredocDelimiterCase:
|
|
2044
2454
|
StyleGuide: '#heredoc-delimiters'
|
2045
2455
|
Enabled: true
|
2046
2456
|
VersionAdded: '0.50'
|
2457
|
+
VersionChanged: '1.2'
|
2047
2458
|
EnforcedStyle: uppercase
|
2048
2459
|
SupportedStyles:
|
2049
2460
|
- lowercase
|
@@ -2062,7 +2473,7 @@ Naming/MemoizedInstanceVariableName:
|
|
2062
2473
|
Memoized method name should match memo instance variable name.
|
2063
2474
|
Enabled: false
|
2064
2475
|
VersionAdded: '0.53'
|
2065
|
-
VersionChanged: '
|
2476
|
+
VersionChanged: '1.2'
|
2066
2477
|
EnforcedStyleForLeadingUnderscores: disallowed
|
2067
2478
|
SupportedStylesForLeadingUnderscores:
|
2068
2479
|
- disallowed
|
@@ -2088,27 +2499,28 @@ Naming/MethodName:
|
|
2088
2499
|
|
2089
2500
|
Naming/MethodParameterName:
|
2090
2501
|
Description: >-
|
2091
|
-
|
2092
|
-
|
2502
|
+
Checks for method parameter names that contain capital letters,
|
2503
|
+
end in numbers, or do not meet a minimal length.
|
2093
2504
|
Enabled: true
|
2094
2505
|
VersionAdded: '0.53'
|
2095
2506
|
VersionChanged: '0.77'
|
2096
2507
|
# Parameter names may be equal to or greater than this value
|
2097
|
-
MinNameLength:
|
2508
|
+
MinNameLength: 3
|
2098
2509
|
AllowNamesEndingInNumbers: true
|
2099
2510
|
# Allowed names that will not register an offense
|
2100
2511
|
AllowedNames:
|
2101
|
-
-
|
2102
|
-
- id
|
2103
|
-
- to
|
2512
|
+
- at
|
2104
2513
|
- by
|
2105
|
-
-
|
2514
|
+
- db
|
2515
|
+
- id
|
2106
2516
|
- in
|
2107
|
-
-
|
2517
|
+
- io
|
2108
2518
|
- ip
|
2109
|
-
-
|
2519
|
+
- of
|
2520
|
+
- 'on'
|
2110
2521
|
- os
|
2111
2522
|
- pp
|
2523
|
+
- to
|
2112
2524
|
# Forbidden names that will register an offense
|
2113
2525
|
ForbiddenNames: []
|
2114
2526
|
|
@@ -2153,20 +2565,39 @@ Naming/VariableName:
|
|
2153
2565
|
StyleGuide: '#snake-case-symbols-methods-vars'
|
2154
2566
|
Enabled: true
|
2155
2567
|
VersionAdded: '0.50'
|
2568
|
+
VersionChanged: '1.8'
|
2156
2569
|
EnforcedStyle: snake_case
|
2157
2570
|
SupportedStyles:
|
2158
2571
|
- snake_case
|
2159
2572
|
- camelCase
|
2573
|
+
AllowedIdentifiers: []
|
2160
2574
|
|
2161
2575
|
Naming/VariableNumber:
|
2162
|
-
Description: 'Use the configured style when numbering variables.'
|
2576
|
+
Description: 'Use the configured style when numbering symbols, methods and variables.'
|
2577
|
+
StyleGuide: '#snake-case-symbols-methods-vars-with-numbers'
|
2163
2578
|
Enabled: true
|
2164
2579
|
VersionAdded: '0.50'
|
2580
|
+
VersionChanged: '1.4'
|
2165
2581
|
EnforcedStyle: snake_case
|
2166
2582
|
SupportedStyles:
|
2167
2583
|
- snake_case
|
2168
2584
|
- normalcase
|
2169
2585
|
- non_integer
|
2586
|
+
CheckMethodNames: true
|
2587
|
+
CheckSymbols: true
|
2588
|
+
AllowedIdentifiers:
|
2589
|
+
- capture3 # Open3.capture3
|
2590
|
+
- iso8601 # Time#iso8601
|
2591
|
+
- rfc1123_date # CGI.rfc1123_date
|
2592
|
+
- rfc822 # Time#rfc822
|
2593
|
+
- rfc2822 # Time#rfc2822
|
2594
|
+
- rfc3339 # DateTime.rfc3339
|
2595
|
+
- html5 # Simple Form variable
|
2596
|
+
- h1 # content_tag :h1
|
2597
|
+
- h2 # content_tag :h2
|
2598
|
+
- h3 # content_tag :h3
|
2599
|
+
- h4 # content_tag :h4
|
2600
|
+
- h5 # content_tag :h5
|
2170
2601
|
|
2171
2602
|
#################### Security ##############################
|
2172
2603
|
|
@@ -2179,7 +2610,7 @@ Security/JSONLoad:
|
|
2179
2610
|
Description: >-
|
2180
2611
|
Prefer usage of `JSON.parse` over `JSON.load` due to potential
|
2181
2612
|
security issues. See reference for more information.
|
2182
|
-
Reference: 'https://ruby-doc.org/stdlib-2.
|
2613
|
+
Reference: 'https://ruby-doc.org/stdlib-2.7.0/libdoc/json/rdoc/JSON.html#method-i-load'
|
2183
2614
|
Enabled: true
|
2184
2615
|
VersionAdded: '0.43'
|
2185
2616
|
VersionChanged: '0.44'
|
@@ -2192,21 +2623,22 @@ Security/MarshalLoad:
|
|
2192
2623
|
Description: >-
|
2193
2624
|
Avoid using of `Marshal.load` or `Marshal.restore` due to potential
|
2194
2625
|
security issues. See reference for more information.
|
2195
|
-
Reference: 'https://ruby-doc.org/core-2.
|
2626
|
+
Reference: 'https://ruby-doc.org/core-2.7.0/Marshal.html#module-Marshal-label-Security+considerations'
|
2196
2627
|
Enabled: true
|
2197
2628
|
VersionAdded: '0.47'
|
2198
2629
|
|
2199
2630
|
Security/Open:
|
2200
|
-
Description: 'The use of Kernel#open
|
2631
|
+
Description: 'The use of `Kernel#open` and `URI.open` represent a serious security risk.'
|
2201
2632
|
Enabled: true
|
2202
2633
|
VersionAdded: '0.53'
|
2634
|
+
VersionChanged: '1.0'
|
2203
2635
|
Safe: false
|
2204
2636
|
|
2205
2637
|
Security/YAMLLoad:
|
2206
2638
|
Description: >-
|
2207
2639
|
Prefer usage of `YAML.safe_load` over `YAML.load` due to potential
|
2208
2640
|
security issues. See reference for more information.
|
2209
|
-
Reference: 'https://ruby-doc.org/stdlib-2.
|
2641
|
+
Reference: 'https://ruby-doc.org/stdlib-2.7.0/libdoc/yaml/rdoc/YAML.html#module-YAML-label-Security'
|
2210
2642
|
Enabled: true
|
2211
2643
|
VersionAdded: '0.47'
|
2212
2644
|
SafeAutoCorrect: false
|
@@ -2224,6 +2656,17 @@ Style/AccessModifierDeclarations:
|
|
2224
2656
|
- group
|
2225
2657
|
AllowModifiersOnSymbols: true
|
2226
2658
|
|
2659
|
+
Style/AccessorGrouping:
|
2660
|
+
Description: 'Checks for grouping of accessors in `class` and `module` bodies.'
|
2661
|
+
Enabled: true
|
2662
|
+
VersionAdded: '0.87'
|
2663
|
+
EnforcedStyle: grouped
|
2664
|
+
SupportedStyles:
|
2665
|
+
# separated: each accessor goes in a separate statement.
|
2666
|
+
# grouped: accessors are grouped into a single statement.
|
2667
|
+
- separated
|
2668
|
+
- grouped
|
2669
|
+
|
2227
2670
|
Style/Alias:
|
2228
2671
|
Description: 'Use alias instead of alias_method.'
|
2229
2672
|
StyleGuide: '#alias-method-lexically'
|
@@ -2248,6 +2691,22 @@ Style/AndOr:
|
|
2248
2691
|
- always
|
2249
2692
|
- conditionals
|
2250
2693
|
|
2694
|
+
Style/ArgumentsForwarding:
|
2695
|
+
Description: 'Use arguments forwarding.'
|
2696
|
+
StyleGuide: '#arguments-forwarding'
|
2697
|
+
Enabled: true
|
2698
|
+
AllowOnlyRestArgument: true
|
2699
|
+
VersionAdded: '1.1'
|
2700
|
+
|
2701
|
+
Style/ArrayCoercion:
|
2702
|
+
Description: >-
|
2703
|
+
Use Array() instead of explicit Array check or [*var], when dealing
|
2704
|
+
with a variable you want to treat as an Array, but you're not certain it's an array.
|
2705
|
+
StyleGuide: '#array-coercion'
|
2706
|
+
Safe: false
|
2707
|
+
Enabled: true # We use this quite often exactly like described
|
2708
|
+
VersionAdded: '0.88'
|
2709
|
+
|
2251
2710
|
Style/ArrayJoin:
|
2252
2711
|
Description: 'Use Array#join instead of Array#*.'
|
2253
2712
|
StyleGuide: '#array-join'
|
@@ -2261,7 +2720,8 @@ Style/AsciiComments:
|
|
2261
2720
|
Enabled: false
|
2262
2721
|
VersionAdded: '0.9'
|
2263
2722
|
VersionChanged: '0.52'
|
2264
|
-
AllowedChars:
|
2723
|
+
AllowedChars:
|
2724
|
+
- ©
|
2265
2725
|
|
2266
2726
|
Style/Attr:
|
2267
2727
|
Description: 'Checks for uses of Module#attr.'
|
@@ -2291,6 +2751,13 @@ Style/BeginBlock:
|
|
2291
2751
|
Enabled: true
|
2292
2752
|
VersionAdded: '0.9'
|
2293
2753
|
|
2754
|
+
Style/BisectedAttrAccessor:
|
2755
|
+
Description: >-
|
2756
|
+
Checks for places where `attr_reader` and `attr_writer`
|
2757
|
+
for the same method can be combined into single `attr_accessor`.
|
2758
|
+
Enabled: true
|
2759
|
+
VersionAdded: '0.87'
|
2760
|
+
|
2294
2761
|
Style/BlockComments:
|
2295
2762
|
Description: 'Do not use block comments.'
|
2296
2763
|
StyleGuide: '#no-block-comments'
|
@@ -2413,6 +2880,23 @@ Style/CaseEquality:
|
|
2413
2880
|
StyleGuide: '#no-case-equality'
|
2414
2881
|
Enabled: true
|
2415
2882
|
VersionAdded: '0.9'
|
2883
|
+
VersionChanged: '0.89'
|
2884
|
+
# If AllowOnConstant is enabled, the cop will ignore violations when the receiver of
|
2885
|
+
# the case equality operator is a constant.
|
2886
|
+
#
|
2887
|
+
# # bad
|
2888
|
+
# /string/ === "string"
|
2889
|
+
#
|
2890
|
+
# # good
|
2891
|
+
# String === "string"
|
2892
|
+
AllowOnConstant: false
|
2893
|
+
|
2894
|
+
Style/CaseLikeIf:
|
2895
|
+
Description: 'This cop identifies places where `if-elsif` constructions can be replaced with `case-when`.'
|
2896
|
+
StyleGuide: '#case-vs-if-else'
|
2897
|
+
Enabled: true
|
2898
|
+
Safe: false
|
2899
|
+
VersionAdded: '0.88'
|
2416
2900
|
|
2417
2901
|
Style/CharacterLiteral:
|
2418
2902
|
Description: 'Checks for uses of character literals.'
|
@@ -2429,7 +2913,6 @@ Style/ClassAndModuleChildren:
|
|
2429
2913
|
# have the knowledge to perform either operation safely and thus requires
|
2430
2914
|
# manual oversight.
|
2431
2915
|
SafeAutoCorrect: false
|
2432
|
-
AutoCorrect: false
|
2433
2916
|
Enabled: false
|
2434
2917
|
VersionAdded: '0.19'
|
2435
2918
|
#
|
@@ -2453,6 +2936,7 @@ Style/ClassAndModuleChildren:
|
|
2453
2936
|
|
2454
2937
|
Style/ClassCheck:
|
2455
2938
|
Description: 'Enforces consistent use of `Object#is_a?` or `Object#kind_of?`.'
|
2939
|
+
StyleGuide: '#is-a-vs-kind-of'
|
2456
2940
|
Enabled: false # These methods are not the same, see https://github.com/makandra/makandra-rubocop/issues/22
|
2457
2941
|
VersionAdded: '0.24'
|
2458
2942
|
EnforcedStyle: is_a?
|
@@ -2460,6 +2944,16 @@ Style/ClassCheck:
|
|
2460
2944
|
- is_a?
|
2461
2945
|
- kind_of?
|
2462
2946
|
|
2947
|
+
Style/ClassEqualityComparison:
|
2948
|
+
Description: 'Enforces the use of `Object#instance_of?` instead of class comparison for equality.'
|
2949
|
+
StyleGuide: '#instance-of-vs-class-comparison'
|
2950
|
+
Enabled: true
|
2951
|
+
VersionAdded: '0.93'
|
2952
|
+
IgnoredMethods:
|
2953
|
+
- ==
|
2954
|
+
- equal?
|
2955
|
+
- eql?
|
2956
|
+
|
2463
2957
|
Style/ClassMethods:
|
2464
2958
|
Description: 'Use self when defining module/class methods.'
|
2465
2959
|
StyleGuide: '#def-self-class-methods'
|
@@ -2467,19 +2961,36 @@ Style/ClassMethods:
|
|
2467
2961
|
VersionAdded: '0.9'
|
2468
2962
|
VersionChanged: '0.20'
|
2469
2963
|
|
2964
|
+
Style/ClassMethodsDefinitions:
|
2965
|
+
Description: 'Enforces using `def self.method_name` or `class << self` to define class methods.'
|
2966
|
+
StyleGuide: '#def-self-class-methods'
|
2967
|
+
Enabled: false
|
2968
|
+
VersionAdded: '0.89'
|
2969
|
+
EnforcedStyle: def_self
|
2970
|
+
SupportedStyles:
|
2971
|
+
- def_self
|
2972
|
+
- self_class
|
2973
|
+
|
2470
2974
|
Style/ClassVars:
|
2471
2975
|
Description: 'Avoid the use of class variables.'
|
2472
2976
|
StyleGuide: '#no-class-vars'
|
2473
2977
|
Enabled: true
|
2474
2978
|
VersionAdded: '0.13'
|
2475
2979
|
|
2980
|
+
Style/CollectionCompact:
|
2981
|
+
Description: 'Use `{Array,Hash}#{compact,compact!}` instead of custom logic to reject nils.'
|
2982
|
+
Enabled: false
|
2983
|
+
Safe: false
|
2984
|
+
VersionAdded: '1.2'
|
2985
|
+
VersionChanged: '1.3'
|
2986
|
+
|
2476
2987
|
# Align with the style guide.
|
2477
2988
|
Style/CollectionMethods:
|
2478
2989
|
Description: 'Preferred collection methods.'
|
2479
2990
|
StyleGuide: '#map-find-select-reduce-include-size'
|
2480
2991
|
Enabled: false # We'll maybe enable this later.
|
2481
2992
|
VersionAdded: '0.9'
|
2482
|
-
VersionChanged: '
|
2993
|
+
VersionChanged: '1.7'
|
2483
2994
|
Safe: false
|
2484
2995
|
# Mapping from undesired method to desired method
|
2485
2996
|
# e.g. to use `detect` over `find`:
|
@@ -2494,6 +3005,11 @@ Style/CollectionMethods:
|
|
2494
3005
|
detect: 'find'
|
2495
3006
|
find_all: 'select'
|
2496
3007
|
member?: 'include?'
|
3008
|
+
# Methods in this array accept a final symbol as an implicit block
|
3009
|
+
# eg. `inject(:+)`
|
3010
|
+
MethodsAcceptingSymbol:
|
3011
|
+
- inject
|
3012
|
+
- reduce
|
2497
3013
|
|
2498
3014
|
Style/ColonMethodCall:
|
2499
3015
|
Description: 'Do not use :: for method call.'
|
@@ -2507,6 +3023,14 @@ Style/ColonMethodDefinition:
|
|
2507
3023
|
Enabled: true
|
2508
3024
|
VersionAdded: '0.52'
|
2509
3025
|
|
3026
|
+
Style/CombinableLoops:
|
3027
|
+
Description: >-
|
3028
|
+
Checks for places where multiple consecutive loops over the same data
|
3029
|
+
can be combined into a single loop.
|
3030
|
+
Enabled: true
|
3031
|
+
Safe: false
|
3032
|
+
VersionAdded: '0.90'
|
3033
|
+
|
2510
3034
|
Style/CommandLiteral:
|
2511
3035
|
Description: 'Use `` or %x around command literals.'
|
2512
3036
|
StyleGuide: '#percent-x'
|
@@ -2528,22 +3052,24 @@ Style/CommandLiteral:
|
|
2528
3052
|
Style/CommentAnnotation:
|
2529
3053
|
Description: >-
|
2530
3054
|
Checks formatting of special comments
|
2531
|
-
(TODO, FIXME, OPTIMIZE, HACK, REVIEW).
|
3055
|
+
(TODO, FIXME, OPTIMIZE, HACK, REVIEW, NOTE).
|
2532
3056
|
StyleGuide: '#annotate-keywords'
|
2533
3057
|
Enabled: true
|
2534
3058
|
VersionAdded: '0.10'
|
2535
|
-
VersionChanged: '
|
3059
|
+
VersionChanged: '1.3'
|
2536
3060
|
Keywords:
|
2537
3061
|
- TODO
|
2538
3062
|
- FIXME
|
2539
3063
|
- OPTIMIZE
|
2540
3064
|
- HACK
|
2541
3065
|
- REVIEW
|
3066
|
+
- NOTE
|
2542
3067
|
|
2543
3068
|
Style/CommentedKeyword:
|
2544
3069
|
Description: 'Do not place comments on the same line as certain keywords.'
|
2545
3070
|
Enabled: false
|
2546
3071
|
VersionAdded: '0.51'
|
3072
|
+
VersionChanged: '1.7'
|
2547
3073
|
|
2548
3074
|
Style/ConditionalAssignment:
|
2549
3075
|
Description: >-
|
@@ -2603,7 +3129,8 @@ Style/DateTime:
|
|
2603
3129
|
StyleGuide: '#date--time'
|
2604
3130
|
Enabled: true # This cop allows DateTime, when used properly. You almost always want Date or Time, though. https://gist.github.com/pixeltrix/e2298822dd89d854444b
|
2605
3131
|
VersionAdded: '0.51'
|
2606
|
-
VersionChanged: '0.
|
3132
|
+
VersionChanged: '0.92'
|
3133
|
+
SafeAutoCorrect: false
|
2607
3134
|
AllowCoercion: false
|
2608
3135
|
|
2609
3136
|
Style/DefWithParentheses:
|
@@ -2620,6 +3147,23 @@ Style/Dir:
|
|
2620
3147
|
Enabled: true
|
2621
3148
|
VersionAdded: '0.50'
|
2622
3149
|
|
3150
|
+
Style/DisableCopsWithinSourceCodeDirective:
|
3151
|
+
Description: >-
|
3152
|
+
Forbids disabling/enabling cops within source code.
|
3153
|
+
Enabled: false
|
3154
|
+
VersionAdded: '0.82'
|
3155
|
+
VersionChanged: '1.9'
|
3156
|
+
AllowedCops: []
|
3157
|
+
|
3158
|
+
Style/DocumentDynamicEvalDefinition:
|
3159
|
+
Description: >-
|
3160
|
+
When using `class_eval` (or other `eval`) with string interpolation,
|
3161
|
+
add a comment block showing its appearance if interpolated.
|
3162
|
+
StyleGuide: '#eval-comment-docs'
|
3163
|
+
Enabled: false
|
3164
|
+
VersionAdded: '1.1'
|
3165
|
+
VersionChanged: '1.3'
|
3166
|
+
|
2623
3167
|
Style/Documentation:
|
2624
3168
|
Description: 'Document classes and non-namespace modules.'
|
2625
3169
|
Enabled: false
|
@@ -2647,6 +3191,12 @@ Style/DoubleNegation:
|
|
2647
3191
|
StyleGuide: '#no-bang-bang'
|
2648
3192
|
Enabled: false
|
2649
3193
|
VersionAdded: '0.19'
|
3194
|
+
VersionChanged: '1.2'
|
3195
|
+
EnforcedStyle: allowed_in_returns
|
3196
|
+
SafeAutoCorrect: false
|
3197
|
+
SupportedStyles:
|
3198
|
+
- allowed_in_returns
|
3199
|
+
- forbidden
|
2650
3200
|
|
2651
3201
|
Style/EachForSimpleLoop:
|
2652
3202
|
Description: >-
|
@@ -2721,6 +3271,17 @@ Style/EndBlock:
|
|
2721
3271
|
VersionAdded: '0.9'
|
2722
3272
|
VersionChanged: '0.81'
|
2723
3273
|
|
3274
|
+
Style/EndlessMethod:
|
3275
|
+
Description: 'Avoid the use of multi-lined endless method definitions.'
|
3276
|
+
StyleGuide: '#endless-methods'
|
3277
|
+
Enabled: true
|
3278
|
+
VersionAdded: '1.8'
|
3279
|
+
EnforcedStyle: allow_single_line
|
3280
|
+
SupportedStyles:
|
3281
|
+
- allow_single_line
|
3282
|
+
- allow_always
|
3283
|
+
- disallow
|
3284
|
+
|
2724
3285
|
Style/EvalWithLocation:
|
2725
3286
|
Description: 'Pass `__FILE__` and `__LINE__` to `eval` method, as they are used by backtraces.'
|
2726
3287
|
Enabled: true
|
@@ -2738,12 +3299,34 @@ Style/ExpandPathArguments:
|
|
2738
3299
|
Enabled: true
|
2739
3300
|
VersionAdded: '0.53'
|
2740
3301
|
|
3302
|
+
Style/ExplicitBlockArgument:
|
3303
|
+
Description: >-
|
3304
|
+
Consider using explicit block argument to avoid writing block literal
|
3305
|
+
that just passes its arguments to another block.
|
3306
|
+
StyleGuide: '#block-argument'
|
3307
|
+
Enabled: true
|
3308
|
+
VersionAdded: '0.89'
|
3309
|
+
VersionChanged: '1.8'
|
3310
|
+
|
3311
|
+
Style/ExponentialNotation:
|
3312
|
+
Description: 'When using exponential notation, favor a mantissa between 1 (inclusive) and 10 (exclusive).'
|
3313
|
+
StyleGuide: '#exponential-notation'
|
3314
|
+
Enabled: true
|
3315
|
+
VersionAdded: '0.82'
|
3316
|
+
EnforcedStyle: scientific
|
3317
|
+
SupportedStyles:
|
3318
|
+
- scientific
|
3319
|
+
- engineering
|
3320
|
+
- integral
|
3321
|
+
|
2741
3322
|
Style/FloatDivision:
|
2742
3323
|
Description: 'For performing float division, coerce one side only.'
|
2743
3324
|
StyleGuide: '#float-division'
|
2744
|
-
Reference: 'https://
|
3325
|
+
Reference: 'https://blog.rubystyle.guide/ruby/2019/06/21/float-division.html'
|
2745
3326
|
Enabled: false # We disable this cop, it's fine for us to have .to_f on both sides
|
2746
3327
|
VersionAdded: '0.72'
|
3328
|
+
VersionChanged: '1.9'
|
3329
|
+
Safe: false
|
2747
3330
|
EnforcedStyle: single_coerce
|
2748
3331
|
SupportedStyles:
|
2749
3332
|
- left_coerce
|
@@ -2785,8 +3368,13 @@ Style/FormatStringToken:
|
|
2785
3368
|
# Prefer simple looking "template" style tokens like `%{name}`, `%{age}`
|
2786
3369
|
- template
|
2787
3370
|
- unannotated
|
3371
|
+
# `MaxUnannotatedPlaceholdersAllowed` defines the number of `unannotated`
|
3372
|
+
# style token in a format string to be allowed when enforced style is not
|
3373
|
+
# `unannotated`.
|
3374
|
+
MaxUnannotatedPlaceholdersAllowed: 1
|
2788
3375
|
VersionAdded: '0.49'
|
2789
|
-
VersionChanged: '0
|
3376
|
+
VersionChanged: '1.0'
|
3377
|
+
IgnoredMethods: []
|
2790
3378
|
|
2791
3379
|
Style/FrozenStringLiteralComment:
|
2792
3380
|
Description: >-
|
@@ -2799,8 +3387,7 @@ Style/FrozenStringLiteralComment:
|
|
2799
3387
|
SupportedStyles:
|
2800
3388
|
# `always` will always add the frozen string literal comment to a file
|
2801
3389
|
# regardless of the Ruby version or if `freeze` or `<<` are called on a
|
2802
|
-
# string literal.
|
2803
|
-
# possible that this will create errors in Ruby 2.3.0+.
|
3390
|
+
# string literal. It is possible that this will create errors.
|
2804
3391
|
- always
|
2805
3392
|
# `always_true` will add the frozen string literal comment to a file,
|
2806
3393
|
# similarly to the `always` style, but will also change any disabled
|
@@ -2809,7 +3396,14 @@ Style/FrozenStringLiteralComment:
|
|
2809
3396
|
# `never` will enforce that the frozen string literal comment does not
|
2810
3397
|
# exist in a file.
|
2811
3398
|
- never
|
2812
|
-
|
3399
|
+
SafeAutoCorrect: false
|
3400
|
+
|
3401
|
+
Style/GlobalStdStream:
|
3402
|
+
Description: 'Enforces the use of `$stdout/$stderr/$stdin` instead of `STDOUT/STDERR/STDIN`.'
|
3403
|
+
StyleGuide: '#global-stdout'
|
3404
|
+
Enabled: true
|
3405
|
+
VersionAdded: '0.89'
|
3406
|
+
SafeAutoCorrect: false
|
2813
3407
|
|
2814
3408
|
Style/GlobalVars:
|
2815
3409
|
Description: 'Do not introduce global variables.'
|
@@ -2830,6 +3424,18 @@ Style/GuardClause:
|
|
2830
3424
|
# needs to have to trigger this cop
|
2831
3425
|
MinBodyLength: 1
|
2832
3426
|
|
3427
|
+
Style/HashAsLastArrayItem:
|
3428
|
+
Description: >-
|
3429
|
+
Checks for presence or absence of braces around hash literal as a last
|
3430
|
+
array item depending on configuration.
|
3431
|
+
StyleGuide: '#hash-literal-as-last-array-item'
|
3432
|
+
Enabled: false
|
3433
|
+
VersionAdded: '0.88'
|
3434
|
+
EnforcedStyle: braces
|
3435
|
+
SupportedStyles:
|
3436
|
+
- braces
|
3437
|
+
- no_braces
|
3438
|
+
|
2833
3439
|
Style/HashEachMethods:
|
2834
3440
|
Description: 'Use Hash#each_key and Hash#each_value.'
|
2835
3441
|
StyleGuide: '#hash-each'
|
@@ -2837,6 +3443,23 @@ Style/HashEachMethods:
|
|
2837
3443
|
VersionAdded: '0.80'
|
2838
3444
|
Safe: false
|
2839
3445
|
|
3446
|
+
Style/HashExcept:
|
3447
|
+
Description: >-
|
3448
|
+
Checks for usages of `Hash#reject`, `Hash#select`, and `Hash#filter` methods
|
3449
|
+
that can be replaced with `Hash#except` method.
|
3450
|
+
Enabled: true
|
3451
|
+
VersionAdded: '1.7'
|
3452
|
+
|
3453
|
+
Style/HashLikeCase:
|
3454
|
+
Description: >-
|
3455
|
+
Checks for places where `case-when` represents a simple 1:1
|
3456
|
+
mapping and can be replaced with a hash lookup.
|
3457
|
+
Enabled: false # The case statement makes it easier to add an else case e.g. to raise an ArgumentError
|
3458
|
+
VersionAdded: '0.88'
|
3459
|
+
# `MinBranchesCount` defines the number of branches `case` needs to have
|
3460
|
+
# to trigger this cop
|
3461
|
+
MinBranchesCount: 3
|
3462
|
+
|
2840
3463
|
Style/HashSyntax:
|
2841
3464
|
Description: >-
|
2842
3465
|
Prefer Ruby 1.9 hash syntax { a: 1, b: 2 } over 1.8 syntax
|
@@ -2861,15 +3484,17 @@ Style/HashSyntax:
|
|
2861
3484
|
PreferHashRocketsForNonAlnumEndingSymbols: false
|
2862
3485
|
|
2863
3486
|
Style/HashTransformKeys:
|
2864
|
-
Description: 'Prefer `transform_keys` over `each_with_object`
|
3487
|
+
Description: 'Prefer `transform_keys` over `each_with_object`, `map`, or `to_h`.'
|
2865
3488
|
Enabled: true
|
2866
3489
|
VersionAdded: '0.80'
|
3490
|
+
VersionChanged: '0.90'
|
2867
3491
|
Safe: false
|
2868
3492
|
|
2869
3493
|
Style/HashTransformValues:
|
2870
|
-
Description: 'Prefer `transform_values` over `each_with_object`
|
3494
|
+
Description: 'Prefer `transform_values` over `each_with_object`, `map`, or `to_h`.'
|
2871
3495
|
Enabled: true
|
2872
3496
|
VersionAdded: '0.80'
|
3497
|
+
VersionChanged: '0.90'
|
2873
3498
|
Safe: false
|
2874
3499
|
|
2875
3500
|
Style/IdenticalConditionalBranches:
|
@@ -2885,6 +3510,7 @@ Style/IfInsideElse:
|
|
2885
3510
|
Enabled: true
|
2886
3511
|
AllowIfModifier: false
|
2887
3512
|
VersionAdded: '0.36'
|
3513
|
+
VersionChanged: '1.3'
|
2888
3514
|
|
2889
3515
|
Style/IfUnlessModifier:
|
2890
3516
|
Description: >-
|
@@ -2900,12 +3526,22 @@ Style/IfUnlessModifierOfIfUnless:
|
|
2900
3526
|
Avoid modifier if/unless usage on conditionals.
|
2901
3527
|
Enabled: true
|
2902
3528
|
VersionAdded: '0.39'
|
3529
|
+
VersionChanged: '0.87'
|
3530
|
+
|
3531
|
+
Style/IfWithBooleanLiteralBranches:
|
3532
|
+
Description: 'Checks for redundant `if` with boolean literal branches.'
|
3533
|
+
Enabled: true
|
3534
|
+
VersionAdded: '1.9'
|
3535
|
+
SafeAutoCorrect: false
|
3536
|
+
AllowedMethods:
|
3537
|
+
- nonzero?
|
2903
3538
|
|
2904
3539
|
Style/IfWithSemicolon:
|
2905
3540
|
Description: 'Do not use if x; .... Use the ternary operator instead.'
|
2906
3541
|
StyleGuide: '#no-semicolon-ifs'
|
2907
3542
|
Enabled: true
|
2908
3543
|
VersionAdded: '0.9'
|
3544
|
+
VersionChanged: '0.83'
|
2909
3545
|
|
2910
3546
|
Style/ImplicitRuntimeError:
|
2911
3547
|
Description: >-
|
@@ -2915,12 +3551,14 @@ Style/ImplicitRuntimeError:
|
|
2915
3551
|
VersionAdded: '0.41'
|
2916
3552
|
|
2917
3553
|
Style/InfiniteLoop:
|
2918
|
-
Description:
|
3554
|
+
Description: >-
|
3555
|
+
Use Kernel#loop for infinite loops.
|
3556
|
+
This cop is unsafe in the body may raise a `StopIteration` exception.
|
3557
|
+
Safe: false
|
2919
3558
|
StyleGuide: '#infinite-loop'
|
2920
3559
|
Enabled: true
|
2921
3560
|
VersionAdded: '0.26'
|
2922
3561
|
VersionChanged: '0.61'
|
2923
|
-
SafeAutoCorrect: true
|
2924
3562
|
|
2925
3563
|
Style/InlineComment:
|
2926
3564
|
Description: 'Avoid trailing inline comments.'
|
@@ -2958,11 +3596,23 @@ Style/IpAddresses:
|
|
2958
3596
|
Description: "Don't include literal IP addresses in code."
|
2959
3597
|
Enabled: false
|
2960
3598
|
VersionAdded: '0.58'
|
2961
|
-
VersionChanged: '0.
|
3599
|
+
VersionChanged: '0.91'
|
2962
3600
|
# Allow addresses to be permitted
|
2963
3601
|
AllowedAddresses:
|
2964
3602
|
- "::"
|
2965
3603
|
# :: is a valid IPv6 address, but could potentially be legitimately in code
|
3604
|
+
Exclude:
|
3605
|
+
- '**/*.gemfile'
|
3606
|
+
- '**/Gemfile'
|
3607
|
+
- '**/gems.rb'
|
3608
|
+
- '**/*.gemspec'
|
3609
|
+
|
3610
|
+
Style/KeywordParametersOrder:
|
3611
|
+
Description: 'Enforces that optional keyword parameters are placed at the end of the parameters list.'
|
3612
|
+
StyleGuide: '#keyword-parameters-order'
|
3613
|
+
Enabled: true
|
3614
|
+
VersionAdded: '0.90'
|
3615
|
+
VersionChanged: '1.7'
|
2966
3616
|
|
2967
3617
|
Style/Lambda:
|
2968
3618
|
Description: 'Use the new lambda literal syntax for single-line blocks.'
|
@@ -3001,7 +3651,7 @@ Style/MethodCallWithArgsParentheses:
|
|
3001
3651
|
StyleGuide: '#method-invocation-parens'
|
3002
3652
|
Enabled: false
|
3003
3653
|
VersionAdded: '0.47'
|
3004
|
-
VersionChanged: '
|
3654
|
+
VersionChanged: '1.7'
|
3005
3655
|
IgnoreMacros: true
|
3006
3656
|
IgnoredMethods: []
|
3007
3657
|
IgnoredPatterns: []
|
@@ -3035,19 +3685,13 @@ Style/MethodDefParentheses:
|
|
3035
3685
|
StyleGuide: '#method-parens'
|
3036
3686
|
Enabled: true
|
3037
3687
|
VersionAdded: '0.16'
|
3038
|
-
VersionChanged: '
|
3688
|
+
VersionChanged: '1.7'
|
3039
3689
|
EnforcedStyle: require_parentheses
|
3040
3690
|
SupportedStyles:
|
3041
3691
|
- require_parentheses
|
3042
3692
|
- require_no_parentheses
|
3043
3693
|
- require_no_parentheses_except_multiline
|
3044
3694
|
|
3045
|
-
Style/MethodMissingSuper:
|
3046
|
-
Description: Checks for `method_missing` to call `super`.
|
3047
|
-
StyleGuide: '#no-method-missing'
|
3048
|
-
Enabled: true
|
3049
|
-
VersionAdded: '0.56'
|
3050
|
-
|
3051
3695
|
Style/MinMax:
|
3052
3696
|
Description: >-
|
3053
3697
|
Use `Enumerable#minmax` instead of `Enumerable#min`
|
@@ -3149,6 +3793,7 @@ Style/MultilineMethodSignature:
|
|
3149
3793
|
Description: 'Avoid multi-line method signatures.'
|
3150
3794
|
Enabled: true
|
3151
3795
|
VersionAdded: '0.59'
|
3796
|
+
VersionChanged: '1.7'
|
3152
3797
|
|
3153
3798
|
Style/MultilineTernaryOperator:
|
3154
3799
|
Description: >-
|
@@ -3157,6 +3802,7 @@ Style/MultilineTernaryOperator:
|
|
3157
3802
|
StyleGuide: '#no-multiline-ternary'
|
3158
3803
|
Enabled: true
|
3159
3804
|
VersionAdded: '0.9'
|
3805
|
+
VersionChanged: '0.86'
|
3160
3806
|
|
3161
3807
|
Style/MultilineWhenThen:
|
3162
3808
|
Description: 'Do not use then for multi-line when statement.'
|
@@ -3170,12 +3816,14 @@ Style/MultipleComparison:
|
|
3170
3816
|
use Array#include? instead.
|
3171
3817
|
Enabled: true
|
3172
3818
|
VersionAdded: '0.49'
|
3819
|
+
VersionChanged: '1.1'
|
3173
3820
|
|
3174
3821
|
Style/MutableConstant:
|
3175
3822
|
Description: 'Do not assign mutable objects to constants.'
|
3176
3823
|
Enabled: true
|
3177
3824
|
VersionAdded: '0.34'
|
3178
|
-
VersionChanged: '
|
3825
|
+
VersionChanged: '1.8'
|
3826
|
+
SafeAutoCorrect: false
|
3179
3827
|
EnforcedStyle: literals
|
3180
3828
|
SupportedStyles:
|
3181
3829
|
# literals: freeze literals assigned to constants
|
@@ -3204,6 +3852,13 @@ Style/NegatedIf:
|
|
3204
3852
|
- prefix
|
3205
3853
|
- postfix
|
3206
3854
|
|
3855
|
+
Style/NegatedIfElseCondition:
|
3856
|
+
Description: >-
|
3857
|
+
This cop checks for uses of `if-else` and ternary operators with a negated condition
|
3858
|
+
which can be simplified by inverting condition and swapping branches.
|
3859
|
+
Enabled: false
|
3860
|
+
VersionAdded: '1.2'
|
3861
|
+
|
3207
3862
|
Style/NegatedUnless:
|
3208
3863
|
Description: 'Favor if over unless for negative conditions.'
|
3209
3864
|
StyleGuide: '#if-for-negatives'
|
@@ -3261,6 +3916,7 @@ Style/NestedTernaryOperator:
|
|
3261
3916
|
StyleGuide: '#no-nested-ternary'
|
3262
3917
|
Enabled: true
|
3263
3918
|
VersionAdded: '0.9'
|
3919
|
+
VersionChanged: '0.86'
|
3264
3920
|
|
3265
3921
|
Style/Next:
|
3266
3922
|
Description: 'Use `next` to skip iteration instead of a condition at the end.'
|
@@ -3290,6 +3946,11 @@ Style/NilComparison:
|
|
3290
3946
|
- predicate
|
3291
3947
|
- comparison
|
3292
3948
|
|
3949
|
+
Style/NilLambda:
|
3950
|
+
Description: 'Prefer `-> {}` to `-> { nil }`.'
|
3951
|
+
Enabled: true
|
3952
|
+
VersionAdded: '1.3'
|
3953
|
+
|
3293
3954
|
Style/NonNilCheck:
|
3294
3955
|
Description: 'Checks for redundant nil checks.'
|
3295
3956
|
StyleGuide: '#no-non-nil-checks'
|
@@ -3343,7 +4004,6 @@ Style/NumericPredicate:
|
|
3343
4004
|
# object. Switching these methods has to be done with knowledge of the types
|
3344
4005
|
# of the variables which rubocop doesn't have.
|
3345
4006
|
SafeAutoCorrect: false
|
3346
|
-
AutoCorrect: false
|
3347
4007
|
Enabled: false
|
3348
4008
|
VersionAdded: '0.42'
|
3349
4009
|
VersionChanged: '0.59'
|
@@ -3359,12 +4019,13 @@ Style/NumericPredicate:
|
|
3359
4019
|
|
3360
4020
|
Style/OneLineConditional:
|
3361
4021
|
Description: >-
|
3362
|
-
Favor the ternary operator(?:) over
|
3363
|
-
if/then/else/end constructs.
|
4022
|
+
Favor the ternary operator (?:) or multi-line constructs over
|
4023
|
+
single-line if/then/else/end constructs.
|
3364
4024
|
StyleGuide: '#ternary-operator'
|
3365
4025
|
Enabled: true
|
4026
|
+
AlwaysCorrectToMultiline: false
|
3366
4027
|
VersionAdded: '0.9'
|
3367
|
-
VersionChanged: '0.
|
4028
|
+
VersionChanged: '0.90'
|
3368
4029
|
|
3369
4030
|
Style/OptionHash:
|
3370
4031
|
Description: "Don't use option hashes when you can use keyword arguments."
|
@@ -3385,7 +4046,18 @@ Style/OptionalArguments:
|
|
3385
4046
|
of the argument list.
|
3386
4047
|
StyleGuide: '#optional-arguments'
|
3387
4048
|
Enabled: false # We want to support helpers like link_to where the link text may be the first argument or be defined by a block
|
4049
|
+
Safe: false
|
3388
4050
|
VersionAdded: '0.33'
|
4051
|
+
VersionChanged: '0.83'
|
4052
|
+
|
4053
|
+
Style/OptionalBooleanParameter:
|
4054
|
+
Description: 'Use keyword arguments when defining method with boolean argument.'
|
4055
|
+
StyleGuide: '#boolean-keyword-arguments'
|
4056
|
+
Enabled: true
|
4057
|
+
Safe: false
|
4058
|
+
VersionAdded: '0.89'
|
4059
|
+
AllowedMethods:
|
4060
|
+
- respond_to_missing?
|
3389
4061
|
|
3390
4062
|
Style/OrAssignment:
|
3391
4063
|
Description: 'Recommend usage of double pipe equals (||=) where applicable.'
|
@@ -3428,7 +4100,7 @@ Style/PercentLiteralDelimiters:
|
|
3428
4100
|
'%r': '()'
|
3429
4101
|
'%w': '[]'
|
3430
4102
|
'%W': '[]'
|
3431
|
-
VersionChanged: '0.48
|
4103
|
+
VersionChanged: '0.48'
|
3432
4104
|
|
3433
4105
|
Style/PercentQLiterals:
|
3434
4106
|
Description: 'Checks if uses of %Q/%q match the configured preference.'
|
@@ -3469,11 +4141,12 @@ Style/RaiseArgs:
|
|
3469
4141
|
StyleGuide: '#exception-class-messages'
|
3470
4142
|
Enabled: true
|
3471
4143
|
VersionAdded: '0.14'
|
3472
|
-
VersionChanged: '
|
4144
|
+
VersionChanged: '1.2'
|
3473
4145
|
EnforcedStyle: exploded
|
3474
4146
|
SupportedStyles:
|
3475
4147
|
- compact # raise Exception.new(msg)
|
3476
4148
|
- exploded # raise Exception, msg
|
4149
|
+
AllowedCompactTypes: []
|
3477
4150
|
|
3478
4151
|
Style/RandomWithOffset:
|
3479
4152
|
Description: >-
|
@@ -3483,6 +4156,27 @@ Style/RandomWithOffset:
|
|
3483
4156
|
Enabled: true
|
3484
4157
|
VersionAdded: '0.52'
|
3485
4158
|
|
4159
|
+
Style/RedundantArgument:
|
4160
|
+
Description: 'Check for a redundant argument passed to certain methods.'
|
4161
|
+
Enabled: true
|
4162
|
+
Safe: false
|
4163
|
+
VersionAdded: '1.4'
|
4164
|
+
VersionChanged: '1.7'
|
4165
|
+
Methods:
|
4166
|
+
# Array#join
|
4167
|
+
join: ''
|
4168
|
+
# String#split
|
4169
|
+
split: ' '
|
4170
|
+
# String#chomp
|
4171
|
+
chomp: "\n"
|
4172
|
+
# String#chomp!
|
4173
|
+
chomp!: "\n"
|
4174
|
+
|
4175
|
+
Style/RedundantAssignment:
|
4176
|
+
Description: 'Checks for redundant assignment before returning.'
|
4177
|
+
Enabled: true
|
4178
|
+
VersionAdded: '0.87'
|
4179
|
+
|
3486
4180
|
Style/RedundantBegin:
|
3487
4181
|
Description: "Don't use begin blocks when they are not needed."
|
3488
4182
|
StyleGuide: '#begin-implicit'
|
@@ -3512,6 +4206,27 @@ Style/RedundantException:
|
|
3512
4206
|
VersionAdded: '0.14'
|
3513
4207
|
VersionChanged: '0.29'
|
3514
4208
|
|
4209
|
+
Style/RedundantFetchBlock:
|
4210
|
+
Description: >-
|
4211
|
+
Use `fetch(key, value)` instead of `fetch(key) { value }`
|
4212
|
+
when value has Numeric, Rational, Complex, Symbol or String type, `false`, `true`, `nil` or is a constant.
|
4213
|
+
Reference: 'https://github.com/JuanitoFatas/fast-ruby#hashfetch-with-argument-vs-hashfetch--block-code'
|
4214
|
+
Enabled: true
|
4215
|
+
Safe: false
|
4216
|
+
# If enabled, this cop will autocorrect usages of
|
4217
|
+
# `fetch` being called with block returning a constant.
|
4218
|
+
# This can be dangerous since constants will not be defined at that moment.
|
4219
|
+
SafeForConstants: false
|
4220
|
+
VersionAdded: '0.86'
|
4221
|
+
|
4222
|
+
Style/RedundantFileExtensionInRequire:
|
4223
|
+
Description: >-
|
4224
|
+
Checks for the presence of superfluous `.rb` extension in
|
4225
|
+
the filename provided to `require` and `require_relative`.
|
4226
|
+
StyleGuide: '#no-explicit-rb-to-require'
|
4227
|
+
Enabled: true
|
4228
|
+
VersionAdded: '0.88'
|
4229
|
+
|
3515
4230
|
Style/RedundantFreeze:
|
3516
4231
|
Description: "Checks usages of Object#freeze on immutable objects."
|
3517
4232
|
Enabled: true
|
@@ -3534,6 +4249,16 @@ Style/RedundantPercentQ:
|
|
3534
4249
|
Enabled: true
|
3535
4250
|
VersionAdded: '0.76'
|
3536
4251
|
|
4252
|
+
Style/RedundantRegexpCharacterClass:
|
4253
|
+
Description: 'Checks for unnecessary single-element Regexp character classes.'
|
4254
|
+
Enabled: true
|
4255
|
+
VersionAdded: '0.85'
|
4256
|
+
|
4257
|
+
Style/RedundantRegexpEscape:
|
4258
|
+
Description: 'Checks for redundant escapes in Regexps.'
|
4259
|
+
Enabled: true
|
4260
|
+
VersionAdded: '0.85'
|
4261
|
+
|
3537
4262
|
Style/RedundantReturn:
|
3538
4263
|
Description: "Don't use return where it's not required."
|
3539
4264
|
StyleGuide: '#no-explicit-return'
|
@@ -3550,6 +4275,12 @@ Style/RedundantSelf:
|
|
3550
4275
|
VersionAdded: '0.10'
|
3551
4276
|
VersionChanged: '0.13'
|
3552
4277
|
|
4278
|
+
Style/RedundantSelfAssignment:
|
4279
|
+
Description: 'Checks for places where redundant assignments are made for in place modification methods.'
|
4280
|
+
Enabled: true
|
4281
|
+
Safe: false
|
4282
|
+
VersionAdded: '0.90'
|
4283
|
+
|
3553
4284
|
Style/RedundantSort:
|
3554
4285
|
Description: >-
|
3555
4286
|
Use `min` instead of `sort.first`,
|
@@ -3612,6 +4343,8 @@ Style/SafeNavigation:
|
|
3612
4343
|
This cop transforms usages of a method call safeguarded by
|
3613
4344
|
a check for the existence of the object to
|
3614
4345
|
safe navigation (`&.`).
|
4346
|
+
Auto-correction is unsafe as it assumes the object will
|
4347
|
+
be `nil` or truthy, but never `false`.
|
3615
4348
|
Enabled: true
|
3616
4349
|
VersionAdded: '0.43'
|
3617
4350
|
VersionChanged: '0.77'
|
@@ -3624,6 +4357,7 @@ Style/SafeNavigation:
|
|
3624
4357
|
- presence
|
3625
4358
|
- try
|
3626
4359
|
- try!
|
4360
|
+
SafeAutoCorrect: false
|
3627
4361
|
|
3628
4362
|
Style/Sample:
|
3629
4363
|
Description: >-
|
@@ -3669,11 +4403,17 @@ Style/SignalException:
|
|
3669
4403
|
- only_fail
|
3670
4404
|
- semantic
|
3671
4405
|
|
4406
|
+
Style/SingleArgumentDig:
|
4407
|
+
Description: 'Avoid using single argument dig method.'
|
4408
|
+
Enabled: true
|
4409
|
+
VersionAdded: '0.89'
|
4410
|
+
Safe: false
|
4411
|
+
|
3672
4412
|
Style/SingleLineBlockParams:
|
3673
4413
|
Description: 'Enforces the names of some block params.'
|
3674
4414
|
Enabled: false
|
3675
4415
|
VersionAdded: '0.16'
|
3676
|
-
VersionChanged: '
|
4416
|
+
VersionChanged: '1.6'
|
3677
4417
|
Methods:
|
3678
4418
|
- reduce:
|
3679
4419
|
- acc
|
@@ -3687,9 +4427,24 @@ Style/SingleLineMethods:
|
|
3687
4427
|
StyleGuide: '#no-single-line-methods'
|
3688
4428
|
Enabled: true
|
3689
4429
|
VersionAdded: '0.9'
|
3690
|
-
VersionChanged: '
|
4430
|
+
VersionChanged: '1.8'
|
3691
4431
|
AllowIfMethodIsEmpty: true
|
3692
4432
|
|
4433
|
+
Style/SlicingWithRange:
|
4434
|
+
Description: 'Checks array slicing is done with endless ranges when suitable.'
|
4435
|
+
Enabled: true
|
4436
|
+
VersionAdded: '0.83'
|
4437
|
+
Safe: false
|
4438
|
+
|
4439
|
+
Style/SoleNestedConditional:
|
4440
|
+
Description: >-
|
4441
|
+
Finds sole nested conditional nodes
|
4442
|
+
which can be merged into outer conditional node.
|
4443
|
+
Enabled: true
|
4444
|
+
VersionAdded: '0.89'
|
4445
|
+
VersionChanged: '1.5'
|
4446
|
+
AllowModifier: false
|
4447
|
+
|
3693
4448
|
Style/SpecialGlobalVars:
|
3694
4449
|
Description: 'Avoid Perl-style global variables.'
|
3695
4450
|
StyleGuide: '#no-cryptic-perlisms'
|
@@ -3712,12 +4467,27 @@ Style/StabbyLambdaParentheses:
|
|
3712
4467
|
- require_parentheses
|
3713
4468
|
- require_no_parentheses
|
3714
4469
|
|
4470
|
+
Style/StaticClass:
|
4471
|
+
Description: 'Prefer modules to classes with only class methods.'
|
4472
|
+
StyleGuide: '#modules-vs-classes'
|
4473
|
+
Enabled: false
|
4474
|
+
Safe: false
|
4475
|
+
VersionAdded: '1.3'
|
4476
|
+
|
3715
4477
|
Style/StderrPuts:
|
3716
4478
|
Description: 'Use `warn` instead of `$stderr.puts`.'
|
3717
4479
|
StyleGuide: '#warn'
|
3718
4480
|
Enabled: true
|
3719
4481
|
VersionAdded: '0.51'
|
3720
4482
|
|
4483
|
+
Style/StringConcatenation:
|
4484
|
+
Description: 'Checks for places where string concatenation can be replaced with string interpolation.'
|
4485
|
+
StyleGuide: '#string-interpolation'
|
4486
|
+
Enabled: true
|
4487
|
+
Safe: false
|
4488
|
+
VersionAdded: '0.89'
|
4489
|
+
VersionChanged: '1.6'
|
4490
|
+
|
3721
4491
|
Style/StringHashKeys:
|
3722
4492
|
Description: 'Prefer symbols instead of strings as hash keys.'
|
3723
4493
|
StyleGuide: '#symbols-as-keys'
|
@@ -3755,7 +4525,7 @@ Style/StringMethods:
|
|
3755
4525
|
Description: 'Checks if configured preferred methods are used over non-preferred.'
|
3756
4526
|
Enabled: true
|
3757
4527
|
VersionAdded: '0.34'
|
3758
|
-
VersionChanged: '0.34
|
4528
|
+
VersionChanged: '0.34'
|
3759
4529
|
# Mapping from undesired method to desired_method
|
3760
4530
|
# e.g. to use `to_sym` over `intern`:
|
3761
4531
|
#
|
@@ -3775,6 +4545,14 @@ Style/StructInheritance:
|
|
3775
4545
|
StyleGuide: '#no-extend-struct-new'
|
3776
4546
|
Enabled: false
|
3777
4547
|
VersionAdded: '0.29'
|
4548
|
+
VersionChanged: '0.86'
|
4549
|
+
|
4550
|
+
Style/SwapValues:
|
4551
|
+
Description: 'This cop enforces the use of shorthand-style swapping of 2 variables.'
|
4552
|
+
StyleGuide: '#values-swapping'
|
4553
|
+
Enabled: true
|
4554
|
+
VersionAdded: '1.1'
|
4555
|
+
SafeAutoCorrect: false
|
3778
4556
|
|
3779
4557
|
Style/SymbolArray:
|
3780
4558
|
Description: 'Use %i or %I for arrays of symbols.'
|
@@ -3796,9 +4574,9 @@ Style/SymbolLiteral:
|
|
3796
4574
|
Style/SymbolProc:
|
3797
4575
|
Description: 'Use symbols as procs instead of blocks when possible.'
|
3798
4576
|
Enabled: false # We can't enforce this because of "Can't create Binding from C level Proc" errors, and because it messes up arity checks.
|
3799
|
-
|
4577
|
+
Safe: false
|
3800
4578
|
VersionAdded: '0.26'
|
3801
|
-
VersionChanged: '
|
4579
|
+
VersionChanged: '1.5'
|
3802
4580
|
# A list of method names to be ignored by the check.
|
3803
4581
|
# The names should be fairly unique, otherwise you'll end up ignoring lots of code.
|
3804
4582
|
IgnoredMethods:
|