rubocop 1.6.0 → 1.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE.txt +1 -1
- data/README.md +3 -2
- data/config/default.yml +142 -19
- data/lib/rubocop.rb +15 -1
- data/lib/rubocop/cli/command/auto_genenerate_config.rb +5 -4
- data/lib/rubocop/comment_config.rb +6 -6
- data/lib/rubocop/config.rb +10 -7
- data/lib/rubocop/config_loader.rb +11 -14
- data/lib/rubocop/config_loader_resolver.rb +21 -4
- data/lib/rubocop/config_obsoletion.rb +5 -3
- data/lib/rubocop/config_obsoletion/extracted_cop.rb +6 -6
- data/lib/rubocop/config_store.rb +12 -1
- data/lib/rubocop/cop/base.rb +1 -1
- data/lib/rubocop/cop/gemspec/required_ruby_version.rb +3 -2
- data/lib/rubocop/cop/generator.rb +1 -3
- data/lib/rubocop/cop/internal_affairs.rb +6 -1
- data/lib/rubocop/cop/internal_affairs/empty_line_between_expect_offense_and_correction.rb +68 -0
- data/lib/rubocop/cop/internal_affairs/example_description.rb +89 -0
- data/lib/rubocop/cop/internal_affairs/redundant_described_class_as_subject.rb +61 -0
- data/lib/rubocop/cop/internal_affairs/redundant_let_rubocop_config_new.rb +64 -0
- data/lib/rubocop/cop/internal_affairs/style_detected_api_use.rb +145 -0
- data/lib/rubocop/cop/layout/class_structure.rb +7 -2
- data/lib/rubocop/cop/layout/empty_line_between_defs.rb +19 -3
- data/lib/rubocop/cop/layout/heredoc_argument_closing_parenthesis.rb +14 -0
- data/lib/rubocop/cop/layout/multiline_operation_indentation.rb +2 -2
- data/lib/rubocop/cop/layout/rescue_ensure_alignment.rb +3 -10
- data/lib/rubocop/cop/layout/space_around_equals_in_parameter_default.rb +1 -0
- data/lib/rubocop/cop/layout/space_before_block_braces.rb +2 -0
- data/lib/rubocop/cop/layout/space_before_brackets.rb +62 -0
- data/lib/rubocop/cop/layout/space_inside_block_braces.rb +13 -10
- data/lib/rubocop/cop/layout/space_inside_hash_literal_braces.rb +2 -2
- data/lib/rubocop/cop/lint/ambiguous_assignment.rb +59 -0
- data/lib/rubocop/cop/lint/binary_operator_with_identical_operands.rb +7 -2
- data/lib/rubocop/cop/lint/deprecated_constants.rb +75 -0
- data/lib/rubocop/cop/lint/duplicate_branch.rb +64 -2
- data/lib/rubocop/cop/lint/lambda_without_literal_block.rb +44 -0
- data/lib/rubocop/cop/lint/non_deterministic_require_order.rb +10 -6
- data/lib/rubocop/cop/lint/number_conversion.rb +41 -6
- data/lib/rubocop/cop/lint/numbered_parameter_assignment.rb +47 -0
- data/lib/rubocop/cop/lint/or_assignment_to_constant.rb +39 -0
- data/lib/rubocop/cop/lint/redundant_cop_disable_directive.rb +2 -1
- data/lib/rubocop/cop/lint/redundant_dir_glob_sort.rb +50 -0
- data/lib/rubocop/cop/lint/redundant_splat_expansion.rb +50 -17
- data/lib/rubocop/cop/lint/shadowed_exception.rb +1 -11
- data/lib/rubocop/cop/lint/symbol_conversion.rb +102 -0
- data/lib/rubocop/cop/lint/triple_quotes.rb +71 -0
- data/lib/rubocop/cop/lint/unreachable_loop.rb +17 -0
- data/lib/rubocop/cop/metrics/utils/code_length_calculator.rb +1 -1
- data/lib/rubocop/cop/mixin/allowed_identifiers.rb +18 -0
- data/lib/rubocop/cop/mixin/check_line_breakable.rb +5 -0
- data/lib/rubocop/cop/mixin/comments_help.rb +1 -11
- data/lib/rubocop/cop/mixin/first_element_line_break.rb +1 -1
- data/lib/rubocop/cop/mixin/uncommunicative_name.rb +5 -1
- data/lib/rubocop/cop/naming/memoized_instance_variable_name.rb +59 -5
- data/lib/rubocop/cop/naming/rescued_exceptions_variable_name.rb +38 -5
- data/lib/rubocop/cop/naming/variable_name.rb +2 -0
- data/lib/rubocop/cop/naming/variable_number.rb +2 -9
- data/lib/rubocop/cop/registry.rb +10 -0
- data/lib/rubocop/cop/severity.rb +3 -3
- data/lib/rubocop/cop/style/access_modifier_declarations.rb +3 -1
- data/lib/rubocop/cop/style/ascii_comments.rb +1 -1
- data/lib/rubocop/cop/style/collection_methods.rb +14 -1
- data/lib/rubocop/cop/style/commented_keyword.rb +22 -5
- data/lib/rubocop/cop/style/disable_cops_within_source_code_directive.rb +49 -9
- data/lib/rubocop/cop/style/empty_literal.rb +6 -2
- data/lib/rubocop/cop/style/endless_method.rb +102 -0
- data/lib/rubocop/cop/style/eval_with_location.rb +63 -34
- data/lib/rubocop/cop/style/explicit_block_argument.rb +10 -0
- data/lib/rubocop/cop/style/float_division.rb +3 -0
- data/lib/rubocop/cop/style/for.rb +2 -0
- data/lib/rubocop/cop/style/format_string_token.rb +18 -2
- data/lib/rubocop/cop/style/hash_except.rb +95 -0
- data/lib/rubocop/cop/style/hash_like_case.rb +2 -1
- data/lib/rubocop/cop/style/if_inside_else.rb +22 -10
- data/lib/rubocop/cop/style/if_with_boolean_literal_branches.rb +96 -0
- data/lib/rubocop/cop/style/keyword_parameters_order.rb +12 -2
- data/lib/rubocop/cop/style/lambda_call.rb +2 -1
- data/lib/rubocop/cop/style/method_call_with_args_parentheses.rb +7 -0
- data/lib/rubocop/cop/style/method_call_with_args_parentheses/omit_parentheses.rb +16 -6
- data/lib/rubocop/cop/style/method_def_parentheses.rb +7 -0
- data/lib/rubocop/cop/style/multiline_method_signature.rb +26 -1
- data/lib/rubocop/cop/style/multiline_when_then.rb +3 -1
- data/lib/rubocop/cop/style/mutable_constant.rb +13 -3
- data/lib/rubocop/cop/style/nested_parenthesized_calls.rb +4 -0
- data/lib/rubocop/cop/style/nil_comparison.rb +1 -0
- data/lib/rubocop/cop/style/non_nil_check.rb +23 -13
- data/lib/rubocop/cop/style/raise_args.rb +5 -2
- data/lib/rubocop/cop/style/redundant_argument.rb +7 -1
- data/lib/rubocop/cop/style/redundant_freeze.rb +8 -4
- data/lib/rubocop/cop/style/redundant_return.rb +1 -1
- data/lib/rubocop/cop/style/single_line_methods.rb +34 -2
- data/lib/rubocop/cop/style/sole_nested_conditional.rb +29 -5
- data/lib/rubocop/cop/style/string_concatenation.rb +1 -1
- data/lib/rubocop/cop/style/symbol_proc.rb +5 -4
- data/lib/rubocop/cop/style/ternary_parentheses.rb +1 -1
- data/lib/rubocop/cop/style/while_until_modifier.rb +2 -4
- data/lib/rubocop/cop/util.rb +3 -1
- data/lib/rubocop/formatter/git_hub_actions_formatter.rb +1 -0
- data/lib/rubocop/magic_comment.rb +30 -1
- data/lib/rubocop/options.rb +10 -10
- data/lib/rubocop/rspec/cop_helper.rb +0 -4
- data/lib/rubocop/rspec/expect_offense.rb +37 -22
- data/lib/rubocop/runner.rb +17 -1
- data/lib/rubocop/target_finder.rb +4 -2
- data/lib/rubocop/target_ruby.rb +47 -11
- data/lib/rubocop/util.rb +16 -0
- data/lib/rubocop/version.rb +8 -2
- metadata +26 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ec2d9f7ba4857375232c4e42ea44accdb38b2873c83315f3029a546e315622e0
|
4
|
+
data.tar.gz: 01df5c9957cca7c79cf8cab073c1bae675d684761561835d6d93f554f3743905
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 55a5a8deae643b6d76dc5220c7136a7c5413ecb93ca85ec61dcd3aa9ff0adb3c1ab356ec81f72273771ab3125317fc105bfcaf0c7e1e1ae07f6295c7fa33c26e
|
7
|
+
data.tar.gz: 642d925df9f18c6c42b532eb0193965c6a85a93bd9339523757882eb6e9029052161a32bbc4421e454a210fe2ab5318ae64459dc4a9d792ee0cb5e4b259568ff
|
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -51,7 +51,7 @@ To prevent an unwanted RuboCop update you might want to use a conservative versi
|
|
51
51
|
in your `Gemfile`:
|
52
52
|
|
53
53
|
```rb
|
54
|
-
gem 'rubocop', '~> 1.
|
54
|
+
gem 'rubocop', '~> 1.9', require: false
|
55
55
|
```
|
56
56
|
|
57
57
|
See [versioning](https://docs.rubocop.org/rubocop/1.0/versioning.html) for further details.
|
@@ -109,6 +109,7 @@ Here's a list of RuboCop's core developers:
|
|
109
109
|
* [Maxim Krizhanovski](https://github.com/darhazer)
|
110
110
|
* [Benjamin Quorning](https://github.com/bquorning)
|
111
111
|
* [Marc-André Lafortune](https://github.com/marcandre)
|
112
|
+
* [Daniel Vandersluis](https://github.com/dvandersluis)
|
112
113
|
|
113
114
|
See the [team page](https://docs.rubocop.org/rubocop/about/team.html) for more details.
|
114
115
|
|
@@ -241,5 +242,5 @@ RuboCop's changelog is available [here](CHANGELOG.md).
|
|
241
242
|
|
242
243
|
## Copyright
|
243
244
|
|
244
|
-
Copyright (c) 2012-
|
245
|
+
Copyright (c) 2012-2021 Bozhidar Batsov. See [LICENSE.txt](LICENSE.txt) for
|
245
246
|
further details.
|
data/config/default.yml
CHANGED
@@ -132,12 +132,13 @@ AllCops:
|
|
132
132
|
# If a value is specified for TargetRubyVersion then it is used. Acceptable
|
133
133
|
# values are specificed as a float (i.e. 2.5); the teeny version of Ruby
|
134
134
|
# should not be included. If the project specifies a Ruby version in the
|
135
|
-
# .ruby-version
|
136
|
-
# the desired version of Ruby by inspecting the
|
137
|
-
#
|
138
|
-
#
|
139
|
-
# from the lock file.) If the
|
140
|
-
#
|
135
|
+
# .tool-versions or .ruby-version files, Gemfile or gems.rb file, RuboCop will
|
136
|
+
# try to determine the desired version of Ruby by inspecting the
|
137
|
+
# .tool-versions file first, then .ruby-version, followed by the Gemfile.lock
|
138
|
+
# or gems.locked file. (Although the Ruby version is specified in the Gemfile
|
139
|
+
# or gems.rb file, RuboCop reads the final value from the lock file.) If the
|
140
|
+
# Ruby version is still unresolved, RuboCop will use the oldest officially
|
141
|
+
# supported Ruby version (currently Ruby 2.4).
|
141
142
|
TargetRubyVersion: ~
|
142
143
|
# Determines if a notification for extension libraries should be shown when
|
143
144
|
# rubocop is run. Keys are the name of the extension, and values are an array
|
@@ -473,7 +474,7 @@ Layout/EmptyLineBetweenDefs:
|
|
473
474
|
StyleGuide: '#empty-lines-between-methods'
|
474
475
|
Enabled: true
|
475
476
|
VersionAdded: '0.49'
|
476
|
-
VersionChanged: '1.
|
477
|
+
VersionChanged: '1.7'
|
477
478
|
EmptyLineBetweenMethodDefs: true
|
478
479
|
EmptyLineBetweenClassDefs: true
|
479
480
|
EmptyLineBetweenModuleDefs: true
|
@@ -1192,6 +1193,12 @@ Layout/SpaceBeforeBlockBraces:
|
|
1192
1193
|
- no_space
|
1193
1194
|
VersionChanged: '0.52'
|
1194
1195
|
|
1196
|
+
Layout/SpaceBeforeBrackets:
|
1197
|
+
Description: 'Checks for receiver with a space before the opening brackets.'
|
1198
|
+
StyleGuide: '#space-in-brackets-access'
|
1199
|
+
Enabled: pending
|
1200
|
+
VersionAdded: '1.7'
|
1201
|
+
|
1195
1202
|
Layout/SpaceBeforeComma:
|
1196
1203
|
Description: 'No spaces before commas.'
|
1197
1204
|
Enabled: true
|
@@ -1354,6 +1361,11 @@ Layout/TrailingWhitespace:
|
|
1354
1361
|
#################### Lint ##################################
|
1355
1362
|
### Warnings
|
1356
1363
|
|
1364
|
+
Lint/AmbiguousAssignment:
|
1365
|
+
Description: 'Checks for mistyped shorthand assignments.'
|
1366
|
+
Enabled: pending
|
1367
|
+
VersionAdded: '1.7'
|
1368
|
+
|
1357
1369
|
Lint/AmbiguousBlockAssociation:
|
1358
1370
|
Description: >-
|
1359
1371
|
Checks for ambiguous block association with method when param passed without
|
@@ -1396,6 +1408,7 @@ Lint/BinaryOperatorWithIdenticalOperands:
|
|
1396
1408
|
Enabled: true
|
1397
1409
|
Safe: false
|
1398
1410
|
VersionAdded: '0.89'
|
1411
|
+
VersionChanged: '1.7'
|
1399
1412
|
|
1400
1413
|
Lint/BooleanSymbol:
|
1401
1414
|
Description: 'Check for `:true` and `:false` symbols.'
|
@@ -1456,6 +1469,34 @@ Lint/DeprecatedClassMethods:
|
|
1456
1469
|
Enabled: true
|
1457
1470
|
VersionAdded: '0.19'
|
1458
1471
|
|
1472
|
+
Lint/DeprecatedConstants:
|
1473
|
+
Description: 'Checks for deprecated constants.'
|
1474
|
+
Enabled: pending
|
1475
|
+
VersionAdded: '1.8'
|
1476
|
+
# You can configure deprecated constants.
|
1477
|
+
# If there is an alternative method, you can set alternative value as `Alternative`.
|
1478
|
+
# And you can set the deprecated version as `DeprecatedVersion`.
|
1479
|
+
# These options can be omitted if they are not needed.
|
1480
|
+
#
|
1481
|
+
# DeprecatedConstants:
|
1482
|
+
# 'DEPRECATED_CONSTANT':
|
1483
|
+
# Alternative: 'alternative_value'
|
1484
|
+
# DeprecatedVersion: 'deprecated_version'
|
1485
|
+
#
|
1486
|
+
DeprecatedConstants:
|
1487
|
+
'NIL':
|
1488
|
+
Alternative: 'nil'
|
1489
|
+
DeprecatedVersion: '2.4'
|
1490
|
+
'TRUE':
|
1491
|
+
Alternative: 'true'
|
1492
|
+
DeprecatedVersion: '2.4'
|
1493
|
+
'FALSE':
|
1494
|
+
Alternative: 'false'
|
1495
|
+
DeprecatedVersion: '2.4'
|
1496
|
+
'Random::DEFAULT':
|
1497
|
+
Alternative: 'Random.new'
|
1498
|
+
DeprecatedVersion: '3.0'
|
1499
|
+
|
1459
1500
|
Lint/DeprecatedOpenSSLConstant:
|
1460
1501
|
Description: "Don't use algorithm constants for `OpenSSL::Cipher` and `OpenSSL::Digest`."
|
1461
1502
|
Enabled: true
|
@@ -1472,6 +1513,9 @@ Lint/DuplicateBranch:
|
|
1472
1513
|
Description: Checks that there are no repeated bodies within `if/unless`, `case-when` and `rescue` constructs.
|
1473
1514
|
Enabled: pending
|
1474
1515
|
VersionAdded: '1.3'
|
1516
|
+
VersionChanged: '1.7'
|
1517
|
+
IgnoreLiteralBranches: false
|
1518
|
+
IgnoreConstantBranches: false
|
1475
1519
|
|
1476
1520
|
Lint/DuplicateCaseCondition:
|
1477
1521
|
Description: 'Do not repeat values in case conditionals.'
|
@@ -1658,6 +1702,11 @@ Lint/InterpolationCheck:
|
|
1658
1702
|
VersionAdded: '0.50'
|
1659
1703
|
VersionChanged: '0.87'
|
1660
1704
|
|
1705
|
+
Lint/LambdaWithoutLiteralBlock:
|
1706
|
+
Description: 'Checks uses of lambda without a literal block.'
|
1707
|
+
Enabled: pending
|
1708
|
+
VersionAdded: '1.8'
|
1709
|
+
|
1661
1710
|
Lint/LiteralAsCondition:
|
1662
1711
|
Description: 'Checks of literals used in conditions.'
|
1663
1712
|
Enabled: true
|
@@ -1757,6 +1806,17 @@ Lint/NumberConversion:
|
|
1757
1806
|
- Time
|
1758
1807
|
- DateTime
|
1759
1808
|
|
1809
|
+
Lint/NumberedParameterAssignment:
|
1810
|
+
Description: 'Checks for uses of numbered parameter assignment.'
|
1811
|
+
Enabled: pending
|
1812
|
+
VersionAdded: '1.9'
|
1813
|
+
|
1814
|
+
Lint/OrAssignmentToConstant:
|
1815
|
+
Description: 'Checks unintended or-assignment to constant.'
|
1816
|
+
Enabled: pending
|
1817
|
+
Safe: false
|
1818
|
+
VersionAdded: '1.9'
|
1819
|
+
|
1760
1820
|
Lint/OrderedMagicComments:
|
1761
1821
|
Description: 'Checks the proper ordering of magic comments and whether a magic comment is not placed before a shebang.'
|
1762
1822
|
Enabled: true
|
@@ -1820,6 +1880,11 @@ Lint/RedundantCopEnableDirective:
|
|
1820
1880
|
Enabled: true
|
1821
1881
|
VersionAdded: '0.76'
|
1822
1882
|
|
1883
|
+
Lint/RedundantDirGlobSort:
|
1884
|
+
Description: 'Checks for redundant `sort` method to `Dir.glob` and `Dir[]`.'
|
1885
|
+
Enabled: pending
|
1886
|
+
VersionAdded: '1.8'
|
1887
|
+
|
1823
1888
|
Lint/RedundantRequireStatement:
|
1824
1889
|
Description: 'Checks for unnecessary `require` statement.'
|
1825
1890
|
Enabled: true
|
@@ -1842,6 +1907,8 @@ Lint/RedundantSplatExpansion:
|
|
1842
1907
|
Description: 'Checks for splat unnecessarily being called on literals.'
|
1843
1908
|
Enabled: true
|
1844
1909
|
VersionAdded: '0.76'
|
1910
|
+
VersionChanged: '1.7'
|
1911
|
+
AllowPercentLiteralArrayArgument: true
|
1845
1912
|
|
1846
1913
|
Lint/RedundantStringCoercion:
|
1847
1914
|
Description: 'Checks for Object#to_s usage in string interpolation.'
|
@@ -1976,12 +2043,16 @@ Lint/SuppressedException:
|
|
1976
2043
|
VersionAdded: '0.9'
|
1977
2044
|
VersionChanged: '0.81'
|
1978
2045
|
|
2046
|
+
Lint/SymbolConversion:
|
2047
|
+
Description: 'Checks for unnecessary symbol conversions.'
|
2048
|
+
Enabled: pending
|
2049
|
+
VersionAdded: '1.9'
|
2050
|
+
|
1979
2051
|
Lint/Syntax:
|
1980
|
-
Description: 'Checks syntax
|
2052
|
+
Description: 'Checks for syntax errors.'
|
1981
2053
|
Enabled: true
|
1982
2054
|
VersionAdded: '0.9'
|
1983
2055
|
|
1984
|
-
|
1985
2056
|
Lint/ToEnumArguments:
|
1986
2057
|
Description: 'This cop ensures that `to_enum`/`enum_for`, called for the current method, has correct arguments.'
|
1987
2058
|
Enabled: pending
|
@@ -2002,6 +2073,11 @@ Lint/TrailingCommaInAttributeDeclaration:
|
|
2002
2073
|
Enabled: true
|
2003
2074
|
VersionAdded: '0.90'
|
2004
2075
|
|
2076
|
+
Lint/TripleQuotes:
|
2077
|
+
Description: 'Checks for useless triple quote constructs.'
|
2078
|
+
Enabled: pending
|
2079
|
+
VersionAdded: '1.9'
|
2080
|
+
|
2005
2081
|
Lint/UnderscorePrefixedVariableName:
|
2006
2082
|
Description: 'Do not use prefix `_` for a variable that is used.'
|
2007
2083
|
Enabled: true
|
@@ -2045,6 +2121,11 @@ Lint/UnreachableLoop:
|
|
2045
2121
|
Description: 'This cop checks for loops that will have at most one iteration.'
|
2046
2122
|
Enabled: true
|
2047
2123
|
VersionAdded: '0.89'
|
2124
|
+
VersionChanged: '1.7'
|
2125
|
+
IgnoredPatterns:
|
2126
|
+
# RSpec uses `times` in its message expectations
|
2127
|
+
# eg. `exactly(2).times`
|
2128
|
+
- !ruby/regexp /(exactly|at_least|at_most)\(\d+\)\.times/
|
2048
2129
|
|
2049
2130
|
Lint/UnusedBlockArgument:
|
2050
2131
|
Description: 'Checks for unused block arguments.'
|
@@ -2479,10 +2560,12 @@ Naming/VariableName:
|
|
2479
2560
|
StyleGuide: '#snake-case-symbols-methods-vars'
|
2480
2561
|
Enabled: true
|
2481
2562
|
VersionAdded: '0.50'
|
2563
|
+
VersionChanged: '1.8'
|
2482
2564
|
EnforcedStyle: snake_case
|
2483
2565
|
SupportedStyles:
|
2484
2566
|
- snake_case
|
2485
2567
|
- camelCase
|
2568
|
+
AllowedIdentifiers: []
|
2486
2569
|
|
2487
2570
|
Naming/VariableNumber:
|
2488
2571
|
Description: 'Use the configured style when numbering symbols, methods and variables.'
|
@@ -2626,7 +2709,8 @@ Style/AsciiComments:
|
|
2626
2709
|
Enabled: true
|
2627
2710
|
VersionAdded: '0.9'
|
2628
2711
|
VersionChanged: '0.52'
|
2629
|
-
AllowedChars:
|
2712
|
+
AllowedChars:
|
2713
|
+
- ©
|
2630
2714
|
|
2631
2715
|
Style/Attr:
|
2632
2716
|
Description: 'Checks for uses of Module#attr.'
|
@@ -2895,7 +2979,7 @@ Style/CollectionMethods:
|
|
2895
2979
|
StyleGuide: '#map-find-select-reduce-include-size'
|
2896
2980
|
Enabled: false
|
2897
2981
|
VersionAdded: '0.9'
|
2898
|
-
VersionChanged: '
|
2982
|
+
VersionChanged: '1.7'
|
2899
2983
|
Safe: false
|
2900
2984
|
# Mapping from undesired method to desired method
|
2901
2985
|
# e.g. to use `detect` over `find`:
|
@@ -2910,6 +2994,11 @@ Style/CollectionMethods:
|
|
2910
2994
|
detect: 'find'
|
2911
2995
|
find_all: 'select'
|
2912
2996
|
member?: 'include?'
|
2997
|
+
# Methods in this array accept a final symbol as an implicit block
|
2998
|
+
# eg. `inject(:+)`
|
2999
|
+
MethodsAcceptingSymbol:
|
3000
|
+
- inject
|
3001
|
+
- reduce
|
2913
3002
|
|
2914
3003
|
Style/ColonMethodCall:
|
2915
3004
|
Description: 'Do not use :: for method call.'
|
@@ -2969,6 +3058,7 @@ Style/CommentedKeyword:
|
|
2969
3058
|
Description: 'Do not place comments on the same line as certain keywords.'
|
2970
3059
|
Enabled: true
|
2971
3060
|
VersionAdded: '0.51'
|
3061
|
+
VersionChanged: '1.7'
|
2972
3062
|
|
2973
3063
|
Style/ConditionalAssignment:
|
2974
3064
|
Description: >-
|
@@ -3051,6 +3141,8 @@ Style/DisableCopsWithinSourceCodeDirective:
|
|
3051
3141
|
Forbids disabling/enabling cops within source code.
|
3052
3142
|
Enabled: false
|
3053
3143
|
VersionAdded: '0.82'
|
3144
|
+
VersionChanged: '1.9'
|
3145
|
+
AllowedCops: []
|
3054
3146
|
|
3055
3147
|
Style/DocumentDynamicEvalDefinition:
|
3056
3148
|
Description: >-
|
@@ -3168,6 +3260,17 @@ Style/EndBlock:
|
|
3168
3260
|
VersionAdded: '0.9'
|
3169
3261
|
VersionChanged: '0.81'
|
3170
3262
|
|
3263
|
+
Style/EndlessMethod:
|
3264
|
+
Description: 'Avoid the use of multi-lined endless method definitions.'
|
3265
|
+
StyleGuide: '#endless-methods'
|
3266
|
+
Enabled: pending
|
3267
|
+
VersionAdded: '1.8'
|
3268
|
+
EnforcedStyle: allow_single_line
|
3269
|
+
SupportedStyles:
|
3270
|
+
- allow_single_line
|
3271
|
+
- allow_always
|
3272
|
+
- disallow
|
3273
|
+
|
3171
3274
|
Style/EvalWithLocation:
|
3172
3275
|
Description: 'Pass `__FILE__` and `__LINE__` to `eval` method, as they are used by backtraces.'
|
3173
3276
|
Enabled: true
|
@@ -3191,9 +3294,8 @@ Style/ExplicitBlockArgument:
|
|
3191
3294
|
that just passes its arguments to another block.
|
3192
3295
|
StyleGuide: '#block-argument'
|
3193
3296
|
Enabled: true
|
3194
|
-
# May change the yielding arity.
|
3195
|
-
Safe: false
|
3196
3297
|
VersionAdded: '0.89'
|
3298
|
+
VersionChanged: '1.8'
|
3197
3299
|
|
3198
3300
|
Style/ExponentialNotation:
|
3199
3301
|
Description: 'When using exponential notation, favor a mantissa between 1 (inclusive) and 10 (exclusive).'
|
@@ -3212,7 +3314,8 @@ Style/FloatDivision:
|
|
3212
3314
|
Reference: 'https://blog.rubystyle.guide/ruby/2019/06/21/float-division.html'
|
3213
3315
|
Enabled: true
|
3214
3316
|
VersionAdded: '0.72'
|
3215
|
-
VersionChanged: '1.
|
3317
|
+
VersionChanged: '1.9'
|
3318
|
+
Safe: false
|
3216
3319
|
EnforcedStyle: single_coerce
|
3217
3320
|
SupportedStyles:
|
3218
3321
|
- left_coerce
|
@@ -3260,6 +3363,7 @@ Style/FormatStringToken:
|
|
3260
3363
|
MaxUnannotatedPlaceholdersAllowed: 1
|
3261
3364
|
VersionAdded: '0.49'
|
3262
3365
|
VersionChanged: '1.0'
|
3366
|
+
IgnoredMethods: []
|
3263
3367
|
|
3264
3368
|
Style/FrozenStringLiteralComment:
|
3265
3369
|
Description: >-
|
@@ -3328,6 +3432,13 @@ Style/HashEachMethods:
|
|
3328
3432
|
VersionAdded: '0.80'
|
3329
3433
|
Safe: false
|
3330
3434
|
|
3435
|
+
Style/HashExcept:
|
3436
|
+
Description: >-
|
3437
|
+
Checks for usages of `Hash#reject`, `Hash#select`, and `Hash#filter` methods
|
3438
|
+
that can be replaced with `Hash#except` method.
|
3439
|
+
Enabled: pending
|
3440
|
+
VersionAdded: '1.7'
|
3441
|
+
|
3331
3442
|
Style/HashLikeCase:
|
3332
3443
|
Description: >-
|
3333
3444
|
Checks for places where `case-when` represents a simple 1:1
|
@@ -3406,6 +3517,11 @@ Style/IfUnlessModifierOfIfUnless:
|
|
3406
3517
|
VersionAdded: '0.39'
|
3407
3518
|
VersionChanged: '0.87'
|
3408
3519
|
|
3520
|
+
Style/IfWithBooleanLiteralBranches:
|
3521
|
+
Description: 'Checks for redundant `if` with boolean literal branches.'
|
3522
|
+
Enabled: pending
|
3523
|
+
VersionAdded: '1.9'
|
3524
|
+
|
3409
3525
|
Style/IfWithSemicolon:
|
3410
3526
|
Description: 'Do not use if x; .... Use the ternary operator instead.'
|
3411
3527
|
StyleGuide: '#no-semicolon-ifs'
|
@@ -3482,6 +3598,7 @@ Style/KeywordParametersOrder:
|
|
3482
3598
|
StyleGuide: '#keyword-parameters-order'
|
3483
3599
|
Enabled: true
|
3484
3600
|
VersionAdded: '0.90'
|
3601
|
+
VersionChanged: '1.7'
|
3485
3602
|
|
3486
3603
|
Style/Lambda:
|
3487
3604
|
Description: 'Use the new lambda literal syntax for single-line blocks.'
|
@@ -3520,7 +3637,7 @@ Style/MethodCallWithArgsParentheses:
|
|
3520
3637
|
StyleGuide: '#method-invocation-parens'
|
3521
3638
|
Enabled: false
|
3522
3639
|
VersionAdded: '0.47'
|
3523
|
-
VersionChanged: '
|
3640
|
+
VersionChanged: '1.7'
|
3524
3641
|
IgnoreMacros: true
|
3525
3642
|
IgnoredMethods: []
|
3526
3643
|
IgnoredPatterns: []
|
@@ -3554,7 +3671,7 @@ Style/MethodDefParentheses:
|
|
3554
3671
|
StyleGuide: '#method-parens'
|
3555
3672
|
Enabled: true
|
3556
3673
|
VersionAdded: '0.16'
|
3557
|
-
VersionChanged: '
|
3674
|
+
VersionChanged: '1.7'
|
3558
3675
|
EnforcedStyle: require_parentheses
|
3559
3676
|
SupportedStyles:
|
3560
3677
|
- require_parentheses
|
@@ -3660,6 +3777,7 @@ Style/MultilineMethodSignature:
|
|
3660
3777
|
Description: 'Avoid multi-line method signatures.'
|
3661
3778
|
Enabled: false
|
3662
3779
|
VersionAdded: '0.59'
|
3780
|
+
VersionChanged: '1.7'
|
3663
3781
|
|
3664
3782
|
Style/MultilineTernaryOperator:
|
3665
3783
|
Description: >-
|
@@ -3688,7 +3806,8 @@ Style/MutableConstant:
|
|
3688
3806
|
Description: 'Do not assign mutable objects to constants.'
|
3689
3807
|
Enabled: true
|
3690
3808
|
VersionAdded: '0.34'
|
3691
|
-
VersionChanged: '
|
3809
|
+
VersionChanged: '1.8'
|
3810
|
+
SafeAutoCorrect: false
|
3692
3811
|
EnforcedStyle: literals
|
3693
3812
|
SupportedStyles:
|
3694
3813
|
# literals: freeze literals assigned to constants
|
@@ -4026,12 +4145,16 @@ Style/RedundantArgument:
|
|
4026
4145
|
Enabled: pending
|
4027
4146
|
Safe: false
|
4028
4147
|
VersionAdded: '1.4'
|
4029
|
-
VersionChanged: '1.
|
4148
|
+
VersionChanged: '1.7'
|
4030
4149
|
Methods:
|
4031
4150
|
# Array#join
|
4032
4151
|
join: ''
|
4033
4152
|
# String#split
|
4034
4153
|
split: ' '
|
4154
|
+
# String#chomp
|
4155
|
+
chomp: "\n"
|
4156
|
+
# String#chomp!
|
4157
|
+
chomp!: "\n"
|
4035
4158
|
|
4036
4159
|
Style/RedundantAssignment:
|
4037
4160
|
Description: 'Checks for redundant assignment before returning.'
|
@@ -4288,7 +4411,7 @@ Style/SingleLineMethods:
|
|
4288
4411
|
StyleGuide: '#no-single-line-methods'
|
4289
4412
|
Enabled: true
|
4290
4413
|
VersionAdded: '0.9'
|
4291
|
-
VersionChanged: '
|
4414
|
+
VersionChanged: '1.8'
|
4292
4415
|
AllowIfMethodIsEmpty: true
|
4293
4416
|
|
4294
4417
|
Style/SlicingWithRange:
|
data/lib/rubocop.rb
CHANGED
@@ -7,7 +7,7 @@ require 'rainbow'
|
|
7
7
|
require 'set'
|
8
8
|
require 'forwardable'
|
9
9
|
require 'regexp_parser'
|
10
|
-
require 'unicode/display_width
|
10
|
+
require 'unicode/display_width'
|
11
11
|
|
12
12
|
# we have to require RuboCop's version, before rubocop-ast's
|
13
13
|
require_relative 'rubocop/version'
|
@@ -28,6 +28,7 @@ require_relative 'rubocop/name_similarity'
|
|
28
28
|
require_relative 'rubocop/string_interpreter'
|
29
29
|
require_relative 'rubocop/error'
|
30
30
|
require_relative 'rubocop/warning'
|
31
|
+
require_relative 'rubocop/util'
|
31
32
|
|
32
33
|
require_relative 'rubocop/cop/util'
|
33
34
|
require_relative 'rubocop/cop/offense'
|
@@ -60,6 +61,7 @@ require_relative 'rubocop/cop/mixin/annotation_comment'
|
|
60
61
|
require_relative 'rubocop/cop/mixin/array_min_size'
|
61
62
|
require_relative 'rubocop/cop/mixin/array_syntax'
|
62
63
|
require_relative 'rubocop/cop/mixin/alignment'
|
64
|
+
require_relative 'rubocop/cop/mixin/allowed_identifiers'
|
63
65
|
require_relative 'rubocop/cop/mixin/allowed_methods'
|
64
66
|
require_relative 'rubocop/cop/mixin/auto_corrector'
|
65
67
|
require_relative 'rubocop/cop/mixin/check_assignment'
|
@@ -230,6 +232,7 @@ require_relative 'rubocop/cop/layout/space_around_keyword'
|
|
230
232
|
require_relative 'rubocop/cop/layout/space_around_method_call_operator'
|
231
233
|
require_relative 'rubocop/cop/layout/space_around_operators'
|
232
234
|
require_relative 'rubocop/cop/layout/space_before_block_braces'
|
235
|
+
require_relative 'rubocop/cop/layout/space_before_brackets'
|
233
236
|
require_relative 'rubocop/cop/layout/space_before_comma'
|
234
237
|
require_relative 'rubocop/cop/layout/space_before_comment'
|
235
238
|
require_relative 'rubocop/cop/layout/space_before_first_arg'
|
@@ -247,6 +250,7 @@ require_relative 'rubocop/cop/layout/space_inside_string_interpolation'
|
|
247
250
|
require_relative 'rubocop/cop/layout/trailing_empty_lines'
|
248
251
|
require_relative 'rubocop/cop/layout/trailing_whitespace'
|
249
252
|
|
253
|
+
require_relative 'rubocop/cop/lint/ambiguous_assignment'
|
250
254
|
require_relative 'rubocop/cop/lint/ambiguous_block_association'
|
251
255
|
require_relative 'rubocop/cop/lint/ambiguous_operator'
|
252
256
|
require_relative 'rubocop/cop/lint/ambiguous_regexp_literal'
|
@@ -259,6 +263,7 @@ require_relative 'rubocop/cop/lint/constant_definition_in_block'
|
|
259
263
|
require_relative 'rubocop/cop/lint/constant_resolution'
|
260
264
|
require_relative 'rubocop/cop/lint/debugger'
|
261
265
|
require_relative 'rubocop/cop/lint/deprecated_class_methods'
|
266
|
+
require_relative 'rubocop/cop/lint/deprecated_constants'
|
262
267
|
require_relative 'rubocop/cop/lint/deprecated_open_ssl_constant'
|
263
268
|
require_relative 'rubocop/cop/lint/disjunctive_assignment_in_constructor'
|
264
269
|
require_relative 'rubocop/cop/lint/duplicate_branch'
|
@@ -292,6 +297,7 @@ require_relative 'rubocop/cop/lint/implicit_string_concatenation'
|
|
292
297
|
require_relative 'rubocop/cop/lint/inherit_exception'
|
293
298
|
require_relative 'rubocop/cop/lint/ineffective_access_modifier'
|
294
299
|
require_relative 'rubocop/cop/lint/interpolation_check'
|
300
|
+
require_relative 'rubocop/cop/lint/lambda_without_literal_block'
|
295
301
|
require_relative 'rubocop/cop/lint/literal_as_condition'
|
296
302
|
require_relative 'rubocop/cop/lint/literal_in_interpolation'
|
297
303
|
require_relative 'rubocop/cop/lint/loop'
|
@@ -306,6 +312,8 @@ require_relative 'rubocop/cop/lint/no_return_in_begin_end_blocks'
|
|
306
312
|
require_relative 'rubocop/cop/lint/non_deterministic_require_order'
|
307
313
|
require_relative 'rubocop/cop/lint/non_local_exit_from_iterator'
|
308
314
|
require_relative 'rubocop/cop/lint/number_conversion'
|
315
|
+
require_relative 'rubocop/cop/lint/numbered_parameter_assignment'
|
316
|
+
require_relative 'rubocop/cop/lint/or_assignment_to_constant'
|
309
317
|
require_relative 'rubocop/cop/lint/ordered_magic_comments'
|
310
318
|
require_relative 'rubocop/cop/lint/out_of_range_regexp_ref'
|
311
319
|
require_relative 'rubocop/cop/lint/parentheses_as_grouped_expression'
|
@@ -315,6 +323,7 @@ require_relative 'rubocop/cop/lint/raise_exception'
|
|
315
323
|
require_relative 'rubocop/cop/lint/rand_one'
|
316
324
|
require_relative 'rubocop/cop/lint/redundant_cop_disable_directive'
|
317
325
|
require_relative 'rubocop/cop/lint/redundant_cop_enable_directive'
|
326
|
+
require_relative 'rubocop/cop/lint/redundant_dir_glob_sort'
|
318
327
|
require_relative 'rubocop/cop/lint/redundant_require_statement'
|
319
328
|
require_relative 'rubocop/cop/lint/redundant_safe_navigation'
|
320
329
|
require_relative 'rubocop/cop/lint/redundant_splat_expansion'
|
@@ -337,11 +346,13 @@ require_relative 'rubocop/cop/lint/shadowed_exception'
|
|
337
346
|
require_relative 'rubocop/cop/lint/shadowing_outer_local_variable'
|
338
347
|
require_relative 'rubocop/cop/lint/struct_new_override'
|
339
348
|
require_relative 'rubocop/cop/lint/suppressed_exception'
|
349
|
+
require_relative 'rubocop/cop/lint/symbol_conversion'
|
340
350
|
require_relative 'rubocop/cop/lint/syntax'
|
341
351
|
require_relative 'rubocop/cop/lint/to_enum_arguments'
|
342
352
|
require_relative 'rubocop/cop/lint/to_json'
|
343
353
|
require_relative 'rubocop/cop/lint/top_level_return_with_argument'
|
344
354
|
require_relative 'rubocop/cop/lint/trailing_comma_in_attribute_declaration'
|
355
|
+
require_relative 'rubocop/cop/lint/triple_quotes'
|
345
356
|
require_relative 'rubocop/cop/lint/underscore_prefixed_variable_name'
|
346
357
|
require_relative 'rubocop/cop/lint/unexpected_block_arity'
|
347
358
|
require_relative 'rubocop/cop/lint/unified_integer'
|
@@ -443,6 +454,7 @@ require_relative 'rubocop/cop/style/empty_else'
|
|
443
454
|
require_relative 'rubocop/cop/style/empty_lambda_parameter'
|
444
455
|
require_relative 'rubocop/cop/style/empty_literal'
|
445
456
|
require_relative 'rubocop/cop/style/empty_method'
|
457
|
+
require_relative 'rubocop/cop/style/endless_method'
|
446
458
|
require_relative 'rubocop/cop/style/encoding'
|
447
459
|
require_relative 'rubocop/cop/style/end_block'
|
448
460
|
require_relative 'rubocop/cop/style/eval_with_location'
|
@@ -460,6 +472,7 @@ require_relative 'rubocop/cop/style/global_vars'
|
|
460
472
|
require_relative 'rubocop/cop/style/guard_clause'
|
461
473
|
require_relative 'rubocop/cop/style/hash_as_last_array_item'
|
462
474
|
require_relative 'rubocop/cop/style/hash_each_methods'
|
475
|
+
require_relative 'rubocop/cop/style/hash_except'
|
463
476
|
require_relative 'rubocop/cop/style/hash_like_case'
|
464
477
|
require_relative 'rubocop/cop/style/hash_syntax'
|
465
478
|
require_relative 'rubocop/cop/style/hash_transform_keys'
|
@@ -468,6 +481,7 @@ require_relative 'rubocop/cop/style/identical_conditional_branches'
|
|
468
481
|
require_relative 'rubocop/cop/style/if_inside_else'
|
469
482
|
require_relative 'rubocop/cop/style/if_unless_modifier'
|
470
483
|
require_relative 'rubocop/cop/style/if_unless_modifier_of_if_unless'
|
484
|
+
require_relative 'rubocop/cop/style/if_with_boolean_literal_branches'
|
471
485
|
require_relative 'rubocop/cop/style/if_with_semicolon'
|
472
486
|
require_relative 'rubocop/cop/style/implicit_runtime_error'
|
473
487
|
require_relative 'rubocop/cop/style/infinite_loop'
|