rubocop 1.1.0 → 1.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +29 -12
- data/config/default.yml +113 -16
- data/exe/rubocop +1 -1
- data/lib/rubocop.rb +9 -0
- data/lib/rubocop/cli/command/execute_runner.rb +26 -11
- data/lib/rubocop/config_loader.rb +14 -5
- data/lib/rubocop/config_regeneration.rb +1 -1
- data/lib/rubocop/cop/bundler/duplicated_gem.rb +3 -3
- data/lib/rubocop/cop/bundler/gem_comment.rb +1 -1
- data/lib/rubocop/cop/commissioner.rb +1 -1
- data/lib/rubocop/cop/correctors/percent_literal_corrector.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/else_alignment.rb +15 -2
- data/lib/rubocop/cop/layout/empty_line_between_defs.rb +77 -7
- data/lib/rubocop/cop/layout/end_alignment.rb +3 -3
- 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/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 -27
- 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/else_layout.rb +29 -3
- data/lib/rubocop/cop/lint/empty_block.rb +38 -2
- data/lib/rubocop/cop/lint/empty_class.rb +93 -0
- data/lib/rubocop/cop/lint/literal_in_interpolation.rb +22 -4
- 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/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 +6 -15
- data/lib/rubocop/cop/lint/unmodified_reduce_accumulator.rb +13 -4
- 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/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/variable_number.rb +98 -8
- data/lib/rubocop/cop/style/and_or.rb +1 -3
- 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 +107 -5
- 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 +3 -2
- 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_escape.rb +1 -1
- data/lib/rubocop/cop/style/static_class.rb +97 -0
- data/lib/rubocop/cop/style/while_until_modifier.rb +9 -0
- data/lib/rubocop/cop/util.rb +5 -1
- 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 +10 -5
- data/lib/rubocop/ext/regexp_parser.rb +9 -2
- data/lib/rubocop/formatter/disabled_config_formatter.rb +21 -6
- data/lib/rubocop/formatter/formatter_set.rb +1 -0
- data/lib/rubocop/formatter/git_hub_actions_formatter.rb +47 -0
- data/lib/rubocop/options.rb +7 -0
- data/lib/rubocop/rake_task.rb +2 -2
- 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 +14 -8
- 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: 559e608f152814f5300bb7abd0b4c3e094ae53149f9f99a4cef8c4b6dd0da2ab
|
4
|
+
data.tar.gz: fbee2cd4b7cf20eca1eeec13f67b43b32483a0c8b11c17829f705c9c529446f0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b9dd79f49f7bca665d5e9d05cc6e41a6ba5cdff9f4392b9ed5d8a25ec714966b661d8bfef677087cbd4b3ec29c55afb3dbe08e00ffbd7df34385f1ca60ec1312
|
7
|
+
data.tar.gz: e36d6e3f839d586fd2776767eb4eff2228c5378f90a56726497b5cc37b1b890f1da33d0c76b47cbfdb3e141debb5eeaee63f41914d03cbd2d2cd819361f5301e
|
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
|
@@ -50,7 +51,7 @@ To prevent an unwanted RuboCop update you might want to use a conservative versi
|
|
50
51
|
in your `Gemfile`:
|
51
52
|
|
52
53
|
```rb
|
53
|
-
gem 'rubocop', '~> 1.
|
54
|
+
gem 'rubocop', '~> 1.4', require: false
|
54
55
|
```
|
55
56
|
|
56
57
|
See [versioning](https://docs.rubocop.org/rubocop/1.0/versioning.html) for further details.
|
@@ -70,12 +71,12 @@ You can read a lot more about RuboCop in its [official docs](https://docs.ruboco
|
|
70
71
|
|
71
72
|
## Compatibility
|
72
73
|
|
73
|
-
RuboCop supports the following Ruby implementations:
|
74
|
+
RuboCop officially supports the following Ruby implementations:
|
74
75
|
|
75
76
|
* MRI 2.4+
|
76
77
|
* JRuby 9.2+
|
77
78
|
|
78
|
-
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.
|
79
80
|
|
80
81
|
## Readme Badge
|
81
82
|
|
@@ -85,6 +86,15 @@ If you use RuboCop in your project, you can include one of these badges in your
|
|
85
86
|
|
86
87
|
[![Ruby Style Guide](https://img.shields.io/badge/code_style-community-brightgreen.svg)](https://rubystyle.guide)
|
87
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
|
+
|
88
98
|
## Team
|
89
99
|
|
90
100
|
Here's a list of RuboCop's core developers:
|
@@ -100,6 +110,8 @@ Here's a list of RuboCop's core developers:
|
|
100
110
|
* [Benjamin Quorning](https://github.com/bquorning)
|
101
111
|
* [Marc-André Lafortune](https://github.com/marcandre)
|
102
112
|
|
113
|
+
See the [team page](https://docs.rubocop.org/rubocop/about/team.html) for more details.
|
114
|
+
|
103
115
|
## Logo
|
104
116
|
|
105
117
|
RuboCop's logo was created by [Dimiter Petrov](https://www.chadomoto.com/). You can find the logo in various
|
@@ -139,14 +151,19 @@ wide array of funding channels to account for your preferences
|
|
139
151
|
currently [Open Collective](https://opencollective.com/rubocop) is our
|
140
152
|
preferred funding platform).
|
141
153
|
|
142
|
-
If you're working in a company that's making significant use of RuboCop we'd appreciate it if you suggest to your company
|
143
|
-
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.**
|
144
156
|
|
145
157
|
You can support the development of RuboCop via
|
146
158
|
[GitHub Sponsors](https://github.com/sponsors/bbatsov),
|
147
159
|
[Patreon](https://www.patreon.com/bbatsov),
|
148
|
-
[PayPal](https://paypal.me/bbatsov)
|
149
|
-
|
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.
|
150
167
|
|
151
168
|
### Open Collective Backers
|
152
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.'
|
@@ -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
|
@@ -1478,12 +1508,21 @@ Lint/ElseLayout:
|
|
1478
1508
|
Description: 'Check for odd code arrangement in an else block.'
|
1479
1509
|
Enabled: true
|
1480
1510
|
VersionAdded: '0.17'
|
1511
|
+
VersionChanged: '1.2'
|
1481
1512
|
|
1482
1513
|
Lint/EmptyBlock:
|
1483
1514
|
Description: 'This cop checks for blocks without a body.'
|
1484
1515
|
Enabled: pending
|
1485
1516
|
VersionAdded: '1.1'
|
1517
|
+
VersionChanged: '1.3'
|
1486
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
|
1487
1526
|
|
1488
1527
|
Lint/EmptyConditionalBody:
|
1489
1528
|
Description: 'This cop checks for the presence of `if`, `elsif` and `unless` branches without a body.'
|
@@ -1627,7 +1666,8 @@ Lint/Loop:
|
|
1627
1666
|
StyleGuide: '#loop-with-break'
|
1628
1667
|
Enabled: true
|
1629
1668
|
VersionAdded: '0.9'
|
1630
|
-
VersionChanged: '
|
1669
|
+
VersionChanged: '1.3'
|
1670
|
+
Safe: false
|
1631
1671
|
|
1632
1672
|
Lint/MissingCopEnableDirective:
|
1633
1673
|
Description: 'Checks for a `# rubocop:enable` after `# rubocop:disable`.'
|
@@ -1648,6 +1688,7 @@ Lint/MissingSuper:
|
|
1648
1688
|
without calls to `super`'.
|
1649
1689
|
Enabled: true
|
1650
1690
|
VersionAdded: '0.89'
|
1691
|
+
VersionChanged: '1.4'
|
1651
1692
|
|
1652
1693
|
Lint/MixedRegexpCaptureTypes:
|
1653
1694
|
Description: 'Do not mix named captures and numbered captures in a Regexp literal.'
|
@@ -1679,6 +1720,11 @@ Lint/NextWithoutAccumulator:
|
|
1679
1720
|
Enabled: true
|
1680
1721
|
VersionAdded: '0.36'
|
1681
1722
|
|
1723
|
+
Lint/NoReturnInBeginEndBlocks:
|
1724
|
+
Description: 'Do not `return` inside `begin..end` blocks in assignment contexts.'
|
1725
|
+
Enabled: pending
|
1726
|
+
VersionAdded: '1.2'
|
1727
|
+
|
1682
1728
|
Lint/NonDeterministicRequireOrder:
|
1683
1729
|
Description: 'Always sort arrays returned by Dir.glob when requiring files.'
|
1684
1730
|
Enabled: true
|
@@ -1824,7 +1870,7 @@ Lint/RescueException:
|
|
1824
1870
|
StyleGuide: '#no-blind-rescues'
|
1825
1871
|
Enabled: true
|
1826
1872
|
VersionAdded: '0.9'
|
1827
|
-
VersionChanged: '0.27
|
1873
|
+
VersionChanged: '0.27'
|
1828
1874
|
|
1829
1875
|
Lint/RescueType:
|
1830
1876
|
Description: 'Avoid rescuing from non constants that could result in a `TypeError`.'
|
@@ -2036,8 +2082,9 @@ Lint/UselessMethodDefinition:
|
|
2036
2082
|
Lint/UselessSetterCall:
|
2037
2083
|
Description: 'Checks for useless setter call to a local variable.'
|
2038
2084
|
Enabled: true
|
2085
|
+
SafeAutoCorrect: false
|
2039
2086
|
VersionAdded: '0.13'
|
2040
|
-
VersionChanged: '
|
2087
|
+
VersionChanged: '1.2'
|
2041
2088
|
Safe: false
|
2042
2089
|
|
2043
2090
|
Lint/UselessTimes:
|
@@ -2181,6 +2228,7 @@ Naming/BinaryOperatorParameterName:
|
|
2181
2228
|
StyleGuide: '#other-arg'
|
2182
2229
|
Enabled: true
|
2183
2230
|
VersionAdded: '0.50'
|
2231
|
+
VersionChanged: '1.2'
|
2184
2232
|
|
2185
2233
|
Naming/BlockParameterName:
|
2186
2234
|
Description: >-
|
@@ -2287,6 +2335,7 @@ Naming/HeredocDelimiterCase:
|
|
2287
2335
|
StyleGuide: '#heredoc-delimiters'
|
2288
2336
|
Enabled: true
|
2289
2337
|
VersionAdded: '0.50'
|
2338
|
+
VersionChanged: '1.2'
|
2290
2339
|
EnforcedStyle: uppercase
|
2291
2340
|
SupportedStyles:
|
2292
2341
|
- lowercase
|
@@ -2305,7 +2354,7 @@ Naming/MemoizedInstanceVariableName:
|
|
2305
2354
|
Memoized method name should match memo instance variable name.
|
2306
2355
|
Enabled: true
|
2307
2356
|
VersionAdded: '0.53'
|
2308
|
-
VersionChanged: '
|
2357
|
+
VersionChanged: '1.2'
|
2309
2358
|
EnforcedStyleForLeadingUnderscores: disallowed
|
2310
2359
|
SupportedStylesForLeadingUnderscores:
|
2311
2360
|
- disallowed
|
@@ -2403,14 +2452,19 @@ Naming/VariableName:
|
|
2403
2452
|
- camelCase
|
2404
2453
|
|
2405
2454
|
Naming/VariableNumber:
|
2406
|
-
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'
|
2407
2457
|
Enabled: true
|
2408
2458
|
VersionAdded: '0.50'
|
2459
|
+
VersionChanged: '1.3'
|
2409
2460
|
EnforcedStyle: normalcase
|
2410
2461
|
SupportedStyles:
|
2411
2462
|
- snake_case
|
2412
2463
|
- normalcase
|
2413
2464
|
- non_integer
|
2465
|
+
CheckMethodNames: true
|
2466
|
+
CheckSymbols: true
|
2467
|
+
AllowedIdentifiers: []
|
2414
2468
|
|
2415
2469
|
#################### Security ##############################
|
2416
2470
|
|
@@ -2789,6 +2843,13 @@ Style/ClassVars:
|
|
2789
2843
|
Enabled: true
|
2790
2844
|
VersionAdded: '0.13'
|
2791
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
|
+
|
2792
2853
|
# Align with the style guide.
|
2793
2854
|
Style/CollectionMethods:
|
2794
2855
|
Description: 'Preferred collection methods.'
|
@@ -2852,17 +2913,18 @@ Style/CommandLiteral:
|
|
2852
2913
|
Style/CommentAnnotation:
|
2853
2914
|
Description: >-
|
2854
2915
|
Checks formatting of special comments
|
2855
|
-
(TODO, FIXME, OPTIMIZE, HACK, REVIEW).
|
2916
|
+
(TODO, FIXME, OPTIMIZE, HACK, REVIEW, NOTE).
|
2856
2917
|
StyleGuide: '#annotate-keywords'
|
2857
2918
|
Enabled: true
|
2858
2919
|
VersionAdded: '0.10'
|
2859
|
-
VersionChanged: '
|
2920
|
+
VersionChanged: '1.3'
|
2860
2921
|
Keywords:
|
2861
2922
|
- TODO
|
2862
2923
|
- FIXME
|
2863
2924
|
- OPTIMIZE
|
2864
2925
|
- HACK
|
2865
2926
|
- REVIEW
|
2927
|
+
- NOTE
|
2866
2928
|
|
2867
2929
|
Style/CommentedKeyword:
|
2868
2930
|
Description: 'Do not place comments on the same line as certain keywords.'
|
@@ -2958,6 +3020,7 @@ Style/DocumentDynamicEvalDefinition:
|
|
2958
3020
|
StyleGuide: '#eval-comment-docs'
|
2959
3021
|
Enabled: pending
|
2960
3022
|
VersionAdded: '1.1'
|
3023
|
+
VersionChanged: '1.3'
|
2961
3024
|
|
2962
3025
|
Style/Documentation:
|
2963
3026
|
Description: 'Document classes and non-namespace modules.'
|
@@ -2986,7 +3049,7 @@ Style/DoubleNegation:
|
|
2986
3049
|
StyleGuide: '#no-bang-bang'
|
2987
3050
|
Enabled: true
|
2988
3051
|
VersionAdded: '0.19'
|
2989
|
-
VersionChanged: '
|
3052
|
+
VersionChanged: '1.2'
|
2990
3053
|
EnforcedStyle: allowed_in_returns
|
2991
3054
|
SafeAutoCorrect: false
|
2992
3055
|
SupportedStyles:
|
@@ -3285,6 +3348,7 @@ Style/IfInsideElse:
|
|
3285
3348
|
Enabled: true
|
3286
3349
|
AllowIfModifier: false
|
3287
3350
|
VersionAdded: '0.36'
|
3351
|
+
VersionChanged: '1.3'
|
3288
3352
|
|
3289
3353
|
Style/IfUnlessModifier:
|
3290
3354
|
Description: >-
|
@@ -3317,12 +3381,14 @@ Style/ImplicitRuntimeError:
|
|
3317
3381
|
VersionAdded: '0.41'
|
3318
3382
|
|
3319
3383
|
Style/InfiniteLoop:
|
3320
|
-
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
|
3321
3388
|
StyleGuide: '#infinite-loop'
|
3322
3389
|
Enabled: true
|
3323
3390
|
VersionAdded: '0.26'
|
3324
3391
|
VersionChanged: '0.61'
|
3325
|
-
SafeAutoCorrect: true
|
3326
3392
|
|
3327
3393
|
Style/InlineComment:
|
3328
3394
|
Description: 'Avoid trailing inline comments.'
|
@@ -3611,6 +3677,13 @@ Style/NegatedIf:
|
|
3611
3677
|
- prefix
|
3612
3678
|
- postfix
|
3613
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
|
+
|
3614
3687
|
Style/NegatedUnless:
|
3615
3688
|
Description: 'Favor if over unless for negative conditions.'
|
3616
3689
|
StyleGuide: '#if-for-negatives'
|
@@ -3698,6 +3771,11 @@ Style/NilComparison:
|
|
3698
3771
|
- predicate
|
3699
3772
|
- comparison
|
3700
3773
|
|
3774
|
+
Style/NilLambda:
|
3775
|
+
Description: 'Prefer `-> {}` to `-> { nil }`.'
|
3776
|
+
Enabled: pending
|
3777
|
+
VersionAdded: '1.3'
|
3778
|
+
|
3701
3779
|
Style/NonNilCheck:
|
3702
3780
|
Description: 'Checks for redundant nil checks.'
|
3703
3781
|
StyleGuide: '#no-non-nil-checks'
|
@@ -3847,7 +3925,7 @@ Style/PercentLiteralDelimiters:
|
|
3847
3925
|
'%r': '{}'
|
3848
3926
|
'%w': '[]'
|
3849
3927
|
'%W': '[]'
|
3850
|
-
VersionChanged: '0.48
|
3928
|
+
VersionChanged: '0.48'
|
3851
3929
|
|
3852
3930
|
Style/PercentQLiterals:
|
3853
3931
|
Description: 'Checks if uses of %Q/%q match the configured preference.'
|
@@ -3888,11 +3966,12 @@ Style/RaiseArgs:
|
|
3888
3966
|
StyleGuide: '#exception-class-messages'
|
3889
3967
|
Enabled: true
|
3890
3968
|
VersionAdded: '0.14'
|
3891
|
-
VersionChanged: '
|
3969
|
+
VersionChanged: '1.2'
|
3892
3970
|
EnforcedStyle: exploded
|
3893
3971
|
SupportedStyles:
|
3894
3972
|
- compact # raise Exception.new(msg)
|
3895
3973
|
- exploded # raise Exception, msg
|
3974
|
+
AllowedCompactTypes: []
|
3896
3975
|
|
3897
3976
|
Style/RandomWithOffset:
|
3898
3977
|
Description: >-
|
@@ -3902,6 +3981,17 @@ Style/RandomWithOffset:
|
|
3902
3981
|
Enabled: true
|
3903
3982
|
VersionAdded: '0.52'
|
3904
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
|
+
|
3905
3995
|
Style/RedundantAssignment:
|
3906
3996
|
Description: 'Checks for redundant assignment before returning.'
|
3907
3997
|
Enabled: true
|
@@ -4196,6 +4286,13 @@ Style/StabbyLambdaParentheses:
|
|
4196
4286
|
- require_parentheses
|
4197
4287
|
- require_no_parentheses
|
4198
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
|
+
|
4199
4296
|
Style/StderrPuts:
|
4200
4297
|
Description: 'Use `warn` instead of `$stderr.puts`.'
|
4201
4298
|
StyleGuide: '#warn'
|
@@ -4246,7 +4343,7 @@ Style/StringMethods:
|
|
4246
4343
|
Description: 'Checks if configured preferred methods are used over non-preferred.'
|
4247
4344
|
Enabled: false
|
4248
4345
|
VersionAdded: '0.34'
|
4249
|
-
VersionChanged: '0.34
|
4346
|
+
VersionChanged: '0.34'
|
4250
4347
|
# Mapping from undesired method to desired_method
|
4251
4348
|
# e.g. to use `to_sym` over `intern`:
|
4252
4349
|
#
|