rubocop 0.93.0 → 1.3.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/README.md +36 -16
- data/config/default.yml +207 -77
- data/exe/rubocop +1 -1
- data/lib/rubocop.rb +16 -2
- data/lib/rubocop/cli/command/auto_genenerate_config.rb +1 -1
- data/lib/rubocop/cli/command/version.rb +1 -1
- data/lib/rubocop/comment_config.rb +1 -1
- data/lib/rubocop/config.rb +4 -0
- data/lib/rubocop/config_loader.rb +26 -8
- data/lib/rubocop/config_loader_resolver.rb +7 -5
- data/lib/rubocop/config_validator.rb +7 -6
- data/lib/rubocop/cop/badge.rb +9 -24
- data/lib/rubocop/cop/base.rb +16 -1
- data/lib/rubocop/cop/bundler/duplicated_gem.rb +26 -6
- data/lib/rubocop/cop/bundler/gem_comment.rb +1 -1
- data/lib/rubocop/cop/commissioner.rb +37 -23
- data/lib/rubocop/cop/corrector.rb +3 -1
- data/lib/rubocop/cop/correctors/percent_literal_corrector.rb +1 -1
- data/lib/rubocop/cop/force.rb +1 -1
- data/lib/rubocop/cop/gemspec/duplicated_assignment.rb +3 -3
- data/lib/rubocop/cop/gemspec/required_ruby_version.rb +4 -5
- data/lib/rubocop/cop/gemspec/ruby_version_globals_usage.rb +1 -1
- data/lib/rubocop/cop/generator.rb +1 -1
- data/lib/rubocop/cop/layout/block_alignment.rb +3 -4
- data/lib/rubocop/cop/layout/class_structure.rb +7 -0
- data/lib/rubocop/cop/layout/def_end_alignment.rb +1 -1
- data/lib/rubocop/cop/layout/else_alignment.rb +15 -2
- data/lib/rubocop/cop/layout/empty_lines_around_access_modifier.rb +1 -0
- data/lib/rubocop/cop/layout/end_alignment.rb +3 -3
- data/lib/rubocop/cop/layout/extra_spacing.rb +1 -2
- data/lib/rubocop/cop/layout/hash_alignment.rb +4 -4
- data/lib/rubocop/cop/layout/line_length.rb +8 -1
- data/lib/rubocop/cop/layout/space_around_block_parameters.rb +24 -18
- data/lib/rubocop/cop/layout/space_around_operators.rb +4 -1
- data/lib/rubocop/cop/layout/space_inside_parens.rb +35 -13
- data/lib/rubocop/cop/layout/trailing_whitespace.rb +37 -13
- data/lib/rubocop/cop/lint/ambiguous_regexp_literal.rb +6 -3
- data/lib/rubocop/cop/lint/constant_definition_in_block.rb +23 -2
- data/lib/rubocop/cop/lint/debugger.rb +17 -28
- data/lib/rubocop/cop/lint/duplicate_branch.rb +93 -0
- data/lib/rubocop/cop/lint/duplicate_case_condition.rb +2 -12
- data/lib/rubocop/cop/lint/duplicate_regexp_character_class_element.rb +77 -0
- data/lib/rubocop/cop/lint/else_layout.rb +29 -3
- data/lib/rubocop/cop/lint/empty_block.rb +82 -0
- data/lib/rubocop/cop/lint/empty_class.rb +93 -0
- data/lib/rubocop/cop/lint/flip_flop.rb +8 -2
- data/lib/rubocop/cop/lint/literal_in_interpolation.rb +38 -6
- data/lib/rubocop/cop/lint/loop.rb +4 -4
- data/lib/rubocop/cop/lint/nested_percent_literal.rb +14 -0
- data/lib/rubocop/cop/lint/no_return_in_begin_end_blocks.rb +58 -0
- data/lib/rubocop/cop/lint/number_conversion.rb +46 -13
- data/lib/rubocop/cop/lint/out_of_range_regexp_ref.rb +27 -8
- data/lib/rubocop/cop/lint/redundant_cop_enable_directive.rb +19 -16
- data/lib/rubocop/cop/lint/redundant_safe_navigation.rb +44 -11
- data/lib/rubocop/cop/lint/shadowed_exception.rb +4 -5
- data/lib/rubocop/cop/lint/to_enum_arguments.rb +95 -0
- data/lib/rubocop/cop/lint/to_json.rb +1 -1
- data/lib/rubocop/cop/lint/unmodified_reduce_accumulator.rb +185 -0
- data/lib/rubocop/cop/lint/useless_access_modifier.rb +2 -2
- data/lib/rubocop/cop/lint/useless_method_definition.rb +2 -4
- data/lib/rubocop/cop/lint/useless_setter_call.rb +6 -1
- data/lib/rubocop/cop/metrics/class_length.rb +9 -3
- data/lib/rubocop/cop/metrics/parameter_lists.rb +4 -1
- data/lib/rubocop/cop/mixin/check_line_breakable.rb +1 -1
- data/lib/rubocop/cop/mixin/configurable_numbering.rb +3 -3
- data/lib/rubocop/cop/mixin/line_length_help.rb +1 -1
- data/lib/rubocop/cop/mixin/statement_modifier.rb +9 -4
- data/lib/rubocop/cop/naming/binary_operator_parameter_name.rb +12 -2
- data/lib/rubocop/cop/naming/heredoc_delimiter_case.rb +11 -5
- data/lib/rubocop/cop/naming/memoized_instance_variable_name.rb +67 -18
- data/lib/rubocop/cop/naming/predicate_name.rb +2 -1
- data/lib/rubocop/cop/naming/variable_number.rb +98 -8
- data/lib/rubocop/cop/offense.rb +3 -3
- data/lib/rubocop/cop/security/open.rb +12 -10
- data/lib/rubocop/cop/style/accessor_grouping.rb +1 -1
- data/lib/rubocop/cop/style/and_or.rb +1 -3
- data/lib/rubocop/cop/style/arguments_forwarding.rb +142 -0
- data/lib/rubocop/cop/style/bisected_attr_accessor.rb +0 -4
- data/lib/rubocop/cop/style/case_like_if.rb +0 -4
- data/lib/rubocop/cop/style/class_equality_comparison.rb +19 -4
- data/lib/rubocop/cop/style/collection_compact.rb +91 -0
- data/lib/rubocop/cop/style/document_dynamic_eval_definition.rb +162 -0
- data/lib/rubocop/cop/style/double_negation.rb +6 -1
- data/lib/rubocop/cop/style/format_string_token.rb +47 -2
- data/lib/rubocop/cop/style/hash_syntax.rb +3 -3
- data/lib/rubocop/cop/style/identical_conditional_branches.rb +7 -2
- data/lib/rubocop/cop/style/if_inside_else.rb +37 -1
- data/lib/rubocop/cop/style/if_unless_modifier.rb +7 -3
- data/lib/rubocop/cop/style/infinite_loop.rb +4 -0
- data/lib/rubocop/cop/style/keyword_parameters_order.rb +12 -0
- data/lib/rubocop/cop/style/method_call_with_args_parentheses.rb +10 -13
- data/lib/rubocop/cop/style/method_call_with_args_parentheses/omit_parentheses.rb +6 -11
- data/lib/rubocop/cop/style/method_call_with_args_parentheses/require_parentheses.rb +7 -11
- data/lib/rubocop/cop/style/mixin_grouping.rb +0 -4
- data/lib/rubocop/cop/style/multiple_comparison.rb +55 -7
- data/lib/rubocop/cop/style/negated_if_else_condition.rb +104 -0
- data/lib/rubocop/cop/style/nil_lambda.rb +52 -0
- data/lib/rubocop/cop/style/raise_args.rb +21 -6
- data/lib/rubocop/cop/style/redundant_begin.rb +14 -4
- data/lib/rubocop/cop/style/redundant_parentheses.rb +4 -0
- data/lib/rubocop/cop/style/redundant_regexp_character_class.rb +7 -1
- data/lib/rubocop/cop/style/redundant_regexp_escape.rb +1 -1
- data/lib/rubocop/cop/style/redundant_self.rb +3 -0
- data/lib/rubocop/cop/style/safe_navigation.rb +16 -4
- data/lib/rubocop/cop/style/semicolon.rb +3 -0
- data/lib/rubocop/cop/style/static_class.rb +97 -0
- data/lib/rubocop/cop/style/string_concatenation.rb +13 -1
- data/lib/rubocop/cop/style/swap_values.rb +108 -0
- data/lib/rubocop/cop/style/ternary_parentheses.rb +1 -1
- data/lib/rubocop/cop/style/trailing_underscore_variable.rb +3 -1
- data/lib/rubocop/cop/style/while_until_modifier.rb +9 -0
- data/lib/rubocop/cop/team.rb +6 -1
- data/lib/rubocop/cop/util.rb +5 -1
- data/lib/rubocop/ext/regexp_node.rb +17 -9
- data/lib/rubocop/ext/regexp_parser.rb +84 -0
- data/lib/rubocop/formatter/formatter_set.rb +2 -1
- data/lib/rubocop/formatter/git_hub_actions_formatter.rb +47 -0
- data/lib/rubocop/formatter/offense_count_formatter.rb +1 -1
- data/lib/rubocop/formatter/worst_offenders_formatter.rb +1 -1
- data/lib/rubocop/magic_comment.rb +2 -2
- data/lib/rubocop/options.rb +6 -1
- data/lib/rubocop/rspec/shared_contexts.rb +4 -0
- data/lib/rubocop/target_ruby.rb +57 -1
- data/lib/rubocop/version.rb +56 -6
- metadata +21 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5013f1930869ad961d7fe1cf2cd8bad7a36a15bc37f6cf42e1663fbdb61f2cc2
|
4
|
+
data.tar.gz: 1ac4e658406f0f6e22a068f28fab225a8e9f53c59a79f89f0e52157cdc076efc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 555adab63cf768a150f37d2ca84e08f2322e84182528949e09bd5eda4c79348e4c41dc17d23737785ea044a78f54f99d99d512047446d7437efdeaf306147f32
|
7
|
+
data.tar.gz: 3fe186c044fd8733f4edef4055c036106d739e485dbfdcdbffe7882961175695edb79aafe27c1b11a8bbe9791f0754f26e7bd7534571dd09955bd5caf6aa6afe
|
data/README.md
CHANGED
@@ -11,11 +11,6 @@
|
|
11
11
|
[](https://codeclimate.com/github/rubocop-hq/rubocop/maintainability)
|
12
12
|
[](https://dependabot.com/compatibility-score.html?dependency-name=rubocop&package-manager=bundler&version-scheme=semver)
|
13
13
|
|
14
|
-
[](https://www.patreon.com/bbatsov)
|
15
|
-
[](#open-collective-backers)
|
16
|
-
[](#open-collective-sponsors)
|
17
|
-
[](https://tidelift.com/subscription/pkg/rubygems-rubocop?utm_source=rubygems-rubocop&utm_medium=referral&utm_campaign=readme)
|
18
|
-
|
19
14
|
> Role models are important. <br/>
|
20
15
|
> -- Officer Alex J. Murphy / RoboCop
|
21
16
|
|
@@ -27,6 +22,12 @@ RuboCop can also automatically fix many of them for you.
|
|
27
22
|
RuboCop is extremely flexible and most aspects of its behavior can be tweaked via various
|
28
23
|
[configuration options](https://github.com/rubocop-hq/rubocop/blob/master/config/default.yml).
|
29
24
|
|
25
|
+
----------
|
26
|
+
[](https://www.patreon.com/bbatsov)
|
27
|
+
[](#open-collective-backers)
|
28
|
+
[](#open-collective-sponsors)
|
29
|
+
[](https://tidelift.com/subscription/pkg/rubygems-rubocop?utm_source=rubygems-rubocop&utm_medium=referral&utm_campaign=readme)
|
30
|
+
|
30
31
|
**Please consider [financially supporting its ongoing development](#funding).**
|
31
32
|
|
32
33
|
## Installation
|
@@ -43,15 +44,18 @@ If you'd rather install RuboCop using `bundler`, add a line for it in your `Gemf
|
|
43
44
|
gem 'rubocop', require: false
|
44
45
|
```
|
45
46
|
|
46
|
-
RuboCop
|
47
|
-
|
48
|
-
|
49
|
-
might want to use a conservative version lock
|
47
|
+
RuboCop is stable between major versions, both in terms of API and cop configuration.
|
48
|
+
We aim the ease the maintenance of RuboCop extensions and the upgrades between RuboCop
|
49
|
+
releases. All big changes are reserved for major releases.
|
50
|
+
To prevent an unwanted RuboCop update you might want to use a conservative version lock
|
51
|
+
in your `Gemfile`:
|
50
52
|
|
51
53
|
```rb
|
52
|
-
gem 'rubocop', '~>
|
54
|
+
gem 'rubocop', '~> 1.3', require: false
|
53
55
|
```
|
54
56
|
|
57
|
+
See [versioning](https://docs.rubocop.org/rubocop/1.0/versioning.html) for further details.
|
58
|
+
|
55
59
|
## Quickstart
|
56
60
|
|
57
61
|
Just type `rubocop` in a Ruby project's folder and watch the magic happen.
|
@@ -67,12 +71,12 @@ You can read a lot more about RuboCop in its [official docs](https://docs.ruboco
|
|
67
71
|
|
68
72
|
## Compatibility
|
69
73
|
|
70
|
-
RuboCop supports the following Ruby implementations:
|
74
|
+
RuboCop officially supports the following Ruby implementations:
|
71
75
|
|
72
76
|
* MRI 2.4+
|
73
77
|
* JRuby 9.2+
|
74
78
|
|
75
|
-
See [compatibility](https://docs.rubocop.org/rubocop/compatibility.html) for further details.
|
79
|
+
See the [compatibility documentation](https://docs.rubocop.org/rubocop/compatibility.html) for further details.
|
76
80
|
|
77
81
|
## Readme Badge
|
78
82
|
|
@@ -82,6 +86,15 @@ If you use RuboCop in your project, you can include one of these badges in your
|
|
82
86
|
|
83
87
|
[](https://rubystyle.guide)
|
84
88
|
|
89
|
+
|
90
|
+
Here are the Markdown snippets for the two badges:
|
91
|
+
|
92
|
+
``` markdown
|
93
|
+
[](https://github.com/rubocop-hq/rubocop)
|
94
|
+
|
95
|
+
[](https://rubystyle.guide)
|
96
|
+
```
|
97
|
+
|
85
98
|
## Team
|
86
99
|
|
87
100
|
Here's a list of RuboCop's core developers:
|
@@ -97,6 +110,8 @@ Here's a list of RuboCop's core developers:
|
|
97
110
|
* [Benjamin Quorning](https://github.com/bquorning)
|
98
111
|
* [Marc-André Lafortune](https://github.com/marcandre)
|
99
112
|
|
113
|
+
See the [team page](https://docs.rubocop.org/rubocop/about/team.html) for more details.
|
114
|
+
|
100
115
|
## Logo
|
101
116
|
|
102
117
|
RuboCop's logo was created by [Dimiter Petrov](https://www.chadomoto.com/). You can find the logo in various
|
@@ -136,14 +151,19 @@ wide array of funding channels to account for your preferences
|
|
136
151
|
currently [Open Collective](https://opencollective.com/rubocop) is our
|
137
152
|
preferred funding platform).
|
138
153
|
|
139
|
-
If you're working in a company that's making significant use of RuboCop we'd appreciate it if you suggest to your company
|
140
|
-
to become a RuboCop sponsor
|
154
|
+
**If you're working in a company that's making significant use of RuboCop we'd appreciate it if you suggest to your company
|
155
|
+
to become a RuboCop sponsor.**
|
141
156
|
|
142
157
|
You can support the development of RuboCop via
|
143
158
|
[GitHub Sponsors](https://github.com/sponsors/bbatsov),
|
144
159
|
[Patreon](https://www.patreon.com/bbatsov),
|
145
|
-
[PayPal](https://paypal.me/bbatsov)
|
146
|
-
|
160
|
+
[PayPal](https://paypal.me/bbatsov),
|
161
|
+
[Open Collective](https://opencollective.com/rubocop)
|
162
|
+
and [Tidelift](https://tidelift.com/subscription/pkg/rubygems-rubocop?utm_source=rubygems-rubocop&utm_medium=referral&utm_campaign=readme)
|
163
|
+
.
|
164
|
+
|
165
|
+
**Note:** If doing a sponsorship in the form of donation is problematic for your company from an accounting standpoint, we'd recommend
|
166
|
+
the use of Tidelift, where you can get a support-like subscription instead.
|
147
167
|
|
148
168
|
### Open Collective Backers
|
149
169
|
|
data/config/default.yml
CHANGED
@@ -313,7 +313,7 @@ Layout/AssignmentIndentation:
|
|
313
313
|
|
314
314
|
Layout/BeginEndAlignment:
|
315
315
|
Description: 'Align ends corresponding to begins correctly.'
|
316
|
-
Enabled:
|
316
|
+
Enabled: true
|
317
317
|
VersionAdded: '0.91'
|
318
318
|
# The value `start_of_line` means that `end` should be aligned the start of the line
|
319
319
|
# where the `begin` keyword is.
|
@@ -496,7 +496,7 @@ Layout/EmptyLinesAroundArguments:
|
|
496
496
|
Layout/EmptyLinesAroundAttributeAccessor:
|
497
497
|
Description: "Keep blank lines around attribute accessors."
|
498
498
|
StyleGuide: '#empty-lines-around-attribute-accessor'
|
499
|
-
Enabled:
|
499
|
+
Enabled: true
|
500
500
|
VersionAdded: '0.83'
|
501
501
|
VersionChanged: '0.84'
|
502
502
|
AllowAliasSyntax: true
|
@@ -891,7 +891,7 @@ Layout/LineLength:
|
|
891
891
|
StyleGuide: '#max-line-length'
|
892
892
|
Enabled: true
|
893
893
|
VersionAdded: '0.25'
|
894
|
-
VersionChanged: '
|
894
|
+
VersionChanged: '1.3'
|
895
895
|
AutoCorrect: false
|
896
896
|
Max: 120
|
897
897
|
# To make it possible to copy or click on URIs in the code, we allow lines
|
@@ -1145,7 +1145,7 @@ Layout/SpaceAroundKeyword:
|
|
1145
1145
|
|
1146
1146
|
Layout/SpaceAroundMethodCallOperator:
|
1147
1147
|
Description: 'Checks method call operators to not have spaces around them.'
|
1148
|
-
Enabled:
|
1148
|
+
Enabled: true
|
1149
1149
|
VersionAdded: '0.82'
|
1150
1150
|
|
1151
1151
|
Layout/SpaceAroundOperators:
|
@@ -1334,8 +1334,8 @@ Layout/TrailingWhitespace:
|
|
1334
1334
|
StyleGuide: '#no-trailing-whitespace'
|
1335
1335
|
Enabled: true
|
1336
1336
|
VersionAdded: '0.49'
|
1337
|
-
VersionChanged: '0
|
1338
|
-
AllowInHeredoc:
|
1337
|
+
VersionChanged: '1.0'
|
1338
|
+
AllowInHeredoc: false
|
1339
1339
|
|
1340
1340
|
#################### Lint ##################################
|
1341
1341
|
### Warnings
|
@@ -1379,7 +1379,7 @@ Lint/BigDecimalNew:
|
|
1379
1379
|
|
1380
1380
|
Lint/BinaryOperatorWithIdenticalOperands:
|
1381
1381
|
Description: 'This cop checks for places where binary operator has identical operands.'
|
1382
|
-
Enabled:
|
1382
|
+
Enabled: true
|
1383
1383
|
Safe: false
|
1384
1384
|
VersionAdded: '0.89'
|
1385
1385
|
|
@@ -1398,8 +1398,10 @@ Lint/CircularArgumentReference:
|
|
1398
1398
|
Lint/ConstantDefinitionInBlock:
|
1399
1399
|
Description: 'Do not define constants within a block.'
|
1400
1400
|
StyleGuide: '#no-constant-definition-in-block'
|
1401
|
-
Enabled:
|
1401
|
+
Enabled: true
|
1402
1402
|
VersionAdded: '0.91'
|
1403
|
+
VersionChanged: '1.3'
|
1404
|
+
AllowedMethods: []
|
1403
1405
|
|
1404
1406
|
Lint/ConstantResolution:
|
1405
1407
|
Description: 'Check that constants are fully qualified with `::`.'
|
@@ -1415,6 +1417,22 @@ Lint/Debugger:
|
|
1415
1417
|
Enabled: true
|
1416
1418
|
VersionAdded: '0.14'
|
1417
1419
|
VersionChanged: '0.49'
|
1420
|
+
DebuggerReceivers:
|
1421
|
+
- binding
|
1422
|
+
- Kernel
|
1423
|
+
- Pry
|
1424
|
+
DebuggerMethods:
|
1425
|
+
- debugger
|
1426
|
+
- byebug
|
1427
|
+
- remote_byebug
|
1428
|
+
- pry
|
1429
|
+
- remote_pry
|
1430
|
+
- pry_remote
|
1431
|
+
- console
|
1432
|
+
- rescue
|
1433
|
+
- save_and_open_page
|
1434
|
+
- save_and_open_screenshot
|
1435
|
+
- irb
|
1418
1436
|
|
1419
1437
|
Lint/DeprecatedClassMethods:
|
1420
1438
|
Description: 'Check for deprecated class method calls.'
|
@@ -1423,7 +1441,7 @@ Lint/DeprecatedClassMethods:
|
|
1423
1441
|
|
1424
1442
|
Lint/DeprecatedOpenSSLConstant:
|
1425
1443
|
Description: "Don't use algorithm constants for `OpenSSL::Cipher` and `OpenSSL::Digest`."
|
1426
|
-
Enabled:
|
1444
|
+
Enabled: true
|
1427
1445
|
VersionAdded: '0.84'
|
1428
1446
|
|
1429
1447
|
Lint/DisjunctiveAssignmentInConstructor:
|
@@ -1433,6 +1451,11 @@ Lint/DisjunctiveAssignmentInConstructor:
|
|
1433
1451
|
VersionAdded: '0.62'
|
1434
1452
|
VersionChanged: '0.88'
|
1435
1453
|
|
1454
|
+
Lint/DuplicateBranch:
|
1455
|
+
Description: Checks that there are no repeated bodies within `if/unless`, `case-when` and `rescue` constructs.
|
1456
|
+
Enabled: pending
|
1457
|
+
VersionAdded: '1.3'
|
1458
|
+
|
1436
1459
|
Lint/DuplicateCaseCondition:
|
1437
1460
|
Description: 'Do not repeat values in case conditionals.'
|
1438
1461
|
Enabled: true
|
@@ -1440,7 +1463,7 @@ Lint/DuplicateCaseCondition:
|
|
1440
1463
|
|
1441
1464
|
Lint/DuplicateElsifCondition:
|
1442
1465
|
Description: 'Do not repeat conditions used in if `elsif`.'
|
1443
|
-
Enabled:
|
1466
|
+
Enabled: true
|
1444
1467
|
VersionAdded: '0.88'
|
1445
1468
|
|
1446
1469
|
Lint/DuplicateHashKey:
|
@@ -1454,14 +1477,19 @@ Lint/DuplicateMethods:
|
|
1454
1477
|
Enabled: true
|
1455
1478
|
VersionAdded: '0.29'
|
1456
1479
|
|
1480
|
+
Lint/DuplicateRegexpCharacterClassElement:
|
1481
|
+
Description: 'Checks for duplicate elements in Regexp character classes.'
|
1482
|
+
Enabled: pending
|
1483
|
+
VersionAdded: '1.1'
|
1484
|
+
|
1457
1485
|
Lint/DuplicateRequire:
|
1458
1486
|
Description: 'Check for duplicate `require`s and `require_relative`s.'
|
1459
|
-
Enabled:
|
1487
|
+
Enabled: true
|
1460
1488
|
VersionAdded: '0.90'
|
1461
1489
|
|
1462
1490
|
Lint/DuplicateRescueException:
|
1463
1491
|
Description: 'Checks that there are no repeated exceptions used in `rescue` expressions.'
|
1464
|
-
Enabled:
|
1492
|
+
Enabled: true
|
1465
1493
|
VersionAdded: '0.89'
|
1466
1494
|
|
1467
1495
|
Lint/EachWithObjectArgument:
|
@@ -1473,10 +1501,25 @@ Lint/ElseLayout:
|
|
1473
1501
|
Description: 'Check for odd code arrangement in an else block.'
|
1474
1502
|
Enabled: true
|
1475
1503
|
VersionAdded: '0.17'
|
1504
|
+
VersionChanged: '1.2'
|
1505
|
+
|
1506
|
+
Lint/EmptyBlock:
|
1507
|
+
Description: 'This cop checks for blocks without a body.'
|
1508
|
+
Enabled: pending
|
1509
|
+
VersionAdded: '1.1'
|
1510
|
+
VersionChanged: '1.3'
|
1511
|
+
AllowComments: true
|
1512
|
+
AllowEmptyLambdas: true
|
1513
|
+
|
1514
|
+
Lint/EmptyClass:
|
1515
|
+
Description: 'Checks for classes and metaclasses without a body.'
|
1516
|
+
Enabled: pending
|
1517
|
+
VersionAdded: '1.3'
|
1518
|
+
AllowComments: false
|
1476
1519
|
|
1477
1520
|
Lint/EmptyConditionalBody:
|
1478
1521
|
Description: 'This cop checks for the presence of `if`, `elsif` and `unless` branches without a body.'
|
1479
|
-
Enabled:
|
1522
|
+
Enabled: true
|
1480
1523
|
AllowComments: true
|
1481
1524
|
VersionAdded: '0.89'
|
1482
1525
|
|
@@ -1493,7 +1536,7 @@ Lint/EmptyExpression:
|
|
1493
1536
|
|
1494
1537
|
Lint/EmptyFile:
|
1495
1538
|
Description: 'Enforces that Ruby source files are not empty.'
|
1496
|
-
Enabled:
|
1539
|
+
Enabled: true
|
1497
1540
|
AllowComments: true
|
1498
1541
|
VersionAdded: '0.90'
|
1499
1542
|
|
@@ -1531,7 +1574,7 @@ Lint/FlipFlop:
|
|
1531
1574
|
Lint/FloatComparison:
|
1532
1575
|
Description: 'Checks for the presence of precise comparison of floating point numbers.'
|
1533
1576
|
StyleGuide: '#float-comparison'
|
1534
|
-
Enabled:
|
1577
|
+
Enabled: true
|
1535
1578
|
VersionAdded: '0.89'
|
1536
1579
|
|
1537
1580
|
Lint/FloatOutOfRange:
|
@@ -1549,7 +1592,7 @@ Lint/FormatParameterMismatch:
|
|
1549
1592
|
Lint/HashCompareByIdentity:
|
1550
1593
|
Description: 'Prefer using `Hash#compare_by_identity` than using `object_id` for keys.'
|
1551
1594
|
StyleGuide: '#identity-comparison'
|
1552
|
-
Enabled:
|
1595
|
+
Enabled: true
|
1553
1596
|
Safe: false
|
1554
1597
|
VersionAdded: '0.93'
|
1555
1598
|
|
@@ -1563,7 +1606,7 @@ Lint/HeredocMethodCallPosition:
|
|
1563
1606
|
|
1564
1607
|
Lint/IdentityComparison:
|
1565
1608
|
Description: 'Prefer `equal?` over `==` when comparing `object_id`.'
|
1566
|
-
Enabled:
|
1609
|
+
Enabled: true
|
1567
1610
|
StyleGuide: '#identity-comparison'
|
1568
1611
|
VersionAdded: '0.91'
|
1569
1612
|
|
@@ -1616,7 +1659,8 @@ Lint/Loop:
|
|
1616
1659
|
StyleGuide: '#loop-with-break'
|
1617
1660
|
Enabled: true
|
1618
1661
|
VersionAdded: '0.9'
|
1619
|
-
VersionChanged: '
|
1662
|
+
VersionChanged: '1.3'
|
1663
|
+
Safe: false
|
1620
1664
|
|
1621
1665
|
Lint/MissingCopEnableDirective:
|
1622
1666
|
Description: 'Checks for a `# rubocop:enable` after `# rubocop:disable`.'
|
@@ -1635,19 +1679,20 @@ Lint/MissingSuper:
|
|
1635
1679
|
Description: >-
|
1636
1680
|
This cop checks for the presence of constructors and lifecycle callbacks
|
1637
1681
|
without calls to `super`'.
|
1638
|
-
Enabled:
|
1682
|
+
Enabled: true
|
1639
1683
|
VersionAdded: '0.89'
|
1640
1684
|
|
1641
1685
|
Lint/MixedRegexpCaptureTypes:
|
1642
1686
|
Description: 'Do not mix named captures and numbered captures in a Regexp literal.'
|
1643
|
-
Enabled:
|
1687
|
+
Enabled: true
|
1644
1688
|
VersionAdded: '0.85'
|
1645
1689
|
|
1646
1690
|
Lint/MultipleComparison:
|
1647
1691
|
Description: "Use `&&` operator to compare multiple values."
|
1648
1692
|
Enabled: true
|
1649
1693
|
VersionAdded: '0.47'
|
1650
|
-
VersionChanged: '
|
1694
|
+
VersionChanged: '1.1'
|
1695
|
+
AllowMethodComparison: true
|
1651
1696
|
|
1652
1697
|
Lint/NestedMethodDefinition:
|
1653
1698
|
Description: 'Do not use nested method definitions.'
|
@@ -1667,6 +1712,11 @@ Lint/NextWithoutAccumulator:
|
|
1667
1712
|
Enabled: true
|
1668
1713
|
VersionAdded: '0.36'
|
1669
1714
|
|
1715
|
+
Lint/NoReturnInBeginEndBlocks:
|
1716
|
+
Description: 'Do not `return` inside `begin..end` blocks in assignment contexts.'
|
1717
|
+
Enabled: pending
|
1718
|
+
VersionAdded: '1.2'
|
1719
|
+
|
1670
1720
|
Lint/NonDeterministicRequireOrder:
|
1671
1721
|
Description: 'Always sort arrays returned by Dir.glob when requiring files.'
|
1672
1722
|
Enabled: true
|
@@ -1682,8 +1732,12 @@ Lint/NumberConversion:
|
|
1682
1732
|
Description: 'Checks unsafe usage of number conversion methods.'
|
1683
1733
|
Enabled: false
|
1684
1734
|
VersionAdded: '0.53'
|
1685
|
-
VersionChanged: '
|
1735
|
+
VersionChanged: '1.1'
|
1686
1736
|
SafeAutoCorrect: false
|
1737
|
+
IgnoredMethods: []
|
1738
|
+
IgnoredClasses:
|
1739
|
+
- Time
|
1740
|
+
- DateTime
|
1687
1741
|
|
1688
1742
|
Lint/OrderedMagicComments:
|
1689
1743
|
Description: 'Checks the proper ordering of magic comments and whether a magic comment is not placed before a shebang.'
|
@@ -1692,7 +1746,7 @@ Lint/OrderedMagicComments:
|
|
1692
1746
|
|
1693
1747
|
Lint/OutOfRangeRegexpRef:
|
1694
1748
|
Description: 'Checks for out of range reference for Regexp because it always returns nil.'
|
1695
|
-
Enabled:
|
1749
|
+
Enabled: true
|
1696
1750
|
Safe: false
|
1697
1751
|
VersionAdded: '0.89'
|
1698
1752
|
|
@@ -1721,7 +1775,7 @@ Lint/PercentSymbolArray:
|
|
1721
1775
|
Lint/RaiseException:
|
1722
1776
|
Description: Checks for `raise` or `fail` statements which are raising `Exception` class.
|
1723
1777
|
StyleGuide: '#raise-exception'
|
1724
|
-
Enabled:
|
1778
|
+
Enabled: true
|
1725
1779
|
Safe: false
|
1726
1780
|
VersionAdded: '0.81'
|
1727
1781
|
VersionChanged: '0.86'
|
@@ -1755,18 +1809,16 @@ Lint/RedundantRequireStatement:
|
|
1755
1809
|
|
1756
1810
|
Lint/RedundantSafeNavigation:
|
1757
1811
|
Description: 'Checks for redundant safe navigation calls.'
|
1758
|
-
Enabled:
|
1812
|
+
Enabled: true
|
1759
1813
|
VersionAdded: '0.93'
|
1814
|
+
AllowedMethods:
|
1815
|
+
- instance_of?
|
1816
|
+
- kind_of?
|
1817
|
+
- is_a?
|
1818
|
+
- eql?
|
1819
|
+
- respond_to?
|
1820
|
+
- equal?
|
1760
1821
|
Safe: false
|
1761
|
-
IgnoredMethods:
|
1762
|
-
- to_c
|
1763
|
-
- to_f
|
1764
|
-
- to_i
|
1765
|
-
- to_r
|
1766
|
-
- rationalize
|
1767
|
-
- public_send
|
1768
|
-
- send
|
1769
|
-
- __send__
|
1770
1822
|
|
1771
1823
|
Lint/RedundantSplatExpansion:
|
1772
1824
|
Description: 'Checks for splat unnecessarily being called on literals.'
|
@@ -1864,7 +1916,7 @@ Lint/ScriptPermission:
|
|
1864
1916
|
|
1865
1917
|
Lint/SelfAssignment:
|
1866
1918
|
Description: 'Checks for self-assignments.'
|
1867
|
-
Enabled:
|
1919
|
+
Enabled: true
|
1868
1920
|
VersionAdded: '0.89'
|
1869
1921
|
|
1870
1922
|
Lint/SendWithMixinArgument:
|
@@ -1895,7 +1947,7 @@ Lint/ShadowingOuterLocalVariable:
|
|
1895
1947
|
|
1896
1948
|
Lint/StructNewOverride:
|
1897
1949
|
Description: 'Disallow overriding the `Struct` built-in methods via `Struct.new`.'
|
1898
|
-
Enabled:
|
1950
|
+
Enabled: true
|
1899
1951
|
VersionAdded: '0.81'
|
1900
1952
|
|
1901
1953
|
Lint/SuppressedException:
|
@@ -1912,6 +1964,11 @@ Lint/Syntax:
|
|
1912
1964
|
VersionAdded: '0.9'
|
1913
1965
|
|
1914
1966
|
|
1967
|
+
Lint/ToEnumArguments:
|
1968
|
+
Description: 'This cop ensures that `to_enum`/`enum_for`, called for the current method, has correct arguments.'
|
1969
|
+
Enabled: pending
|
1970
|
+
VersionAdded: '1.1'
|
1971
|
+
|
1915
1972
|
Lint/ToJSON:
|
1916
1973
|
Description: 'Ensure #to_json includes an optional argument.'
|
1917
1974
|
Enabled: true
|
@@ -1919,12 +1976,12 @@ Lint/ToJSON:
|
|
1919
1976
|
|
1920
1977
|
Lint/TopLevelReturnWithArgument:
|
1921
1978
|
Description: 'This cop detects top level return statements with argument.'
|
1922
|
-
Enabled:
|
1979
|
+
Enabled: true
|
1923
1980
|
VersionAdded: '0.89'
|
1924
1981
|
|
1925
1982
|
Lint/TrailingCommaInAttributeDeclaration:
|
1926
1983
|
Description: 'This cop checks for trailing commas in attribute declarations.'
|
1927
|
-
Enabled:
|
1984
|
+
Enabled: true
|
1928
1985
|
VersionAdded: '0.90'
|
1929
1986
|
|
1930
1987
|
Lint/UnderscorePrefixedVariableName:
|
@@ -1938,6 +1995,11 @@ Lint/UnifiedInteger:
|
|
1938
1995
|
Enabled: true
|
1939
1996
|
VersionAdded: '0.43'
|
1940
1997
|
|
1998
|
+
Lint/UnmodifiedReduceAccumulator:
|
1999
|
+
Description: Checks for `reduce` or `inject` blocks that do not update the accumulator each iteration.
|
2000
|
+
Enabled: pending
|
2001
|
+
VersionAdded: '1.1'
|
2002
|
+
|
1941
2003
|
Lint/UnreachableCode:
|
1942
2004
|
Description: 'Unreachable code.'
|
1943
2005
|
Enabled: true
|
@@ -1945,7 +2007,7 @@ Lint/UnreachableCode:
|
|
1945
2007
|
|
1946
2008
|
Lint/UnreachableLoop:
|
1947
2009
|
Description: 'This cop checks for loops that will have at most one iteration.'
|
1948
|
-
Enabled:
|
2010
|
+
Enabled: true
|
1949
2011
|
VersionAdded: '0.89'
|
1950
2012
|
|
1951
2013
|
Lint/UnusedBlockArgument:
|
@@ -2004,7 +2066,7 @@ Lint/UselessElseWithoutRescue:
|
|
2004
2066
|
|
2005
2067
|
Lint/UselessMethodDefinition:
|
2006
2068
|
Description: 'Checks for useless method definitions.'
|
2007
|
-
Enabled:
|
2069
|
+
Enabled: true
|
2008
2070
|
VersionAdded: '0.90'
|
2009
2071
|
Safe: false
|
2010
2072
|
AllowComments: true
|
@@ -2012,13 +2074,14 @@ Lint/UselessMethodDefinition:
|
|
2012
2074
|
Lint/UselessSetterCall:
|
2013
2075
|
Description: 'Checks for useless setter call to a local variable.'
|
2014
2076
|
Enabled: true
|
2077
|
+
SafeAutoCorrect: false
|
2015
2078
|
VersionAdded: '0.13'
|
2016
|
-
VersionChanged: '
|
2079
|
+
VersionChanged: '1.2'
|
2017
2080
|
Safe: false
|
2018
2081
|
|
2019
2082
|
Lint/UselessTimes:
|
2020
2083
|
Description: 'Checks for useless `Integer#times` calls.'
|
2021
|
-
Enabled:
|
2084
|
+
Enabled: true
|
2022
2085
|
VersionAdded: '0.91'
|
2023
2086
|
Safe: false
|
2024
2087
|
|
@@ -2157,6 +2220,7 @@ Naming/BinaryOperatorParameterName:
|
|
2157
2220
|
StyleGuide: '#other-arg'
|
2158
2221
|
Enabled: true
|
2159
2222
|
VersionAdded: '0.50'
|
2223
|
+
VersionChanged: '1.2'
|
2160
2224
|
|
2161
2225
|
Naming/BlockParameterName:
|
2162
2226
|
Description: >-
|
@@ -2263,6 +2327,7 @@ Naming/HeredocDelimiterCase:
|
|
2263
2327
|
StyleGuide: '#heredoc-delimiters'
|
2264
2328
|
Enabled: true
|
2265
2329
|
VersionAdded: '0.50'
|
2330
|
+
VersionChanged: '1.2'
|
2266
2331
|
EnforcedStyle: uppercase
|
2267
2332
|
SupportedStyles:
|
2268
2333
|
- lowercase
|
@@ -2281,7 +2346,7 @@ Naming/MemoizedInstanceVariableName:
|
|
2281
2346
|
Memoized method name should match memo instance variable name.
|
2282
2347
|
Enabled: true
|
2283
2348
|
VersionAdded: '0.53'
|
2284
|
-
VersionChanged: '
|
2349
|
+
VersionChanged: '1.2'
|
2285
2350
|
EnforcedStyleForLeadingUnderscores: disallowed
|
2286
2351
|
SupportedStylesForLeadingUnderscores:
|
2287
2352
|
- disallowed
|
@@ -2379,14 +2444,19 @@ Naming/VariableName:
|
|
2379
2444
|
- camelCase
|
2380
2445
|
|
2381
2446
|
Naming/VariableNumber:
|
2382
|
-
Description: 'Use the configured style when numbering variables.'
|
2447
|
+
Description: 'Use the configured style when numbering symbols, methods and variables.'
|
2448
|
+
StyleGuide: '#snake-case-symbols-methods-vars-with-numbers'
|
2383
2449
|
Enabled: true
|
2384
2450
|
VersionAdded: '0.50'
|
2451
|
+
VersionChanged: '1.3'
|
2385
2452
|
EnforcedStyle: normalcase
|
2386
2453
|
SupportedStyles:
|
2387
2454
|
- snake_case
|
2388
2455
|
- normalcase
|
2389
2456
|
- non_integer
|
2457
|
+
CheckMethodNames: true
|
2458
|
+
CheckSymbols: true
|
2459
|
+
AllowedIdentifiers: []
|
2390
2460
|
|
2391
2461
|
#################### Security ##############################
|
2392
2462
|
|
@@ -2417,9 +2487,10 @@ Security/MarshalLoad:
|
|
2417
2487
|
VersionAdded: '0.47'
|
2418
2488
|
|
2419
2489
|
Security/Open:
|
2420
|
-
Description: 'The use of Kernel#open
|
2490
|
+
Description: 'The use of `Kernel#open` and `URI.open` represent a serious security risk.'
|
2421
2491
|
Enabled: true
|
2422
2492
|
VersionAdded: '0.53'
|
2493
|
+
VersionChanged: '1.0'
|
2423
2494
|
Safe: false
|
2424
2495
|
|
2425
2496
|
Security/YAMLLoad:
|
@@ -2446,7 +2517,7 @@ Style/AccessModifierDeclarations:
|
|
2446
2517
|
|
2447
2518
|
Style/AccessorGrouping:
|
2448
2519
|
Description: 'Checks for grouping of accessors in `class` and `module` bodies.'
|
2449
|
-
Enabled:
|
2520
|
+
Enabled: true
|
2450
2521
|
VersionAdded: '0.87'
|
2451
2522
|
EnforcedStyle: grouped
|
2452
2523
|
SupportedStyles:
|
@@ -2479,6 +2550,13 @@ Style/AndOr:
|
|
2479
2550
|
- always
|
2480
2551
|
- conditionals
|
2481
2552
|
|
2553
|
+
Style/ArgumentsForwarding:
|
2554
|
+
Description: 'Use arguments forwarding.'
|
2555
|
+
StyleGuide: '#arguments-forwarding'
|
2556
|
+
Enabled: pending
|
2557
|
+
AllowOnlyRestArgument: true
|
2558
|
+
VersionAdded: '1.1'
|
2559
|
+
|
2482
2560
|
Style/ArrayCoercion:
|
2483
2561
|
Description: >-
|
2484
2562
|
Use Array() instead of explicit Array check or [*var], when dealing
|
@@ -2535,7 +2613,7 @@ Style/BisectedAttrAccessor:
|
|
2535
2613
|
Description: >-
|
2536
2614
|
Checks for places where `attr_reader` and `attr_writer`
|
2537
2615
|
for the same method can be combined into single `attr_accessor`.
|
2538
|
-
Enabled:
|
2616
|
+
Enabled: true
|
2539
2617
|
VersionAdded: '0.87'
|
2540
2618
|
|
2541
2619
|
Style/BlockComments:
|
@@ -2674,7 +2752,7 @@ Style/CaseEquality:
|
|
2674
2752
|
Style/CaseLikeIf:
|
2675
2753
|
Description: 'This cop identifies places where `if-elsif` constructions can be replaced with `case-when`.'
|
2676
2754
|
StyleGuide: '#case-vs-if-else'
|
2677
|
-
Enabled:
|
2755
|
+
Enabled: true
|
2678
2756
|
Safe: false
|
2679
2757
|
VersionAdded: '0.88'
|
2680
2758
|
|
@@ -2727,7 +2805,7 @@ Style/ClassCheck:
|
|
2727
2805
|
Style/ClassEqualityComparison:
|
2728
2806
|
Description: 'Enforces the use of `Object#instance_of?` instead of class comparison for equality.'
|
2729
2807
|
StyleGuide: '#instance-of-vs-class-comparison'
|
2730
|
-
Enabled:
|
2808
|
+
Enabled: true
|
2731
2809
|
VersionAdded: '0.93'
|
2732
2810
|
IgnoredMethods:
|
2733
2811
|
- ==
|
@@ -2757,6 +2835,13 @@ Style/ClassVars:
|
|
2757
2835
|
Enabled: true
|
2758
2836
|
VersionAdded: '0.13'
|
2759
2837
|
|
2838
|
+
Style/CollectionCompact:
|
2839
|
+
Description: 'Use `{Array,Hash}#{compact,compact!}` instead of custom logic to reject nils.'
|
2840
|
+
Enabled: pending
|
2841
|
+
Safe: false
|
2842
|
+
VersionAdded: '1.2'
|
2843
|
+
VersionChanged: '1.3'
|
2844
|
+
|
2760
2845
|
# Align with the style guide.
|
2761
2846
|
Style/CollectionMethods:
|
2762
2847
|
Description: 'Preferred collection methods.'
|
@@ -2795,7 +2880,7 @@ Style/CombinableLoops:
|
|
2795
2880
|
Description: >-
|
2796
2881
|
Checks for places where multiple consecutive loops over the same data
|
2797
2882
|
can be combined into a single loop.
|
2798
|
-
Enabled:
|
2883
|
+
Enabled: true
|
2799
2884
|
Safe: false
|
2800
2885
|
VersionAdded: '0.90'
|
2801
2886
|
|
@@ -2820,17 +2905,18 @@ Style/CommandLiteral:
|
|
2820
2905
|
Style/CommentAnnotation:
|
2821
2906
|
Description: >-
|
2822
2907
|
Checks formatting of special comments
|
2823
|
-
(TODO, FIXME, OPTIMIZE, HACK, REVIEW).
|
2908
|
+
(TODO, FIXME, OPTIMIZE, HACK, REVIEW, NOTE).
|
2824
2909
|
StyleGuide: '#annotate-keywords'
|
2825
2910
|
Enabled: true
|
2826
2911
|
VersionAdded: '0.10'
|
2827
|
-
VersionChanged: '
|
2912
|
+
VersionChanged: '1.3'
|
2828
2913
|
Keywords:
|
2829
2914
|
- TODO
|
2830
2915
|
- FIXME
|
2831
2916
|
- OPTIMIZE
|
2832
2917
|
- HACK
|
2833
2918
|
- REVIEW
|
2919
|
+
- NOTE
|
2834
2920
|
|
2835
2921
|
Style/CommentedKeyword:
|
2836
2922
|
Description: 'Do not place comments on the same line as certain keywords.'
|
@@ -2919,6 +3005,15 @@ Style/DisableCopsWithinSourceCodeDirective:
|
|
2919
3005
|
Enabled: false
|
2920
3006
|
VersionAdded: '0.82'
|
2921
3007
|
|
3008
|
+
Style/DocumentDynamicEvalDefinition:
|
3009
|
+
Description: >-
|
3010
|
+
When using `class_eval` (or other `eval`) with string interpolation,
|
3011
|
+
add a comment block showing its appearance if interpolated.
|
3012
|
+
StyleGuide: '#eval-comment-docs'
|
3013
|
+
Enabled: pending
|
3014
|
+
VersionAdded: '1.1'
|
3015
|
+
VersionChanged: '1.3'
|
3016
|
+
|
2922
3017
|
Style/Documentation:
|
2923
3018
|
Description: 'Document classes and non-namespace modules.'
|
2924
3019
|
Enabled: true
|
@@ -2946,7 +3041,7 @@ Style/DoubleNegation:
|
|
2946
3041
|
StyleGuide: '#no-bang-bang'
|
2947
3042
|
Enabled: true
|
2948
3043
|
VersionAdded: '0.19'
|
2949
|
-
VersionChanged: '
|
3044
|
+
VersionChanged: '1.2'
|
2950
3045
|
EnforcedStyle: allowed_in_returns
|
2951
3046
|
SafeAutoCorrect: false
|
2952
3047
|
SupportedStyles:
|
@@ -3048,7 +3143,7 @@ Style/ExplicitBlockArgument:
|
|
3048
3143
|
Consider using explicit block argument to avoid writing block literal
|
3049
3144
|
that just passes its arguments to another block.
|
3050
3145
|
StyleGuide: '#block-argument'
|
3051
|
-
Enabled:
|
3146
|
+
Enabled: true
|
3052
3147
|
# May change the yielding arity.
|
3053
3148
|
Safe: false
|
3054
3149
|
VersionAdded: '0.89'
|
@@ -3056,7 +3151,7 @@ Style/ExplicitBlockArgument:
|
|
3056
3151
|
Style/ExponentialNotation:
|
3057
3152
|
Description: 'When using exponential notation, favor a mantissa between 1 (inclusive) and 10 (exclusive).'
|
3058
3153
|
StyleGuide: '#exponential-notation'
|
3059
|
-
Enabled:
|
3154
|
+
Enabled: true
|
3060
3155
|
VersionAdded: '0.82'
|
3061
3156
|
EnforcedStyle: scientific
|
3062
3157
|
SupportedStyles:
|
@@ -3111,8 +3206,12 @@ Style/FormatStringToken:
|
|
3111
3206
|
# Prefer simple looking "template" style tokens like `%{name}`, `%{age}`
|
3112
3207
|
- template
|
3113
3208
|
- unannotated
|
3209
|
+
# `MaxUnannotatedPlaceholdersAllowed` defines the number of `unannotated`
|
3210
|
+
# style token in a format string to be allowed when enforced style is not
|
3211
|
+
# `unannotated`.
|
3212
|
+
MaxUnannotatedPlaceholdersAllowed: 1
|
3114
3213
|
VersionAdded: '0.49'
|
3115
|
-
VersionChanged: '0
|
3214
|
+
VersionChanged: '1.0'
|
3116
3215
|
|
3117
3216
|
Style/FrozenStringLiteralComment:
|
3118
3217
|
Description: >-
|
@@ -3139,7 +3238,7 @@ Style/FrozenStringLiteralComment:
|
|
3139
3238
|
Style/GlobalStdStream:
|
3140
3239
|
Description: 'Enforces the use of `$stdout/$stderr/$stdin` instead of `STDOUT/STDERR/STDIN`.'
|
3141
3240
|
StyleGuide: '#global-stdout'
|
3142
|
-
Enabled:
|
3241
|
+
Enabled: true
|
3143
3242
|
VersionAdded: '0.89'
|
3144
3243
|
SafeAutoCorrect: false
|
3145
3244
|
|
@@ -3167,7 +3266,7 @@ Style/HashAsLastArrayItem:
|
|
3167
3266
|
Checks for presence or absence of braces around hash literal as a last
|
3168
3267
|
array item depending on configuration.
|
3169
3268
|
StyleGuide: '#hash-literal-as-last-array-item'
|
3170
|
-
Enabled:
|
3269
|
+
Enabled: true
|
3171
3270
|
VersionAdded: '0.88'
|
3172
3271
|
EnforcedStyle: braces
|
3173
3272
|
SupportedStyles:
|
@@ -3177,7 +3276,7 @@ Style/HashAsLastArrayItem:
|
|
3177
3276
|
Style/HashEachMethods:
|
3178
3277
|
Description: 'Use Hash#each_key and Hash#each_value.'
|
3179
3278
|
StyleGuide: '#hash-each'
|
3180
|
-
Enabled:
|
3279
|
+
Enabled: true
|
3181
3280
|
VersionAdded: '0.80'
|
3182
3281
|
Safe: false
|
3183
3282
|
|
@@ -3185,7 +3284,7 @@ Style/HashLikeCase:
|
|
3185
3284
|
Description: >-
|
3186
3285
|
Checks for places where `case-when` represents a simple 1:1
|
3187
3286
|
mapping and can be replaced with a hash lookup.
|
3188
|
-
Enabled:
|
3287
|
+
Enabled: true
|
3189
3288
|
VersionAdded: '0.88'
|
3190
3289
|
# `MinBranchesCount` defines the number of branches `case` needs to have
|
3191
3290
|
# to trigger this cop
|
@@ -3216,14 +3315,14 @@ Style/HashSyntax:
|
|
3216
3315
|
|
3217
3316
|
Style/HashTransformKeys:
|
3218
3317
|
Description: 'Prefer `transform_keys` over `each_with_object`, `map`, or `to_h`.'
|
3219
|
-
Enabled:
|
3318
|
+
Enabled: true
|
3220
3319
|
VersionAdded: '0.80'
|
3221
3320
|
VersionChanged: '0.90'
|
3222
3321
|
Safe: false
|
3223
3322
|
|
3224
3323
|
Style/HashTransformValues:
|
3225
3324
|
Description: 'Prefer `transform_values` over `each_with_object`, `map`, or `to_h`.'
|
3226
|
-
Enabled:
|
3325
|
+
Enabled: true
|
3227
3326
|
VersionAdded: '0.80'
|
3228
3327
|
VersionChanged: '0.90'
|
3229
3328
|
Safe: false
|
@@ -3241,6 +3340,7 @@ Style/IfInsideElse:
|
|
3241
3340
|
Enabled: true
|
3242
3341
|
AllowIfModifier: false
|
3243
3342
|
VersionAdded: '0.36'
|
3343
|
+
VersionChanged: '1.3'
|
3244
3344
|
|
3245
3345
|
Style/IfUnlessModifier:
|
3246
3346
|
Description: >-
|
@@ -3273,12 +3373,14 @@ Style/ImplicitRuntimeError:
|
|
3273
3373
|
VersionAdded: '0.41'
|
3274
3374
|
|
3275
3375
|
Style/InfiniteLoop:
|
3276
|
-
Description:
|
3376
|
+
Description: >-
|
3377
|
+
Use Kernel#loop for infinite loops.
|
3378
|
+
This cop is unsafe in the body may raise a `StopIteration` exception.
|
3379
|
+
Safe: false
|
3277
3380
|
StyleGuide: '#infinite-loop'
|
3278
3381
|
Enabled: true
|
3279
3382
|
VersionAdded: '0.26'
|
3280
3383
|
VersionChanged: '0.61'
|
3281
|
-
SafeAutoCorrect: true
|
3282
3384
|
|
3283
3385
|
Style/InlineComment:
|
3284
3386
|
Description: 'Avoid trailing inline comments.'
|
@@ -3330,7 +3432,7 @@ Style/IpAddresses:
|
|
3330
3432
|
Style/KeywordParametersOrder:
|
3331
3433
|
Description: 'Enforces that optional keyword parameters are placed at the end of the parameters list.'
|
3332
3434
|
StyleGuide: '#keyword-parameters-order'
|
3333
|
-
Enabled:
|
3435
|
+
Enabled: true
|
3334
3436
|
VersionAdded: '0.90'
|
3335
3437
|
|
3336
3438
|
Style/Lambda:
|
@@ -3532,6 +3634,7 @@ Style/MultipleComparison:
|
|
3532
3634
|
use Array#include? instead.
|
3533
3635
|
Enabled: true
|
3534
3636
|
VersionAdded: '0.49'
|
3637
|
+
VersionChanged: '1.1'
|
3535
3638
|
|
3536
3639
|
Style/MutableConstant:
|
3537
3640
|
Description: 'Do not assign mutable objects to constants.'
|
@@ -3566,6 +3669,13 @@ Style/NegatedIf:
|
|
3566
3669
|
- prefix
|
3567
3670
|
- postfix
|
3568
3671
|
|
3672
|
+
Style/NegatedIfElseCondition:
|
3673
|
+
Description: >-
|
3674
|
+
This cop checks for uses of `if-else` and ternary operators with a negated condition
|
3675
|
+
which can be simplified by inverting condition and swapping branches.
|
3676
|
+
Enabled: pending
|
3677
|
+
VersionAdded: '1.2'
|
3678
|
+
|
3569
3679
|
Style/NegatedUnless:
|
3570
3680
|
Description: 'Favor if over unless for negative conditions.'
|
3571
3681
|
StyleGuide: '#if-for-negatives'
|
@@ -3653,6 +3763,11 @@ Style/NilComparison:
|
|
3653
3763
|
- predicate
|
3654
3764
|
- comparison
|
3655
3765
|
|
3766
|
+
Style/NilLambda:
|
3767
|
+
Description: 'Prefer `-> {}` to `-> { nil }`.'
|
3768
|
+
Enabled: pending
|
3769
|
+
VersionAdded: '1.3'
|
3770
|
+
|
3656
3771
|
Style/NonNilCheck:
|
3657
3772
|
Description: 'Checks for redundant nil checks.'
|
3658
3773
|
StyleGuide: '#no-non-nil-checks'
|
@@ -3755,7 +3870,7 @@ Style/OptionalArguments:
|
|
3755
3870
|
Style/OptionalBooleanParameter:
|
3756
3871
|
Description: 'Use keyword arguments when defining method with boolean argument.'
|
3757
3872
|
StyleGuide: '#boolean-keyword-arguments'
|
3758
|
-
Enabled:
|
3873
|
+
Enabled: true
|
3759
3874
|
Safe: false
|
3760
3875
|
VersionAdded: '0.89'
|
3761
3876
|
AllowedMethods:
|
@@ -3843,11 +3958,12 @@ Style/RaiseArgs:
|
|
3843
3958
|
StyleGuide: '#exception-class-messages'
|
3844
3959
|
Enabled: true
|
3845
3960
|
VersionAdded: '0.14'
|
3846
|
-
VersionChanged: '
|
3961
|
+
VersionChanged: '1.2'
|
3847
3962
|
EnforcedStyle: exploded
|
3848
3963
|
SupportedStyles:
|
3849
3964
|
- compact # raise Exception.new(msg)
|
3850
3965
|
- exploded # raise Exception, msg
|
3966
|
+
AllowedCompactTypes: []
|
3851
3967
|
|
3852
3968
|
Style/RandomWithOffset:
|
3853
3969
|
Description: >-
|
@@ -3859,7 +3975,7 @@ Style/RandomWithOffset:
|
|
3859
3975
|
|
3860
3976
|
Style/RedundantAssignment:
|
3861
3977
|
Description: 'Checks for redundant assignment before returning.'
|
3862
|
-
Enabled:
|
3978
|
+
Enabled: true
|
3863
3979
|
VersionAdded: '0.87'
|
3864
3980
|
|
3865
3981
|
Style/RedundantBegin:
|
@@ -3896,7 +4012,7 @@ Style/RedundantFetchBlock:
|
|
3896
4012
|
Use `fetch(key, value)` instead of `fetch(key) { value }`
|
3897
4013
|
when value has Numeric, Rational, Complex, Symbol or String type, `false`, `true`, `nil` or is a constant.
|
3898
4014
|
Reference: 'https://github.com/JuanitoFatas/fast-ruby#hashfetch-with-argument-vs-hashfetch--block-code'
|
3899
|
-
Enabled:
|
4015
|
+
Enabled: true
|
3900
4016
|
Safe: false
|
3901
4017
|
# If enabled, this cop will autocorrect usages of
|
3902
4018
|
# `fetch` being called with block returning a constant.
|
@@ -3909,7 +4025,7 @@ Style/RedundantFileExtensionInRequire:
|
|
3909
4025
|
Checks for the presence of superfluous `.rb` extension in
|
3910
4026
|
the filename provided to `require` and `require_relative`.
|
3911
4027
|
StyleGuide: '#no-explicit-rb-to-require'
|
3912
|
-
Enabled:
|
4028
|
+
Enabled: true
|
3913
4029
|
VersionAdded: '0.88'
|
3914
4030
|
|
3915
4031
|
Style/RedundantFreeze:
|
@@ -3936,12 +4052,12 @@ Style/RedundantPercentQ:
|
|
3936
4052
|
|
3937
4053
|
Style/RedundantRegexpCharacterClass:
|
3938
4054
|
Description: 'Checks for unnecessary single-element Regexp character classes.'
|
3939
|
-
Enabled:
|
4055
|
+
Enabled: true
|
3940
4056
|
VersionAdded: '0.85'
|
3941
4057
|
|
3942
4058
|
Style/RedundantRegexpEscape:
|
3943
4059
|
Description: 'Checks for redundant escapes in Regexps.'
|
3944
|
-
Enabled:
|
4060
|
+
Enabled: true
|
3945
4061
|
VersionAdded: '0.85'
|
3946
4062
|
|
3947
4063
|
Style/RedundantReturn:
|
@@ -3962,7 +4078,7 @@ Style/RedundantSelf:
|
|
3962
4078
|
|
3963
4079
|
Style/RedundantSelfAssignment:
|
3964
4080
|
Description: 'Checks for places where redundant assignments are made for in place modification methods.'
|
3965
|
-
Enabled:
|
4081
|
+
Enabled: true
|
3966
4082
|
Safe: false
|
3967
4083
|
VersionAdded: '0.90'
|
3968
4084
|
|
@@ -4090,7 +4206,7 @@ Style/SignalException:
|
|
4090
4206
|
|
4091
4207
|
Style/SingleArgumentDig:
|
4092
4208
|
Description: 'Avoid using single argument dig method.'
|
4093
|
-
Enabled:
|
4209
|
+
Enabled: true
|
4094
4210
|
VersionAdded: '0.89'
|
4095
4211
|
Safe: false
|
4096
4212
|
|
@@ -4117,7 +4233,7 @@ Style/SingleLineMethods:
|
|
4117
4233
|
|
4118
4234
|
Style/SlicingWithRange:
|
4119
4235
|
Description: 'Checks array slicing is done with endless ranges when suitable.'
|
4120
|
-
Enabled:
|
4236
|
+
Enabled: true
|
4121
4237
|
VersionAdded: '0.83'
|
4122
4238
|
Safe: false
|
4123
4239
|
|
@@ -4125,7 +4241,7 @@ Style/SoleNestedConditional:
|
|
4125
4241
|
Description: >-
|
4126
4242
|
Finds sole nested conditional nodes
|
4127
4243
|
which can be merged into outer conditional node.
|
4128
|
-
Enabled:
|
4244
|
+
Enabled: true
|
4129
4245
|
VersionAdded: '0.89'
|
4130
4246
|
AllowModifier: false
|
4131
4247
|
|
@@ -4151,6 +4267,13 @@ Style/StabbyLambdaParentheses:
|
|
4151
4267
|
- require_parentheses
|
4152
4268
|
- require_no_parentheses
|
4153
4269
|
|
4270
|
+
Style/StaticClass:
|
4271
|
+
Description: 'Prefer modules to classes with only class methods.'
|
4272
|
+
StyleGuide: '#modules-vs-classes'
|
4273
|
+
Enabled: false
|
4274
|
+
Safe: false
|
4275
|
+
VersionAdded: '1.3'
|
4276
|
+
|
4154
4277
|
Style/StderrPuts:
|
4155
4278
|
Description: 'Use `warn` instead of `$stderr.puts`.'
|
4156
4279
|
StyleGuide: '#warn'
|
@@ -4160,7 +4283,7 @@ Style/StderrPuts:
|
|
4160
4283
|
Style/StringConcatenation:
|
4161
4284
|
Description: 'Checks for places where string concatenation can be replaced with string interpolation.'
|
4162
4285
|
StyleGuide: '#string-interpolation'
|
4163
|
-
Enabled:
|
4286
|
+
Enabled: true
|
4164
4287
|
Safe: false
|
4165
4288
|
VersionAdded: '0.89'
|
4166
4289
|
|
@@ -4223,6 +4346,13 @@ Style/StructInheritance:
|
|
4223
4346
|
VersionAdded: '0.29'
|
4224
4347
|
VersionChanged: '0.86'
|
4225
4348
|
|
4349
|
+
Style/SwapValues:
|
4350
|
+
Description: 'This cop enforces the use of shorthand-style swapping of 2 variables.'
|
4351
|
+
StyleGuide: '#values-swapping'
|
4352
|
+
Enabled: pending
|
4353
|
+
VersionAdded: '1.1'
|
4354
|
+
SafeAutoCorrect: false
|
4355
|
+
|
4226
4356
|
Style/SymbolArray:
|
4227
4357
|
Description: 'Use %i or %I for arrays of symbols.'
|
4228
4358
|
StyleGuide: '#percent-i'
|