makandra-rubocop 3.2.1 → 4.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 +40 -8
- data/Gemfile.lock +12 -11
- data/README.md +28 -2
- data/config/default.yml +436 -857
- data/config/ext/rails.yml +485 -0
- data/lib/makandra_rubocop/support/rubocop_spec.rb +1 -1
- data/lib/makandra_rubocop/version.rb +1 -1
- data/makandra-rubocop.gemspec +14 -12
- metadata +20 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c748c28b6295e75d04c1254c1c1181fca72fdf9daee553d0386635c70fc36c3f
|
4
|
+
data.tar.gz: 8ca3a1e46f1c26fb51e6685e71bcbda08f84c80c42a8764502ff24a3e5948060
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 886ac6d00bd7db5eeebbabebf5c9a9da369d4b4ca6781d0ece5fd48d98e0c82094ec96295c1f1590955afb2942f288c96de7bb8cd6e200006facfcad412f31c2
|
7
|
+
data.tar.gz: 41758cfc49b67543b80bd19a9a6452a2b4468a897571f9d0209bf3dab73da8d601817ce530a2e9cfe0b3770f7505a684f315a7495edfb2c5de5dc42f92e7c5c1
|
data/CHANGELOG.md
CHANGED
@@ -2,16 +2,52 @@ All notable changes to this project will be documented in this file.
|
|
2
2
|
|
3
3
|
This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
4
4
|
|
5
|
-
|
6
5
|
## Unreleased
|
7
6
|
|
8
7
|
### Breaking changes
|
9
8
|
|
10
|
-
-
|
11
|
-
|
12
9
|
### Compatible changes
|
13
10
|
|
14
|
-
|
11
|
+
|
12
|
+
## 4.0.0 - 2019-12-06
|
13
|
+
|
14
|
+
### Breaking changes
|
15
|
+
|
16
|
+
- Upgrade to Rubocop 0.76.0
|
17
|
+
- Drop support for Ruby < 2.3.0
|
18
|
+
|
19
|
+
Rubopcop 0.72.0 extracts all its Rails helpers to a new gem. This results in two split config files in the
|
20
|
+
`makandra-rubocop` gem:
|
21
|
+
|
22
|
+
* config/default.yml (contains now only Ruby cops)
|
23
|
+
* config/ext/rails.yml (contains all Rails cops)
|
24
|
+
|
25
|
+
Enabling the Rails cops was and is optional in `makandra-rubocop`. In case you want to use the Ruby cops only, please
|
26
|
+
use the following config as before:
|
27
|
+
|
28
|
+
```
|
29
|
+
inherit_gem:
|
30
|
+
makandra-rubocop:
|
31
|
+
- config/default.yml
|
32
|
+
```
|
33
|
+
|
34
|
+
In case you want to use the Ruby and the Rails cops:
|
35
|
+
|
36
|
+
1\. Remove the following config (if present) from your `.rubocop.yml`:
|
37
|
+
|
38
|
+
```
|
39
|
+
Rails:
|
40
|
+
Enabled: true
|
41
|
+
```
|
42
|
+
|
43
|
+
2\. Change the beginning of your `.rubocop.yml`:
|
44
|
+
|
45
|
+
```
|
46
|
+
inherit_gem:
|
47
|
+
makandra-rubocop:
|
48
|
+
- config/default.yml
|
49
|
+
- config/ext/rails.yml
|
50
|
+
```
|
15
51
|
|
16
52
|
|
17
53
|
## 3.2.1 - 2019-11-14
|
@@ -22,10 +58,6 @@ This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html
|
|
22
58
|
|
23
59
|
## 3.2.0 - 2019-07-29
|
24
60
|
|
25
|
-
### Breaking changes
|
26
|
-
|
27
|
-
-
|
28
|
-
|
29
61
|
### Compatible changes
|
30
62
|
|
31
63
|
- Exclude files in `tmp` and `public/system`.
|
data/Gemfile.lock
CHANGED
@@ -1,32 +1,33 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
makandra-rubocop (
|
5
|
-
rubocop (~> 0.
|
4
|
+
makandra-rubocop (4.0.0)
|
5
|
+
rubocop (~> 0.76.0)
|
6
|
+
rubocop-rails (~> 2.3.2)
|
6
7
|
|
7
8
|
GEM
|
8
9
|
remote: https://rubygems.org/
|
9
10
|
specs:
|
10
11
|
ast (2.4.0)
|
11
12
|
jaro_winkler (1.5.4)
|
12
|
-
parallel (1.19.
|
13
|
+
parallel (1.19.1)
|
13
14
|
parser (2.6.5.0)
|
14
15
|
ast (~> 2.4.0)
|
15
|
-
|
16
|
-
psych (3.1.0)
|
16
|
+
rack (2.0.7)
|
17
17
|
rainbow (3.0.0)
|
18
18
|
rake (12.3.2)
|
19
|
-
rubocop (0.
|
19
|
+
rubocop (0.76.0)
|
20
20
|
jaro_winkler (~> 1.5.1)
|
21
21
|
parallel (~> 1.10)
|
22
|
-
parser (>= 2.
|
23
|
-
powerpack (~> 0.1)
|
24
|
-
psych (>= 3.1.0)
|
22
|
+
parser (>= 2.6)
|
25
23
|
rainbow (>= 2.2.2, < 4.0)
|
26
24
|
ruby-progressbar (~> 1.7)
|
27
|
-
unicode-display_width (
|
25
|
+
unicode-display_width (>= 1.4.0, < 1.7)
|
26
|
+
rubocop-rails (2.3.2)
|
27
|
+
rack (>= 1.1)
|
28
|
+
rubocop (>= 0.72.0)
|
28
29
|
ruby-progressbar (1.10.1)
|
29
|
-
unicode-display_width (1.
|
30
|
+
unicode-display_width (1.6.0)
|
30
31
|
|
31
32
|
PLATFORMS
|
32
33
|
ruby
|
data/README.md
CHANGED
@@ -21,20 +21,46 @@ Or install it yourself as:
|
|
21
21
|
|
22
22
|
## Usage
|
23
23
|
|
24
|
-
Add `.rubocop.yml` to your project with the following contents:
|
24
|
+
Add a `.rubocop.yml` to your project with the following contents:
|
25
|
+
|
26
|
+
**For Ruby**
|
25
27
|
|
26
28
|
```yaml
|
27
29
|
inherit_gem:
|
28
30
|
makandra-rubocop: config/default.yml
|
29
31
|
```
|
30
32
|
|
31
|
-
|
33
|
+
**For Rails**
|
34
|
+
|
35
|
+
```yaml
|
36
|
+
inherit_gem:
|
37
|
+
makandra-rubocop:
|
38
|
+
- config/default.yml
|
39
|
+
- config/ext/rails.yml
|
40
|
+
```
|
41
|
+
|
42
|
+
Any per-project rules can then be defined in `.rubocop.yml`:
|
43
|
+
|
44
|
+
```
|
45
|
+
inherit_gem:
|
46
|
+
makandra-rubocop:
|
47
|
+
- config/default.yml
|
48
|
+
- config/ext/rails.yml
|
49
|
+
|
50
|
+
AllCops:
|
51
|
+
Exclude:
|
52
|
+
- 'lib/assets/**/*'
|
53
|
+
|
54
|
+
Layout/MultilineArrayLineBreaks:
|
55
|
+
Enabled: true
|
56
|
+
```
|
32
57
|
|
33
58
|
### Executing Rubocop on demand
|
34
59
|
|
35
60
|
Run Rubocop via `bundle exec rubocop` from your project directory.
|
36
61
|
|
37
62
|
For an initial run it might also useful to use the auto-correct option (`bundle exec rubocop --auto-correct`) and carefully check in all changes.
|
63
|
+
You can follow [this guide](https://makandracards.com/makandra/400093-adding-makandra-rubocop-to-an-existing-code-base) for bigger projects.
|
38
64
|
|
39
65
|
### Integrating Rubocop into your test suite
|
40
66
|
|
data/config/default.yml
CHANGED
@@ -77,7 +77,7 @@ AllCops:
|
|
77
77
|
DisplayStyleGuide: false
|
78
78
|
# When specifying style guide URLs, any paths and/or fragments will be
|
79
79
|
# evaluated relative to the base URL.
|
80
|
-
StyleGuideBaseURL: https://
|
80
|
+
StyleGuideBaseURL: https://rubystyle.guide
|
81
81
|
# Extra details are not displayed in offense messages by default. Change
|
82
82
|
# behavior by overriding ExtraDetails, or by giving the
|
83
83
|
# `-E/--extra-details` option.
|
@@ -127,16 +127,8 @@ AllCops:
|
|
127
127
|
# followed by the Gemfile.lock or gems.locked file. (Although the Ruby version
|
128
128
|
# is specified in the Gemfile or gems.rb file, RuboCop reads the final value
|
129
129
|
# from the lock file.) If the Ruby version is still unresolved, RuboCop will
|
130
|
-
# use the oldest officially supported Ruby version (currently Ruby 2.
|
130
|
+
# use the oldest officially supported Ruby version (currently Ruby 2.3).
|
131
131
|
TargetRubyVersion: ~
|
132
|
-
# What version of Rails is the inspected code using? If a value is specified
|
133
|
-
# for TargetRailsVersion then it is used. Acceptable values are specificed
|
134
|
-
# as a float (i.e. 5.1); the patch version of Rails should not be included.
|
135
|
-
# If TargetRailsVersion is not set, RuboCop will parse the Gemfile.lock or
|
136
|
-
# gems.locked file to find the version of Rails that has been bound to the
|
137
|
-
# application. If neither of those files exist, RuboCop will use Rails 5.0
|
138
|
-
# as the default.
|
139
|
-
TargetRailsVersion: ~
|
140
132
|
|
141
133
|
#################### Bundler ###############################
|
142
134
|
|
@@ -207,6 +199,13 @@ Gemspec/RequiredRubyVersion:
|
|
207
199
|
VersionAdded: '0.52'
|
208
200
|
Include:
|
209
201
|
- '**/*.gemspec'
|
202
|
+
-
|
203
|
+
Gemspec/RubyVersionGlobalsUsage:
|
204
|
+
Description: Checks usage of RUBY_VERSION in gemspec.
|
205
|
+
Enabled: false
|
206
|
+
VersionAdded: '0.72'
|
207
|
+
Include:
|
208
|
+
- '**/*.gemspec'
|
210
209
|
|
211
210
|
#################### Layout ###########################
|
212
211
|
|
@@ -223,6 +222,34 @@ Layout/AccessModifierIndentation:
|
|
223
222
|
# But it can be overridden by setting this parameter
|
224
223
|
IndentationWidth: ~
|
225
224
|
|
225
|
+
Layout/AlignArguments:
|
226
|
+
Description: >-
|
227
|
+
Align the arguments of a method call if they span more
|
228
|
+
than one line.
|
229
|
+
StyleGuide: '#no-double-indent'
|
230
|
+
Enabled: false
|
231
|
+
VersionAdded: '0.68'
|
232
|
+
# Alignment of arguments in multi-line method calls.
|
233
|
+
#
|
234
|
+
# The `with_first_argument` style aligns the following lines along the same
|
235
|
+
# column as the first parameter.
|
236
|
+
#
|
237
|
+
# method_call(a,
|
238
|
+
# b)
|
239
|
+
#
|
240
|
+
# The `with_fixed_indentation` style aligns the following lines with one
|
241
|
+
# level of indentation relative to the start of the line with the method call.
|
242
|
+
#
|
243
|
+
# method_call(a,
|
244
|
+
# b)
|
245
|
+
EnforcedStyle: with_first_argument
|
246
|
+
SupportedStyles:
|
247
|
+
- with_first_argument
|
248
|
+
- with_fixed_indentation
|
249
|
+
# By default, the indentation width from Layout/IndentationWidth is used
|
250
|
+
# But it can be overridden by setting this parameter
|
251
|
+
IndentationWidth: ~
|
252
|
+
|
226
253
|
Layout/AlignArray:
|
227
254
|
Description: >-
|
228
255
|
Align the elements of an array literal if they span more than
|
@@ -236,6 +263,7 @@ Layout/AlignHash:
|
|
236
263
|
Align the elements of a hash literal if they span more than
|
237
264
|
one line.
|
238
265
|
Enabled: false
|
266
|
+
AllowMultipleStyles: true
|
239
267
|
VersionAdded: '0.49'
|
240
268
|
# Alignment of entries using hash rocket as separator. Valid values are:
|
241
269
|
#
|
@@ -309,23 +337,24 @@ Layout/AlignHash:
|
|
309
337
|
|
310
338
|
Layout/AlignParameters:
|
311
339
|
Description: >-
|
312
|
-
Align the parameters of a method
|
340
|
+
Align the parameters of a method definition if they span more
|
313
341
|
than one line.
|
314
342
|
StyleGuide: '#no-double-indent'
|
315
343
|
Enabled: false
|
316
344
|
VersionAdded: '0.49'
|
345
|
+
VersionChanged: '0.68'
|
317
346
|
# Alignment of parameters in multi-line method calls.
|
318
347
|
#
|
319
348
|
# The `with_first_parameter` style aligns the following lines along the same
|
320
349
|
# column as the first parameter.
|
321
350
|
#
|
322
|
-
#
|
323
|
-
#
|
351
|
+
# def method_foo(a,
|
352
|
+
# b)
|
324
353
|
#
|
325
354
|
# The `with_fixed_indentation` style aligns the following lines with one
|
326
355
|
# level of indentation relative to the start of the line with the method call.
|
327
356
|
#
|
328
|
-
#
|
357
|
+
# def method_foo(a,
|
329
358
|
# b)
|
330
359
|
EnforcedStyle: with_first_parameter
|
331
360
|
SupportedStyles:
|
@@ -372,7 +401,7 @@ Layout/CaseIndentation:
|
|
372
401
|
|
373
402
|
Layout/ClassStructure:
|
374
403
|
Description: 'Enforces a configured order of definitions within a class body.'
|
375
|
-
StyleGuide: '
|
404
|
+
StyleGuide: '#consistent-classes'
|
376
405
|
Enabled: false
|
377
406
|
VersionAdded: '0.52'
|
378
407
|
Categories:
|
@@ -483,6 +512,13 @@ Layout/EmptyLinesAroundAccessModifier:
|
|
483
512
|
StyleGuide: '#empty-lines-around-access-modifier'
|
484
513
|
Enabled: false
|
485
514
|
VersionAdded: '0.49'
|
515
|
+
EnforcedStyle: around
|
516
|
+
SupportedStyles:
|
517
|
+
- around
|
518
|
+
- only_before
|
519
|
+
Reference:
|
520
|
+
# A reference to `EnforcedStyle: only_before`.
|
521
|
+
- https://edgeguides.rubyonrails.org/contributing_to_ruby_on_rails.html#follow-the-coding-conventions
|
486
522
|
|
487
523
|
Layout/EmptyLinesAroundArguments:
|
488
524
|
Description: "Keeps track of empty lines around method arguments."
|
@@ -585,6 +621,10 @@ Layout/ExtraSpacing:
|
|
585
621
|
# things with the previous or next line, not counting empty lines or comment
|
586
622
|
# lines.
|
587
623
|
AllowForAlignment: true
|
624
|
+
# When true, allows things like 'obj.meth(arg) # comment',
|
625
|
+
# rather than insisting on 'obj.meth(arg) # comment'.
|
626
|
+
# If done for alignment, either this OR AllowForAlignment will allow it.
|
627
|
+
AllowBeforeTrailingComments: false
|
588
628
|
# When true, forces the alignment of `=` in assignments on consecutive lines.
|
589
629
|
ForceEqualSignAlignment: false
|
590
630
|
|
@@ -616,11 +656,28 @@ Layout/FirstMethodParameterLineBreak:
|
|
616
656
|
Enabled: false
|
617
657
|
VersionAdded: '0.49'
|
618
658
|
|
619
|
-
Layout/
|
620
|
-
Description:
|
621
|
-
|
659
|
+
Layout/HeredocArgumentClosingParenthesis:
|
660
|
+
Description: >-
|
661
|
+
Checks for the placement of the closing parenthesis in a
|
662
|
+
method call that passes a HEREDOC string as an argument.
|
663
|
+
Enabled: false
|
664
|
+
StyleGuide: '#heredoc-argument-closing-parentheses'
|
665
|
+
VersionAdded: '0.68'
|
666
|
+
|
667
|
+
Layout/IndentAssignment:
|
668
|
+
Description: >-
|
669
|
+
Checks the indentation of the first line of the
|
670
|
+
right-hand-side of a multi-line assignment.
|
671
|
+
Enabled: false # We do not want to write the assignment in the following line
|
622
672
|
VersionAdded: '0.49'
|
623
|
-
|
673
|
+
# By default, the indentation width from `Layout/IndentationWidth` is used
|
674
|
+
# But it can be overridden by setting this parameter
|
675
|
+
IndentationWidth: ~
|
676
|
+
|
677
|
+
Layout/IndentFirstArgument:
|
678
|
+
Description: 'Checks the indentation of the first argument in a method call.'
|
679
|
+
Enabled: true
|
680
|
+
VersionAdded: '0.68'
|
624
681
|
EnforcedStyle: special_for_inner_method_call_in_parentheses
|
625
682
|
SupportedStyles:
|
626
683
|
# The first parameter should always be indented one step more than the
|
@@ -641,12 +698,12 @@ Layout/FirstParameterIndentation:
|
|
641
698
|
# But it can be overridden by setting this parameter
|
642
699
|
IndentationWidth: ~
|
643
700
|
|
644
|
-
Layout/
|
701
|
+
Layout/IndentFirstArrayElement:
|
645
702
|
Description: >-
|
646
703
|
Checks the indentation of the first element in an array
|
647
704
|
literal.
|
648
705
|
Enabled: true
|
649
|
-
VersionAdded: '0.
|
706
|
+
VersionAdded: '0.68'
|
650
707
|
# The value `special_inside_parentheses` means that array literals with
|
651
708
|
# brackets that have their opening bracket on the same line as a surrounding
|
652
709
|
# opening round parenthesis, shall have their first element indented relative
|
@@ -667,20 +724,10 @@ Layout/IndentArray:
|
|
667
724
|
# But it can be overridden by setting this parameter
|
668
725
|
IndentationWidth: ~
|
669
726
|
|
670
|
-
Layout/
|
671
|
-
Description: >-
|
672
|
-
Checks the indentation of the first line of the
|
673
|
-
right-hand-side of a multi-line assignment.
|
674
|
-
Enabled: true
|
675
|
-
VersionAdded: '0.49'
|
676
|
-
# By default, the indentation width from `Layout/IndentationWidth` is used
|
677
|
-
# But it can be overridden by setting this parameter
|
678
|
-
IndentationWidth: ~
|
679
|
-
|
680
|
-
Layout/IndentHash:
|
727
|
+
Layout/IndentFirstHashElement:
|
681
728
|
Description: 'Checks the indentation of the first key in a hash literal.'
|
682
729
|
Enabled: true
|
683
|
-
VersionAdded: '0.
|
730
|
+
VersionAdded: '0.68'
|
684
731
|
# The value `special_inside_parentheses` means that hash literals with braces
|
685
732
|
# that have their opening brace on the same line as a surrounding opening
|
686
733
|
# round parenthesis, shall have their first key indented relative to the
|
@@ -701,14 +748,29 @@ Layout/IndentHash:
|
|
701
748
|
# But it can be overridden by setting this parameter
|
702
749
|
IndentationWidth: ~
|
703
750
|
|
751
|
+
Layout/IndentFirstParameter:
|
752
|
+
Description: >-
|
753
|
+
Checks the indentation of the first parameter in a
|
754
|
+
method definition.
|
755
|
+
Enabled: true
|
756
|
+
VersionAdded: '0.49'
|
757
|
+
VersionChanged: '0.68'
|
758
|
+
EnforcedStyle: consistent
|
759
|
+
SupportedStyles:
|
760
|
+
- consistent
|
761
|
+
- align_parentheses
|
762
|
+
# By default, the indentation width from `Layout/IndentationWidth` is used
|
763
|
+
# But it can be overridden by setting this parameter
|
764
|
+
IndentationWidth: ~
|
765
|
+
|
704
766
|
Layout/IndentHeredoc:
|
705
767
|
Description: 'This cop checks the indentation of the here document bodies.'
|
706
768
|
StyleGuide: '#squiggly-heredocs'
|
707
769
|
Enabled: true
|
708
770
|
VersionAdded: '0.49'
|
709
|
-
|
771
|
+
VersionChanged: '0.69'
|
772
|
+
EnforcedStyle: squiggly
|
710
773
|
SupportedStyles:
|
711
|
-
- auto_detection
|
712
774
|
- squiggly
|
713
775
|
- active_support
|
714
776
|
- powerpack
|
@@ -719,8 +781,8 @@ Layout/IndentationConsistency:
|
|
719
781
|
StyleGuide: '#spaces-indentation'
|
720
782
|
Enabled: true
|
721
783
|
VersionAdded: '0.49'
|
722
|
-
# The difference between `
|
723
|
-
# prescribes that in classes and modules the `protected` and `private`
|
784
|
+
# The difference between `indented` and `normal` is that the `indented_internal_methods`
|
785
|
+
# style prescribes that in classes and modules the `protected` and `private`
|
724
786
|
# modifier keywords shall be indented the same as public methods and that
|
725
787
|
# protected and private members shall be indented one step more than the
|
726
788
|
# modifiers. Other than that, both styles mean that entities on the same
|
@@ -728,7 +790,10 @@ Layout/IndentationConsistency:
|
|
728
790
|
EnforcedStyle: normal
|
729
791
|
SupportedStyles:
|
730
792
|
- normal
|
731
|
-
-
|
793
|
+
- indented_internal_methods
|
794
|
+
Reference:
|
795
|
+
# A reference to `EnforcedStyle: indented_internal_methods`.
|
796
|
+
- https://edgeguides.rubyonrails.org/contributing_to_ruby_on_rails.html#follow-the-coding-conventions
|
732
797
|
|
733
798
|
Layout/IndentationWidth:
|
734
799
|
Description: 'Use 2 spaces for indentation.'
|
@@ -755,6 +820,8 @@ Layout/LeadingCommentSpace:
|
|
755
820
|
StyleGuide: '#hash-space'
|
756
821
|
Enabled: true
|
757
822
|
VersionAdded: '0.49'
|
823
|
+
VersionChanged: '0.73'
|
824
|
+
AllowDoxygenCommentStyle: false
|
758
825
|
|
759
826
|
Layout/MultilineArrayBraceLayout:
|
760
827
|
Description: >-
|
@@ -772,6 +839,13 @@ Layout/MultilineArrayBraceLayout:
|
|
772
839
|
- new_line
|
773
840
|
- same_line
|
774
841
|
|
842
|
+
Layout/MultilineArrayLineBreaks:
|
843
|
+
Description: >-
|
844
|
+
Checks that each item in a multi-line array literal
|
845
|
+
starts on a separate line.
|
846
|
+
Enabled: false # As discussed in https://github.com/makandra/makandra-rubocop/issues/10
|
847
|
+
VersionAdded: '0.67'
|
848
|
+
|
775
849
|
Layout/MultilineAssignmentLayout:
|
776
850
|
Description: 'Check for a newline after the assignment operator in multi-line assignments.'
|
777
851
|
StyleGuide: '#indent-conditional-assignment'
|
@@ -815,6 +889,20 @@ Layout/MultilineHashBraceLayout:
|
|
815
889
|
- new_line
|
816
890
|
- same_line
|
817
891
|
|
892
|
+
Layout/MultilineHashKeyLineBreaks:
|
893
|
+
Description: >-
|
894
|
+
Checks that each item in a multi-line hash literal
|
895
|
+
starts on a separate line.
|
896
|
+
Enabled: false
|
897
|
+
VersionAdded: '0.67'
|
898
|
+
|
899
|
+
Layout/MultilineMethodArgumentLineBreaks:
|
900
|
+
Description: >-
|
901
|
+
Checks that each argument in a multi-line method call
|
902
|
+
starts on a separate line.
|
903
|
+
Enabled: false
|
904
|
+
VersionAdded: '0.67'
|
905
|
+
|
818
906
|
Layout/MultilineMethodCallBraceLayout:
|
819
907
|
Description: >-
|
820
908
|
Checks that the closing brace in a method call is
|
@@ -878,7 +966,7 @@ Layout/MultilineOperationIndentation:
|
|
878
966
|
|
879
967
|
Layout/RescueEnsureAlignment:
|
880
968
|
Description: 'Align rescues and ensures correctly.'
|
881
|
-
Enabled:
|
969
|
+
Enabled: true
|
882
970
|
VersionAdded: '0.49'
|
883
971
|
|
884
972
|
Layout/SpaceAfterColon:
|
@@ -1266,7 +1354,7 @@ Lint/ErbNewArguments:
|
|
1266
1354
|
VersionAdded: '0.56'
|
1267
1355
|
|
1268
1356
|
Lint/FlipFlop:
|
1269
|
-
Description: 'Checks for flip-flops'
|
1357
|
+
Description: 'Checks for flip-flops.'
|
1270
1358
|
StyleGuide: '#no-flip-flops'
|
1271
1359
|
Enabled: true
|
1272
1360
|
VersionAdded: '0.16'
|
@@ -1287,7 +1375,17 @@ Lint/HandleExceptions:
|
|
1287
1375
|
Description: "Don't suppress exception."
|
1288
1376
|
StyleGuide: '#dont-hide-exceptions'
|
1289
1377
|
Enabled: false
|
1378
|
+
AllowComments: false
|
1290
1379
|
VersionAdded: '0.9'
|
1380
|
+
VersionChanged: '0.70'
|
1381
|
+
|
1382
|
+
Lint/HeredocMethodCallPosition:
|
1383
|
+
Description: >-
|
1384
|
+
Checks for the ordering of a method call where
|
1385
|
+
the receiver of the call is a HEREDOC.
|
1386
|
+
Enabled: false
|
1387
|
+
StyleGuide: '#heredoc-method-calls'
|
1388
|
+
VersionAdded: '0.68'
|
1291
1389
|
|
1292
1390
|
Lint/ImplicitStringConcatenation:
|
1293
1391
|
Description: >-
|
@@ -1314,7 +1412,7 @@ Lint/InheritException:
|
|
1314
1412
|
- standard_error
|
1315
1413
|
|
1316
1414
|
Lint/InterpolationCheck:
|
1317
|
-
Description: 'Raise warning for interpolation in single q strs'
|
1415
|
+
Description: 'Raise warning for interpolation in single q strs.'
|
1318
1416
|
Enabled: true
|
1319
1417
|
VersionAdded: '0.50'
|
1320
1418
|
|
@@ -1338,7 +1436,7 @@ Lint/Loop:
|
|
1338
1436
|
VersionAdded: '0.9'
|
1339
1437
|
|
1340
1438
|
Lint/MissingCopEnableDirective:
|
1341
|
-
Description: 'Checks for a `# rubocop:enable` after `# rubocop:disable
|
1439
|
+
Description: 'Checks for a `# rubocop:enable` after `# rubocop:disable`.'
|
1342
1440
|
Enabled: true
|
1343
1441
|
VersionAdded: '0.52'
|
1344
1442
|
# Maximum number of consecutive lines the cop can be disabled for.
|
@@ -1382,6 +1480,8 @@ Lint/NumberConversion:
|
|
1382
1480
|
Description: 'Checks unsafe usage of number conversion methods.'
|
1383
1481
|
Enabled: false
|
1384
1482
|
VersionAdded: '0.53'
|
1483
|
+
VersionChanged: '0.70'
|
1484
|
+
SafeAutoCorrect: false
|
1385
1485
|
|
1386
1486
|
Lint/OrderedMagicComments:
|
1387
1487
|
Description: 'Checks the proper ordering of magic comments and whether a magic comment is not placed before a shebang.'
|
@@ -1400,6 +1500,7 @@ Lint/PercentStringArray:
|
|
1400
1500
|
Description: >-
|
1401
1501
|
Checks for unwanted commas and quotes in %w/%W literals.
|
1402
1502
|
Enabled: true
|
1503
|
+
Safe: false
|
1403
1504
|
VersionAdded: '0.41'
|
1404
1505
|
|
1405
1506
|
Lint/PercentSymbolArray:
|
@@ -1415,6 +1516,29 @@ Lint/RandOne:
|
|
1415
1516
|
Enabled: true
|
1416
1517
|
VersionAdded: '0.36'
|
1417
1518
|
|
1519
|
+
Lint/RedundantCopDisableDirective:
|
1520
|
+
Description: >-
|
1521
|
+
Checks for rubocop:disable comments that can be removed.
|
1522
|
+
Note: this cop is not disabled when disabling all cops.
|
1523
|
+
It must be explicitly disabled.
|
1524
|
+
Enabled: true
|
1525
|
+
VersionAdded: '0.76'
|
1526
|
+
|
1527
|
+
Lint/RedundantCopEnableDirective:
|
1528
|
+
Description: Checks for rubocop:enable comments that can be removed.
|
1529
|
+
Enabled: true
|
1530
|
+
VersionAdded: '0.76'
|
1531
|
+
|
1532
|
+
Lint/RedundantRequireStatement:
|
1533
|
+
Description: 'Checks for unnecessary `require` statement.'
|
1534
|
+
Enabled: true
|
1535
|
+
VersionAdded: '0.76'
|
1536
|
+
|
1537
|
+
Lint/RedundantSplatExpansion:
|
1538
|
+
Description: 'Checks for splat unnecessarily being called on literals.'
|
1539
|
+
Enabled: true
|
1540
|
+
VersionChanged: '0.76'
|
1541
|
+
|
1418
1542
|
Lint/RedundantWithIndex:
|
1419
1543
|
Description: 'Checks for redundant `with_index`.'
|
1420
1544
|
Enabled: true
|
@@ -1483,12 +1607,22 @@ Lint/SafeNavigationConsistency:
|
|
1483
1607
|
- try!
|
1484
1608
|
|
1485
1609
|
|
1610
|
+
Lint/SafeNavigationWithEmpty:
|
1611
|
+
Description: 'Avoid `foo&.empty?` in conditionals.'
|
1612
|
+
Enabled: true
|
1613
|
+
VersionAdded: '0.62'
|
1614
|
+
|
1486
1615
|
Lint/ScriptPermission:
|
1487
1616
|
Description: 'Grant script file execute permission.'
|
1488
1617
|
Enabled: true
|
1489
1618
|
VersionAdded: '0.49'
|
1490
1619
|
VersionChanged: '0.50'
|
1491
1620
|
|
1621
|
+
Lint/SendWithMixinArgument:
|
1622
|
+
Description: 'Checks for `send` method when using mixin.'
|
1623
|
+
Enabled: true
|
1624
|
+
VersionAdded: '0.75'
|
1625
|
+
|
1492
1626
|
Lint/ShadowedArgument:
|
1493
1627
|
Description: 'Avoid reassigning arguments before they were used.'
|
1494
1628
|
Enabled: true
|
@@ -1518,41 +1652,23 @@ Lint/StringConversionInInterpolation:
|
|
1518
1652
|
VersionChanged: '0.20'
|
1519
1653
|
|
1520
1654
|
Lint/Syntax:
|
1521
|
-
Description: 'Checks syntax error'
|
1655
|
+
Description: 'Checks syntax error.'
|
1522
1656
|
Enabled: true
|
1523
1657
|
VersionAdded: '0.9'
|
1524
1658
|
|
1525
1659
|
|
1660
|
+
Lint/ToJSON:
|
1661
|
+
Description: 'Ensure #to_json includes an optional argument.'
|
1662
|
+
Enabled: true
|
1663
|
+
|
1526
1664
|
Lint/UnderscorePrefixedVariableName:
|
1527
1665
|
Description: 'Do not use prefix `_` for a variable that is used.'
|
1528
1666
|
Enabled: true
|
1529
1667
|
VersionAdded: '0.21'
|
1668
|
+
AllowKeywordBlockArguments: false
|
1530
1669
|
|
1531
1670
|
Lint/UnifiedInteger:
|
1532
|
-
Description: 'Use Integer instead of Fixnum or Bignum'
|
1533
|
-
Enabled: true
|
1534
|
-
VersionAdded: '0.43'
|
1535
|
-
|
1536
|
-
Lint/UnneededCopDisableDirective:
|
1537
|
-
Description: >-
|
1538
|
-
Checks for rubocop:disable comments that can be removed.
|
1539
|
-
Note: this cop is not disabled when disabling all cops.
|
1540
|
-
It must be explicitly disabled.
|
1541
|
-
Enabled: true
|
1542
|
-
VersionAdded: '0.53'
|
1543
|
-
|
1544
|
-
Lint/UnneededCopEnableDirective:
|
1545
|
-
Description: Checks for rubocop:enable comments that can be removed.
|
1546
|
-
Enabled: true
|
1547
|
-
VersionAdded: '0.53'
|
1548
|
-
|
1549
|
-
Lint/UnneededRequireStatement:
|
1550
|
-
Description: 'Checks for unnecessary `require` statement.'
|
1551
|
-
Enabled: true
|
1552
|
-
VersionAdded: '0.51'
|
1553
|
-
|
1554
|
-
Lint/UnneededSplatExpansion:
|
1555
|
-
Description: 'Checks for splat unnecessarily being called on literals'
|
1671
|
+
Description: 'Use Integer instead of Fixnum or Bignum.'
|
1556
1672
|
Enabled: true
|
1557
1673
|
VersionAdded: '0.43'
|
1558
1674
|
|
@@ -1636,9 +1752,12 @@ Metrics/AbcSize:
|
|
1636
1752
|
Description: >-
|
1637
1753
|
A calculated magnitude based on number of assignments,
|
1638
1754
|
branches, and conditions.
|
1639
|
-
Reference:
|
1755
|
+
Reference:
|
1756
|
+
- http://c2.com/cgi/wiki?AbcMetric
|
1757
|
+
- https://en.wikipedia.org/wiki/ABC_Software_Metric
|
1640
1758
|
Enabled: false
|
1641
1759
|
VersionAdded: '0.27'
|
1760
|
+
VersionChanged: '0.66'
|
1642
1761
|
# The ABC size is a calculated magnitude, so this number can be an Integer or
|
1643
1762
|
# a Float.
|
1644
1763
|
Max: 15
|
@@ -1647,16 +1766,18 @@ Metrics/BlockLength:
|
|
1647
1766
|
Description: 'Avoid long blocks with many lines.'
|
1648
1767
|
Enabled: false
|
1649
1768
|
VersionAdded: '0.44'
|
1650
|
-
VersionChanged: '0.
|
1769
|
+
VersionChanged: '0.66'
|
1651
1770
|
CountComments: false # count full line comments?
|
1652
1771
|
Max: 25
|
1653
1772
|
ExcludedMethods:
|
1654
1773
|
# By default, exclude the `#refine` method, as it tends to have larger
|
1655
1774
|
# associated blocks.
|
1656
1775
|
- refine
|
1776
|
+
Exclude:
|
1777
|
+
- '**/*.gemspec'
|
1657
1778
|
|
1658
1779
|
Metrics/BlockNesting:
|
1659
|
-
Description: 'Avoid excessive block nesting'
|
1780
|
+
Description: 'Avoid excessive block nesting.'
|
1660
1781
|
StyleGuide: '#three-is-the-number-thou-shalt-count'
|
1661
1782
|
Enabled: false
|
1662
1783
|
VersionAdded: '0.25'
|
@@ -1685,7 +1806,8 @@ Metrics/LineLength:
|
|
1685
1806
|
StyleGuide: '#80-character-limits'
|
1686
1807
|
Enabled: false
|
1687
1808
|
VersionAdded: '0.25'
|
1688
|
-
VersionChanged: '0.
|
1809
|
+
VersionChanged: '0.68'
|
1810
|
+
AutoCorrect: false
|
1689
1811
|
Max: 80
|
1690
1812
|
# To make it possible to copy or click on URIs in the code, we allow lines
|
1691
1813
|
# containing a URI to be longer than Max.
|
@@ -1735,6 +1857,14 @@ Metrics/PerceivedComplexity:
|
|
1735
1857
|
VersionAdded: '0.25'
|
1736
1858
|
Max: 7
|
1737
1859
|
|
1860
|
+
################## Migration #############################
|
1861
|
+
|
1862
|
+
Migration/DepartmentName:
|
1863
|
+
Description: >-
|
1864
|
+
Check that cop names in rubocop:disable (etc) comments are
|
1865
|
+
given with department name.
|
1866
|
+
Enabled: false
|
1867
|
+
|
1738
1868
|
#################### Naming ##############################
|
1739
1869
|
|
1740
1870
|
Naming/AccessorMethodName:
|
@@ -1870,6 +2000,13 @@ Naming/MethodName:
|
|
1870
2000
|
SupportedStyles:
|
1871
2001
|
- snake_case
|
1872
2002
|
- camelCase
|
2003
|
+
# Method names matching patterns are always allowed.
|
2004
|
+
#
|
2005
|
+
# IgnoredPatterns:
|
2006
|
+
# - '\A\s*onSelectionBulkChange\s*'
|
2007
|
+
# - '\A\s*onSelectionCleared\s*'
|
2008
|
+
#
|
2009
|
+
IgnoredPatterns: []
|
1873
2010
|
|
1874
2011
|
Naming/PredicateName:
|
1875
2012
|
Description: 'Check the names of predicate methods.'
|
@@ -1900,6 +2037,13 @@ Naming/PredicateName:
|
|
1900
2037
|
Exclude:
|
1901
2038
|
- 'spec/**/*'
|
1902
2039
|
|
2040
|
+
Naming/RescuedExceptionsVariableName:
|
2041
|
+
Description: 'Use consistent rescued exceptions variables naming.'
|
2042
|
+
Enabled: true
|
2043
|
+
VersionAdded: '0.67'
|
2044
|
+
VersionChanged: '0.68'
|
2045
|
+
PreferredName: e
|
2046
|
+
|
1903
2047
|
Naming/UncommunicativeBlockParamName:
|
1904
2048
|
Description: >-
|
1905
2049
|
Checks for block parameter names that contain capital letters,
|
@@ -1935,6 +2079,7 @@ Naming/UncommunicativeMethodParamName:
|
|
1935
2079
|
- at
|
1936
2080
|
- ip
|
1937
2081
|
- db
|
2082
|
+
- os
|
1938
2083
|
# Blacklisted names that will register an offense
|
1939
2084
|
ForbiddenNames: []
|
1940
2085
|
|
@@ -1959,775 +2104,110 @@ Naming/VariableNumber:
|
|
1959
2104
|
- normalcase
|
1960
2105
|
- non_integer
|
1961
2106
|
|
1962
|
-
####################
|
2107
|
+
#################### Security ##############################
|
1963
2108
|
|
1964
|
-
|
1965
|
-
Description:
|
1966
|
-
|
1967
|
-
|
1968
|
-
VersionAdded: '0.49'
|
2109
|
+
Security/Eval:
|
2110
|
+
Description: 'The use of eval represents a serious security risk.'
|
2111
|
+
Enabled: false # We all know not to eval. If we need to, there will be a reason.
|
2112
|
+
VersionAdded: '0.47'
|
1969
2113
|
|
1970
|
-
|
2114
|
+
Security/JSONLoad:
|
1971
2115
|
Description: >-
|
1972
|
-
|
1973
|
-
|
1974
|
-
|
2116
|
+
Prefer usage of `JSON.parse` over `JSON.load` due to potential
|
2117
|
+
security issues. See reference for more information.
|
2118
|
+
Reference: 'https://ruby-doc.org/stdlib-2.3.0/libdoc/json/rdoc/JSON.html#method-i-load'
|
2119
|
+
Enabled: true
|
2120
|
+
VersionAdded: '0.43'
|
2121
|
+
VersionChanged: '0.44'
|
2122
|
+
# Autocorrect here will change to a method that may cause crashes depending
|
2123
|
+
# on the value of the argument.
|
1975
2124
|
AutoCorrect: false
|
1976
2125
|
SafeAutoCorrect: false
|
1977
|
-
VersionAdded: '0.34'
|
1978
|
-
VersionChanged: '0.59'
|
1979
|
-
|
1980
|
-
Performance/Casecmp:
|
1981
|
-
Description: >-
|
1982
|
-
Use `casecmp` rather than `downcase ==`, `upcase ==`, `== downcase`, or `== upcase`..
|
1983
|
-
Reference: 'https://github.com/JuanitoFatas/fast-ruby#stringcasecmp-vs-stringdowncase---code'
|
1984
|
-
Enabled: false
|
1985
|
-
VersionAdded: '0.36'
|
1986
2126
|
|
1987
|
-
|
2127
|
+
Security/MarshalLoad:
|
1988
2128
|
Description: >-
|
1989
|
-
|
1990
|
-
|
1991
|
-
Reference: 'https://
|
1992
|
-
Enabled: false
|
1993
|
-
VersionAdded: '0.59'
|
1994
|
-
|
1995
|
-
Performance/CompareWithBlock:
|
1996
|
-
Description: 'Use `sort_by(&:foo)` instead of `sort { |a, b| a.foo <=> b.foo }`.'
|
2129
|
+
Avoid using of `Marshal.load` or `Marshal.restore` due to potential
|
2130
|
+
security issues. See reference for more information.
|
2131
|
+
Reference: 'https://ruby-doc.org/core-2.3.3/Marshal.html#module-Marshal-label-Security+considerations'
|
1997
2132
|
Enabled: true
|
1998
|
-
VersionAdded: '0.
|
1999
|
-
|
2000
|
-
Performance/Count:
|
2001
|
-
Description: >-
|
2002
|
-
Use `count` instead of `select...size`, `reject...size`,
|
2003
|
-
`select...count`, `reject...count`, `select...length`,
|
2004
|
-
and `reject...length`.
|
2005
|
-
# This cop has known compatibility issues with `ActiveRecord` and other
|
2006
|
-
# frameworks. ActiveRecord's `count` ignores the block that is passed to it.
|
2007
|
-
# For more information, see the documentation in the cop itself.
|
2008
|
-
# If you understand the known risk, you can disable `SafeMode`.
|
2009
|
-
SafeMode: true
|
2010
|
-
Enabled: false
|
2011
|
-
VersionAdded: '0.31'
|
2012
|
-
VersionChanged: '0.39'
|
2133
|
+
VersionAdded: '0.47'
|
2013
2134
|
|
2014
|
-
|
2015
|
-
Description:
|
2016
|
-
Use `detect` instead of `select.first`, `find_all.first`,
|
2017
|
-
`select.last`, and `find_all.last`.
|
2018
|
-
Reference: 'https://github.com/JuanitoFatas/fast-ruby#enumerabledetect-vs-enumerableselectfirst-code'
|
2019
|
-
# This cop has known compatibility issues with `ActiveRecord` and other
|
2020
|
-
# frameworks. `ActiveRecord` does not implement a `detect` method and `find`
|
2021
|
-
# has its own meaning. Correcting `ActiveRecord` methods with this cop
|
2022
|
-
# should be considered unsafe.
|
2023
|
-
SafeMode: true
|
2135
|
+
Security/Open:
|
2136
|
+
Description: 'The use of Kernel#open represents a serious security risk.'
|
2024
2137
|
Enabled: true
|
2025
|
-
VersionAdded: '0.
|
2026
|
-
|
2138
|
+
VersionAdded: '0.53'
|
2139
|
+
Safe: false
|
2027
2140
|
|
2028
|
-
|
2141
|
+
Security/YAMLLoad:
|
2029
2142
|
Description: >-
|
2030
|
-
|
2031
|
-
|
2143
|
+
Prefer usage of `YAML.safe_load` over `YAML.load` due to potential
|
2144
|
+
security issues. See reference for more information.
|
2145
|
+
Reference: 'https://ruby-doc.org/stdlib-2.3.3/libdoc/yaml/rdoc/YAML.html#module-YAML-label-Security'
|
2032
2146
|
Enabled: true
|
2033
|
-
VersionAdded: '0.
|
2034
|
-
VersionChanged: '0.48'
|
2035
|
-
# Used to check for `starts_with?` and `ends_with?`.
|
2036
|
-
# These methods are defined by `ActiveSupport`.
|
2037
|
-
IncludeActiveSupportAliases: false
|
2038
|
-
|
2039
|
-
Performance/EndWith:
|
2040
|
-
Description: 'Use `end_with?` instead of a regex match anchored to the end of a string.'
|
2041
|
-
Reference: 'https://github.com/JuanitoFatas/fast-ruby#stringmatch-vs-stringstart_withstringend_with-code-start-code-end'
|
2042
|
-
# This will change to a new method call which isn't guaranteed to be on the
|
2043
|
-
# object. Switching these methods has to be done with knowledge of the types
|
2044
|
-
# of the variables which rubocop doesn't have.
|
2147
|
+
VersionAdded: '0.47'
|
2045
2148
|
SafeAutoCorrect: false
|
2046
|
-
AutoCorrect: false
|
2047
|
-
Enabled: false
|
2048
|
-
VersionAdded: '0.36'
|
2049
|
-
VersionChanged: '0.44'
|
2050
2149
|
|
2051
|
-
|
2052
|
-
Description: 'Do not compute the size of statically sized objects except in constants'
|
2053
|
-
Enabled: false
|
2054
|
-
VersionAdded: '0.35'
|
2150
|
+
#################### Style ###############################
|
2055
2151
|
|
2056
|
-
|
2057
|
-
Description:
|
2058
|
-
Use `Enumerable#flat_map`
|
2059
|
-
instead of `Enumerable#map...Array#flatten(1)`
|
2060
|
-
or `Enumberable#collect..Array#flatten(1)`
|
2061
|
-
Reference: 'https://github.com/JuanitoFatas/fast-ruby#enumerablemaparrayflatten-vs-enumerableflat_map-code'
|
2152
|
+
Style/AccessModifierDeclarations:
|
2153
|
+
Description: 'Checks style of how access modifiers are used.'
|
2062
2154
|
Enabled: true
|
2063
|
-
VersionAdded: '0.
|
2064
|
-
|
2065
|
-
|
2066
|
-
|
2067
|
-
|
2068
|
-
# `flatten` without any parameters can flatten multiple levels.
|
2155
|
+
VersionAdded: '0.57'
|
2156
|
+
EnforcedStyle: group
|
2157
|
+
SupportedStyles:
|
2158
|
+
- inline
|
2159
|
+
- group
|
2069
2160
|
|
2070
|
-
|
2071
|
-
Description: 'Use
|
2072
|
-
|
2161
|
+
Style/Alias:
|
2162
|
+
Description: 'Use alias instead of alias_method.'
|
2163
|
+
StyleGuide: '#alias-method-lexically'
|
2073
2164
|
Enabled: true
|
2074
|
-
VersionAdded: '0.
|
2075
|
-
|
2165
|
+
VersionAdded: '0.9'
|
2166
|
+
VersionChanged: '0.36'
|
2167
|
+
EnforcedStyle: prefer_alias_method
|
2168
|
+
SupportedStyles:
|
2169
|
+
- prefer_alias
|
2170
|
+
- prefer_alias_method
|
2076
2171
|
|
2077
|
-
|
2078
|
-
Description: 'Use
|
2172
|
+
Style/AndOr:
|
2173
|
+
Description: 'Use &&/|| instead of and/or.'
|
2174
|
+
StyleGuide: '#no-and-or-or'
|
2079
2175
|
Enabled: true
|
2080
|
-
VersionAdded: '0.
|
2081
|
-
|
2082
|
-
|
2083
|
-
|
2084
|
-
|
2085
|
-
|
2086
|
-
|
2176
|
+
VersionAdded: '0.9'
|
2177
|
+
VersionChanged: '0.25'
|
2178
|
+
# Whether `and` and `or` are banned only in conditionals (conditionals)
|
2179
|
+
# or completely (always).
|
2180
|
+
EnforcedStyle: always
|
2181
|
+
SupportedStyles:
|
2182
|
+
- always
|
2183
|
+
- conditionals
|
2087
2184
|
|
2088
|
-
|
2089
|
-
Description: 'Use
|
2090
|
-
|
2185
|
+
Style/ArrayJoin:
|
2186
|
+
Description: 'Use Array#join instead of Array#*.'
|
2187
|
+
StyleGuide: '#array-join'
|
2091
2188
|
Enabled: true
|
2092
|
-
VersionAdded: '0.
|
2093
|
-
|
2189
|
+
VersionAdded: '0.20'
|
2190
|
+
VersionChanged: '0.31'
|
2094
2191
|
|
2095
|
-
|
2096
|
-
Description: 'Use
|
2097
|
-
|
2192
|
+
Style/AsciiComments:
|
2193
|
+
Description: 'Use only ascii symbols in comments.'
|
2194
|
+
StyleGuide: '#english-comments'
|
2098
2195
|
Enabled: false
|
2099
|
-
VersionAdded: '0.
|
2196
|
+
VersionAdded: '0.9'
|
2197
|
+
VersionChanged: '0.52'
|
2198
|
+
AllowedChars: []
|
2100
2199
|
|
2101
|
-
|
2102
|
-
Description:
|
2103
|
-
|
2104
|
-
returned `MatchData` is not needed.
|
2200
|
+
Style/Attr:
|
2201
|
+
Description: 'Checks for uses of Module#attr.'
|
2202
|
+
StyleGuide: '#attr'
|
2105
2203
|
Enabled: true
|
2106
|
-
VersionAdded: '0.
|
2204
|
+
VersionAdded: '0.9'
|
2205
|
+
VersionChanged: '0.12'
|
2107
2206
|
|
2108
|
-
|
2109
|
-
Description: '
|
2110
|
-
Reference: 'https://github.com/JuanitoFatas/fast-ruby#hashmerge-vs-hash-code'
|
2207
|
+
Style/AutoResourceCleanup:
|
2208
|
+
Description: 'Suggests the usage of an auto resource cleanup version of a method (if available).'
|
2111
2209
|
Enabled: false
|
2112
|
-
VersionAdded: '0.
|
2113
|
-
# Max number of key-value pairs to consider an offense
|
2114
|
-
MaxKeyValuePairs: 2
|
2115
|
-
|
2116
|
-
Performance/RedundantSortBy:
|
2117
|
-
Description: 'Use `sort` instead of `sort_by { |x| x }`.'
|
2118
|
-
Enabled: true
|
2119
|
-
VersionAdded: '0.36'
|
2120
|
-
|
2121
|
-
Performance/RegexpMatch:
|
2122
|
-
Description: >-
|
2123
|
-
Use `match?` instead of `Regexp#match`, `String#match`, `Symbol#match`,
|
2124
|
-
`Regexp#===`, or `=~` when `MatchData` is not used.
|
2125
|
-
Reference: 'https://github.com/JuanitoFatas/fast-ruby#regexp-vs-stringmatch-vs-string-vs-stringmatch-code-'
|
2126
|
-
Enabled: true
|
2127
|
-
VersionAdded: '0.47'
|
2128
|
-
|
2129
|
-
Performance/ReverseEach:
|
2130
|
-
Description: 'Use `reverse_each` instead of `reverse.each`.'
|
2131
|
-
Reference: 'https://github.com/JuanitoFatas/fast-ruby#enumerablereverseeach-vs-enumerablereverse_each-code'
|
2132
|
-
Enabled: true
|
2133
|
-
VersionAdded: '0.30'
|
2134
|
-
|
2135
|
-
Performance/Sample:
|
2136
|
-
Description: >-
|
2137
|
-
Use `sample` instead of `shuffle.first`,
|
2138
|
-
`shuffle.last`, and `shuffle[Integer]`.
|
2139
|
-
Reference: 'https://github.com/JuanitoFatas/fast-ruby#arrayshufflefirst-vs-arraysample-code'
|
2140
|
-
Enabled: true
|
2141
|
-
VersionAdded: '0.30'
|
2142
|
-
|
2143
|
-
Performance/Size:
|
2144
|
-
Description: >-
|
2145
|
-
Use `size` instead of `count` for counting
|
2146
|
-
the number of elements in `Array` and `Hash`.
|
2147
|
-
Reference: 'https://github.com/JuanitoFatas/fast-ruby#arraylength-vs-arraysize-vs-arraycount-code'
|
2148
|
-
Enabled: true
|
2149
|
-
VersionAdded: '0.30'
|
2150
|
-
|
2151
|
-
Performance/StartWith:
|
2152
|
-
Description: 'Use `start_with?` instead of a regex match anchored to the beginning of a string.'
|
2153
|
-
Reference: 'https://github.com/JuanitoFatas/fast-ruby#stringmatch-vs-stringstart_withstringend_with-code-start-code-end'
|
2154
|
-
# This will change to a new method call which isn't guaranteed to be on the
|
2155
|
-
# object. Switching these methods has to be done with knowledge of the types
|
2156
|
-
# of the variables which rubocop doesn't have.
|
2157
|
-
SafeAutoCorrect: false
|
2158
|
-
AutoCorrect: false
|
2159
|
-
Enabled: false
|
2160
|
-
VersionAdded: '0.36'
|
2161
|
-
VersionChanged: '0.44'
|
2162
|
-
|
2163
|
-
Performance/StringReplacement:
|
2164
|
-
Description: >-
|
2165
|
-
Use `tr` instead of `gsub` when you are replacing the same
|
2166
|
-
number of characters. Use `delete` instead of `gsub` when
|
2167
|
-
you are deleting characters.
|
2168
|
-
Reference: 'https://github.com/JuanitoFatas/fast-ruby#stringgsub-vs-stringtr-code'
|
2169
|
-
Enabled: false
|
2170
|
-
VersionAdded: '0.33'
|
2171
|
-
|
2172
|
-
Performance/TimesMap:
|
2173
|
-
Description: 'Checks for .times.map calls.'
|
2174
|
-
AutoCorrect: false
|
2175
|
-
Enabled: true
|
2176
|
-
VersionAdded: '0.36'
|
2177
|
-
VersionChanged: '0.50'
|
2178
|
-
SafeAutoCorrect: false # see https://github.com/rubocop-hq/rubocop/issues/4658
|
2179
|
-
|
2180
|
-
Performance/UnfreezeString:
|
2181
|
-
Description: 'Use unary plus to get an unfrozen string literal.'
|
2182
|
-
Enabled: false
|
2183
|
-
VersionAdded: '0.50'
|
2184
|
-
|
2185
|
-
Performance/UnneededSort:
|
2186
|
-
Description: >-
|
2187
|
-
Use `min` instead of `sort.first`,
|
2188
|
-
`max_by` instead of `sort_by...last`, etc.
|
2189
|
-
Enabled: true
|
2190
|
-
VersionAdded: '0.55'
|
2191
|
-
|
2192
|
-
Performance/UriDefaultParser:
|
2193
|
-
Description: 'Use `URI::DEFAULT_PARSER` instead of `URI::Parser.new`.'
|
2194
|
-
Enabled: true
|
2195
|
-
VersionAdded: '0.50'
|
2196
|
-
|
2197
|
-
#################### Rails #################################
|
2198
|
-
|
2199
|
-
# By default, the rails cops are not run. Override in project or home
|
2200
|
-
# directory .rubocop.yml files, or by giving the -R/--rails option.
|
2201
|
-
Rails:
|
2202
|
-
Enabled: false
|
2203
|
-
|
2204
|
-
Rails/ActionFilter:
|
2205
|
-
Description: 'Enforces consistent use of action filter methods.'
|
2206
|
-
Enabled: true
|
2207
|
-
VersionAdded: '0.19'
|
2208
|
-
EnforcedStyle: action
|
2209
|
-
SupportedStyles:
|
2210
|
-
- action
|
2211
|
-
- filter
|
2212
|
-
Include:
|
2213
|
-
- app/controllers/**/*.rb
|
2214
|
-
|
2215
|
-
Rails/ActiveRecordAliases:
|
2216
|
-
Description: >-
|
2217
|
-
Avoid Active Record aliases:
|
2218
|
-
Use `update` instead of `update_attributes`.
|
2219
|
-
Use `update!` instead of `update_attributes!`.
|
2220
|
-
Enabled: true
|
2221
|
-
VersionAdded: '0.53'
|
2222
|
-
|
2223
|
-
Rails/ActiveSupportAliases:
|
2224
|
-
Description: >-
|
2225
|
-
Avoid ActiveSupport aliases of standard ruby methods:
|
2226
|
-
`String#starts_with?`, `String#ends_with?`,
|
2227
|
-
`Array#append`, `Array#prepend`.
|
2228
|
-
Enabled: false
|
2229
|
-
VersionAdded: '0.48'
|
2230
|
-
|
2231
|
-
Rails/ApplicationJob:
|
2232
|
-
Description: 'Check that jobs subclass ApplicationJob.'
|
2233
|
-
Enabled: true
|
2234
|
-
VersionAdded: '0.49'
|
2235
|
-
|
2236
|
-
Rails/ApplicationRecord:
|
2237
|
-
Description: 'Check that models subclass ApplicationRecord.'
|
2238
|
-
Enabled: false # Because not all models are necessarily domain models (e.g. migration models for legacy databases)
|
2239
|
-
VersionAdded: '0.49'
|
2240
|
-
|
2241
|
-
Rails/AssertNot:
|
2242
|
-
Description: 'Use `assert_not` instead of `assert !`.'
|
2243
|
-
Enabled: true
|
2244
|
-
VersionAdded: '0.56'
|
2245
|
-
Include:
|
2246
|
-
- '**/test/**/*'
|
2247
|
-
|
2248
|
-
Rails/BelongsTo:
|
2249
|
-
Description: >-
|
2250
|
-
Use `optional: true` instead of `required: false` for
|
2251
|
-
`belongs_to` relations'
|
2252
|
-
Enabled: true
|
2253
|
-
VersionAdded: '0.62'
|
2254
|
-
|
2255
|
-
Rails/Blank:
|
2256
|
-
Description: 'Enforces use of `blank?`.'
|
2257
|
-
Enabled: true
|
2258
|
-
VersionAdded: '0.48'
|
2259
|
-
# Convert usages of `nil? || empty?` to `blank?`
|
2260
|
-
NilOrEmpty: true
|
2261
|
-
# Convert usages of `!present?` to `blank?`
|
2262
|
-
NotPresent: true
|
2263
|
-
# Convert usages of `unless present?` to `if blank?`
|
2264
|
-
UnlessPresent: true
|
2265
|
-
|
2266
|
-
Rails/BulkChangeTable:
|
2267
|
-
Description: 'Check whether alter queries are combinable.'
|
2268
|
-
Enabled: false # We'll maybe enable this later.
|
2269
|
-
VersionAdded: '0.57'
|
2270
|
-
Database: null
|
2271
|
-
SupportedDatabases:
|
2272
|
-
- mysql
|
2273
|
-
- postgresql
|
2274
|
-
Include:
|
2275
|
-
- db/migrate/*.rb
|
2276
|
-
|
2277
|
-
Rails/CreateTableWithTimestamps:
|
2278
|
-
Description: >-
|
2279
|
-
Checks the migration for which timestamps are not included
|
2280
|
-
when creating a new table.
|
2281
|
-
Enabled: true
|
2282
|
-
VersionAdded: '0.52'
|
2283
|
-
Include:
|
2284
|
-
- db/migrate/*.rb
|
2285
|
-
|
2286
|
-
Rails/Date:
|
2287
|
-
Description: >-
|
2288
|
-
Checks the correct usage of date aware methods,
|
2289
|
-
such as Date.today, Date.current etc.
|
2290
|
-
Enabled: false # It's not that simple. Really.
|
2291
|
-
VersionAdded: '0.30'
|
2292
|
-
VersionChanged: '0.33'
|
2293
|
-
# The value `strict` disallows usage of `Date.today`, `Date.current`,
|
2294
|
-
# `Date#to_time` etc.
|
2295
|
-
# The value `flexible` allows usage of `Date.current`, `Date.yesterday`, etc
|
2296
|
-
# (but not `Date.today`) which are overridden by ActiveSupport to handle current
|
2297
|
-
# time zone.
|
2298
|
-
EnforcedStyle: flexible
|
2299
|
-
SupportedStyles:
|
2300
|
-
- strict
|
2301
|
-
- flexible
|
2302
|
-
|
2303
|
-
Rails/Delegate:
|
2304
|
-
Description: 'Prefer delegate method for delegations.'
|
2305
|
-
Enabled: false
|
2306
|
-
VersionAdded: '0.21'
|
2307
|
-
VersionChanged: '0.50'
|
2308
|
-
# When set to true, using the target object as a prefix of the
|
2309
|
-
# method name without using the `delegate` method will be a
|
2310
|
-
# violation. When set to false, this case is legal.
|
2311
|
-
EnforceForPrefixed: true
|
2312
|
-
|
2313
|
-
Rails/DelegateAllowBlank:
|
2314
|
-
Description: 'Do not use allow_blank as an option to delegate.'
|
2315
|
-
Enabled: true
|
2316
|
-
VersionAdded: '0.44'
|
2317
|
-
|
2318
|
-
Rails/DynamicFindBy:
|
2319
|
-
Description: 'Use `find_by` instead of dynamic `find_by_*`.'
|
2320
|
-
StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#find_by'
|
2321
|
-
Enabled: false # We occasionally define custom find_by_* methods (e.g. `find_by_anything`) which don't work like ActiveRecord's methods.
|
2322
|
-
VersionAdded: '0.44'
|
2323
|
-
Whitelist:
|
2324
|
-
- find_by_sql
|
2325
|
-
|
2326
|
-
Rails/EnumUniqueness:
|
2327
|
-
Description: 'Avoid duplicate integers in hash-syntax `enum` declaration.'
|
2328
|
-
Enabled: true
|
2329
|
-
VersionAdded: '0.46'
|
2330
|
-
Include:
|
2331
|
-
- app/models/**/*.rb
|
2332
|
-
|
2333
|
-
Rails/EnvironmentComparison:
|
2334
|
-
Description: "Favor `Rails.env.production?` over `Rails.env == 'production'`"
|
2335
|
-
Enabled: true
|
2336
|
-
VersionAdded: '0.52'
|
2337
|
-
|
2338
|
-
Rails/Exit:
|
2339
|
-
Description: >-
|
2340
|
-
Favor `fail`, `break`, `return`, etc. over `exit` in
|
2341
|
-
application or library code outside of Rake files to avoid
|
2342
|
-
exits during unit testing or running in production.
|
2343
|
-
Enabled: true
|
2344
|
-
VersionAdded: '0.41'
|
2345
|
-
Include:
|
2346
|
-
- app/**/*.rb
|
2347
|
-
- config/**/*.rb
|
2348
|
-
- lib/**/*.rb
|
2349
|
-
Exclude:
|
2350
|
-
- lib/**/*.rake
|
2351
|
-
|
2352
|
-
Rails/FilePath:
|
2353
|
-
Description: 'Use `Rails.root.join` for file path joining.'
|
2354
|
-
Enabled: false
|
2355
|
-
VersionAdded: '0.47'
|
2356
|
-
VersionChanged: '0.57'
|
2357
|
-
EnforcedStyle: arguments
|
2358
|
-
SupportedStyles:
|
2359
|
-
- slashes
|
2360
|
-
- arguments
|
2361
|
-
|
2362
|
-
Rails/FindBy:
|
2363
|
-
Description: 'Prefer find_by over where.first.'
|
2364
|
-
StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#find_by'
|
2365
|
-
Enabled: false
|
2366
|
-
VersionAdded: '0.30'
|
2367
|
-
Include:
|
2368
|
-
- app/models/**/*.rb
|
2369
|
-
|
2370
|
-
Rails/FindEach:
|
2371
|
-
Description: 'Prefer all.find_each over all.find.'
|
2372
|
-
StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#find-each'
|
2373
|
-
Enabled: true
|
2374
|
-
VersionAdded: '0.30'
|
2375
|
-
Include:
|
2376
|
-
- app/models/**/*.rb
|
2377
|
-
|
2378
|
-
Rails/HasAndBelongsToMany:
|
2379
|
-
Description: 'Prefer has_many :through to has_and_belongs_to_many.'
|
2380
|
-
StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#has-many-through'
|
2381
|
-
Enabled: true
|
2382
|
-
VersionAdded: '0.12'
|
2383
|
-
Include:
|
2384
|
-
- app/models/**/*.rb
|
2385
|
-
|
2386
|
-
Rails/HasManyOrHasOneDependent:
|
2387
|
-
Description: 'Define the dependent option to the has_many and has_one associations.'
|
2388
|
-
StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#has_many-has_one-dependent-option'
|
2389
|
-
Enabled: true
|
2390
|
-
VersionAdded: '0.50'
|
2391
|
-
Include:
|
2392
|
-
- app/models/**/*.rb
|
2393
|
-
|
2394
|
-
Rails/HttpPositionalArguments:
|
2395
|
-
Description: 'Use keyword arguments instead of positional arguments in http method calls.'
|
2396
|
-
Enabled: true
|
2397
|
-
VersionAdded: '0.44'
|
2398
|
-
Include:
|
2399
|
-
- 'spec/**/*'
|
2400
|
-
- 'test/**/*'
|
2401
|
-
|
2402
|
-
Rails/HttpStatus:
|
2403
|
-
Description: 'Enforces use of symbolic or numeric value to define HTTP status.'
|
2404
|
-
Enabled: false
|
2405
|
-
VersionAdded: '0.54'
|
2406
|
-
EnforcedStyle: symbolic
|
2407
|
-
SupportedStyles:
|
2408
|
-
- numeric
|
2409
|
-
- symbolic
|
2410
|
-
|
2411
|
-
Rails/IgnoredSkipActionFilterOption:
|
2412
|
-
Description: 'Checks that `if` and `only` (or `except`) are not used together as options of `skip_*` action filter.'
|
2413
|
-
Reference: 'https://api.rubyonrails.org/classes/AbstractController/Callbacks/ClassMethods.html#method-i-_normalize_callback_options'
|
2414
|
-
Enabled: true
|
2415
|
-
VersionAdded: '0.63'
|
2416
|
-
Include:
|
2417
|
-
- app/controllers/**/*.rb
|
2418
|
-
|
2419
|
-
Rails/InverseOf:
|
2420
|
-
Description: 'Checks for associations where the inverse cannot be determined automatically.'
|
2421
|
-
Enabled: true
|
2422
|
-
VersionAdded: '0.52'
|
2423
|
-
Include:
|
2424
|
-
- app/models/**/*.rb
|
2425
|
-
|
2426
|
-
Rails/LexicallyScopedActionFilter:
|
2427
|
-
Description: "Checks that methods specified in the filter's `only` or `except` options are explicitly defined in the controller."
|
2428
|
-
StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#lexically-scoped-action-filter'
|
2429
|
-
Enabled: true
|
2430
|
-
VersionAdded: '0.52'
|
2431
|
-
Include:
|
2432
|
-
- app/controllers/**/*.rb
|
2433
|
-
|
2434
|
-
Rails/LinkToBlank:
|
2435
|
-
Description: 'Checks that `link_to` with a `target: "_blank"` have a `rel: "noopener"` option passed to them.'
|
2436
|
-
Reference: https://mathiasbynens.github.io/rel-noopener/
|
2437
|
-
Enabled: true
|
2438
|
-
VersionAdded: '0.62'
|
2439
|
-
|
2440
|
-
Rails/NotNullColumn:
|
2441
|
-
Description: 'Do not add a NOT NULL column without a default value'
|
2442
|
-
Enabled: true
|
2443
|
-
VersionAdded: '0.43'
|
2444
|
-
Include:
|
2445
|
-
- db/migrate/*.rb
|
2446
|
-
|
2447
|
-
Rails/Output:
|
2448
|
-
Description: 'Checks for calls to puts, print, etc.'
|
2449
|
-
Enabled: false
|
2450
|
-
VersionAdded: '0.15'
|
2451
|
-
VersionChanged: '0.19'
|
2452
|
-
Include:
|
2453
|
-
- app/**/*.rb
|
2454
|
-
- config/**/*.rb
|
2455
|
-
- db/**/*.rb
|
2456
|
-
- lib/**/*.rb
|
2457
|
-
|
2458
|
-
Rails/OutputSafety:
|
2459
|
-
Description: 'The use of `html_safe` or `raw` may be a security risk.'
|
2460
|
-
Enabled: true # We may need to review this. Unsure if the cop can always know which `html_safe` call is valid and which one is not.
|
2461
|
-
VersionAdded: '0.41'
|
2462
|
-
|
2463
|
-
Rails/PluralizationGrammar:
|
2464
|
-
Description: 'Checks for incorrect grammar when using methods like `3.day.ago`.'
|
2465
|
-
Enabled: true
|
2466
|
-
VersionAdded: '0.35'
|
2467
|
-
|
2468
|
-
Rails/Presence:
|
2469
|
-
Description: 'Checks code that can be written more easily using `Object#presence` defined by Active Support.'
|
2470
|
-
Enabled: true
|
2471
|
-
VersionAdded: '0.52'
|
2472
|
-
|
2473
|
-
Rails/Present:
|
2474
|
-
Description: 'Enforces use of `present?`.'
|
2475
|
-
Enabled: true
|
2476
|
-
VersionAdded: '0.48'
|
2477
|
-
# Convert usages of `!nil? && !empty?` to `present?`
|
2478
|
-
NotNilAndNotEmpty: true
|
2479
|
-
# Convert usages of `!blank?` to `present?`
|
2480
|
-
NotBlank: true
|
2481
|
-
# Convert usages of `unless blank?` to `if present?`
|
2482
|
-
UnlessBlank: true
|
2483
|
-
|
2484
|
-
Rails/ReadWriteAttribute:
|
2485
|
-
Description: >-
|
2486
|
-
Checks for read_attribute(:attr) and
|
2487
|
-
write_attribute(:attr, val).
|
2488
|
-
StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#read-attribute'
|
2489
|
-
Enabled: true
|
2490
|
-
VersionAdded: '0.20'
|
2491
|
-
VersionChanged: '0.29'
|
2492
|
-
Include:
|
2493
|
-
- app/models/**/*.rb
|
2494
|
-
|
2495
|
-
Rails/RedundantReceiverInWithOptions:
|
2496
|
-
Description: 'Checks for redundant receiver in `with_options`.'
|
2497
|
-
Enabled: true
|
2498
|
-
VersionAdded: '0.52'
|
2499
|
-
|
2500
|
-
Rails/ReflectionClassName:
|
2501
|
-
Description: 'Use a string for `class_name` option value in the definition of a reflection.'
|
2502
|
-
Enabled: true
|
2503
|
-
VersionAdded: '0.64'
|
2504
|
-
|
2505
|
-
Rails/RefuteMethods:
|
2506
|
-
Description: 'Use `assert_not` methods instead of `refute` methods.'
|
2507
|
-
Enabled: true
|
2508
|
-
VersionAdded: '0.56'
|
2509
|
-
Include:
|
2510
|
-
- '**/test/**/*'
|
2511
|
-
|
2512
|
-
Rails/RelativeDateConstant:
|
2513
|
-
Description: 'Do not assign relative date to constants.'
|
2514
|
-
Enabled: true
|
2515
|
-
VersionAdded: '0.48'
|
2516
|
-
VersionChanged: '0.59'
|
2517
|
-
AutoCorrect: false
|
2518
|
-
|
2519
|
-
Rails/RequestReferer:
|
2520
|
-
Description: 'Use consistent syntax for request.referer.'
|
2521
|
-
Enabled: true
|
2522
|
-
VersionAdded: '0.41'
|
2523
|
-
EnforcedStyle: referrer # A typo in a "remote API" (HTTP RFC) should not force us using badly named methods
|
2524
|
-
SupportedStyles:
|
2525
|
-
- referer
|
2526
|
-
- referrer
|
2527
|
-
|
2528
|
-
Rails/ReversibleMigration:
|
2529
|
-
Description: 'Checks whether the change method of the migration file is reversible.'
|
2530
|
-
StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#reversible-migration'
|
2531
|
-
Reference: 'https://api.rubyonrails.org/classes/ActiveRecord/Migration/CommandRecorder.html'
|
2532
|
-
Enabled: true
|
2533
|
-
VersionAdded: '0.47'
|
2534
|
-
Include:
|
2535
|
-
- db/migrate/*.rb
|
2536
|
-
|
2537
|
-
Rails/SafeNavigation:
|
2538
|
-
Description: "Use Ruby's safe navigation operator (`&.`) instead of `try!`"
|
2539
|
-
Enabled: false
|
2540
|
-
VersionAdded: '0.43'
|
2541
|
-
# This will convert usages of `try` to use safe navigation as well as `try!`.
|
2542
|
-
# `try` and `try!` work slightly differently. `try!` and safe navigation will
|
2543
|
-
# both raise a `NoMethodError` if the receiver of the method call does not
|
2544
|
-
# implement the intended method. `try` will not raise an exception for this.
|
2545
|
-
ConvertTry: false
|
2546
|
-
|
2547
|
-
Rails/SaveBang:
|
2548
|
-
Description: 'Identifies possible cases where Active Record save! or related should be used.'
|
2549
|
-
StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#save-bang'
|
2550
|
-
Enabled: false
|
2551
|
-
VersionAdded: '0.42'
|
2552
|
-
VersionChanged: '0.59'
|
2553
|
-
AllowImplicitReturn: true
|
2554
|
-
AllowedReceivers: []
|
2555
|
-
|
2556
|
-
Rails/ScopeArgs:
|
2557
|
-
Description: 'Checks the arguments of ActiveRecord scopes.'
|
2558
|
-
Enabled: true
|
2559
|
-
VersionAdded: '0.19'
|
2560
|
-
Include:
|
2561
|
-
- app/models/**/*.rb
|
2562
|
-
|
2563
|
-
Rails/SkipsModelValidations:
|
2564
|
-
Description: >-
|
2565
|
-
Use methods that skips model validations with caution.
|
2566
|
-
See reference for more information.
|
2567
|
-
Reference: 'https://guides.rubyonrails.org/active_record_validations.html#skipping-validations'
|
2568
|
-
Enabled: false
|
2569
|
-
VersionAdded: '0.47'
|
2570
|
-
VersionChanged: '0.60'
|
2571
|
-
Blacklist:
|
2572
|
-
- decrement!
|
2573
|
-
- decrement_counter
|
2574
|
-
- increment!
|
2575
|
-
- increment_counter
|
2576
|
-
- toggle!
|
2577
|
-
- touch
|
2578
|
-
- update_all
|
2579
|
-
- update_attribute
|
2580
|
-
- update_column
|
2581
|
-
- update_columns
|
2582
|
-
- update_counters
|
2583
|
-
Whitelist: []
|
2584
|
-
|
2585
|
-
Rails/TimeZone:
|
2586
|
-
Description: 'Checks the correct usage of time zone aware methods.'
|
2587
|
-
StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#time'
|
2588
|
-
Reference: 'http://danilenko.org/2012/7/6/rails_timezones'
|
2589
|
-
Enabled: false
|
2590
|
-
VersionAdded: '0.30'
|
2591
|
-
VersionChanged: '0.33'
|
2592
|
-
# The value `strict` means that `Time` should be used with `zone`.
|
2593
|
-
# The value `flexible` allows usage of `in_time_zone` instead of `zone`.
|
2594
|
-
EnforcedStyle: flexible
|
2595
|
-
SupportedStyles:
|
2596
|
-
- strict
|
2597
|
-
- flexible
|
2598
|
-
|
2599
|
-
Rails/UniqBeforePluck:
|
2600
|
-
Description: 'Prefer the use of uniq or distinct before pluck.'
|
2601
|
-
Enabled: true
|
2602
|
-
VersionAdded: '0.40'
|
2603
|
-
VersionChanged: '0.47'
|
2604
|
-
EnforcedStyle: conservative
|
2605
|
-
SupportedStyles:
|
2606
|
-
- conservative
|
2607
|
-
- aggressive
|
2608
|
-
AutoCorrect: false
|
2609
|
-
|
2610
|
-
Rails/UnknownEnv:
|
2611
|
-
Description: 'Use correct environment name.'
|
2612
|
-
Enabled: true
|
2613
|
-
VersionAdded: '0.51'
|
2614
|
-
Environments:
|
2615
|
-
- development
|
2616
|
-
- test
|
2617
|
-
- production
|
2618
|
-
|
2619
|
-
Rails/Validation:
|
2620
|
-
Description: 'Use validates :attribute, hash of validations.'
|
2621
|
-
Enabled: true
|
2622
|
-
VersionAdded: '0.9'
|
2623
|
-
VersionChanged: '0.41'
|
2624
|
-
Include:
|
2625
|
-
- app/models/**/*.rb
|
2626
|
-
|
2627
|
-
#################### Security ##############################
|
2628
|
-
|
2629
|
-
Security/Eval:
|
2630
|
-
Description: 'The use of eval represents a serious security risk.'
|
2631
|
-
Enabled: false # We all know not to eval. If we need to, there will be a reason.
|
2632
|
-
VersionAdded: '0.47'
|
2633
|
-
|
2634
|
-
Security/JSONLoad:
|
2635
|
-
Description: >-
|
2636
|
-
Prefer usage of `JSON.parse` over `JSON.load` due to potential
|
2637
|
-
security issues. See reference for more information.
|
2638
|
-
Reference: 'https://ruby-doc.org/stdlib-2.3.0/libdoc/json/rdoc/JSON.html#method-i-load'
|
2639
|
-
Enabled: true
|
2640
|
-
VersionAdded: '0.43'
|
2641
|
-
VersionChanged: '0.44'
|
2642
|
-
# Autocorrect here will change to a method that may cause crashes depending
|
2643
|
-
# on the value of the argument.
|
2644
|
-
AutoCorrect: false
|
2645
|
-
SafeAutoCorrect: false
|
2646
|
-
|
2647
|
-
Security/MarshalLoad:
|
2648
|
-
Description: >-
|
2649
|
-
Avoid using of `Marshal.load` or `Marshal.restore` due to potential
|
2650
|
-
security issues. See reference for more information.
|
2651
|
-
Reference: 'https://ruby-doc.org/core-2.3.3/Marshal.html#module-Marshal-label-Security+considerations'
|
2652
|
-
Enabled: true
|
2653
|
-
VersionAdded: '0.47'
|
2654
|
-
|
2655
|
-
Security/Open:
|
2656
|
-
Description: 'The use of Kernel#open represents a serious security risk.'
|
2657
|
-
Enabled: true
|
2658
|
-
VersionAdded: '0.53'
|
2659
|
-
Safe: false
|
2660
|
-
|
2661
|
-
Security/YAMLLoad:
|
2662
|
-
Description: >-
|
2663
|
-
Prefer usage of `YAML.safe_load` over `YAML.load` due to potential
|
2664
|
-
security issues. See reference for more information.
|
2665
|
-
Reference: 'https://ruby-doc.org/stdlib-2.3.3/libdoc/yaml/rdoc/YAML.html#module-YAML-label-Security'
|
2666
|
-
Enabled: true
|
2667
|
-
VersionAdded: '0.47'
|
2668
|
-
SafeAutoCorrect: false
|
2669
|
-
|
2670
|
-
#################### Style ###############################
|
2671
|
-
|
2672
|
-
Style/AccessModifierDeclarations:
|
2673
|
-
Description: 'Checks style of how access modifiers are used.'
|
2674
|
-
Enabled: true
|
2675
|
-
VersionAdded: '0.57'
|
2676
|
-
EnforcedStyle: group
|
2677
|
-
SupportedStyles:
|
2678
|
-
- inline
|
2679
|
-
- group
|
2680
|
-
|
2681
|
-
Style/Alias:
|
2682
|
-
Description: 'Use alias instead of alias_method.'
|
2683
|
-
StyleGuide: '#alias-method'
|
2684
|
-
Enabled: true
|
2685
|
-
VersionAdded: '0.9'
|
2686
|
-
VersionChanged: '0.36'
|
2687
|
-
EnforcedStyle: prefer_alias_method
|
2688
|
-
SupportedStyles:
|
2689
|
-
- prefer_alias
|
2690
|
-
- prefer_alias_method
|
2691
|
-
|
2692
|
-
Style/AndOr:
|
2693
|
-
Description: 'Use &&/|| instead of and/or.'
|
2694
|
-
StyleGuide: '#no-and-or-or'
|
2695
|
-
Enabled: true
|
2696
|
-
VersionAdded: '0.9'
|
2697
|
-
VersionChanged: '0.25'
|
2698
|
-
# Whether `and` and `or` are banned only in conditionals (conditionals)
|
2699
|
-
# or completely (always).
|
2700
|
-
EnforcedStyle: always
|
2701
|
-
SupportedStyles:
|
2702
|
-
- always
|
2703
|
-
- conditionals
|
2704
|
-
|
2705
|
-
Style/ArrayJoin:
|
2706
|
-
Description: 'Use Array#join instead of Array#*.'
|
2707
|
-
StyleGuide: '#array-join'
|
2708
|
-
Enabled: true
|
2709
|
-
VersionAdded: '0.20'
|
2710
|
-
VersionChanged: '0.31'
|
2711
|
-
|
2712
|
-
Style/AsciiComments:
|
2713
|
-
Description: 'Use only ascii symbols in comments.'
|
2714
|
-
StyleGuide: '#english-comments'
|
2715
|
-
Enabled: false
|
2716
|
-
VersionAdded: '0.9'
|
2717
|
-
VersionChanged: '0.52'
|
2718
|
-
AllowedChars: []
|
2719
|
-
|
2720
|
-
Style/Attr:
|
2721
|
-
Description: 'Checks for uses of Module#attr.'
|
2722
|
-
StyleGuide: '#attr'
|
2723
|
-
Enabled: true
|
2724
|
-
VersionAdded: '0.9'
|
2725
|
-
VersionChanged: '0.12'
|
2726
|
-
|
2727
|
-
Style/AutoResourceCleanup:
|
2728
|
-
Description: 'Suggests the usage of an auto resource cleanup version of a method (if available).'
|
2729
|
-
Enabled: false
|
2730
|
-
VersionAdded: '0.30'
|
2210
|
+
VersionAdded: '0.30'
|
2731
2211
|
|
2732
2212
|
Style/BarePercentLiterals:
|
2733
2213
|
Description: 'Checks if usage of %() or %Q() matches configuration.'
|
@@ -2768,8 +2248,9 @@ Style/BlockDelimiters:
|
|
2768
2248
|
- line_count_based
|
2769
2249
|
# The `semantic` style enforces braces around functional blocks, where the
|
2770
2250
|
# primary purpose of the block is to return a value and do..end for
|
2771
|
-
# procedural blocks, where the primary purpose of the block is
|
2772
|
-
# side-effects.
|
2251
|
+
# multi-line procedural blocks, where the primary purpose of the block is
|
2252
|
+
# its side-effects. Single-line procedural blocks may only use do-end,
|
2253
|
+
# unless AllowBracesOnProceduralOneLiners has a truthy value (see below).
|
2773
2254
|
#
|
2774
2255
|
# This looks at the usage of a block's method to determine its type (e.g. is
|
2775
2256
|
# the result of a `map` assigned to a variable or passed to another
|
@@ -2781,6 +2262,8 @@ Style/BlockDelimiters:
|
|
2781
2262
|
# return value is being chained with another method (in which case braces
|
2782
2263
|
# are enforced).
|
2783
2264
|
- braces_for_chaining
|
2265
|
+
# The `always_braces` style always enforces braces.
|
2266
|
+
- always_braces
|
2784
2267
|
ProceduralMethods:
|
2785
2268
|
# Methods that are known to be procedural in nature but look functional from
|
2786
2269
|
# their usage, e.g.
|
@@ -2830,13 +2313,35 @@ Style/BlockDelimiters:
|
|
2830
2313
|
- lambda
|
2831
2314
|
- proc
|
2832
2315
|
- it
|
2316
|
+
# The AllowBracesOnProceduralOneLiners option is ignored unless the
|
2317
|
+
# EnforcedStyle is set to `semantic`. If so:
|
2318
|
+
#
|
2319
|
+
# If AllowBracesOnProceduralOneLiners is unspecified, or set to any
|
2320
|
+
# falsey value, then semantic purity is maintained, so one-line
|
2321
|
+
# procedural blocks must use do-end, not braces.
|
2322
|
+
#
|
2323
|
+
# # bad
|
2324
|
+
# collection.each { |element| puts element }
|
2325
|
+
#
|
2326
|
+
# # good
|
2327
|
+
# collection.each do |element| puts element end
|
2328
|
+
#
|
2329
|
+
# If AllowBracesOnProceduralOneLiners is set to any truthy value,
|
2330
|
+
# then one-line procedural blocks may use either style.
|
2331
|
+
#
|
2332
|
+
# # good
|
2333
|
+
# collection.each { |element| puts element }
|
2334
|
+
#
|
2335
|
+
# # also good
|
2336
|
+
# collection.each do |element| puts element end
|
2337
|
+
AllowBracesOnProceduralOneLiners: false
|
2833
2338
|
|
2834
2339
|
Style/BracesAroundHashParameters:
|
2835
2340
|
Description: 'Enforce braces style around hash parameters.'
|
2836
2341
|
Enabled: false # Maybe discuss. We actually do want braces if a single hash is split across multiple lines.
|
2837
2342
|
VersionAdded: '0.14.1'
|
2838
2343
|
VersionChanged: '0.28'
|
2839
|
-
EnforcedStyle:
|
2344
|
+
EnforcedStyle: no_braces
|
2840
2345
|
SupportedStyles:
|
2841
2346
|
# The `braces` style enforces braces around all method parameters that are
|
2842
2347
|
# hashes.
|
@@ -3006,6 +2511,13 @@ Style/ConditionalAssignment:
|
|
3006
2511
|
SingleLineConditionsOnly: true
|
3007
2512
|
IncludeTernaryExpressions: true
|
3008
2513
|
|
2514
|
+
Style/ConstantVisibility:
|
2515
|
+
Description: >-
|
2516
|
+
Check that class- and module constants have
|
2517
|
+
visibility declarations.
|
2518
|
+
Enabled: false
|
2519
|
+
VersionAdded: '0.66'
|
2520
|
+
|
3009
2521
|
# Checks that you have put a copyright in a comment before any code.
|
3010
2522
|
#
|
3011
2523
|
# You can override the default Notice in your .rubocop.yml file.
|
@@ -3070,6 +2582,11 @@ Style/DocumentationMethod:
|
|
3070
2582
|
- 'test/**/*'
|
3071
2583
|
RequireForNonPublicMethods: false
|
3072
2584
|
|
2585
|
+
Style/DoubleCopDisableDirective:
|
2586
|
+
Description: 'Checks for double rubocop:disable comments on a single line.'
|
2587
|
+
Enabled: true
|
2588
|
+
VersionAdded: '0.73'
|
2589
|
+
|
3073
2590
|
Style/DoubleNegation:
|
3074
2591
|
Description: 'Checks for uses of double negation (!!).'
|
3075
2592
|
StyleGuide: '#no-bang-bang'
|
@@ -3096,7 +2613,7 @@ Style/EmptyBlockParameter:
|
|
3096
2613
|
|
3097
2614
|
Style/EmptyCaseCondition:
|
3098
2615
|
Description: 'Avoid empty condition in case statements.'
|
3099
|
-
Enabled: true
|
2616
|
+
Enabled: true
|
3100
2617
|
VersionAdded: '0.40'
|
3101
2618
|
|
3102
2619
|
Style/EmptyElse:
|
@@ -3154,7 +2671,7 @@ Style/EvalWithLocation:
|
|
3154
2671
|
VersionAdded: '0.52'
|
3155
2672
|
|
3156
2673
|
Style/EvenOdd:
|
3157
|
-
Description: 'Favor the use of Integer#even
|
2674
|
+
Description: 'Favor the use of `Integer#even?` && `Integer#odd?`.'
|
3158
2675
|
StyleGuide: '#predicate-methods'
|
3159
2676
|
Enabled: false
|
3160
2677
|
VersionAdded: '0.12'
|
@@ -3165,6 +2682,19 @@ Style/ExpandPathArguments:
|
|
3165
2682
|
Enabled: true
|
3166
2683
|
VersionAdded: '0.53'
|
3167
2684
|
|
2685
|
+
Style/FloatDivision:
|
2686
|
+
Description: 'For performing float division, coerce one side only.'
|
2687
|
+
StyleGuide: '#float-division'
|
2688
|
+
Reference: 'https://github.com/rubocop-hq/ruby-style-guide/issues/628'
|
2689
|
+
Enabled: false # We disable this cop, it's fine for us to have .to_f on both sides
|
2690
|
+
VersionAdded: '0.72'
|
2691
|
+
EnforcedStyle: single_coerce
|
2692
|
+
SupportedStyles:
|
2693
|
+
- left_coerce
|
2694
|
+
- right_coerce
|
2695
|
+
- single_coerce
|
2696
|
+
- fdiv
|
2697
|
+
|
3168
2698
|
Style/For:
|
3169
2699
|
Description: 'Checks use of for or each in multiline loops.'
|
3170
2700
|
StyleGuide: '#no-for-loops'
|
@@ -3179,7 +2709,7 @@ Style/For:
|
|
3179
2709
|
Style/FormatString:
|
3180
2710
|
Description: 'Enforce the use of Kernel#sprintf, Kernel#format or String#%.'
|
3181
2711
|
StyleGuide: '#sprintf'
|
3182
|
-
Enabled: true
|
2712
|
+
Enabled: true
|
3183
2713
|
VersionAdded: '0.19'
|
3184
2714
|
VersionChanged: '0.49'
|
3185
2715
|
EnforcedStyle: format
|
@@ -3200,7 +2730,7 @@ Style/FormatStringToken:
|
|
3200
2730
|
- template
|
3201
2731
|
- unannotated
|
3202
2732
|
VersionAdded: '0.49'
|
3203
|
-
VersionChanged: '0.
|
2733
|
+
VersionChanged: '0.75'
|
3204
2734
|
|
3205
2735
|
Style/FrozenStringLiteralComment:
|
3206
2736
|
Description: >-
|
@@ -3208,12 +2738,9 @@ Style/FrozenStringLiteralComment:
|
|
3208
2738
|
to help transition to frozen string literals by default.
|
3209
2739
|
Enabled: false
|
3210
2740
|
VersionAdded: '0.36'
|
3211
|
-
VersionChanged: '0.
|
3212
|
-
EnforcedStyle:
|
2741
|
+
VersionChanged: '0.69'
|
2742
|
+
EnforcedStyle: always
|
3213
2743
|
SupportedStyles:
|
3214
|
-
# `when_needed` will add the frozen string literal comment to files
|
3215
|
-
# only when the `TargetRubyVersion` is set to 2.3+.
|
3216
|
-
- when_needed
|
3217
2744
|
# `always` will always add the frozen string literal comment to a file
|
3218
2745
|
# regardless of the Ruby version or if `freeze` or `<<` are called on a
|
3219
2746
|
# string literal. If you run code against multiple versions of Ruby, it is
|
@@ -3233,7 +2760,7 @@ Style/GlobalVars:
|
|
3233
2760
|
AllowedVariables: []
|
3234
2761
|
|
3235
2762
|
Style/GuardClause:
|
3236
|
-
Description: 'Check for conditionals that can be replaced with guard clauses'
|
2763
|
+
Description: 'Check for conditionals that can be replaced with guard clauses.'
|
3237
2764
|
StyleGuide: '#no-nested-conditionals'
|
3238
2765
|
Enabled: false
|
3239
2766
|
VersionAdded: '0.20'
|
@@ -3276,6 +2803,7 @@ Style/IdenticalConditionalBranches:
|
|
3276
2803
|
Style/IfInsideElse:
|
3277
2804
|
Description: 'Finds if nodes inside else, which can be converted to elsif.'
|
3278
2805
|
Enabled: true
|
2806
|
+
AllowIfModifier: false
|
3279
2807
|
VersionAdded: '0.36'
|
3280
2808
|
|
3281
2809
|
Style/IfUnlessModifier:
|
@@ -3395,6 +2923,8 @@ Style/MethodCallWithArgsParentheses:
|
|
3395
2923
|
VersionChanged: '0.61'
|
3396
2924
|
IgnoreMacros: true
|
3397
2925
|
IgnoredMethods: []
|
2926
|
+
IgnoredPatterns: []
|
2927
|
+
IncludedMacros: []
|
3398
2928
|
AllowParenthesesInMultilineCall: false
|
3399
2929
|
AllowParenthesesInChaining: false
|
3400
2930
|
AllowParenthesesInCamelCaseMethod: false
|
@@ -3440,7 +2970,7 @@ Style/MethodMissingSuper:
|
|
3440
2970
|
Style/MinMax:
|
3441
2971
|
Description: >-
|
3442
2972
|
Use `Enumerable#minmax` instead of `Enumerable#min`
|
3443
|
-
and `Enumerable#max` in conjunction.
|
2973
|
+
and `Enumerable#max` in conjunction.
|
3444
2974
|
Enabled: true
|
3445
2975
|
VersionAdded: '0.50'
|
3446
2976
|
|
@@ -3450,7 +2980,7 @@ Style/MissingElse:
|
|
3450
2980
|
If enabled, it is recommended that
|
3451
2981
|
Style/UnlessElse and Style/EmptyElse be enabled.
|
3452
2982
|
This will conflict with Style/EmptyElse if
|
3453
|
-
Style/EmptyElse is configured to style "both"
|
2983
|
+
Style/EmptyElse is configured to style "both".
|
3454
2984
|
Enabled: false
|
3455
2985
|
VersionAdded: '0.30'
|
3456
2986
|
VersionChanged: '0.38'
|
@@ -3546,6 +3076,12 @@ Style/MultilineTernaryOperator:
|
|
3546
3076
|
Enabled: true
|
3547
3077
|
VersionAdded: '0.9'
|
3548
3078
|
|
3079
|
+
Style/MultilineWhenThen:
|
3080
|
+
Description: 'Do not use then for multi-line when statement.'
|
3081
|
+
StyleGuide: '#no-then'
|
3082
|
+
Enabled: true
|
3083
|
+
VersionAdded: '0.73'
|
3084
|
+
|
3549
3085
|
Style/MultipleComparison:
|
3550
3086
|
Description: >-
|
3551
3087
|
Avoid comparing a variable with multiple items in a conditional,
|
@@ -3586,6 +3122,20 @@ Style/NegatedIf:
|
|
3586
3122
|
- prefix
|
3587
3123
|
- postfix
|
3588
3124
|
|
3125
|
+
Style/NegatedUnless:
|
3126
|
+
Description: 'Favor if over unless for negative conditions.'
|
3127
|
+
StyleGuide: '#if-for-negatives'
|
3128
|
+
Enabled: false
|
3129
|
+
VersionAdded: '0.69'
|
3130
|
+
EnforcedStyle: both
|
3131
|
+
SupportedStyles:
|
3132
|
+
# both: prefix and postfix negated `unless` should both use `if`
|
3133
|
+
# prefix: only use `if` for negated `unless` statements positioned before the body of the statement
|
3134
|
+
# postfix: only use `if` for negated `unless` statements positioned after the body of the statement
|
3135
|
+
- both
|
3136
|
+
- prefix
|
3137
|
+
- postfix
|
3138
|
+
|
3589
3139
|
Style/NegatedWhile:
|
3590
3140
|
Description: 'Favor until over while for negative conditions.'
|
3591
3141
|
StyleGuide: '#until-for-negatives'
|
@@ -3750,7 +3300,7 @@ Style/OptionHash:
|
|
3750
3300
|
Style/OptionalArguments:
|
3751
3301
|
Description: >-
|
3752
3302
|
Checks for optional arguments that do not appear at the end
|
3753
|
-
of the argument list
|
3303
|
+
of the argument list.
|
3754
3304
|
StyleGuide: '#optional-arguments'
|
3755
3305
|
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
|
3756
3306
|
VersionAdded: '0.33'
|
@@ -3782,7 +3332,7 @@ Style/ParenthesesAroundCondition:
|
|
3782
3332
|
AllowInMultilineConditions: false
|
3783
3333
|
|
3784
3334
|
Style/PercentLiteralDelimiters:
|
3785
|
-
Description: 'Use `%`-literal delimiters consistently'
|
3335
|
+
Description: 'Use `%`-literal delimiters consistently.'
|
3786
3336
|
StyleGuide: '#percent-literal-braces'
|
3787
3337
|
Enabled: true
|
3788
3338
|
VersionAdded: '0.19'
|
@@ -3817,8 +3367,9 @@ Style/PreferredHashMethods:
|
|
3817
3367
|
Description: 'Checks use of `has_key?` and `has_value?` Hash methods.'
|
3818
3368
|
StyleGuide: '#hash-key'
|
3819
3369
|
Enabled: true
|
3370
|
+
Safe: false
|
3820
3371
|
VersionAdded: '0.41'
|
3821
|
-
VersionChanged: '0.
|
3372
|
+
VersionChanged: '0.70'
|
3822
3373
|
EnforcedStyle: short
|
3823
3374
|
SupportedStyles:
|
3824
3375
|
- short
|
@@ -3857,6 +3408,16 @@ Style/RedundantBegin:
|
|
3857
3408
|
VersionAdded: '0.10'
|
3858
3409
|
VersionChanged: '0.21'
|
3859
3410
|
|
3411
|
+
Style/RedundantCapitalW:
|
3412
|
+
Description: 'Checks for %W when interpolation is not needed.'
|
3413
|
+
Enabled: true
|
3414
|
+
VersionAdded: '0.76'
|
3415
|
+
|
3416
|
+
Style/RedundantCondition:
|
3417
|
+
Description: 'Checks for unnecessary conditional expressions.'
|
3418
|
+
Enabled: true
|
3419
|
+
VersionAdded: '0.76'
|
3420
|
+
|
3860
3421
|
Style/RedundantConditional:
|
3861
3422
|
Description: "Don't return true/false from a conditional."
|
3862
3423
|
Enabled: true
|
@@ -3873,12 +3434,24 @@ Style/RedundantFreeze:
|
|
3873
3434
|
Description: "Checks usages of Object#freeze on immutable objects."
|
3874
3435
|
Enabled: true
|
3875
3436
|
VersionAdded: '0.34'
|
3437
|
+
VersionChanged: '0.66'
|
3438
|
+
|
3439
|
+
Style/RedundantInterpolation:
|
3440
|
+
Description: 'Checks for strings that are just an interpolated expression.'
|
3441
|
+
Enabled: true
|
3442
|
+
VersionAdded: '0.76'
|
3876
3443
|
|
3877
3444
|
Style/RedundantParentheses:
|
3878
3445
|
Description: "Checks for parentheses that seem not to serve any purpose."
|
3879
3446
|
Enabled: true
|
3880
3447
|
VersionAdded: '0.36'
|
3881
3448
|
|
3449
|
+
Style/RedundantPercentQ:
|
3450
|
+
Description: 'Checks for %q/%Q when single quotes or double quotes would do.'
|
3451
|
+
StyleGuide: '#percent-q'
|
3452
|
+
Enabled: true
|
3453
|
+
VersionAdded: '0.76'
|
3454
|
+
|
3882
3455
|
Style/RedundantReturn:
|
3883
3456
|
Description: "Don't use return where it's not required."
|
3884
3457
|
StyleGuide: '#no-explicit-return'
|
@@ -3895,6 +3468,18 @@ Style/RedundantSelf:
|
|
3895
3468
|
VersionAdded: '0.10'
|
3896
3469
|
VersionChanged: '0.13'
|
3897
3470
|
|
3471
|
+
Style/RedundantSort:
|
3472
|
+
Description: >-
|
3473
|
+
Use `min` instead of `sort.first`,
|
3474
|
+
`max_by` instead of `sort_by...last`, etc.
|
3475
|
+
Enabled: true
|
3476
|
+
VersionAdded: '0.76'
|
3477
|
+
|
3478
|
+
Style/RedundantSortBy:
|
3479
|
+
Description: 'Use `sort` instead of `sort_by { |x| x }`.'
|
3480
|
+
Enabled: true
|
3481
|
+
VersionAdded: '0.36'
|
3482
|
+
|
3898
3483
|
Style/RegexpLiteral:
|
3899
3484
|
Description: 'Use / or %r around regular expressions.'
|
3900
3485
|
StyleGuide: '#percent-r'
|
@@ -3958,6 +3543,14 @@ Style/SafeNavigation:
|
|
3958
3543
|
- try
|
3959
3544
|
- try!
|
3960
3545
|
|
3546
|
+
Style/Sample:
|
3547
|
+
Description: >-
|
3548
|
+
Use `sample` instead of `shuffle.first`,
|
3549
|
+
`shuffle.last`, and `shuffle[Integer]`.
|
3550
|
+
Reference: 'https://github.com/JuanitoFatas/fast-ruby#arrayshufflefirst-vs-arraysample-code'
|
3551
|
+
Enabled: true
|
3552
|
+
VersionAdded: '0.30'
|
3553
|
+
|
3961
3554
|
Style/SelfAssignment:
|
3962
3555
|
Description: >-
|
3963
3556
|
Checks for places where self-assignment shorthand should have
|
@@ -4048,6 +3641,8 @@ Style/StringHashKeys:
|
|
4048
3641
|
StyleGuide: '#symbols-as-keys'
|
4049
3642
|
Enabled: false
|
4050
3643
|
VersionAdded: '0.52'
|
3644
|
+
VersionChanged: '0.75'
|
3645
|
+
Safe: false
|
4051
3646
|
|
4052
3647
|
Style/StringLiterals:
|
4053
3648
|
Description: 'Checks if uses of quotes match the configured preference.'
|
@@ -4088,6 +3683,11 @@ Style/StringMethods:
|
|
4088
3683
|
PreferredMethods:
|
4089
3684
|
intern: to_sym
|
4090
3685
|
|
3686
|
+
Style/Strip:
|
3687
|
+
Description: 'Use `strip` instead of `lstrip.rstrip`.'
|
3688
|
+
Enabled: true
|
3689
|
+
VersionAdded: '0.36'
|
3690
|
+
|
4091
3691
|
Style/StructInheritance:
|
4092
3692
|
Description: 'Checks for inheritance from Struct.new.'
|
4093
3693
|
StyleGuide: '#no-extend-struct-new'
|
@@ -4153,7 +3753,7 @@ Style/TrailingBodyOnModule:
|
|
4153
3753
|
Style/TrailingCommaInArguments:
|
4154
3754
|
Description: 'Checks for trailing comma in argument lists.'
|
4155
3755
|
StyleGuide: '#no-trailing-params-comma'
|
4156
|
-
Enabled: true
|
3756
|
+
Enabled: true
|
4157
3757
|
VersionAdded: '0.36'
|
4158
3758
|
# If `comma`, the cop requires a comma after the last argument, but only for
|
4159
3759
|
# parenthesized method calls where each argument is on its own line.
|
@@ -4168,7 +3768,7 @@ Style/TrailingCommaInArguments:
|
|
4168
3768
|
Style/TrailingCommaInArrayLiteral:
|
4169
3769
|
Description: 'Checks for trailing comma in array literals.'
|
4170
3770
|
StyleGuide: '#no-trailing-array-commas'
|
4171
|
-
Enabled: true
|
3771
|
+
Enabled: true
|
4172
3772
|
VersionAdded: '0.53'
|
4173
3773
|
# but only when each item is on its own line.
|
4174
3774
|
# If `consistent_comma`, the cop requires a comma after the last item of all
|
@@ -4181,7 +3781,7 @@ Style/TrailingCommaInArrayLiteral:
|
|
4181
3781
|
|
4182
3782
|
Style/TrailingCommaInHashLiteral:
|
4183
3783
|
Description: 'Checks for trailing comma in hash literals.'
|
4184
|
-
Enabled: true
|
3784
|
+
Enabled: true
|
4185
3785
|
# If `comma`, the cop requires a comma after the last item in a hash,
|
4186
3786
|
# but only when each item is on its own line.
|
4187
3787
|
# If `consistent_comma`, the cop requires a comma after the last item of all
|
@@ -4262,32 +3862,10 @@ Style/UnlessElse:
|
|
4262
3862
|
Enabled: true
|
4263
3863
|
VersionAdded: '0.9'
|
4264
3864
|
|
4265
|
-
Style/UnneededCapitalW:
|
4266
|
-
Description: 'Checks for %W when interpolation is not needed.'
|
4267
|
-
Enabled: true
|
4268
|
-
VersionAdded: '0.21'
|
4269
|
-
VersionChanged: '0.24'
|
4270
|
-
|
4271
|
-
Style/UnneededCondition:
|
4272
|
-
Description: 'Checks for unnecessary conditional expressions.'
|
4273
|
-
Enabled: true
|
4274
|
-
VersionAdded: '0.57'
|
4275
|
-
|
4276
|
-
Style/UnneededInterpolation:
|
4277
|
-
Description: 'Checks for strings that are just an interpolated expression.'
|
4278
|
-
Enabled: true
|
4279
|
-
VersionAdded: '0.36'
|
4280
|
-
|
4281
|
-
Style/UnneededPercentQ:
|
4282
|
-
Description: 'Checks for %q/%Q when single quotes or double quotes would do.'
|
4283
|
-
StyleGuide: '#percent-q'
|
4284
|
-
Enabled: false
|
4285
|
-
VersionAdded: '0.24'
|
4286
|
-
|
4287
3865
|
Style/UnpackFirst:
|
4288
3866
|
Description: >-
|
4289
3867
|
Checks for accessing the first element of `String#unpack`
|
4290
|
-
instead of using `unpack1
|
3868
|
+
instead of using `unpack1`.
|
4291
3869
|
Enabled: false
|
4292
3870
|
VersionAdded: '0.54'
|
4293
3871
|
|
@@ -4338,7 +3916,7 @@ Style/WordArray:
|
|
4338
3916
|
# whose element count is greater than or equal to `MinSize`.
|
4339
3917
|
MinSize: 2
|
4340
3918
|
# The regular expression `WordRegex` decides what is considered a word.
|
4341
|
-
WordRegex: !ruby/regexp '/\A
|
3919
|
+
WordRegex: !ruby/regexp '/\A(?:\p{Word}|\p{Word}-\p{Word}|\n|\t)+\z/'
|
4342
3920
|
|
4343
3921
|
Style/YodaCondition:
|
4344
3922
|
Description: 'Forbid or enforce yoda conditions.'
|
@@ -4354,8 +3932,9 @@ Style/YodaCondition:
|
|
4354
3932
|
- require_for_all_comparison_operators
|
4355
3933
|
# enforce yoda only for equality operators: `!=` and `==`
|
4356
3934
|
- require_for_equality_operators_only
|
3935
|
+
Safe: false
|
4357
3936
|
VersionAdded: '0.49'
|
4358
|
-
VersionChanged: '0.
|
3937
|
+
VersionChanged: '0.75'
|
4359
3938
|
|
4360
3939
|
Style/ZeroLengthPredicate:
|
4361
3940
|
Description: 'Use #empty? when testing for objects of length 0.'
|