rubocop 0.93.1 → 1.3.1
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 -72
- 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 +33 -7
- 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 +2 -9
- data/lib/rubocop/cop/generator/configuration_injector.rb +1 -1
- data/lib/rubocop/cop/layout/block_alignment.rb +3 -4
- data/lib/rubocop/cop/layout/class_structure.rb +22 -3
- 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/constant_definition_in_block.rb +26 -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/shadowed_exception.rb +4 -5
- data/lib/rubocop/cop/lint/to_enum_arguments.rb +86 -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/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/collection_compact.rb +91 -0
- data/lib/rubocop/cop/style/document_dynamic_eval_definition.rb +169 -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 +106 -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_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/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_finder.rb +1 -1
- data/lib/rubocop/target_ruby.rb +65 -1
- data/lib/rubocop/version.rb +56 -6
- metadata +22 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4238df3546a63ce2c279ced4bba228a61c137b083a3fad76b45365954555f690
|
4
|
+
data.tar.gz: bf3bd7a2409203b911212906d013aec7219f1a21825352bc92e0b897faafbd66
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a87bd4426855a7278963b8c3e4373b7c995994b5685318aad04bc2b0832c0db44e705d50d4ea21d81eb47074137fde56665f8317121caae8a81e208e044ce4a7
|
7
|
+
data.tar.gz: 3bb4cb7794129ac95c70876bc009a4ed07425a7a346acaf77279c4e0fc8b1c20f31e82e9590e1d880fa011ddddc08c93bb3851f6f815718b9de8ff7a0dd78c6f
|
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:
|
@@ -1176,7 +1176,7 @@ Layout/SpaceBeforeBlockBraces:
|
|
1176
1176
|
SupportedStylesForEmptyBraces:
|
1177
1177
|
- space
|
1178
1178
|
- no_space
|
1179
|
-
VersionChanged: '0.52
|
1179
|
+
VersionChanged: '0.52'
|
1180
1180
|
|
1181
1181
|
Layout/SpaceBeforeComma:
|
1182
1182
|
Description: 'No spaces before commas.'
|
@@ -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,13 @@ 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
|
+
# `enums` for Typed Enums via T::Enum in Sorbet.
|
1405
|
+
# https://sorbet.org/docs/tenum
|
1406
|
+
AllowedMethods:
|
1407
|
+
- enums
|
1403
1408
|
|
1404
1409
|
Lint/ConstantResolution:
|
1405
1410
|
Description: 'Check that constants are fully qualified with `::`.'
|
@@ -1415,6 +1420,22 @@ Lint/Debugger:
|
|
1415
1420
|
Enabled: true
|
1416
1421
|
VersionAdded: '0.14'
|
1417
1422
|
VersionChanged: '0.49'
|
1423
|
+
DebuggerReceivers:
|
1424
|
+
- binding
|
1425
|
+
- Kernel
|
1426
|
+
- Pry
|
1427
|
+
DebuggerMethods:
|
1428
|
+
- debugger
|
1429
|
+
- byebug
|
1430
|
+
- remote_byebug
|
1431
|
+
- pry
|
1432
|
+
- remote_pry
|
1433
|
+
- pry_remote
|
1434
|
+
- console
|
1435
|
+
- rescue
|
1436
|
+
- save_and_open_page
|
1437
|
+
- save_and_open_screenshot
|
1438
|
+
- irb
|
1418
1439
|
|
1419
1440
|
Lint/DeprecatedClassMethods:
|
1420
1441
|
Description: 'Check for deprecated class method calls.'
|
@@ -1423,7 +1444,7 @@ Lint/DeprecatedClassMethods:
|
|
1423
1444
|
|
1424
1445
|
Lint/DeprecatedOpenSSLConstant:
|
1425
1446
|
Description: "Don't use algorithm constants for `OpenSSL::Cipher` and `OpenSSL::Digest`."
|
1426
|
-
Enabled:
|
1447
|
+
Enabled: true
|
1427
1448
|
VersionAdded: '0.84'
|
1428
1449
|
|
1429
1450
|
Lint/DisjunctiveAssignmentInConstructor:
|
@@ -1433,6 +1454,11 @@ Lint/DisjunctiveAssignmentInConstructor:
|
|
1433
1454
|
VersionAdded: '0.62'
|
1434
1455
|
VersionChanged: '0.88'
|
1435
1456
|
|
1457
|
+
Lint/DuplicateBranch:
|
1458
|
+
Description: Checks that there are no repeated bodies within `if/unless`, `case-when` and `rescue` constructs.
|
1459
|
+
Enabled: pending
|
1460
|
+
VersionAdded: '1.3'
|
1461
|
+
|
1436
1462
|
Lint/DuplicateCaseCondition:
|
1437
1463
|
Description: 'Do not repeat values in case conditionals.'
|
1438
1464
|
Enabled: true
|
@@ -1440,7 +1466,7 @@ Lint/DuplicateCaseCondition:
|
|
1440
1466
|
|
1441
1467
|
Lint/DuplicateElsifCondition:
|
1442
1468
|
Description: 'Do not repeat conditions used in if `elsif`.'
|
1443
|
-
Enabled:
|
1469
|
+
Enabled: true
|
1444
1470
|
VersionAdded: '0.88'
|
1445
1471
|
|
1446
1472
|
Lint/DuplicateHashKey:
|
@@ -1454,14 +1480,19 @@ Lint/DuplicateMethods:
|
|
1454
1480
|
Enabled: true
|
1455
1481
|
VersionAdded: '0.29'
|
1456
1482
|
|
1483
|
+
Lint/DuplicateRegexpCharacterClassElement:
|
1484
|
+
Description: 'Checks for duplicate elements in Regexp character classes.'
|
1485
|
+
Enabled: pending
|
1486
|
+
VersionAdded: '1.1'
|
1487
|
+
|
1457
1488
|
Lint/DuplicateRequire:
|
1458
1489
|
Description: 'Check for duplicate `require`s and `require_relative`s.'
|
1459
|
-
Enabled:
|
1490
|
+
Enabled: true
|
1460
1491
|
VersionAdded: '0.90'
|
1461
1492
|
|
1462
1493
|
Lint/DuplicateRescueException:
|
1463
1494
|
Description: 'Checks that there are no repeated exceptions used in `rescue` expressions.'
|
1464
|
-
Enabled:
|
1495
|
+
Enabled: true
|
1465
1496
|
VersionAdded: '0.89'
|
1466
1497
|
|
1467
1498
|
Lint/EachWithObjectArgument:
|
@@ -1473,10 +1504,25 @@ Lint/ElseLayout:
|
|
1473
1504
|
Description: 'Check for odd code arrangement in an else block.'
|
1474
1505
|
Enabled: true
|
1475
1506
|
VersionAdded: '0.17'
|
1507
|
+
VersionChanged: '1.2'
|
1508
|
+
|
1509
|
+
Lint/EmptyBlock:
|
1510
|
+
Description: 'This cop checks for blocks without a body.'
|
1511
|
+
Enabled: pending
|
1512
|
+
VersionAdded: '1.1'
|
1513
|
+
VersionChanged: '1.3'
|
1514
|
+
AllowComments: true
|
1515
|
+
AllowEmptyLambdas: true
|
1516
|
+
|
1517
|
+
Lint/EmptyClass:
|
1518
|
+
Description: 'Checks for classes and metaclasses without a body.'
|
1519
|
+
Enabled: pending
|
1520
|
+
VersionAdded: '1.3'
|
1521
|
+
AllowComments: false
|
1476
1522
|
|
1477
1523
|
Lint/EmptyConditionalBody:
|
1478
1524
|
Description: 'This cop checks for the presence of `if`, `elsif` and `unless` branches without a body.'
|
1479
|
-
Enabled:
|
1525
|
+
Enabled: true
|
1480
1526
|
AllowComments: true
|
1481
1527
|
VersionAdded: '0.89'
|
1482
1528
|
|
@@ -1493,7 +1539,7 @@ Lint/EmptyExpression:
|
|
1493
1539
|
|
1494
1540
|
Lint/EmptyFile:
|
1495
1541
|
Description: 'Enforces that Ruby source files are not empty.'
|
1496
|
-
Enabled:
|
1542
|
+
Enabled: true
|
1497
1543
|
AllowComments: true
|
1498
1544
|
VersionAdded: '0.90'
|
1499
1545
|
|
@@ -1531,7 +1577,7 @@ Lint/FlipFlop:
|
|
1531
1577
|
Lint/FloatComparison:
|
1532
1578
|
Description: 'Checks for the presence of precise comparison of floating point numbers.'
|
1533
1579
|
StyleGuide: '#float-comparison'
|
1534
|
-
Enabled:
|
1580
|
+
Enabled: true
|
1535
1581
|
VersionAdded: '0.89'
|
1536
1582
|
|
1537
1583
|
Lint/FloatOutOfRange:
|
@@ -1549,7 +1595,7 @@ Lint/FormatParameterMismatch:
|
|
1549
1595
|
Lint/HashCompareByIdentity:
|
1550
1596
|
Description: 'Prefer using `Hash#compare_by_identity` than using `object_id` for keys.'
|
1551
1597
|
StyleGuide: '#identity-comparison'
|
1552
|
-
Enabled:
|
1598
|
+
Enabled: true
|
1553
1599
|
Safe: false
|
1554
1600
|
VersionAdded: '0.93'
|
1555
1601
|
|
@@ -1563,7 +1609,7 @@ Lint/HeredocMethodCallPosition:
|
|
1563
1609
|
|
1564
1610
|
Lint/IdentityComparison:
|
1565
1611
|
Description: 'Prefer `equal?` over `==` when comparing `object_id`.'
|
1566
|
-
Enabled:
|
1612
|
+
Enabled: true
|
1567
1613
|
StyleGuide: '#identity-comparison'
|
1568
1614
|
VersionAdded: '0.91'
|
1569
1615
|
|
@@ -1616,7 +1662,8 @@ Lint/Loop:
|
|
1616
1662
|
StyleGuide: '#loop-with-break'
|
1617
1663
|
Enabled: true
|
1618
1664
|
VersionAdded: '0.9'
|
1619
|
-
VersionChanged: '
|
1665
|
+
VersionChanged: '1.3'
|
1666
|
+
Safe: false
|
1620
1667
|
|
1621
1668
|
Lint/MissingCopEnableDirective:
|
1622
1669
|
Description: 'Checks for a `# rubocop:enable` after `# rubocop:disable`.'
|
@@ -1635,19 +1682,20 @@ Lint/MissingSuper:
|
|
1635
1682
|
Description: >-
|
1636
1683
|
This cop checks for the presence of constructors and lifecycle callbacks
|
1637
1684
|
without calls to `super`'.
|
1638
|
-
Enabled:
|
1685
|
+
Enabled: true
|
1639
1686
|
VersionAdded: '0.89'
|
1640
1687
|
|
1641
1688
|
Lint/MixedRegexpCaptureTypes:
|
1642
1689
|
Description: 'Do not mix named captures and numbered captures in a Regexp literal.'
|
1643
|
-
Enabled:
|
1690
|
+
Enabled: true
|
1644
1691
|
VersionAdded: '0.85'
|
1645
1692
|
|
1646
1693
|
Lint/MultipleComparison:
|
1647
1694
|
Description: "Use `&&` operator to compare multiple values."
|
1648
1695
|
Enabled: true
|
1649
1696
|
VersionAdded: '0.47'
|
1650
|
-
VersionChanged: '
|
1697
|
+
VersionChanged: '1.1'
|
1698
|
+
AllowMethodComparison: true
|
1651
1699
|
|
1652
1700
|
Lint/NestedMethodDefinition:
|
1653
1701
|
Description: 'Do not use nested method definitions.'
|
@@ -1667,6 +1715,11 @@ Lint/NextWithoutAccumulator:
|
|
1667
1715
|
Enabled: true
|
1668
1716
|
VersionAdded: '0.36'
|
1669
1717
|
|
1718
|
+
Lint/NoReturnInBeginEndBlocks:
|
1719
|
+
Description: 'Do not `return` inside `begin..end` blocks in assignment contexts.'
|
1720
|
+
Enabled: pending
|
1721
|
+
VersionAdded: '1.2'
|
1722
|
+
|
1670
1723
|
Lint/NonDeterministicRequireOrder:
|
1671
1724
|
Description: 'Always sort arrays returned by Dir.glob when requiring files.'
|
1672
1725
|
Enabled: true
|
@@ -1682,8 +1735,12 @@ Lint/NumberConversion:
|
|
1682
1735
|
Description: 'Checks unsafe usage of number conversion methods.'
|
1683
1736
|
Enabled: false
|
1684
1737
|
VersionAdded: '0.53'
|
1685
|
-
VersionChanged: '
|
1738
|
+
VersionChanged: '1.1'
|
1686
1739
|
SafeAutoCorrect: false
|
1740
|
+
IgnoredMethods: []
|
1741
|
+
IgnoredClasses:
|
1742
|
+
- Time
|
1743
|
+
- DateTime
|
1687
1744
|
|
1688
1745
|
Lint/OrderedMagicComments:
|
1689
1746
|
Description: 'Checks the proper ordering of magic comments and whether a magic comment is not placed before a shebang.'
|
@@ -1692,7 +1749,7 @@ Lint/OrderedMagicComments:
|
|
1692
1749
|
|
1693
1750
|
Lint/OutOfRangeRegexpRef:
|
1694
1751
|
Description: 'Checks for out of range reference for Regexp because it always returns nil.'
|
1695
|
-
Enabled:
|
1752
|
+
Enabled: true
|
1696
1753
|
Safe: false
|
1697
1754
|
VersionAdded: '0.89'
|
1698
1755
|
|
@@ -1721,7 +1778,7 @@ Lint/PercentSymbolArray:
|
|
1721
1778
|
Lint/RaiseException:
|
1722
1779
|
Description: Checks for `raise` or `fail` statements which are raising `Exception` class.
|
1723
1780
|
StyleGuide: '#raise-exception'
|
1724
|
-
Enabled:
|
1781
|
+
Enabled: true
|
1725
1782
|
Safe: false
|
1726
1783
|
VersionAdded: '0.81'
|
1727
1784
|
VersionChanged: '0.86'
|
@@ -1755,7 +1812,7 @@ Lint/RedundantRequireStatement:
|
|
1755
1812
|
|
1756
1813
|
Lint/RedundantSafeNavigation:
|
1757
1814
|
Description: 'Checks for redundant safe navigation calls.'
|
1758
|
-
Enabled:
|
1815
|
+
Enabled: true
|
1759
1816
|
VersionAdded: '0.93'
|
1760
1817
|
AllowedMethods:
|
1761
1818
|
- instance_of?
|
@@ -1808,7 +1865,7 @@ Lint/RescueException:
|
|
1808
1865
|
StyleGuide: '#no-blind-rescues'
|
1809
1866
|
Enabled: true
|
1810
1867
|
VersionAdded: '0.9'
|
1811
|
-
VersionChanged: '0.27
|
1868
|
+
VersionChanged: '0.27'
|
1812
1869
|
|
1813
1870
|
Lint/RescueType:
|
1814
1871
|
Description: 'Avoid rescuing from non constants that could result in a `TypeError`.'
|
@@ -1862,7 +1919,7 @@ Lint/ScriptPermission:
|
|
1862
1919
|
|
1863
1920
|
Lint/SelfAssignment:
|
1864
1921
|
Description: 'Checks for self-assignments.'
|
1865
|
-
Enabled:
|
1922
|
+
Enabled: true
|
1866
1923
|
VersionAdded: '0.89'
|
1867
1924
|
|
1868
1925
|
Lint/SendWithMixinArgument:
|
@@ -1893,7 +1950,7 @@ Lint/ShadowingOuterLocalVariable:
|
|
1893
1950
|
|
1894
1951
|
Lint/StructNewOverride:
|
1895
1952
|
Description: 'Disallow overriding the `Struct` built-in methods via `Struct.new`.'
|
1896
|
-
Enabled:
|
1953
|
+
Enabled: true
|
1897
1954
|
VersionAdded: '0.81'
|
1898
1955
|
|
1899
1956
|
Lint/SuppressedException:
|
@@ -1910,6 +1967,11 @@ Lint/Syntax:
|
|
1910
1967
|
VersionAdded: '0.9'
|
1911
1968
|
|
1912
1969
|
|
1970
|
+
Lint/ToEnumArguments:
|
1971
|
+
Description: 'This cop ensures that `to_enum`/`enum_for`, called for the current method, has correct arguments.'
|
1972
|
+
Enabled: pending
|
1973
|
+
VersionAdded: '1.1'
|
1974
|
+
|
1913
1975
|
Lint/ToJSON:
|
1914
1976
|
Description: 'Ensure #to_json includes an optional argument.'
|
1915
1977
|
Enabled: true
|
@@ -1917,12 +1979,12 @@ Lint/ToJSON:
|
|
1917
1979
|
|
1918
1980
|
Lint/TopLevelReturnWithArgument:
|
1919
1981
|
Description: 'This cop detects top level return statements with argument.'
|
1920
|
-
Enabled:
|
1982
|
+
Enabled: true
|
1921
1983
|
VersionAdded: '0.89'
|
1922
1984
|
|
1923
1985
|
Lint/TrailingCommaInAttributeDeclaration:
|
1924
1986
|
Description: 'This cop checks for trailing commas in attribute declarations.'
|
1925
|
-
Enabled:
|
1987
|
+
Enabled: true
|
1926
1988
|
VersionAdded: '0.90'
|
1927
1989
|
|
1928
1990
|
Lint/UnderscorePrefixedVariableName:
|
@@ -1936,6 +1998,11 @@ Lint/UnifiedInteger:
|
|
1936
1998
|
Enabled: true
|
1937
1999
|
VersionAdded: '0.43'
|
1938
2000
|
|
2001
|
+
Lint/UnmodifiedReduceAccumulator:
|
2002
|
+
Description: Checks for `reduce` or `inject` blocks that do not update the accumulator each iteration.
|
2003
|
+
Enabled: pending
|
2004
|
+
VersionAdded: '1.1'
|
2005
|
+
|
1939
2006
|
Lint/UnreachableCode:
|
1940
2007
|
Description: 'Unreachable code.'
|
1941
2008
|
Enabled: true
|
@@ -1943,7 +2010,7 @@ Lint/UnreachableCode:
|
|
1943
2010
|
|
1944
2011
|
Lint/UnreachableLoop:
|
1945
2012
|
Description: 'This cop checks for loops that will have at most one iteration.'
|
1946
|
-
Enabled:
|
2013
|
+
Enabled: true
|
1947
2014
|
VersionAdded: '0.89'
|
1948
2015
|
|
1949
2016
|
Lint/UnusedBlockArgument:
|
@@ -2002,7 +2069,7 @@ Lint/UselessElseWithoutRescue:
|
|
2002
2069
|
|
2003
2070
|
Lint/UselessMethodDefinition:
|
2004
2071
|
Description: 'Checks for useless method definitions.'
|
2005
|
-
Enabled:
|
2072
|
+
Enabled: true
|
2006
2073
|
VersionAdded: '0.90'
|
2007
2074
|
Safe: false
|
2008
2075
|
AllowComments: true
|
@@ -2010,13 +2077,14 @@ Lint/UselessMethodDefinition:
|
|
2010
2077
|
Lint/UselessSetterCall:
|
2011
2078
|
Description: 'Checks for useless setter call to a local variable.'
|
2012
2079
|
Enabled: true
|
2080
|
+
SafeAutoCorrect: false
|
2013
2081
|
VersionAdded: '0.13'
|
2014
|
-
VersionChanged: '
|
2082
|
+
VersionChanged: '1.2'
|
2015
2083
|
Safe: false
|
2016
2084
|
|
2017
2085
|
Lint/UselessTimes:
|
2018
2086
|
Description: 'Checks for useless `Integer#times` calls.'
|
2019
|
-
Enabled:
|
2087
|
+
Enabled: true
|
2020
2088
|
VersionAdded: '0.91'
|
2021
2089
|
Safe: false
|
2022
2090
|
|
@@ -2155,6 +2223,7 @@ Naming/BinaryOperatorParameterName:
|
|
2155
2223
|
StyleGuide: '#other-arg'
|
2156
2224
|
Enabled: true
|
2157
2225
|
VersionAdded: '0.50'
|
2226
|
+
VersionChanged: '1.2'
|
2158
2227
|
|
2159
2228
|
Naming/BlockParameterName:
|
2160
2229
|
Description: >-
|
@@ -2261,6 +2330,7 @@ Naming/HeredocDelimiterCase:
|
|
2261
2330
|
StyleGuide: '#heredoc-delimiters'
|
2262
2331
|
Enabled: true
|
2263
2332
|
VersionAdded: '0.50'
|
2333
|
+
VersionChanged: '1.2'
|
2264
2334
|
EnforcedStyle: uppercase
|
2265
2335
|
SupportedStyles:
|
2266
2336
|
- lowercase
|
@@ -2279,7 +2349,7 @@ Naming/MemoizedInstanceVariableName:
|
|
2279
2349
|
Memoized method name should match memo instance variable name.
|
2280
2350
|
Enabled: true
|
2281
2351
|
VersionAdded: '0.53'
|
2282
|
-
VersionChanged: '
|
2352
|
+
VersionChanged: '1.2'
|
2283
2353
|
EnforcedStyleForLeadingUnderscores: disallowed
|
2284
2354
|
SupportedStylesForLeadingUnderscores:
|
2285
2355
|
- disallowed
|
@@ -2377,14 +2447,19 @@ Naming/VariableName:
|
|
2377
2447
|
- camelCase
|
2378
2448
|
|
2379
2449
|
Naming/VariableNumber:
|
2380
|
-
Description: 'Use the configured style when numbering variables.'
|
2450
|
+
Description: 'Use the configured style when numbering symbols, methods and variables.'
|
2451
|
+
StyleGuide: '#snake-case-symbols-methods-vars-with-numbers'
|
2381
2452
|
Enabled: true
|
2382
2453
|
VersionAdded: '0.50'
|
2454
|
+
VersionChanged: '1.3'
|
2383
2455
|
EnforcedStyle: normalcase
|
2384
2456
|
SupportedStyles:
|
2385
2457
|
- snake_case
|
2386
2458
|
- normalcase
|
2387
2459
|
- non_integer
|
2460
|
+
CheckMethodNames: true
|
2461
|
+
CheckSymbols: true
|
2462
|
+
AllowedIdentifiers: []
|
2388
2463
|
|
2389
2464
|
#################### Security ##############################
|
2390
2465
|
|
@@ -2415,9 +2490,10 @@ Security/MarshalLoad:
|
|
2415
2490
|
VersionAdded: '0.47'
|
2416
2491
|
|
2417
2492
|
Security/Open:
|
2418
|
-
Description: 'The use of Kernel#open
|
2493
|
+
Description: 'The use of `Kernel#open` and `URI.open` represent a serious security risk.'
|
2419
2494
|
Enabled: true
|
2420
2495
|
VersionAdded: '0.53'
|
2496
|
+
VersionChanged: '1.0'
|
2421
2497
|
Safe: false
|
2422
2498
|
|
2423
2499
|
Security/YAMLLoad:
|
@@ -2444,7 +2520,7 @@ Style/AccessModifierDeclarations:
|
|
2444
2520
|
|
2445
2521
|
Style/AccessorGrouping:
|
2446
2522
|
Description: 'Checks for grouping of accessors in `class` and `module` bodies.'
|
2447
|
-
Enabled:
|
2523
|
+
Enabled: true
|
2448
2524
|
VersionAdded: '0.87'
|
2449
2525
|
EnforcedStyle: grouped
|
2450
2526
|
SupportedStyles:
|
@@ -2477,6 +2553,13 @@ Style/AndOr:
|
|
2477
2553
|
- always
|
2478
2554
|
- conditionals
|
2479
2555
|
|
2556
|
+
Style/ArgumentsForwarding:
|
2557
|
+
Description: 'Use arguments forwarding.'
|
2558
|
+
StyleGuide: '#arguments-forwarding'
|
2559
|
+
Enabled: pending
|
2560
|
+
AllowOnlyRestArgument: true
|
2561
|
+
VersionAdded: '1.1'
|
2562
|
+
|
2480
2563
|
Style/ArrayCoercion:
|
2481
2564
|
Description: >-
|
2482
2565
|
Use Array() instead of explicit Array check or [*var], when dealing
|
@@ -2533,7 +2616,7 @@ Style/BisectedAttrAccessor:
|
|
2533
2616
|
Description: >-
|
2534
2617
|
Checks for places where `attr_reader` and `attr_writer`
|
2535
2618
|
for the same method can be combined into single `attr_accessor`.
|
2536
|
-
Enabled:
|
2619
|
+
Enabled: true
|
2537
2620
|
VersionAdded: '0.87'
|
2538
2621
|
|
2539
2622
|
Style/BlockComments:
|
@@ -2672,7 +2755,7 @@ Style/CaseEquality:
|
|
2672
2755
|
Style/CaseLikeIf:
|
2673
2756
|
Description: 'This cop identifies places where `if-elsif` constructions can be replaced with `case-when`.'
|
2674
2757
|
StyleGuide: '#case-vs-if-else'
|
2675
|
-
Enabled:
|
2758
|
+
Enabled: true
|
2676
2759
|
Safe: false
|
2677
2760
|
VersionAdded: '0.88'
|
2678
2761
|
|
@@ -2725,7 +2808,7 @@ Style/ClassCheck:
|
|
2725
2808
|
Style/ClassEqualityComparison:
|
2726
2809
|
Description: 'Enforces the use of `Object#instance_of?` instead of class comparison for equality.'
|
2727
2810
|
StyleGuide: '#instance-of-vs-class-comparison'
|
2728
|
-
Enabled:
|
2811
|
+
Enabled: true
|
2729
2812
|
VersionAdded: '0.93'
|
2730
2813
|
IgnoredMethods:
|
2731
2814
|
- ==
|
@@ -2755,6 +2838,13 @@ Style/ClassVars:
|
|
2755
2838
|
Enabled: true
|
2756
2839
|
VersionAdded: '0.13'
|
2757
2840
|
|
2841
|
+
Style/CollectionCompact:
|
2842
|
+
Description: 'Use `{Array,Hash}#{compact,compact!}` instead of custom logic to reject nils.'
|
2843
|
+
Enabled: pending
|
2844
|
+
Safe: false
|
2845
|
+
VersionAdded: '1.2'
|
2846
|
+
VersionChanged: '1.3'
|
2847
|
+
|
2758
2848
|
# Align with the style guide.
|
2759
2849
|
Style/CollectionMethods:
|
2760
2850
|
Description: 'Preferred collection methods.'
|
@@ -2793,7 +2883,7 @@ Style/CombinableLoops:
|
|
2793
2883
|
Description: >-
|
2794
2884
|
Checks for places where multiple consecutive loops over the same data
|
2795
2885
|
can be combined into a single loop.
|
2796
|
-
Enabled:
|
2886
|
+
Enabled: true
|
2797
2887
|
Safe: false
|
2798
2888
|
VersionAdded: '0.90'
|
2799
2889
|
|
@@ -2818,17 +2908,18 @@ Style/CommandLiteral:
|
|
2818
2908
|
Style/CommentAnnotation:
|
2819
2909
|
Description: >-
|
2820
2910
|
Checks formatting of special comments
|
2821
|
-
(TODO, FIXME, OPTIMIZE, HACK, REVIEW).
|
2911
|
+
(TODO, FIXME, OPTIMIZE, HACK, REVIEW, NOTE).
|
2822
2912
|
StyleGuide: '#annotate-keywords'
|
2823
2913
|
Enabled: true
|
2824
2914
|
VersionAdded: '0.10'
|
2825
|
-
VersionChanged: '
|
2915
|
+
VersionChanged: '1.3'
|
2826
2916
|
Keywords:
|
2827
2917
|
- TODO
|
2828
2918
|
- FIXME
|
2829
2919
|
- OPTIMIZE
|
2830
2920
|
- HACK
|
2831
2921
|
- REVIEW
|
2922
|
+
- NOTE
|
2832
2923
|
|
2833
2924
|
Style/CommentedKeyword:
|
2834
2925
|
Description: 'Do not place comments on the same line as certain keywords.'
|
@@ -2917,6 +3008,15 @@ Style/DisableCopsWithinSourceCodeDirective:
|
|
2917
3008
|
Enabled: false
|
2918
3009
|
VersionAdded: '0.82'
|
2919
3010
|
|
3011
|
+
Style/DocumentDynamicEvalDefinition:
|
3012
|
+
Description: >-
|
3013
|
+
When using `class_eval` (or other `eval`) with string interpolation,
|
3014
|
+
add a comment block showing its appearance if interpolated.
|
3015
|
+
StyleGuide: '#eval-comment-docs'
|
3016
|
+
Enabled: pending
|
3017
|
+
VersionAdded: '1.1'
|
3018
|
+
VersionChanged: '1.3'
|
3019
|
+
|
2920
3020
|
Style/Documentation:
|
2921
3021
|
Description: 'Document classes and non-namespace modules.'
|
2922
3022
|
Enabled: true
|
@@ -2944,7 +3044,7 @@ Style/DoubleNegation:
|
|
2944
3044
|
StyleGuide: '#no-bang-bang'
|
2945
3045
|
Enabled: true
|
2946
3046
|
VersionAdded: '0.19'
|
2947
|
-
VersionChanged: '
|
3047
|
+
VersionChanged: '1.2'
|
2948
3048
|
EnforcedStyle: allowed_in_returns
|
2949
3049
|
SafeAutoCorrect: false
|
2950
3050
|
SupportedStyles:
|
@@ -3046,7 +3146,7 @@ Style/ExplicitBlockArgument:
|
|
3046
3146
|
Consider using explicit block argument to avoid writing block literal
|
3047
3147
|
that just passes its arguments to another block.
|
3048
3148
|
StyleGuide: '#block-argument'
|
3049
|
-
Enabled:
|
3149
|
+
Enabled: true
|
3050
3150
|
# May change the yielding arity.
|
3051
3151
|
Safe: false
|
3052
3152
|
VersionAdded: '0.89'
|
@@ -3054,7 +3154,7 @@ Style/ExplicitBlockArgument:
|
|
3054
3154
|
Style/ExponentialNotation:
|
3055
3155
|
Description: 'When using exponential notation, favor a mantissa between 1 (inclusive) and 10 (exclusive).'
|
3056
3156
|
StyleGuide: '#exponential-notation'
|
3057
|
-
Enabled:
|
3157
|
+
Enabled: true
|
3058
3158
|
VersionAdded: '0.82'
|
3059
3159
|
EnforcedStyle: scientific
|
3060
3160
|
SupportedStyles:
|
@@ -3109,8 +3209,12 @@ Style/FormatStringToken:
|
|
3109
3209
|
# Prefer simple looking "template" style tokens like `%{name}`, `%{age}`
|
3110
3210
|
- template
|
3111
3211
|
- unannotated
|
3212
|
+
# `MaxUnannotatedPlaceholdersAllowed` defines the number of `unannotated`
|
3213
|
+
# style token in a format string to be allowed when enforced style is not
|
3214
|
+
# `unannotated`.
|
3215
|
+
MaxUnannotatedPlaceholdersAllowed: 1
|
3112
3216
|
VersionAdded: '0.49'
|
3113
|
-
VersionChanged: '0
|
3217
|
+
VersionChanged: '1.0'
|
3114
3218
|
|
3115
3219
|
Style/FrozenStringLiteralComment:
|
3116
3220
|
Description: >-
|
@@ -3137,7 +3241,7 @@ Style/FrozenStringLiteralComment:
|
|
3137
3241
|
Style/GlobalStdStream:
|
3138
3242
|
Description: 'Enforces the use of `$stdout/$stderr/$stdin` instead of `STDOUT/STDERR/STDIN`.'
|
3139
3243
|
StyleGuide: '#global-stdout'
|
3140
|
-
Enabled:
|
3244
|
+
Enabled: true
|
3141
3245
|
VersionAdded: '0.89'
|
3142
3246
|
SafeAutoCorrect: false
|
3143
3247
|
|
@@ -3165,7 +3269,7 @@ Style/HashAsLastArrayItem:
|
|
3165
3269
|
Checks for presence or absence of braces around hash literal as a last
|
3166
3270
|
array item depending on configuration.
|
3167
3271
|
StyleGuide: '#hash-literal-as-last-array-item'
|
3168
|
-
Enabled:
|
3272
|
+
Enabled: true
|
3169
3273
|
VersionAdded: '0.88'
|
3170
3274
|
EnforcedStyle: braces
|
3171
3275
|
SupportedStyles:
|
@@ -3175,7 +3279,7 @@ Style/HashAsLastArrayItem:
|
|
3175
3279
|
Style/HashEachMethods:
|
3176
3280
|
Description: 'Use Hash#each_key and Hash#each_value.'
|
3177
3281
|
StyleGuide: '#hash-each'
|
3178
|
-
Enabled:
|
3282
|
+
Enabled: true
|
3179
3283
|
VersionAdded: '0.80'
|
3180
3284
|
Safe: false
|
3181
3285
|
|
@@ -3183,7 +3287,7 @@ Style/HashLikeCase:
|
|
3183
3287
|
Description: >-
|
3184
3288
|
Checks for places where `case-when` represents a simple 1:1
|
3185
3289
|
mapping and can be replaced with a hash lookup.
|
3186
|
-
Enabled:
|
3290
|
+
Enabled: true
|
3187
3291
|
VersionAdded: '0.88'
|
3188
3292
|
# `MinBranchesCount` defines the number of branches `case` needs to have
|
3189
3293
|
# to trigger this cop
|
@@ -3214,14 +3318,14 @@ Style/HashSyntax:
|
|
3214
3318
|
|
3215
3319
|
Style/HashTransformKeys:
|
3216
3320
|
Description: 'Prefer `transform_keys` over `each_with_object`, `map`, or `to_h`.'
|
3217
|
-
Enabled:
|
3321
|
+
Enabled: true
|
3218
3322
|
VersionAdded: '0.80'
|
3219
3323
|
VersionChanged: '0.90'
|
3220
3324
|
Safe: false
|
3221
3325
|
|
3222
3326
|
Style/HashTransformValues:
|
3223
3327
|
Description: 'Prefer `transform_values` over `each_with_object`, `map`, or `to_h`.'
|
3224
|
-
Enabled:
|
3328
|
+
Enabled: true
|
3225
3329
|
VersionAdded: '0.80'
|
3226
3330
|
VersionChanged: '0.90'
|
3227
3331
|
Safe: false
|
@@ -3239,6 +3343,7 @@ Style/IfInsideElse:
|
|
3239
3343
|
Enabled: true
|
3240
3344
|
AllowIfModifier: false
|
3241
3345
|
VersionAdded: '0.36'
|
3346
|
+
VersionChanged: '1.3'
|
3242
3347
|
|
3243
3348
|
Style/IfUnlessModifier:
|
3244
3349
|
Description: >-
|
@@ -3271,12 +3376,14 @@ Style/ImplicitRuntimeError:
|
|
3271
3376
|
VersionAdded: '0.41'
|
3272
3377
|
|
3273
3378
|
Style/InfiniteLoop:
|
3274
|
-
Description:
|
3379
|
+
Description: >-
|
3380
|
+
Use Kernel#loop for infinite loops.
|
3381
|
+
This cop is unsafe in the body may raise a `StopIteration` exception.
|
3382
|
+
Safe: false
|
3275
3383
|
StyleGuide: '#infinite-loop'
|
3276
3384
|
Enabled: true
|
3277
3385
|
VersionAdded: '0.26'
|
3278
3386
|
VersionChanged: '0.61'
|
3279
|
-
SafeAutoCorrect: true
|
3280
3387
|
|
3281
3388
|
Style/InlineComment:
|
3282
3389
|
Description: 'Avoid trailing inline comments.'
|
@@ -3328,7 +3435,7 @@ Style/IpAddresses:
|
|
3328
3435
|
Style/KeywordParametersOrder:
|
3329
3436
|
Description: 'Enforces that optional keyword parameters are placed at the end of the parameters list.'
|
3330
3437
|
StyleGuide: '#keyword-parameters-order'
|
3331
|
-
Enabled:
|
3438
|
+
Enabled: true
|
3332
3439
|
VersionAdded: '0.90'
|
3333
3440
|
|
3334
3441
|
Style/Lambda:
|
@@ -3530,6 +3637,7 @@ Style/MultipleComparison:
|
|
3530
3637
|
use Array#include? instead.
|
3531
3638
|
Enabled: true
|
3532
3639
|
VersionAdded: '0.49'
|
3640
|
+
VersionChanged: '1.1'
|
3533
3641
|
|
3534
3642
|
Style/MutableConstant:
|
3535
3643
|
Description: 'Do not assign mutable objects to constants.'
|
@@ -3564,6 +3672,13 @@ Style/NegatedIf:
|
|
3564
3672
|
- prefix
|
3565
3673
|
- postfix
|
3566
3674
|
|
3675
|
+
Style/NegatedIfElseCondition:
|
3676
|
+
Description: >-
|
3677
|
+
This cop checks for uses of `if-else` and ternary operators with a negated condition
|
3678
|
+
which can be simplified by inverting condition and swapping branches.
|
3679
|
+
Enabled: pending
|
3680
|
+
VersionAdded: '1.2'
|
3681
|
+
|
3567
3682
|
Style/NegatedUnless:
|
3568
3683
|
Description: 'Favor if over unless for negative conditions.'
|
3569
3684
|
StyleGuide: '#if-for-negatives'
|
@@ -3651,6 +3766,11 @@ Style/NilComparison:
|
|
3651
3766
|
- predicate
|
3652
3767
|
- comparison
|
3653
3768
|
|
3769
|
+
Style/NilLambda:
|
3770
|
+
Description: 'Prefer `-> {}` to `-> { nil }`.'
|
3771
|
+
Enabled: pending
|
3772
|
+
VersionAdded: '1.3'
|
3773
|
+
|
3654
3774
|
Style/NonNilCheck:
|
3655
3775
|
Description: 'Checks for redundant nil checks.'
|
3656
3776
|
StyleGuide: '#no-non-nil-checks'
|
@@ -3753,7 +3873,7 @@ Style/OptionalArguments:
|
|
3753
3873
|
Style/OptionalBooleanParameter:
|
3754
3874
|
Description: 'Use keyword arguments when defining method with boolean argument.'
|
3755
3875
|
StyleGuide: '#boolean-keyword-arguments'
|
3756
|
-
Enabled:
|
3876
|
+
Enabled: true
|
3757
3877
|
Safe: false
|
3758
3878
|
VersionAdded: '0.89'
|
3759
3879
|
AllowedMethods:
|
@@ -3800,7 +3920,7 @@ Style/PercentLiteralDelimiters:
|
|
3800
3920
|
'%r': '{}'
|
3801
3921
|
'%w': '[]'
|
3802
3922
|
'%W': '[]'
|
3803
|
-
VersionChanged: '0.48
|
3923
|
+
VersionChanged: '0.48'
|
3804
3924
|
|
3805
3925
|
Style/PercentQLiterals:
|
3806
3926
|
Description: 'Checks if uses of %Q/%q match the configured preference.'
|
@@ -3841,11 +3961,12 @@ Style/RaiseArgs:
|
|
3841
3961
|
StyleGuide: '#exception-class-messages'
|
3842
3962
|
Enabled: true
|
3843
3963
|
VersionAdded: '0.14'
|
3844
|
-
VersionChanged: '
|
3964
|
+
VersionChanged: '1.2'
|
3845
3965
|
EnforcedStyle: exploded
|
3846
3966
|
SupportedStyles:
|
3847
3967
|
- compact # raise Exception.new(msg)
|
3848
3968
|
- exploded # raise Exception, msg
|
3969
|
+
AllowedCompactTypes: []
|
3849
3970
|
|
3850
3971
|
Style/RandomWithOffset:
|
3851
3972
|
Description: >-
|
@@ -3857,7 +3978,7 @@ Style/RandomWithOffset:
|
|
3857
3978
|
|
3858
3979
|
Style/RedundantAssignment:
|
3859
3980
|
Description: 'Checks for redundant assignment before returning.'
|
3860
|
-
Enabled:
|
3981
|
+
Enabled: true
|
3861
3982
|
VersionAdded: '0.87'
|
3862
3983
|
|
3863
3984
|
Style/RedundantBegin:
|
@@ -3894,7 +4015,7 @@ Style/RedundantFetchBlock:
|
|
3894
4015
|
Use `fetch(key, value)` instead of `fetch(key) { value }`
|
3895
4016
|
when value has Numeric, Rational, Complex, Symbol or String type, `false`, `true`, `nil` or is a constant.
|
3896
4017
|
Reference: 'https://github.com/JuanitoFatas/fast-ruby#hashfetch-with-argument-vs-hashfetch--block-code'
|
3897
|
-
Enabled:
|
4018
|
+
Enabled: true
|
3898
4019
|
Safe: false
|
3899
4020
|
# If enabled, this cop will autocorrect usages of
|
3900
4021
|
# `fetch` being called with block returning a constant.
|
@@ -3907,7 +4028,7 @@ Style/RedundantFileExtensionInRequire:
|
|
3907
4028
|
Checks for the presence of superfluous `.rb` extension in
|
3908
4029
|
the filename provided to `require` and `require_relative`.
|
3909
4030
|
StyleGuide: '#no-explicit-rb-to-require'
|
3910
|
-
Enabled:
|
4031
|
+
Enabled: true
|
3911
4032
|
VersionAdded: '0.88'
|
3912
4033
|
|
3913
4034
|
Style/RedundantFreeze:
|
@@ -3934,12 +4055,12 @@ Style/RedundantPercentQ:
|
|
3934
4055
|
|
3935
4056
|
Style/RedundantRegexpCharacterClass:
|
3936
4057
|
Description: 'Checks for unnecessary single-element Regexp character classes.'
|
3937
|
-
Enabled:
|
4058
|
+
Enabled: true
|
3938
4059
|
VersionAdded: '0.85'
|
3939
4060
|
|
3940
4061
|
Style/RedundantRegexpEscape:
|
3941
4062
|
Description: 'Checks for redundant escapes in Regexps.'
|
3942
|
-
Enabled:
|
4063
|
+
Enabled: true
|
3943
4064
|
VersionAdded: '0.85'
|
3944
4065
|
|
3945
4066
|
Style/RedundantReturn:
|
@@ -3960,7 +4081,7 @@ Style/RedundantSelf:
|
|
3960
4081
|
|
3961
4082
|
Style/RedundantSelfAssignment:
|
3962
4083
|
Description: 'Checks for places where redundant assignments are made for in place modification methods.'
|
3963
|
-
Enabled:
|
4084
|
+
Enabled: true
|
3964
4085
|
Safe: false
|
3965
4086
|
VersionAdded: '0.90'
|
3966
4087
|
|
@@ -4088,7 +4209,7 @@ Style/SignalException:
|
|
4088
4209
|
|
4089
4210
|
Style/SingleArgumentDig:
|
4090
4211
|
Description: 'Avoid using single argument dig method.'
|
4091
|
-
Enabled:
|
4212
|
+
Enabled: true
|
4092
4213
|
VersionAdded: '0.89'
|
4093
4214
|
Safe: false
|
4094
4215
|
|
@@ -4115,7 +4236,7 @@ Style/SingleLineMethods:
|
|
4115
4236
|
|
4116
4237
|
Style/SlicingWithRange:
|
4117
4238
|
Description: 'Checks array slicing is done with endless ranges when suitable.'
|
4118
|
-
Enabled:
|
4239
|
+
Enabled: true
|
4119
4240
|
VersionAdded: '0.83'
|
4120
4241
|
Safe: false
|
4121
4242
|
|
@@ -4123,7 +4244,7 @@ Style/SoleNestedConditional:
|
|
4123
4244
|
Description: >-
|
4124
4245
|
Finds sole nested conditional nodes
|
4125
4246
|
which can be merged into outer conditional node.
|
4126
|
-
Enabled:
|
4247
|
+
Enabled: true
|
4127
4248
|
VersionAdded: '0.89'
|
4128
4249
|
AllowModifier: false
|
4129
4250
|
|
@@ -4149,6 +4270,13 @@ Style/StabbyLambdaParentheses:
|
|
4149
4270
|
- require_parentheses
|
4150
4271
|
- require_no_parentheses
|
4151
4272
|
|
4273
|
+
Style/StaticClass:
|
4274
|
+
Description: 'Prefer modules to classes with only class methods.'
|
4275
|
+
StyleGuide: '#modules-vs-classes'
|
4276
|
+
Enabled: false
|
4277
|
+
Safe: false
|
4278
|
+
VersionAdded: '1.3'
|
4279
|
+
|
4152
4280
|
Style/StderrPuts:
|
4153
4281
|
Description: 'Use `warn` instead of `$stderr.puts`.'
|
4154
4282
|
StyleGuide: '#warn'
|
@@ -4158,7 +4286,7 @@ Style/StderrPuts:
|
|
4158
4286
|
Style/StringConcatenation:
|
4159
4287
|
Description: 'Checks for places where string concatenation can be replaced with string interpolation.'
|
4160
4288
|
StyleGuide: '#string-interpolation'
|
4161
|
-
Enabled:
|
4289
|
+
Enabled: true
|
4162
4290
|
Safe: false
|
4163
4291
|
VersionAdded: '0.89'
|
4164
4292
|
|
@@ -4199,7 +4327,7 @@ Style/StringMethods:
|
|
4199
4327
|
Description: 'Checks if configured preferred methods are used over non-preferred.'
|
4200
4328
|
Enabled: false
|
4201
4329
|
VersionAdded: '0.34'
|
4202
|
-
VersionChanged: '0.34
|
4330
|
+
VersionChanged: '0.34'
|
4203
4331
|
# Mapping from undesired method to desired_method
|
4204
4332
|
# e.g. to use `to_sym` over `intern`:
|
4205
4333
|
#
|
@@ -4221,6 +4349,13 @@ Style/StructInheritance:
|
|
4221
4349
|
VersionAdded: '0.29'
|
4222
4350
|
VersionChanged: '0.86'
|
4223
4351
|
|
4352
|
+
Style/SwapValues:
|
4353
|
+
Description: 'This cop enforces the use of shorthand-style swapping of 2 variables.'
|
4354
|
+
StyleGuide: '#values-swapping'
|
4355
|
+
Enabled: pending
|
4356
|
+
VersionAdded: '1.1'
|
4357
|
+
SafeAutoCorrect: false
|
4358
|
+
|
4224
4359
|
Style/SymbolArray:
|
4225
4360
|
Description: 'Use %i or %I for arrays of symbols.'
|
4226
4361
|
StyleGuide: '#percent-i'
|