rubocop 1.0.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +36 -16
- data/config/default.yml +141 -14
- data/exe/rubocop +1 -1
- data/lib/rubocop.rb +16 -0
- data/lib/rubocop/cli/command/auto_genenerate_config.rb +1 -1
- data/lib/rubocop/comment_config.rb +1 -1
- data/lib/rubocop/config_loader.rb +7 -6
- 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/force.rb +1 -1
- data/lib/rubocop/cop/gemspec/duplicated_assignment.rb +3 -3
- data/lib/rubocop/cop/gemspec/required_ruby_version.rb +4 -5
- data/lib/rubocop/cop/gemspec/ruby_version_globals_usage.rb +1 -1
- data/lib/rubocop/cop/generator.rb +1 -1
- data/lib/rubocop/cop/layout/block_alignment.rb +3 -4
- data/lib/rubocop/cop/layout/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_inside_parens.rb +35 -13
- data/lib/rubocop/cop/layout/trailing_whitespace.rb +1 -1
- data/lib/rubocop/cop/lint/constant_definition_in_block.rb +23 -2
- data/lib/rubocop/cop/lint/debugger.rb +17 -28
- data/lib/rubocop/cop/lint/duplicate_branch.rb +93 -0
- data/lib/rubocop/cop/lint/duplicate_case_condition.rb +2 -12
- data/lib/rubocop/cop/lint/duplicate_regexp_character_class_element.rb +77 -0
- data/lib/rubocop/cop/lint/else_layout.rb +29 -3
- data/lib/rubocop/cop/lint/empty_block.rb +82 -0
- data/lib/rubocop/cop/lint/empty_class.rb +93 -0
- data/lib/rubocop/cop/lint/flip_flop.rb +8 -2
- data/lib/rubocop/cop/lint/literal_in_interpolation.rb +38 -6
- data/lib/rubocop/cop/lint/loop.rb +4 -4
- data/lib/rubocop/cop/lint/nested_percent_literal.rb +14 -0
- data/lib/rubocop/cop/lint/no_return_in_begin_end_blocks.rb +58 -0
- data/lib/rubocop/cop/lint/number_conversion.rb +46 -13
- data/lib/rubocop/cop/lint/out_of_range_regexp_ref.rb +27 -8
- data/lib/rubocop/cop/lint/redundant_cop_enable_directive.rb +19 -16
- data/lib/rubocop/cop/lint/shadowed_exception.rb +4 -5
- data/lib/rubocop/cop/lint/to_enum_arguments.rb +95 -0
- 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/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 +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 +162 -0
- 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/mixin_grouping.rb +0 -4
- data/lib/rubocop/cop/style/multiple_comparison.rb +55 -7
- data/lib/rubocop/cop/style/negated_if_else_condition.rb +104 -0
- data/lib/rubocop/cop/style/nil_lambda.rb +52 -0
- data/lib/rubocop/cop/style/raise_args.rb +21 -6
- data/lib/rubocop/cop/style/redundant_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 +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/magic_comment.rb +2 -2
- data/lib/rubocop/options.rb +2 -0
- data/lib/rubocop/rspec/shared_contexts.rb +4 -0
- data/lib/rubocop/target_ruby.rb +57 -1
- data/lib/rubocop/version.rb +1 -1
- metadata +21 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5013f1930869ad961d7fe1cf2cd8bad7a36a15bc37f6cf42e1663fbdb61f2cc2
|
4
|
+
data.tar.gz: 1ac4e658406f0f6e22a068f28fab225a8e9f53c59a79f89f0e52157cdc076efc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 555adab63cf768a150f37d2ca84e08f2322e84182528949e09bd5eda4c79348e4c41dc17d23737785ea044a78f54f99d99d512047446d7437efdeaf306147f32
|
7
|
+
data.tar.gz: 3fe186c044fd8733f4edef4055c036106d739e485dbfdcdbffe7882961175695edb79aafe27c1b11a8bbe9791f0754f26e7bd7534571dd09955bd5caf6aa6afe
|
data/README.md
CHANGED
@@ -11,11 +11,6 @@
|
|
11
11
|
[](https://codeclimate.com/github/rubocop-hq/rubocop/maintainability)
|
12
12
|
[](https://dependabot.com/compatibility-score.html?dependency-name=rubocop&package-manager=bundler&version-scheme=semver)
|
13
13
|
|
14
|
-
[](https://www.patreon.com/bbatsov)
|
15
|
-
[](#open-collective-backers)
|
16
|
-
[](#open-collective-sponsors)
|
17
|
-
[](https://tidelift.com/subscription/pkg/rubygems-rubocop?utm_source=rubygems-rubocop&utm_medium=referral&utm_campaign=readme)
|
18
|
-
|
19
14
|
> Role models are important. <br/>
|
20
15
|
> -- Officer Alex J. Murphy / RoboCop
|
21
16
|
|
@@ -27,6 +22,12 @@ RuboCop can also automatically fix many of them for you.
|
|
27
22
|
RuboCop is extremely flexible and most aspects of its behavior can be tweaked via various
|
28
23
|
[configuration options](https://github.com/rubocop-hq/rubocop/blob/master/config/default.yml).
|
29
24
|
|
25
|
+
----------
|
26
|
+
[](https://www.patreon.com/bbatsov)
|
27
|
+
[](#open-collective-backers)
|
28
|
+
[](#open-collective-sponsors)
|
29
|
+
[](https://tidelift.com/subscription/pkg/rubygems-rubocop?utm_source=rubygems-rubocop&utm_medium=referral&utm_campaign=readme)
|
30
|
+
|
30
31
|
**Please consider [financially supporting its ongoing development](#funding).**
|
31
32
|
|
32
33
|
## Installation
|
@@ -43,15 +44,18 @@ If you'd rather install RuboCop using `bundler`, add a line for it in your `Gemf
|
|
43
44
|
gem 'rubocop', require: false
|
44
45
|
```
|
45
46
|
|
46
|
-
RuboCop
|
47
|
-
|
48
|
-
|
49
|
-
might want to use a conservative version lock
|
47
|
+
RuboCop is stable between major versions, both in terms of API and cop configuration.
|
48
|
+
We aim the ease the maintenance of RuboCop extensions and the upgrades between RuboCop
|
49
|
+
releases. All big changes are reserved for major releases.
|
50
|
+
To prevent an unwanted RuboCop update you might want to use a conservative version lock
|
51
|
+
in your `Gemfile`:
|
50
52
|
|
51
53
|
```rb
|
52
|
-
gem 'rubocop', '~> 1.
|
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
@@ -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
|
@@ -1334,7 +1334,7 @@ Layout/TrailingWhitespace:
|
|
1334
1334
|
StyleGuide: '#no-trailing-whitespace'
|
1335
1335
|
Enabled: true
|
1336
1336
|
VersionAdded: '0.49'
|
1337
|
-
VersionChanged: '0
|
1337
|
+
VersionChanged: '1.0'
|
1338
1338
|
AllowInHeredoc: false
|
1339
1339
|
|
1340
1340
|
#################### Lint ##################################
|
@@ -1400,6 +1400,8 @@ Lint/ConstantDefinitionInBlock:
|
|
1400
1400
|
StyleGuide: '#no-constant-definition-in-block'
|
1401
1401
|
Enabled: true
|
1402
1402
|
VersionAdded: '0.91'
|
1403
|
+
VersionChanged: '1.3'
|
1404
|
+
AllowedMethods: []
|
1403
1405
|
|
1404
1406
|
Lint/ConstantResolution:
|
1405
1407
|
Description: 'Check that constants are fully qualified with `::`.'
|
@@ -1415,6 +1417,22 @@ Lint/Debugger:
|
|
1415
1417
|
Enabled: true
|
1416
1418
|
VersionAdded: '0.14'
|
1417
1419
|
VersionChanged: '0.49'
|
1420
|
+
DebuggerReceivers:
|
1421
|
+
- binding
|
1422
|
+
- Kernel
|
1423
|
+
- Pry
|
1424
|
+
DebuggerMethods:
|
1425
|
+
- debugger
|
1426
|
+
- byebug
|
1427
|
+
- remote_byebug
|
1428
|
+
- pry
|
1429
|
+
- remote_pry
|
1430
|
+
- pry_remote
|
1431
|
+
- console
|
1432
|
+
- rescue
|
1433
|
+
- save_and_open_page
|
1434
|
+
- save_and_open_screenshot
|
1435
|
+
- irb
|
1418
1436
|
|
1419
1437
|
Lint/DeprecatedClassMethods:
|
1420
1438
|
Description: 'Check for deprecated class method calls.'
|
@@ -1433,6 +1451,11 @@ Lint/DisjunctiveAssignmentInConstructor:
|
|
1433
1451
|
VersionAdded: '0.62'
|
1434
1452
|
VersionChanged: '0.88'
|
1435
1453
|
|
1454
|
+
Lint/DuplicateBranch:
|
1455
|
+
Description: Checks that there are no repeated bodies within `if/unless`, `case-when` and `rescue` constructs.
|
1456
|
+
Enabled: pending
|
1457
|
+
VersionAdded: '1.3'
|
1458
|
+
|
1436
1459
|
Lint/DuplicateCaseCondition:
|
1437
1460
|
Description: 'Do not repeat values in case conditionals.'
|
1438
1461
|
Enabled: true
|
@@ -1454,6 +1477,11 @@ Lint/DuplicateMethods:
|
|
1454
1477
|
Enabled: true
|
1455
1478
|
VersionAdded: '0.29'
|
1456
1479
|
|
1480
|
+
Lint/DuplicateRegexpCharacterClassElement:
|
1481
|
+
Description: 'Checks for duplicate elements in Regexp character classes.'
|
1482
|
+
Enabled: pending
|
1483
|
+
VersionAdded: '1.1'
|
1484
|
+
|
1457
1485
|
Lint/DuplicateRequire:
|
1458
1486
|
Description: 'Check for duplicate `require`s and `require_relative`s.'
|
1459
1487
|
Enabled: true
|
@@ -1473,6 +1501,21 @@ Lint/ElseLayout:
|
|
1473
1501
|
Description: 'Check for odd code arrangement in an else block.'
|
1474
1502
|
Enabled: true
|
1475
1503
|
VersionAdded: '0.17'
|
1504
|
+
VersionChanged: '1.2'
|
1505
|
+
|
1506
|
+
Lint/EmptyBlock:
|
1507
|
+
Description: 'This cop checks for blocks without a body.'
|
1508
|
+
Enabled: pending
|
1509
|
+
VersionAdded: '1.1'
|
1510
|
+
VersionChanged: '1.3'
|
1511
|
+
AllowComments: true
|
1512
|
+
AllowEmptyLambdas: true
|
1513
|
+
|
1514
|
+
Lint/EmptyClass:
|
1515
|
+
Description: 'Checks for classes and metaclasses without a body.'
|
1516
|
+
Enabled: pending
|
1517
|
+
VersionAdded: '1.3'
|
1518
|
+
AllowComments: false
|
1476
1519
|
|
1477
1520
|
Lint/EmptyConditionalBody:
|
1478
1521
|
Description: 'This cop checks for the presence of `if`, `elsif` and `unless` branches without a body.'
|
@@ -1616,7 +1659,8 @@ Lint/Loop:
|
|
1616
1659
|
StyleGuide: '#loop-with-break'
|
1617
1660
|
Enabled: true
|
1618
1661
|
VersionAdded: '0.9'
|
1619
|
-
VersionChanged: '
|
1662
|
+
VersionChanged: '1.3'
|
1663
|
+
Safe: false
|
1620
1664
|
|
1621
1665
|
Lint/MissingCopEnableDirective:
|
1622
1666
|
Description: 'Checks for a `# rubocop:enable` after `# rubocop:disable`.'
|
@@ -1647,7 +1691,8 @@ Lint/MultipleComparison:
|
|
1647
1691
|
Description: "Use `&&` operator to compare multiple values."
|
1648
1692
|
Enabled: true
|
1649
1693
|
VersionAdded: '0.47'
|
1650
|
-
VersionChanged: '
|
1694
|
+
VersionChanged: '1.1'
|
1695
|
+
AllowMethodComparison: true
|
1651
1696
|
|
1652
1697
|
Lint/NestedMethodDefinition:
|
1653
1698
|
Description: 'Do not use nested method definitions.'
|
@@ -1667,6 +1712,11 @@ Lint/NextWithoutAccumulator:
|
|
1667
1712
|
Enabled: true
|
1668
1713
|
VersionAdded: '0.36'
|
1669
1714
|
|
1715
|
+
Lint/NoReturnInBeginEndBlocks:
|
1716
|
+
Description: 'Do not `return` inside `begin..end` blocks in assignment contexts.'
|
1717
|
+
Enabled: pending
|
1718
|
+
VersionAdded: '1.2'
|
1719
|
+
|
1670
1720
|
Lint/NonDeterministicRequireOrder:
|
1671
1721
|
Description: 'Always sort arrays returned by Dir.glob when requiring files.'
|
1672
1722
|
Enabled: true
|
@@ -1682,8 +1732,12 @@ Lint/NumberConversion:
|
|
1682
1732
|
Description: 'Checks unsafe usage of number conversion methods.'
|
1683
1733
|
Enabled: false
|
1684
1734
|
VersionAdded: '0.53'
|
1685
|
-
VersionChanged: '
|
1735
|
+
VersionChanged: '1.1'
|
1686
1736
|
SafeAutoCorrect: false
|
1737
|
+
IgnoredMethods: []
|
1738
|
+
IgnoredClasses:
|
1739
|
+
- Time
|
1740
|
+
- DateTime
|
1687
1741
|
|
1688
1742
|
Lint/OrderedMagicComments:
|
1689
1743
|
Description: 'Checks the proper ordering of magic comments and whether a magic comment is not placed before a shebang.'
|
@@ -1910,6 +1964,11 @@ Lint/Syntax:
|
|
1910
1964
|
VersionAdded: '0.9'
|
1911
1965
|
|
1912
1966
|
|
1967
|
+
Lint/ToEnumArguments:
|
1968
|
+
Description: 'This cop ensures that `to_enum`/`enum_for`, called for the current method, has correct arguments.'
|
1969
|
+
Enabled: pending
|
1970
|
+
VersionAdded: '1.1'
|
1971
|
+
|
1913
1972
|
Lint/ToJSON:
|
1914
1973
|
Description: 'Ensure #to_json includes an optional argument.'
|
1915
1974
|
Enabled: true
|
@@ -1936,6 +1995,11 @@ Lint/UnifiedInteger:
|
|
1936
1995
|
Enabled: true
|
1937
1996
|
VersionAdded: '0.43'
|
1938
1997
|
|
1998
|
+
Lint/UnmodifiedReduceAccumulator:
|
1999
|
+
Description: Checks for `reduce` or `inject` blocks that do not update the accumulator each iteration.
|
2000
|
+
Enabled: pending
|
2001
|
+
VersionAdded: '1.1'
|
2002
|
+
|
1939
2003
|
Lint/UnreachableCode:
|
1940
2004
|
Description: 'Unreachable code.'
|
1941
2005
|
Enabled: true
|
@@ -2010,8 +2074,9 @@ Lint/UselessMethodDefinition:
|
|
2010
2074
|
Lint/UselessSetterCall:
|
2011
2075
|
Description: 'Checks for useless setter call to a local variable.'
|
2012
2076
|
Enabled: true
|
2077
|
+
SafeAutoCorrect: false
|
2013
2078
|
VersionAdded: '0.13'
|
2014
|
-
VersionChanged: '
|
2079
|
+
VersionChanged: '1.2'
|
2015
2080
|
Safe: false
|
2016
2081
|
|
2017
2082
|
Lint/UselessTimes:
|
@@ -2155,6 +2220,7 @@ Naming/BinaryOperatorParameterName:
|
|
2155
2220
|
StyleGuide: '#other-arg'
|
2156
2221
|
Enabled: true
|
2157
2222
|
VersionAdded: '0.50'
|
2223
|
+
VersionChanged: '1.2'
|
2158
2224
|
|
2159
2225
|
Naming/BlockParameterName:
|
2160
2226
|
Description: >-
|
@@ -2261,6 +2327,7 @@ Naming/HeredocDelimiterCase:
|
|
2261
2327
|
StyleGuide: '#heredoc-delimiters'
|
2262
2328
|
Enabled: true
|
2263
2329
|
VersionAdded: '0.50'
|
2330
|
+
VersionChanged: '1.2'
|
2264
2331
|
EnforcedStyle: uppercase
|
2265
2332
|
SupportedStyles:
|
2266
2333
|
- lowercase
|
@@ -2279,7 +2346,7 @@ Naming/MemoizedInstanceVariableName:
|
|
2279
2346
|
Memoized method name should match memo instance variable name.
|
2280
2347
|
Enabled: true
|
2281
2348
|
VersionAdded: '0.53'
|
2282
|
-
VersionChanged: '
|
2349
|
+
VersionChanged: '1.2'
|
2283
2350
|
EnforcedStyleForLeadingUnderscores: disallowed
|
2284
2351
|
SupportedStylesForLeadingUnderscores:
|
2285
2352
|
- disallowed
|
@@ -2377,14 +2444,19 @@ Naming/VariableName:
|
|
2377
2444
|
- camelCase
|
2378
2445
|
|
2379
2446
|
Naming/VariableNumber:
|
2380
|
-
Description: 'Use the configured style when numbering variables.'
|
2447
|
+
Description: 'Use the configured style when numbering symbols, methods and variables.'
|
2448
|
+
StyleGuide: '#snake-case-symbols-methods-vars-with-numbers'
|
2381
2449
|
Enabled: true
|
2382
2450
|
VersionAdded: '0.50'
|
2451
|
+
VersionChanged: '1.3'
|
2383
2452
|
EnforcedStyle: normalcase
|
2384
2453
|
SupportedStyles:
|
2385
2454
|
- snake_case
|
2386
2455
|
- normalcase
|
2387
2456
|
- non_integer
|
2457
|
+
CheckMethodNames: true
|
2458
|
+
CheckSymbols: true
|
2459
|
+
AllowedIdentifiers: []
|
2388
2460
|
|
2389
2461
|
#################### Security ##############################
|
2390
2462
|
|
@@ -2478,6 +2550,13 @@ Style/AndOr:
|
|
2478
2550
|
- always
|
2479
2551
|
- conditionals
|
2480
2552
|
|
2553
|
+
Style/ArgumentsForwarding:
|
2554
|
+
Description: 'Use arguments forwarding.'
|
2555
|
+
StyleGuide: '#arguments-forwarding'
|
2556
|
+
Enabled: pending
|
2557
|
+
AllowOnlyRestArgument: true
|
2558
|
+
VersionAdded: '1.1'
|
2559
|
+
|
2481
2560
|
Style/ArrayCoercion:
|
2482
2561
|
Description: >-
|
2483
2562
|
Use Array() instead of explicit Array check or [*var], when dealing
|
@@ -2756,6 +2835,13 @@ Style/ClassVars:
|
|
2756
2835
|
Enabled: true
|
2757
2836
|
VersionAdded: '0.13'
|
2758
2837
|
|
2838
|
+
Style/CollectionCompact:
|
2839
|
+
Description: 'Use `{Array,Hash}#{compact,compact!}` instead of custom logic to reject nils.'
|
2840
|
+
Enabled: pending
|
2841
|
+
Safe: false
|
2842
|
+
VersionAdded: '1.2'
|
2843
|
+
VersionChanged: '1.3'
|
2844
|
+
|
2759
2845
|
# Align with the style guide.
|
2760
2846
|
Style/CollectionMethods:
|
2761
2847
|
Description: 'Preferred collection methods.'
|
@@ -2819,17 +2905,18 @@ Style/CommandLiteral:
|
|
2819
2905
|
Style/CommentAnnotation:
|
2820
2906
|
Description: >-
|
2821
2907
|
Checks formatting of special comments
|
2822
|
-
(TODO, FIXME, OPTIMIZE, HACK, REVIEW).
|
2908
|
+
(TODO, FIXME, OPTIMIZE, HACK, REVIEW, NOTE).
|
2823
2909
|
StyleGuide: '#annotate-keywords'
|
2824
2910
|
Enabled: true
|
2825
2911
|
VersionAdded: '0.10'
|
2826
|
-
VersionChanged: '
|
2912
|
+
VersionChanged: '1.3'
|
2827
2913
|
Keywords:
|
2828
2914
|
- TODO
|
2829
2915
|
- FIXME
|
2830
2916
|
- OPTIMIZE
|
2831
2917
|
- HACK
|
2832
2918
|
- REVIEW
|
2919
|
+
- NOTE
|
2833
2920
|
|
2834
2921
|
Style/CommentedKeyword:
|
2835
2922
|
Description: 'Do not place comments on the same line as certain keywords.'
|
@@ -2918,6 +3005,15 @@ Style/DisableCopsWithinSourceCodeDirective:
|
|
2918
3005
|
Enabled: false
|
2919
3006
|
VersionAdded: '0.82'
|
2920
3007
|
|
3008
|
+
Style/DocumentDynamicEvalDefinition:
|
3009
|
+
Description: >-
|
3010
|
+
When using `class_eval` (or other `eval`) with string interpolation,
|
3011
|
+
add a comment block showing its appearance if interpolated.
|
3012
|
+
StyleGuide: '#eval-comment-docs'
|
3013
|
+
Enabled: pending
|
3014
|
+
VersionAdded: '1.1'
|
3015
|
+
VersionChanged: '1.3'
|
3016
|
+
|
2921
3017
|
Style/Documentation:
|
2922
3018
|
Description: 'Document classes and non-namespace modules.'
|
2923
3019
|
Enabled: true
|
@@ -2945,7 +3041,7 @@ Style/DoubleNegation:
|
|
2945
3041
|
StyleGuide: '#no-bang-bang'
|
2946
3042
|
Enabled: true
|
2947
3043
|
VersionAdded: '0.19'
|
2948
|
-
VersionChanged: '
|
3044
|
+
VersionChanged: '1.2'
|
2949
3045
|
EnforcedStyle: allowed_in_returns
|
2950
3046
|
SafeAutoCorrect: false
|
2951
3047
|
SupportedStyles:
|
@@ -3244,6 +3340,7 @@ Style/IfInsideElse:
|
|
3244
3340
|
Enabled: true
|
3245
3341
|
AllowIfModifier: false
|
3246
3342
|
VersionAdded: '0.36'
|
3343
|
+
VersionChanged: '1.3'
|
3247
3344
|
|
3248
3345
|
Style/IfUnlessModifier:
|
3249
3346
|
Description: >-
|
@@ -3276,12 +3373,14 @@ Style/ImplicitRuntimeError:
|
|
3276
3373
|
VersionAdded: '0.41'
|
3277
3374
|
|
3278
3375
|
Style/InfiniteLoop:
|
3279
|
-
Description:
|
3376
|
+
Description: >-
|
3377
|
+
Use Kernel#loop for infinite loops.
|
3378
|
+
This cop is unsafe in the body may raise a `StopIteration` exception.
|
3379
|
+
Safe: false
|
3280
3380
|
StyleGuide: '#infinite-loop'
|
3281
3381
|
Enabled: true
|
3282
3382
|
VersionAdded: '0.26'
|
3283
3383
|
VersionChanged: '0.61'
|
3284
|
-
SafeAutoCorrect: true
|
3285
3384
|
|
3286
3385
|
Style/InlineComment:
|
3287
3386
|
Description: 'Avoid trailing inline comments.'
|
@@ -3535,6 +3634,7 @@ Style/MultipleComparison:
|
|
3535
3634
|
use Array#include? instead.
|
3536
3635
|
Enabled: true
|
3537
3636
|
VersionAdded: '0.49'
|
3637
|
+
VersionChanged: '1.1'
|
3538
3638
|
|
3539
3639
|
Style/MutableConstant:
|
3540
3640
|
Description: 'Do not assign mutable objects to constants.'
|
@@ -3569,6 +3669,13 @@ Style/NegatedIf:
|
|
3569
3669
|
- prefix
|
3570
3670
|
- postfix
|
3571
3671
|
|
3672
|
+
Style/NegatedIfElseCondition:
|
3673
|
+
Description: >-
|
3674
|
+
This cop checks for uses of `if-else` and ternary operators with a negated condition
|
3675
|
+
which can be simplified by inverting condition and swapping branches.
|
3676
|
+
Enabled: pending
|
3677
|
+
VersionAdded: '1.2'
|
3678
|
+
|
3572
3679
|
Style/NegatedUnless:
|
3573
3680
|
Description: 'Favor if over unless for negative conditions.'
|
3574
3681
|
StyleGuide: '#if-for-negatives'
|
@@ -3656,6 +3763,11 @@ Style/NilComparison:
|
|
3656
3763
|
- predicate
|
3657
3764
|
- comparison
|
3658
3765
|
|
3766
|
+
Style/NilLambda:
|
3767
|
+
Description: 'Prefer `-> {}` to `-> { nil }`.'
|
3768
|
+
Enabled: pending
|
3769
|
+
VersionAdded: '1.3'
|
3770
|
+
|
3659
3771
|
Style/NonNilCheck:
|
3660
3772
|
Description: 'Checks for redundant nil checks.'
|
3661
3773
|
StyleGuide: '#no-non-nil-checks'
|
@@ -3846,11 +3958,12 @@ Style/RaiseArgs:
|
|
3846
3958
|
StyleGuide: '#exception-class-messages'
|
3847
3959
|
Enabled: true
|
3848
3960
|
VersionAdded: '0.14'
|
3849
|
-
VersionChanged: '
|
3961
|
+
VersionChanged: '1.2'
|
3850
3962
|
EnforcedStyle: exploded
|
3851
3963
|
SupportedStyles:
|
3852
3964
|
- compact # raise Exception.new(msg)
|
3853
3965
|
- exploded # raise Exception, msg
|
3966
|
+
AllowedCompactTypes: []
|
3854
3967
|
|
3855
3968
|
Style/RandomWithOffset:
|
3856
3969
|
Description: >-
|
@@ -4154,6 +4267,13 @@ Style/StabbyLambdaParentheses:
|
|
4154
4267
|
- require_parentheses
|
4155
4268
|
- require_no_parentheses
|
4156
4269
|
|
4270
|
+
Style/StaticClass:
|
4271
|
+
Description: 'Prefer modules to classes with only class methods.'
|
4272
|
+
StyleGuide: '#modules-vs-classes'
|
4273
|
+
Enabled: false
|
4274
|
+
Safe: false
|
4275
|
+
VersionAdded: '1.3'
|
4276
|
+
|
4157
4277
|
Style/StderrPuts:
|
4158
4278
|
Description: 'Use `warn` instead of `$stderr.puts`.'
|
4159
4279
|
StyleGuide: '#warn'
|
@@ -4226,6 +4346,13 @@ Style/StructInheritance:
|
|
4226
4346
|
VersionAdded: '0.29'
|
4227
4347
|
VersionChanged: '0.86'
|
4228
4348
|
|
4349
|
+
Style/SwapValues:
|
4350
|
+
Description: 'This cop enforces the use of shorthand-style swapping of 2 variables.'
|
4351
|
+
StyleGuide: '#values-swapping'
|
4352
|
+
Enabled: pending
|
4353
|
+
VersionAdded: '1.1'
|
4354
|
+
SafeAutoCorrect: false
|
4355
|
+
|
4229
4356
|
Style/SymbolArray:
|
4230
4357
|
Description: 'Use %i or %I for arrays of symbols.'
|
4231
4358
|
StyleGuide: '#percent-i'
|