rubocop 1.0.0 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +36 -16
- data/config/default.yml +165 -19
- data/exe/rubocop +1 -1
- data/lib/rubocop.rb +17 -0
- data/lib/rubocop/cli/command/auto_genenerate_config.rb +1 -1
- data/lib/rubocop/cli/command/execute_runner.rb +26 -11
- data/lib/rubocop/comment_config.rb +1 -1
- data/lib/rubocop/config_loader.rb +14 -5
- data/lib/rubocop/config_regeneration.rb +1 -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 +10 -10
- 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/internal_affairs/useless_message_assertion.rb +1 -1
- data/lib/rubocop/cop/layout/block_alignment.rb +3 -4
- data/lib/rubocop/cop/layout/class_structure.rb +15 -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_line_between_defs.rb +77 -7
- 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_method_call_operator.rb +1 -1
- data/lib/rubocop/cop/layout/space_inside_parens.rb +35 -13
- data/lib/rubocop/cop/layout/trailing_whitespace.rb +1 -1
- data/lib/rubocop/cop/lint/ambiguous_regexp_literal.rb +2 -1
- 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 +39 -7
- data/lib/rubocop/cop/lint/loop.rb +4 -4
- data/lib/rubocop/cop/lint/missing_super.rb +7 -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/unmodified_reduce_accumulator.rb +194 -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/method_length.rb +1 -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/multiline_expression_indentation.rb +1 -1
- data/lib/rubocop/cop/mixin/statement_modifier.rb +9 -4
- data/lib/rubocop/cop/mixin/visibility_help.rb +1 -3
- data/lib/rubocop/cop/naming/binary_operator_parameter_name.rb +11 -1
- 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/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/documentation.rb +12 -1
- data/lib/rubocop/cop/style/double_negation.rb +6 -1
- 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/omit_parentheses.rb +2 -2
- 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_argument.rb +73 -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/semicolon.rb +3 -0
- data/lib/rubocop/cop/style/static_class.rb +97 -0
- data/lib/rubocop/cop/style/swap_values.rb +108 -0
- 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 +6 -2
- data/lib/rubocop/cop/variable_force/branch.rb +1 -1
- data/lib/rubocop/cop/variable_force/scope.rb +1 -1
- data/lib/rubocop/ext/regexp_node.rb +17 -9
- data/lib/rubocop/ext/regexp_parser.rb +84 -0
- data/lib/rubocop/formatter/disabled_config_formatter.rb +21 -6
- data/lib/rubocop/formatter/formatter_set.rb +2 -1
- data/lib/rubocop/formatter/git_hub_actions_formatter.rb +47 -0
- data/lib/rubocop/magic_comment.rb +2 -2
- data/lib/rubocop/options.rb +7 -0
- data/lib/rubocop/rake_task.rb +2 -2
- data/lib/rubocop/rspec/shared_contexts.rb +4 -0
- data/lib/rubocop/runner.rb +1 -1
- data/lib/rubocop/target_finder.rb +1 -1
- data/lib/rubocop/target_ruby.rb +65 -1
- data/lib/rubocop/version.rb +1 -1
- metadata +22 -10
- data/assets/logo.png +0 -0
- data/assets/output.html.erb +0 -261
- data/bin/console +0 -10
- data/bin/rubocop-profile +0 -32
- data/bin/setup +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 840dbd224c26defdcf3fe6d5c48f6e495f4288141a38f5e79de74552a0a1d9d8
|
4
|
+
data.tar.gz: 381215eaceb9e62bdb1ba0df04880b4b8c702bfd4e11df78d0683b539451fb3c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d3a563aeb426e7ae74dcc9dbc28d153e3b672d0abcae22bea62ff6077bb2bb7eff78cdacf3f4f9a384d09ddc417744135c3a47536145052bbbca985008514b5e
|
7
|
+
data.tar.gz: 0c832cf607fa6fe0bd5513dc82f315638285f225c7456a2a884830cd173bb740ca741b4ea2279e908b8a00ecb94e60f40c7b2064841efa2152f50ce6a40477a2
|
data/README.md
CHANGED
@@ -11,11 +11,6 @@
|
|
11
11
|
[![Maintainability](https://api.codeclimate.com/v1/badges/d2d67f728e88ea84ac69/maintainability)](https://codeclimate.com/github/rubocop-hq/rubocop/maintainability)
|
12
12
|
[![SemVer](https://api.dependabot.com/badges/compatibility_score?dependency-name=rubocop&package-manager=bundler&version-scheme=semver)](https://dependabot.com/compatibility-score.html?dependency-name=rubocop&package-manager=bundler&version-scheme=semver)
|
13
13
|
|
14
|
-
[![Patreon](https://img.shields.io/badge/patreon-donate-orange.svg)](https://www.patreon.com/bbatsov)
|
15
|
-
[![OpenCollective](https://opencollective.com/rubocop/backers/badge.svg)](#open-collective-backers)
|
16
|
-
[![OpenCollective](https://opencollective.com/rubocop/sponsors/badge.svg)](#open-collective-sponsors)
|
17
|
-
[![Tidelift](https://tidelift.com/badges/package/rubygems/rubocop)](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
|
+
[![Patreon](https://img.shields.io/badge/patreon-donate-orange.svg)](https://www.patreon.com/bbatsov)
|
27
|
+
[![OpenCollective](https://opencollective.com/rubocop/backers/badge.svg)](#open-collective-backers)
|
28
|
+
[![OpenCollective](https://opencollective.com/rubocop/sponsors/badge.svg)](#open-collective-sponsors)
|
29
|
+
[![Tidelift](https://tidelift.com/badges/package/rubygems/rubocop)](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', '~> 1.
|
54
|
+
gem 'rubocop', '~> 1.4', 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
|
[![Ruby Style Guide](https://img.shields.io/badge/code_style-community-brightgreen.svg)](https://rubystyle.guide)
|
84
88
|
|
89
|
+
|
90
|
+
Here are the Markdown snippets for the two badges:
|
91
|
+
|
92
|
+
``` markdown
|
93
|
+
[![Ruby Style Guide](https://img.shields.io/badge/code_style-rubocop-brightgreen.svg)](https://github.com/rubocop-hq/rubocop)
|
94
|
+
|
95
|
+
[![Ruby Style Guide](https://img.shields.io/badge/code_style-community-brightgreen.svg)](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
@@ -463,6 +463,10 @@ Layout/EmptyLineBetweenDefs:
|
|
463
463
|
StyleGuide: '#empty-lines-between-methods'
|
464
464
|
Enabled: true
|
465
465
|
VersionAdded: '0.49'
|
466
|
+
VersionChanged: '1.4'
|
467
|
+
EmptyLineBetweenMethodDefs: true
|
468
|
+
EmptyLineBetweenClassDefs: true
|
469
|
+
EmptyLineBetweenModuleDefs: true
|
466
470
|
# If `true`, this parameter means that single line method definitions don't
|
467
471
|
# need an empty line between them.
|
468
472
|
AllowAdjacentOneLineDefs: false
|
@@ -891,8 +895,8 @@ Layout/LineLength:
|
|
891
895
|
StyleGuide: '#max-line-length'
|
892
896
|
Enabled: true
|
893
897
|
VersionAdded: '0.25'
|
894
|
-
VersionChanged: '
|
895
|
-
AutoCorrect:
|
898
|
+
VersionChanged: '1.4'
|
899
|
+
AutoCorrect: true
|
896
900
|
Max: 120
|
897
901
|
# To make it possible to copy or click on URIs in the code, we allow lines
|
898
902
|
# containing a URI to be longer than Max.
|
@@ -1176,7 +1180,7 @@ Layout/SpaceBeforeBlockBraces:
|
|
1176
1180
|
SupportedStylesForEmptyBraces:
|
1177
1181
|
- space
|
1178
1182
|
- no_space
|
1179
|
-
VersionChanged: '0.52
|
1183
|
+
VersionChanged: '0.52'
|
1180
1184
|
|
1181
1185
|
Layout/SpaceBeforeComma:
|
1182
1186
|
Description: 'No spaces before commas.'
|
@@ -1334,7 +1338,7 @@ Layout/TrailingWhitespace:
|
|
1334
1338
|
StyleGuide: '#no-trailing-whitespace'
|
1335
1339
|
Enabled: true
|
1336
1340
|
VersionAdded: '0.49'
|
1337
|
-
VersionChanged: '0
|
1341
|
+
VersionChanged: '1.0'
|
1338
1342
|
AllowInHeredoc: false
|
1339
1343
|
|
1340
1344
|
#################### Lint ##################################
|
@@ -1400,6 +1404,11 @@ Lint/ConstantDefinitionInBlock:
|
|
1400
1404
|
StyleGuide: '#no-constant-definition-in-block'
|
1401
1405
|
Enabled: true
|
1402
1406
|
VersionAdded: '0.91'
|
1407
|
+
VersionChanged: '1.3'
|
1408
|
+
# `enums` for Typed Enums via T::Enum in Sorbet.
|
1409
|
+
# https://sorbet.org/docs/tenum
|
1410
|
+
AllowedMethods:
|
1411
|
+
- enums
|
1403
1412
|
|
1404
1413
|
Lint/ConstantResolution:
|
1405
1414
|
Description: 'Check that constants are fully qualified with `::`.'
|
@@ -1415,6 +1424,22 @@ Lint/Debugger:
|
|
1415
1424
|
Enabled: true
|
1416
1425
|
VersionAdded: '0.14'
|
1417
1426
|
VersionChanged: '0.49'
|
1427
|
+
DebuggerReceivers:
|
1428
|
+
- binding
|
1429
|
+
- Kernel
|
1430
|
+
- Pry
|
1431
|
+
DebuggerMethods:
|
1432
|
+
- debugger
|
1433
|
+
- byebug
|
1434
|
+
- remote_byebug
|
1435
|
+
- pry
|
1436
|
+
- remote_pry
|
1437
|
+
- pry_remote
|
1438
|
+
- console
|
1439
|
+
- rescue
|
1440
|
+
- save_and_open_page
|
1441
|
+
- save_and_open_screenshot
|
1442
|
+
- irb
|
1418
1443
|
|
1419
1444
|
Lint/DeprecatedClassMethods:
|
1420
1445
|
Description: 'Check for deprecated class method calls.'
|
@@ -1433,6 +1458,11 @@ Lint/DisjunctiveAssignmentInConstructor:
|
|
1433
1458
|
VersionAdded: '0.62'
|
1434
1459
|
VersionChanged: '0.88'
|
1435
1460
|
|
1461
|
+
Lint/DuplicateBranch:
|
1462
|
+
Description: Checks that there are no repeated bodies within `if/unless`, `case-when` and `rescue` constructs.
|
1463
|
+
Enabled: pending
|
1464
|
+
VersionAdded: '1.3'
|
1465
|
+
|
1436
1466
|
Lint/DuplicateCaseCondition:
|
1437
1467
|
Description: 'Do not repeat values in case conditionals.'
|
1438
1468
|
Enabled: true
|
@@ -1454,6 +1484,11 @@ Lint/DuplicateMethods:
|
|
1454
1484
|
Enabled: true
|
1455
1485
|
VersionAdded: '0.29'
|
1456
1486
|
|
1487
|
+
Lint/DuplicateRegexpCharacterClassElement:
|
1488
|
+
Description: 'Checks for duplicate elements in Regexp character classes.'
|
1489
|
+
Enabled: pending
|
1490
|
+
VersionAdded: '1.1'
|
1491
|
+
|
1457
1492
|
Lint/DuplicateRequire:
|
1458
1493
|
Description: 'Check for duplicate `require`s and `require_relative`s.'
|
1459
1494
|
Enabled: true
|
@@ -1473,6 +1508,21 @@ Lint/ElseLayout:
|
|
1473
1508
|
Description: 'Check for odd code arrangement in an else block.'
|
1474
1509
|
Enabled: true
|
1475
1510
|
VersionAdded: '0.17'
|
1511
|
+
VersionChanged: '1.2'
|
1512
|
+
|
1513
|
+
Lint/EmptyBlock:
|
1514
|
+
Description: 'This cop checks for blocks without a body.'
|
1515
|
+
Enabled: pending
|
1516
|
+
VersionAdded: '1.1'
|
1517
|
+
VersionChanged: '1.3'
|
1518
|
+
AllowComments: true
|
1519
|
+
AllowEmptyLambdas: true
|
1520
|
+
|
1521
|
+
Lint/EmptyClass:
|
1522
|
+
Description: 'Checks for classes and metaclasses without a body.'
|
1523
|
+
Enabled: pending
|
1524
|
+
VersionAdded: '1.3'
|
1525
|
+
AllowComments: false
|
1476
1526
|
|
1477
1527
|
Lint/EmptyConditionalBody:
|
1478
1528
|
Description: 'This cop checks for the presence of `if`, `elsif` and `unless` branches without a body.'
|
@@ -1616,7 +1666,8 @@ Lint/Loop:
|
|
1616
1666
|
StyleGuide: '#loop-with-break'
|
1617
1667
|
Enabled: true
|
1618
1668
|
VersionAdded: '0.9'
|
1619
|
-
VersionChanged: '
|
1669
|
+
VersionChanged: '1.3'
|
1670
|
+
Safe: false
|
1620
1671
|
|
1621
1672
|
Lint/MissingCopEnableDirective:
|
1622
1673
|
Description: 'Checks for a `# rubocop:enable` after `# rubocop:disable`.'
|
@@ -1637,6 +1688,7 @@ Lint/MissingSuper:
|
|
1637
1688
|
without calls to `super`'.
|
1638
1689
|
Enabled: true
|
1639
1690
|
VersionAdded: '0.89'
|
1691
|
+
VersionChanged: '1.4'
|
1640
1692
|
|
1641
1693
|
Lint/MixedRegexpCaptureTypes:
|
1642
1694
|
Description: 'Do not mix named captures and numbered captures in a Regexp literal.'
|
@@ -1647,7 +1699,8 @@ Lint/MultipleComparison:
|
|
1647
1699
|
Description: "Use `&&` operator to compare multiple values."
|
1648
1700
|
Enabled: true
|
1649
1701
|
VersionAdded: '0.47'
|
1650
|
-
VersionChanged: '
|
1702
|
+
VersionChanged: '1.1'
|
1703
|
+
AllowMethodComparison: true
|
1651
1704
|
|
1652
1705
|
Lint/NestedMethodDefinition:
|
1653
1706
|
Description: 'Do not use nested method definitions.'
|
@@ -1667,6 +1720,11 @@ Lint/NextWithoutAccumulator:
|
|
1667
1720
|
Enabled: true
|
1668
1721
|
VersionAdded: '0.36'
|
1669
1722
|
|
1723
|
+
Lint/NoReturnInBeginEndBlocks:
|
1724
|
+
Description: 'Do not `return` inside `begin..end` blocks in assignment contexts.'
|
1725
|
+
Enabled: pending
|
1726
|
+
VersionAdded: '1.2'
|
1727
|
+
|
1670
1728
|
Lint/NonDeterministicRequireOrder:
|
1671
1729
|
Description: 'Always sort arrays returned by Dir.glob when requiring files.'
|
1672
1730
|
Enabled: true
|
@@ -1682,8 +1740,12 @@ Lint/NumberConversion:
|
|
1682
1740
|
Description: 'Checks unsafe usage of number conversion methods.'
|
1683
1741
|
Enabled: false
|
1684
1742
|
VersionAdded: '0.53'
|
1685
|
-
VersionChanged: '
|
1743
|
+
VersionChanged: '1.1'
|
1686
1744
|
SafeAutoCorrect: false
|
1745
|
+
IgnoredMethods: []
|
1746
|
+
IgnoredClasses:
|
1747
|
+
- Time
|
1748
|
+
- DateTime
|
1687
1749
|
|
1688
1750
|
Lint/OrderedMagicComments:
|
1689
1751
|
Description: 'Checks the proper ordering of magic comments and whether a magic comment is not placed before a shebang.'
|
@@ -1808,7 +1870,7 @@ Lint/RescueException:
|
|
1808
1870
|
StyleGuide: '#no-blind-rescues'
|
1809
1871
|
Enabled: true
|
1810
1872
|
VersionAdded: '0.9'
|
1811
|
-
VersionChanged: '0.27
|
1873
|
+
VersionChanged: '0.27'
|
1812
1874
|
|
1813
1875
|
Lint/RescueType:
|
1814
1876
|
Description: 'Avoid rescuing from non constants that could result in a `TypeError`.'
|
@@ -1910,6 +1972,11 @@ Lint/Syntax:
|
|
1910
1972
|
VersionAdded: '0.9'
|
1911
1973
|
|
1912
1974
|
|
1975
|
+
Lint/ToEnumArguments:
|
1976
|
+
Description: 'This cop ensures that `to_enum`/`enum_for`, called for the current method, has correct arguments.'
|
1977
|
+
Enabled: pending
|
1978
|
+
VersionAdded: '1.1'
|
1979
|
+
|
1913
1980
|
Lint/ToJSON:
|
1914
1981
|
Description: 'Ensure #to_json includes an optional argument.'
|
1915
1982
|
Enabled: true
|
@@ -1936,6 +2003,11 @@ Lint/UnifiedInteger:
|
|
1936
2003
|
Enabled: true
|
1937
2004
|
VersionAdded: '0.43'
|
1938
2005
|
|
2006
|
+
Lint/UnmodifiedReduceAccumulator:
|
2007
|
+
Description: Checks for `reduce` or `inject` blocks that do not update the accumulator each iteration.
|
2008
|
+
Enabled: pending
|
2009
|
+
VersionAdded: '1.1'
|
2010
|
+
|
1939
2011
|
Lint/UnreachableCode:
|
1940
2012
|
Description: 'Unreachable code.'
|
1941
2013
|
Enabled: true
|
@@ -2010,8 +2082,9 @@ Lint/UselessMethodDefinition:
|
|
2010
2082
|
Lint/UselessSetterCall:
|
2011
2083
|
Description: 'Checks for useless setter call to a local variable.'
|
2012
2084
|
Enabled: true
|
2085
|
+
SafeAutoCorrect: false
|
2013
2086
|
VersionAdded: '0.13'
|
2014
|
-
VersionChanged: '
|
2087
|
+
VersionChanged: '1.2'
|
2015
2088
|
Safe: false
|
2016
2089
|
|
2017
2090
|
Lint/UselessTimes:
|
@@ -2155,6 +2228,7 @@ Naming/BinaryOperatorParameterName:
|
|
2155
2228
|
StyleGuide: '#other-arg'
|
2156
2229
|
Enabled: true
|
2157
2230
|
VersionAdded: '0.50'
|
2231
|
+
VersionChanged: '1.2'
|
2158
2232
|
|
2159
2233
|
Naming/BlockParameterName:
|
2160
2234
|
Description: >-
|
@@ -2261,6 +2335,7 @@ Naming/HeredocDelimiterCase:
|
|
2261
2335
|
StyleGuide: '#heredoc-delimiters'
|
2262
2336
|
Enabled: true
|
2263
2337
|
VersionAdded: '0.50'
|
2338
|
+
VersionChanged: '1.2'
|
2264
2339
|
EnforcedStyle: uppercase
|
2265
2340
|
SupportedStyles:
|
2266
2341
|
- lowercase
|
@@ -2279,7 +2354,7 @@ Naming/MemoizedInstanceVariableName:
|
|
2279
2354
|
Memoized method name should match memo instance variable name.
|
2280
2355
|
Enabled: true
|
2281
2356
|
VersionAdded: '0.53'
|
2282
|
-
VersionChanged: '
|
2357
|
+
VersionChanged: '1.2'
|
2283
2358
|
EnforcedStyleForLeadingUnderscores: disallowed
|
2284
2359
|
SupportedStylesForLeadingUnderscores:
|
2285
2360
|
- disallowed
|
@@ -2377,14 +2452,19 @@ Naming/VariableName:
|
|
2377
2452
|
- camelCase
|
2378
2453
|
|
2379
2454
|
Naming/VariableNumber:
|
2380
|
-
Description: 'Use the configured style when numbering variables.'
|
2455
|
+
Description: 'Use the configured style when numbering symbols, methods and variables.'
|
2456
|
+
StyleGuide: '#snake-case-symbols-methods-vars-with-numbers'
|
2381
2457
|
Enabled: true
|
2382
2458
|
VersionAdded: '0.50'
|
2459
|
+
VersionChanged: '1.3'
|
2383
2460
|
EnforcedStyle: normalcase
|
2384
2461
|
SupportedStyles:
|
2385
2462
|
- snake_case
|
2386
2463
|
- normalcase
|
2387
2464
|
- non_integer
|
2465
|
+
CheckMethodNames: true
|
2466
|
+
CheckSymbols: true
|
2467
|
+
AllowedIdentifiers: []
|
2388
2468
|
|
2389
2469
|
#################### Security ##############################
|
2390
2470
|
|
@@ -2478,6 +2558,13 @@ Style/AndOr:
|
|
2478
2558
|
- always
|
2479
2559
|
- conditionals
|
2480
2560
|
|
2561
|
+
Style/ArgumentsForwarding:
|
2562
|
+
Description: 'Use arguments forwarding.'
|
2563
|
+
StyleGuide: '#arguments-forwarding'
|
2564
|
+
Enabled: pending
|
2565
|
+
AllowOnlyRestArgument: true
|
2566
|
+
VersionAdded: '1.1'
|
2567
|
+
|
2481
2568
|
Style/ArrayCoercion:
|
2482
2569
|
Description: >-
|
2483
2570
|
Use Array() instead of explicit Array check or [*var], when dealing
|
@@ -2756,6 +2843,13 @@ Style/ClassVars:
|
|
2756
2843
|
Enabled: true
|
2757
2844
|
VersionAdded: '0.13'
|
2758
2845
|
|
2846
|
+
Style/CollectionCompact:
|
2847
|
+
Description: 'Use `{Array,Hash}#{compact,compact!}` instead of custom logic to reject nils.'
|
2848
|
+
Enabled: pending
|
2849
|
+
Safe: false
|
2850
|
+
VersionAdded: '1.2'
|
2851
|
+
VersionChanged: '1.3'
|
2852
|
+
|
2759
2853
|
# Align with the style guide.
|
2760
2854
|
Style/CollectionMethods:
|
2761
2855
|
Description: 'Preferred collection methods.'
|
@@ -2819,17 +2913,18 @@ Style/CommandLiteral:
|
|
2819
2913
|
Style/CommentAnnotation:
|
2820
2914
|
Description: >-
|
2821
2915
|
Checks formatting of special comments
|
2822
|
-
(TODO, FIXME, OPTIMIZE, HACK, REVIEW).
|
2916
|
+
(TODO, FIXME, OPTIMIZE, HACK, REVIEW, NOTE).
|
2823
2917
|
StyleGuide: '#annotate-keywords'
|
2824
2918
|
Enabled: true
|
2825
2919
|
VersionAdded: '0.10'
|
2826
|
-
VersionChanged: '
|
2920
|
+
VersionChanged: '1.3'
|
2827
2921
|
Keywords:
|
2828
2922
|
- TODO
|
2829
2923
|
- FIXME
|
2830
2924
|
- OPTIMIZE
|
2831
2925
|
- HACK
|
2832
2926
|
- REVIEW
|
2927
|
+
- NOTE
|
2833
2928
|
|
2834
2929
|
Style/CommentedKeyword:
|
2835
2930
|
Description: 'Do not place comments on the same line as certain keywords.'
|
@@ -2918,6 +3013,15 @@ Style/DisableCopsWithinSourceCodeDirective:
|
|
2918
3013
|
Enabled: false
|
2919
3014
|
VersionAdded: '0.82'
|
2920
3015
|
|
3016
|
+
Style/DocumentDynamicEvalDefinition:
|
3017
|
+
Description: >-
|
3018
|
+
When using `class_eval` (or other `eval`) with string interpolation,
|
3019
|
+
add a comment block showing its appearance if interpolated.
|
3020
|
+
StyleGuide: '#eval-comment-docs'
|
3021
|
+
Enabled: pending
|
3022
|
+
VersionAdded: '1.1'
|
3023
|
+
VersionChanged: '1.3'
|
3024
|
+
|
2921
3025
|
Style/Documentation:
|
2922
3026
|
Description: 'Document classes and non-namespace modules.'
|
2923
3027
|
Enabled: true
|
@@ -2945,7 +3049,7 @@ Style/DoubleNegation:
|
|
2945
3049
|
StyleGuide: '#no-bang-bang'
|
2946
3050
|
Enabled: true
|
2947
3051
|
VersionAdded: '0.19'
|
2948
|
-
VersionChanged: '
|
3052
|
+
VersionChanged: '1.2'
|
2949
3053
|
EnforcedStyle: allowed_in_returns
|
2950
3054
|
SafeAutoCorrect: false
|
2951
3055
|
SupportedStyles:
|
@@ -3244,6 +3348,7 @@ Style/IfInsideElse:
|
|
3244
3348
|
Enabled: true
|
3245
3349
|
AllowIfModifier: false
|
3246
3350
|
VersionAdded: '0.36'
|
3351
|
+
VersionChanged: '1.3'
|
3247
3352
|
|
3248
3353
|
Style/IfUnlessModifier:
|
3249
3354
|
Description: >-
|
@@ -3276,12 +3381,14 @@ Style/ImplicitRuntimeError:
|
|
3276
3381
|
VersionAdded: '0.41'
|
3277
3382
|
|
3278
3383
|
Style/InfiniteLoop:
|
3279
|
-
Description:
|
3384
|
+
Description: >-
|
3385
|
+
Use Kernel#loop for infinite loops.
|
3386
|
+
This cop is unsafe in the body may raise a `StopIteration` exception.
|
3387
|
+
Safe: false
|
3280
3388
|
StyleGuide: '#infinite-loop'
|
3281
3389
|
Enabled: true
|
3282
3390
|
VersionAdded: '0.26'
|
3283
3391
|
VersionChanged: '0.61'
|
3284
|
-
SafeAutoCorrect: true
|
3285
3392
|
|
3286
3393
|
Style/InlineComment:
|
3287
3394
|
Description: 'Avoid trailing inline comments.'
|
@@ -3535,6 +3642,7 @@ Style/MultipleComparison:
|
|
3535
3642
|
use Array#include? instead.
|
3536
3643
|
Enabled: true
|
3537
3644
|
VersionAdded: '0.49'
|
3645
|
+
VersionChanged: '1.1'
|
3538
3646
|
|
3539
3647
|
Style/MutableConstant:
|
3540
3648
|
Description: 'Do not assign mutable objects to constants.'
|
@@ -3569,6 +3677,13 @@ Style/NegatedIf:
|
|
3569
3677
|
- prefix
|
3570
3678
|
- postfix
|
3571
3679
|
|
3680
|
+
Style/NegatedIfElseCondition:
|
3681
|
+
Description: >-
|
3682
|
+
This cop checks for uses of `if-else` and ternary operators with a negated condition
|
3683
|
+
which can be simplified by inverting condition and swapping branches.
|
3684
|
+
Enabled: pending
|
3685
|
+
VersionAdded: '1.2'
|
3686
|
+
|
3572
3687
|
Style/NegatedUnless:
|
3573
3688
|
Description: 'Favor if over unless for negative conditions.'
|
3574
3689
|
StyleGuide: '#if-for-negatives'
|
@@ -3656,6 +3771,11 @@ Style/NilComparison:
|
|
3656
3771
|
- predicate
|
3657
3772
|
- comparison
|
3658
3773
|
|
3774
|
+
Style/NilLambda:
|
3775
|
+
Description: 'Prefer `-> {}` to `-> { nil }`.'
|
3776
|
+
Enabled: pending
|
3777
|
+
VersionAdded: '1.3'
|
3778
|
+
|
3659
3779
|
Style/NonNilCheck:
|
3660
3780
|
Description: 'Checks for redundant nil checks.'
|
3661
3781
|
StyleGuide: '#no-non-nil-checks'
|
@@ -3805,7 +3925,7 @@ Style/PercentLiteralDelimiters:
|
|
3805
3925
|
'%r': '{}'
|
3806
3926
|
'%w': '[]'
|
3807
3927
|
'%W': '[]'
|
3808
|
-
VersionChanged: '0.48
|
3928
|
+
VersionChanged: '0.48'
|
3809
3929
|
|
3810
3930
|
Style/PercentQLiterals:
|
3811
3931
|
Description: 'Checks if uses of %Q/%q match the configured preference.'
|
@@ -3846,11 +3966,12 @@ Style/RaiseArgs:
|
|
3846
3966
|
StyleGuide: '#exception-class-messages'
|
3847
3967
|
Enabled: true
|
3848
3968
|
VersionAdded: '0.14'
|
3849
|
-
VersionChanged: '
|
3969
|
+
VersionChanged: '1.2'
|
3850
3970
|
EnforcedStyle: exploded
|
3851
3971
|
SupportedStyles:
|
3852
3972
|
- compact # raise Exception.new(msg)
|
3853
3973
|
- exploded # raise Exception, msg
|
3974
|
+
AllowedCompactTypes: []
|
3854
3975
|
|
3855
3976
|
Style/RandomWithOffset:
|
3856
3977
|
Description: >-
|
@@ -3860,6 +3981,17 @@ Style/RandomWithOffset:
|
|
3860
3981
|
Enabled: true
|
3861
3982
|
VersionAdded: '0.52'
|
3862
3983
|
|
3984
|
+
Style/RedundantArgument:
|
3985
|
+
Description: 'Check for a redundant argument passed to certain methods.'
|
3986
|
+
Enabled: pending
|
3987
|
+
Safe: false
|
3988
|
+
VersionAdded: '1.4'
|
3989
|
+
Methods:
|
3990
|
+
# Array#join
|
3991
|
+
join: ''
|
3992
|
+
# String#split
|
3993
|
+
split: ' '
|
3994
|
+
|
3863
3995
|
Style/RedundantAssignment:
|
3864
3996
|
Description: 'Checks for redundant assignment before returning.'
|
3865
3997
|
Enabled: true
|
@@ -4154,6 +4286,13 @@ Style/StabbyLambdaParentheses:
|
|
4154
4286
|
- require_parentheses
|
4155
4287
|
- require_no_parentheses
|
4156
4288
|
|
4289
|
+
Style/StaticClass:
|
4290
|
+
Description: 'Prefer modules to classes with only class methods.'
|
4291
|
+
StyleGuide: '#modules-vs-classes'
|
4292
|
+
Enabled: false
|
4293
|
+
Safe: false
|
4294
|
+
VersionAdded: '1.3'
|
4295
|
+
|
4157
4296
|
Style/StderrPuts:
|
4158
4297
|
Description: 'Use `warn` instead of `$stderr.puts`.'
|
4159
4298
|
StyleGuide: '#warn'
|
@@ -4204,7 +4343,7 @@ Style/StringMethods:
|
|
4204
4343
|
Description: 'Checks if configured preferred methods are used over non-preferred.'
|
4205
4344
|
Enabled: false
|
4206
4345
|
VersionAdded: '0.34'
|
4207
|
-
VersionChanged: '0.34
|
4346
|
+
VersionChanged: '0.34'
|
4208
4347
|
# Mapping from undesired method to desired_method
|
4209
4348
|
# e.g. to use `to_sym` over `intern`:
|
4210
4349
|
#
|
@@ -4226,6 +4365,13 @@ Style/StructInheritance:
|
|
4226
4365
|
VersionAdded: '0.29'
|
4227
4366
|
VersionChanged: '0.86'
|
4228
4367
|
|
4368
|
+
Style/SwapValues:
|
4369
|
+
Description: 'This cop enforces the use of shorthand-style swapping of 2 variables.'
|
4370
|
+
StyleGuide: '#values-swapping'
|
4371
|
+
Enabled: pending
|
4372
|
+
VersionAdded: '1.1'
|
4373
|
+
SafeAutoCorrect: false
|
4374
|
+
|
4229
4375
|
Style/SymbolArray:
|
4230
4376
|
Description: 'Use %i or %I for arrays of symbols.'
|
4231
4377
|
StyleGuide: '#percent-i'
|