rubocop 1.5.2 → 1.8.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (113) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE.txt +1 -1
  3. data/README.md +3 -2
  4. data/config/default.yml +112 -16
  5. data/config/obsoletion.yml +196 -0
  6. data/lib/rubocop.rb +20 -1
  7. data/lib/rubocop/cli/command/suggest_extensions.rb +16 -44
  8. data/lib/rubocop/comment_config.rb +6 -6
  9. data/lib/rubocop/config.rb +8 -5
  10. data/lib/rubocop/config_loader.rb +11 -7
  11. data/lib/rubocop/config_loader_resolver.rb +21 -4
  12. data/lib/rubocop/config_obsoletion.rb +64 -262
  13. data/lib/rubocop/config_obsoletion/changed_enforced_styles.rb +33 -0
  14. data/lib/rubocop/config_obsoletion/changed_parameter.rb +21 -0
  15. data/lib/rubocop/config_obsoletion/cop_rule.rb +34 -0
  16. data/lib/rubocop/config_obsoletion/extracted_cop.rb +44 -0
  17. data/lib/rubocop/config_obsoletion/parameter_rule.rb +44 -0
  18. data/lib/rubocop/config_obsoletion/removed_cop.rb +41 -0
  19. data/lib/rubocop/config_obsoletion/renamed_cop.rb +34 -0
  20. data/lib/rubocop/config_obsoletion/rule.rb +41 -0
  21. data/lib/rubocop/config_obsoletion/split_cop.rb +27 -0
  22. data/lib/rubocop/config_validator.rb +11 -4
  23. data/lib/rubocop/cop/base.rb +17 -15
  24. data/lib/rubocop/cop/cop.rb +2 -2
  25. data/lib/rubocop/cop/correctors/string_literal_corrector.rb +6 -8
  26. data/lib/rubocop/cop/gemspec/required_ruby_version.rb +3 -2
  27. data/lib/rubocop/cop/internal_affairs.rb +1 -0
  28. data/lib/rubocop/cop/internal_affairs/style_detected_api_use.rb +145 -0
  29. data/lib/rubocop/cop/layout/empty_line_between_defs.rb +19 -3
  30. data/lib/rubocop/cop/layout/empty_lines_around_attribute_accessor.rb +1 -1
  31. data/lib/rubocop/cop/layout/heredoc_argument_closing_parenthesis.rb +14 -0
  32. data/lib/rubocop/cop/layout/line_length.rb +6 -16
  33. data/lib/rubocop/cop/layout/multiline_operation_indentation.rb +2 -2
  34. data/lib/rubocop/cop/layout/rescue_ensure_alignment.rb +3 -10
  35. data/lib/rubocop/cop/layout/space_around_equals_in_parameter_default.rb +1 -0
  36. data/lib/rubocop/cop/layout/space_before_block_braces.rb +2 -0
  37. data/lib/rubocop/cop/layout/space_before_brackets.rb +62 -0
  38. data/lib/rubocop/cop/layout/space_inside_block_braces.rb +13 -10
  39. data/lib/rubocop/cop/layout/space_inside_hash_literal_braces.rb +2 -2
  40. data/lib/rubocop/cop/lint/ambiguous_assignment.rb +59 -0
  41. data/lib/rubocop/cop/lint/binary_operator_with_identical_operands.rb +7 -2
  42. data/lib/rubocop/cop/lint/deprecated_constants.rb +75 -0
  43. data/lib/rubocop/cop/lint/duplicate_branch.rb +64 -2
  44. data/lib/rubocop/cop/lint/lambda_without_literal_block.rb +44 -0
  45. data/lib/rubocop/cop/lint/non_deterministic_require_order.rb +10 -6
  46. data/lib/rubocop/cop/lint/redundant_cop_disable_directive.rb +2 -1
  47. data/lib/rubocop/cop/lint/redundant_dir_glob_sort.rb +50 -0
  48. data/lib/rubocop/cop/lint/redundant_splat_expansion.rb +50 -17
  49. data/lib/rubocop/cop/lint/shadowed_exception.rb +1 -11
  50. data/lib/rubocop/cop/lint/unreachable_loop.rb +17 -0
  51. data/lib/rubocop/cop/metrics/utils/code_length_calculator.rb +1 -1
  52. data/lib/rubocop/cop/migration/department_name.rb +1 -1
  53. data/lib/rubocop/cop/mixin/allowed_identifiers.rb +18 -0
  54. data/lib/rubocop/cop/mixin/comments_help.rb +1 -10
  55. data/lib/rubocop/cop/mixin/first_element_line_break.rb +1 -1
  56. data/lib/rubocop/cop/mixin/string_help.rb +4 -1
  57. data/lib/rubocop/cop/mixin/uncommunicative_name.rb +5 -1
  58. data/lib/rubocop/cop/naming/accessor_method_name.rb +15 -1
  59. data/lib/rubocop/cop/naming/memoized_instance_variable_name.rb +59 -5
  60. data/lib/rubocop/cop/naming/variable_name.rb +2 -0
  61. data/lib/rubocop/cop/naming/variable_number.rb +1 -8
  62. data/lib/rubocop/cop/registry.rb +10 -0
  63. data/lib/rubocop/cop/style/access_modifier_declarations.rb +3 -1
  64. data/lib/rubocop/cop/style/character_literal.rb +10 -11
  65. data/lib/rubocop/cop/style/collection_methods.rb +14 -1
  66. data/lib/rubocop/cop/style/commented_keyword.rb +22 -5
  67. data/lib/rubocop/cop/style/empty_literal.rb +6 -2
  68. data/lib/rubocop/cop/style/endless_method.rb +102 -0
  69. data/lib/rubocop/cop/style/explicit_block_argument.rb +10 -0
  70. data/lib/rubocop/cop/style/float_division.rb +44 -1
  71. data/lib/rubocop/cop/style/for.rb +2 -0
  72. data/lib/rubocop/cop/style/hash_except.rb +95 -0
  73. data/lib/rubocop/cop/style/hash_like_case.rb +2 -1
  74. data/lib/rubocop/cop/style/if_inside_else.rb +8 -3
  75. data/lib/rubocop/cop/style/if_unless_modifier.rb +4 -0
  76. data/lib/rubocop/cop/style/ip_addresses.rb +1 -1
  77. data/lib/rubocop/cop/style/keyword_parameters_order.rb +12 -2
  78. data/lib/rubocop/cop/style/lambda_call.rb +2 -1
  79. data/lib/rubocop/cop/style/method_call_with_args_parentheses.rb +7 -0
  80. data/lib/rubocop/cop/style/method_call_with_args_parentheses/omit_parentheses.rb +16 -6
  81. data/lib/rubocop/cop/style/method_def_parentheses.rb +7 -0
  82. data/lib/rubocop/cop/style/multiline_method_signature.rb +26 -1
  83. data/lib/rubocop/cop/style/multiline_when_then.rb +3 -1
  84. data/lib/rubocop/cop/style/mutable_constant.rb +13 -3
  85. data/lib/rubocop/cop/style/nested_parenthesized_calls.rb +4 -0
  86. data/lib/rubocop/cop/style/perl_backrefs.rb +86 -9
  87. data/lib/rubocop/cop/style/raise_args.rb +5 -2
  88. data/lib/rubocop/cop/style/redundant_argument.rb +21 -2
  89. data/lib/rubocop/cop/style/redundant_freeze.rb +8 -4
  90. data/lib/rubocop/cop/style/redundant_return.rb +1 -1
  91. data/lib/rubocop/cop/style/single_line_block_params.rb +30 -7
  92. data/lib/rubocop/cop/style/single_line_methods.rb +34 -2
  93. data/lib/rubocop/cop/style/sole_nested_conditional.rb +15 -9
  94. data/lib/rubocop/cop/style/special_global_vars.rb +1 -13
  95. data/lib/rubocop/cop/style/string_concatenation.rb +20 -1
  96. data/lib/rubocop/cop/style/string_literals.rb +14 -8
  97. data/lib/rubocop/cop/style/string_literals_in_interpolation.rb +4 -3
  98. data/lib/rubocop/cop/style/symbol_proc.rb +5 -4
  99. data/lib/rubocop/cop/style/while_until_modifier.rb +2 -4
  100. data/lib/rubocop/cop/util.rb +3 -1
  101. data/lib/rubocop/formatter/emacs_style_formatter.rb +2 -0
  102. data/lib/rubocop/formatter/simple_text_formatter.rb +2 -0
  103. data/lib/rubocop/formatter/tap_formatter.rb +2 -0
  104. data/lib/rubocop/lockfile.rb +40 -0
  105. data/lib/rubocop/options.rb +9 -9
  106. data/lib/rubocop/rspec/cop_helper.rb +0 -4
  107. data/lib/rubocop/rspec/expect_offense.rb +34 -22
  108. data/lib/rubocop/runner.rb +16 -1
  109. data/lib/rubocop/target_finder.rb +4 -2
  110. data/lib/rubocop/target_ruby.rb +47 -11
  111. data/lib/rubocop/util.rb +16 -0
  112. data/lib/rubocop/version.rb +8 -2
  113. metadata +28 -7
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 77baac77fdf5ed6293449d9653e1caeadc94b18e49bbd5115176c3681b8ed752
4
- data.tar.gz: 677ced7d3409d54555aaba855aec07fac0717bdb100eef4ea0196d68688247d6
3
+ metadata.gz: fe7ec80b8cde2a075fee5a5658abf6dc74889091dae29e88482107983d2de270
4
+ data.tar.gz: 7852fe6a6d0ba9cae98439cba0dfbfda659a5a434f62eca318bcd5bc45dfd3c4
5
5
  SHA512:
6
- metadata.gz: d083c6f78d892e14780bc3ab2cadf4b4208b87ab3dae357df39cc5dcbd9c2a18ff416795cd73a39c0d743fd07923ccbd092b916be3e738114558aa2b37f724cc
7
- data.tar.gz: 6a5e0502cfbc9c0c5c11f075b89a91ea7ae4ec1b70134fbe6930caca9f7959282dea23f9358db291cca2a4e1fa72e830a1717c1c845528024eb89d23e6368379
6
+ metadata.gz: 4239a27259a39584a544ed4bfc7c6025ece2198d463f8a2918a98e5560cec9a5a2ea5b978f0d253e61ea700446bb49f705627d8b8e41d4ead0fef35b23b14d98
7
+ data.tar.gz: 59746b47f6bbe92dec5f6d79395ad6cd1a175d3a186005412953f0a849192673084b426bd14f6e9ac83e11dfaa0b27fc15718857b29ca6d359e2c9d387bca9c2
@@ -1,4 +1,4 @@
1
- Copyright (c) 2012-20 Bozhidar Batsov
1
+ Copyright (c) 2012-21 Bozhidar Batsov
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
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.5', require: false
54
+ gem 'rubocop', '~> 1.8', 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-2020 Bozhidar Batsov. See [LICENSE.txt](LICENSE.txt) for
245
+ Copyright (c) 2012-2021 Bozhidar Batsov. See [LICENSE.txt](LICENSE.txt) for
245
246
  further details.
@@ -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 file, Gemfile or gems.rb file, RuboCop will try to determine
136
- # the desired version of Ruby by inspecting the .ruby-version file first,
137
- # followed by the Gemfile.lock or gems.locked file. (Although the Ruby version
138
- # is specified in the Gemfile or gems.rb file, RuboCop reads the final value
139
- # from the lock file.) If the Ruby version is still unresolved, RuboCop will
140
- # use the oldest officially supported Ruby version (currently Ruby 2.4).
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.4'
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
@@ -1820,6 +1869,11 @@ Lint/RedundantCopEnableDirective:
1820
1869
  Enabled: true
1821
1870
  VersionAdded: '0.76'
1822
1871
 
1872
+ Lint/RedundantDirGlobSort:
1873
+ Description: 'Checks for redundant `sort` method to `Dir.glob` and `Dir[]`.'
1874
+ Enabled: pending
1875
+ VersionAdded: '1.8'
1876
+
1823
1877
  Lint/RedundantRequireStatement:
1824
1878
  Description: 'Checks for unnecessary `require` statement.'
1825
1879
  Enabled: true
@@ -1842,6 +1896,8 @@ Lint/RedundantSplatExpansion:
1842
1896
  Description: 'Checks for splat unnecessarily being called on literals.'
1843
1897
  Enabled: true
1844
1898
  VersionAdded: '0.76'
1899
+ VersionChanged: '1.7'
1900
+ AllowPercentLiteralArrayArgument: true
1845
1901
 
1846
1902
  Lint/RedundantStringCoercion:
1847
1903
  Description: 'Checks for Object#to_s usage in string interpolation.'
@@ -2045,6 +2101,11 @@ Lint/UnreachableLoop:
2045
2101
  Description: 'This cop checks for loops that will have at most one iteration.'
2046
2102
  Enabled: true
2047
2103
  VersionAdded: '0.89'
2104
+ VersionChanged: '1.7'
2105
+ IgnoredPatterns:
2106
+ # RSpec uses `times` in its message expectations
2107
+ # eg. `exactly(2).times`
2108
+ - !ruby/regexp /(exactly|at_least|at_most)\(\d+\)\.times/
2048
2109
 
2049
2110
  Lint/UnusedBlockArgument:
2050
2111
  Description: 'Checks for unused block arguments.'
@@ -2479,10 +2540,12 @@ Naming/VariableName:
2479
2540
  StyleGuide: '#snake-case-symbols-methods-vars'
2480
2541
  Enabled: true
2481
2542
  VersionAdded: '0.50'
2543
+ VersionChanged: '1.8'
2482
2544
  EnforcedStyle: snake_case
2483
2545
  SupportedStyles:
2484
2546
  - snake_case
2485
2547
  - camelCase
2548
+ AllowedIdentifiers: []
2486
2549
 
2487
2550
  Naming/VariableNumber:
2488
2551
  Description: 'Use the configured style when numbering symbols, methods and variables.'
@@ -2895,7 +2958,7 @@ Style/CollectionMethods:
2895
2958
  StyleGuide: '#map-find-select-reduce-include-size'
2896
2959
  Enabled: false
2897
2960
  VersionAdded: '0.9'
2898
- VersionChanged: '0.27'
2961
+ VersionChanged: '1.7'
2899
2962
  Safe: false
2900
2963
  # Mapping from undesired method to desired method
2901
2964
  # e.g. to use `detect` over `find`:
@@ -2910,6 +2973,11 @@ Style/CollectionMethods:
2910
2973
  detect: 'find'
2911
2974
  find_all: 'select'
2912
2975
  member?: 'include?'
2976
+ # Methods in this array accept a final symbol as an implicit block
2977
+ # eg. `inject(:+)`
2978
+ MethodsAcceptingSymbol:
2979
+ - inject
2980
+ - reduce
2913
2981
 
2914
2982
  Style/ColonMethodCall:
2915
2983
  Description: 'Do not use :: for method call.'
@@ -2969,6 +3037,7 @@ Style/CommentedKeyword:
2969
3037
  Description: 'Do not place comments on the same line as certain keywords.'
2970
3038
  Enabled: true
2971
3039
  VersionAdded: '0.51'
3040
+ VersionChanged: '1.7'
2972
3041
 
2973
3042
  Style/ConditionalAssignment:
2974
3043
  Description: >-
@@ -3168,6 +3237,17 @@ Style/EndBlock:
3168
3237
  VersionAdded: '0.9'
3169
3238
  VersionChanged: '0.81'
3170
3239
 
3240
+ Style/EndlessMethod:
3241
+ Description: 'Avoid the use of multi-lined endless method definitions.'
3242
+ StyleGuide: '#endless-methods'
3243
+ Enabled: pending
3244
+ VersionAdded: '1.8'
3245
+ EnforcedStyle: allow_single_line
3246
+ SupportedStyles:
3247
+ - allow_single_line
3248
+ - allow_always
3249
+ - disallow
3250
+
3171
3251
  Style/EvalWithLocation:
3172
3252
  Description: 'Pass `__FILE__` and `__LINE__` to `eval` method, as they are used by backtraces.'
3173
3253
  Enabled: true
@@ -3191,9 +3271,8 @@ Style/ExplicitBlockArgument:
3191
3271
  that just passes its arguments to another block.
3192
3272
  StyleGuide: '#block-argument'
3193
3273
  Enabled: true
3194
- # May change the yielding arity.
3195
- Safe: false
3196
3274
  VersionAdded: '0.89'
3275
+ VersionChanged: '1.8'
3197
3276
 
3198
3277
  Style/ExponentialNotation:
3199
3278
  Description: 'When using exponential notation, favor a mantissa between 1 (inclusive) and 10 (exclusive).'
@@ -3209,9 +3288,10 @@ Style/ExponentialNotation:
3209
3288
  Style/FloatDivision:
3210
3289
  Description: 'For performing float division, coerce one side only.'
3211
3290
  StyleGuide: '#float-division'
3212
- Reference: 'https://github.com/rubocop-hq/ruby-style-guide/issues/628'
3291
+ Reference: 'https://blog.rubystyle.guide/ruby/2019/06/21/float-division.html'
3213
3292
  Enabled: true
3214
3293
  VersionAdded: '0.72'
3294
+ VersionChanged: '1.6'
3215
3295
  EnforcedStyle: single_coerce
3216
3296
  SupportedStyles:
3217
3297
  - left_coerce
@@ -3327,6 +3407,13 @@ Style/HashEachMethods:
3327
3407
  VersionAdded: '0.80'
3328
3408
  Safe: false
3329
3409
 
3410
+ Style/HashExcept:
3411
+ Description: >-
3412
+ Checks for usages of `Hash#reject`, `Hash#select`, and `Hash#filter` methods
3413
+ that can be replaced with `Hash#except` method.
3414
+ Enabled: pending
3415
+ VersionAdded: '1.7'
3416
+
3330
3417
  Style/HashLikeCase:
3331
3418
  Description: >-
3332
3419
  Checks for places where `case-when` represents a simple 1:1
@@ -3481,6 +3568,7 @@ Style/KeywordParametersOrder:
3481
3568
  StyleGuide: '#keyword-parameters-order'
3482
3569
  Enabled: true
3483
3570
  VersionAdded: '0.90'
3571
+ VersionChanged: '1.7'
3484
3572
 
3485
3573
  Style/Lambda:
3486
3574
  Description: 'Use the new lambda literal syntax for single-line blocks.'
@@ -3519,7 +3607,7 @@ Style/MethodCallWithArgsParentheses:
3519
3607
  StyleGuide: '#method-invocation-parens'
3520
3608
  Enabled: false
3521
3609
  VersionAdded: '0.47'
3522
- VersionChanged: '0.61'
3610
+ VersionChanged: '1.7'
3523
3611
  IgnoreMacros: true
3524
3612
  IgnoredMethods: []
3525
3613
  IgnoredPatterns: []
@@ -3553,7 +3641,7 @@ Style/MethodDefParentheses:
3553
3641
  StyleGuide: '#method-parens'
3554
3642
  Enabled: true
3555
3643
  VersionAdded: '0.16'
3556
- VersionChanged: '0.35'
3644
+ VersionChanged: '1.7'
3557
3645
  EnforcedStyle: require_parentheses
3558
3646
  SupportedStyles:
3559
3647
  - require_parentheses
@@ -3659,6 +3747,7 @@ Style/MultilineMethodSignature:
3659
3747
  Description: 'Avoid multi-line method signatures.'
3660
3748
  Enabled: false
3661
3749
  VersionAdded: '0.59'
3750
+ VersionChanged: '1.7'
3662
3751
 
3663
3752
  Style/MultilineTernaryOperator:
3664
3753
  Description: >-
@@ -3687,7 +3776,8 @@ Style/MutableConstant:
3687
3776
  Description: 'Do not assign mutable objects to constants.'
3688
3777
  Enabled: true
3689
3778
  VersionAdded: '0.34'
3690
- VersionChanged: '0.65'
3779
+ VersionChanged: '1.8'
3780
+ SafeAutoCorrect: false
3691
3781
  EnforcedStyle: literals
3692
3782
  SupportedStyles:
3693
3783
  # literals: freeze literals assigned to constants
@@ -4025,11 +4115,16 @@ Style/RedundantArgument:
4025
4115
  Enabled: pending
4026
4116
  Safe: false
4027
4117
  VersionAdded: '1.4'
4118
+ VersionChanged: '1.7'
4028
4119
  Methods:
4029
4120
  # Array#join
4030
4121
  join: ''
4031
4122
  # String#split
4032
4123
  split: ' '
4124
+ # String#chomp
4125
+ chomp: "\n"
4126
+ # String#chomp!
4127
+ chomp!: "\n"
4033
4128
 
4034
4129
  Style/RedundantAssignment:
4035
4130
  Description: 'Checks for redundant assignment before returning.'
@@ -4272,7 +4367,7 @@ Style/SingleLineBlockParams:
4272
4367
  Description: 'Enforces the names of some block params.'
4273
4368
  Enabled: false
4274
4369
  VersionAdded: '0.16'
4275
- VersionChanged: '0.47'
4370
+ VersionChanged: '1.6'
4276
4371
  Methods:
4277
4372
  - reduce:
4278
4373
  - acc
@@ -4286,7 +4381,7 @@ Style/SingleLineMethods:
4286
4381
  StyleGuide: '#no-single-line-methods'
4287
4382
  Enabled: true
4288
4383
  VersionAdded: '0.9'
4289
- VersionChanged: '0.19'
4384
+ VersionChanged: '1.8'
4290
4385
  AllowIfMethodIsEmpty: true
4291
4386
 
4292
4387
  Style/SlicingWithRange:
@@ -4345,6 +4440,7 @@ Style/StringConcatenation:
4345
4440
  Enabled: true
4346
4441
  Safe: false
4347
4442
  VersionAdded: '0.89'
4443
+ VersionChanged: '1.6'
4348
4444
 
4349
4445
  Style/StringHashKeys:
4350
4446
  Description: 'Prefer symbols instead of strings as hash keys.'
@@ -0,0 +1,196 @@
1
+ # Configuration of obsolete/deprecated cops used by `ConfigObsoletion`
2
+
3
+ # Cops that were renamed
4
+ renamed:
5
+ Layout/AlignArguments: Layout/ArgumentAlignment
6
+ Layout/AlignArray: Layout/ArrayAlignment
7
+ Layout/AlignHash: Layout/HashAlignment
8
+ Layout/AlignParameters: Layout/ParameterAlignment
9
+ Layout/IndentArray: Layout/FirstArrayElementIndentation
10
+ Layout/IndentAssignment: Layout/AssignmentIndentation
11
+ Layout/IndentFirstArgument: Layout/FirstArgumentIndentation
12
+ Layout/IndentFirstArrayElement: Layout/FirstArrayElementIndentation
13
+ Layout/IndentFirstHashElement: Layout/FirstHashElementIndentation
14
+ Layout/IndentFirstParameter: Layout/FirstParameterIndentation
15
+ Layout/IndentHash: Layout/FirstHashElementIndentation
16
+ Layout/IndentHeredoc: Layout/HeredocIndentation
17
+ Layout/LeadingBlankLines: Layout/LeadingEmptyLines
18
+ Layout/Tab: Layout/IndentationStyle
19
+ Layout/TrailingBlankLines: Layout/TrailingEmptyLines
20
+ Lint/BlockAlignment: Layout/BlockAlignment
21
+ Lint/DefEndAlignment: Layout/DefEndAlignment
22
+ Lint/DuplicatedKey: Lint/DuplicateHashKey
23
+ Lint/EndAlignment: Layout/EndAlignment
24
+ Lint/EndInMethod: Style/EndBlock
25
+ Lint/Eval: Security/Eval
26
+ Lint/HandleExceptions: Lint/SuppressedException
27
+ Lint/MultipleCompare: Lint/MultipleComparison
28
+ Lint/StringConversionInInterpolation: Lint/RedundantStringCoercion
29
+ Lint/UnneededCopDisableDirective: Lint/RedundantCopDisableDirective
30
+ Lint/UnneededCopEnableDirective: Lint/RedundantCopEnableDirective
31
+ Lint/UnneededRequireStatement: Lint/RedundantRequireStatement
32
+ Lint/UnneededSplatExpansion: Lint/RedundantSplatExpansion
33
+ Metrics/LineLength: Layout/LineLength
34
+ Naming/UncommunicativeBlockParamName: Naming/BlockParameterName
35
+ Naming/UncommunicativeMethodParamName: Naming/MethodParameterName
36
+ Style/AccessorMethodName: Naming/AccessorMethodName
37
+ Style/AsciiIdentifiers: Naming/AsciiIdentifiers
38
+ Style/ClassAndModuleCamelCase: Naming/ClassAndModuleCamelCase
39
+ Style/ConstantName: Naming/ConstantName
40
+ Style/DeprecatedHashMethods: Style/PreferredHashMethods
41
+ Style/FileName: Naming/FileName
42
+ Style/FlipFlop: Lint/FlipFlop
43
+ Style/MethodCallParentheses: Style/MethodCallWithoutArgsParentheses
44
+ Style/MethodName: Naming/MethodName
45
+ Style/OpMethod: Naming/BinaryOperatorParameterName
46
+ Style/PredicateName: Naming/PredicateName
47
+ Style/SingleSpaceBeforeFirstArg: Layout/SpaceBeforeFirstArg
48
+ Style/UnneededCapitalW: Style/RedundantCapitalW
49
+ Style/UnneededCondition: Style/RedundantCondition
50
+ Style/UnneededInterpolation: Style/RedundantInterpolation
51
+ Style/UnneededPercentQ: Style/RedundantPercentQ
52
+ Style/UnneededSort: Style/RedundantSort
53
+ Style/VariableName: Naming/VariableName
54
+ Style/VariableNumber: Naming/VariableNumber
55
+
56
+ # Cops that were removed
57
+ removed:
58
+ Layout/SpaceAfterControlKeyword:
59
+ alternatives: Layout/SpaceAroundKeyword
60
+ Layout/SpaceBeforeModifierKeyword:
61
+ alternatives: Layout/SpaceAroundKeyword
62
+ Lint/InvalidCharacterLiteral:
63
+ reason: it was never being actually triggered
64
+ Lint/RescueWithoutErrorClass:
65
+ alternatives: Style/RescueStandardError
66
+ Lint/SpaceBeforeFirstArg:
67
+ reason: >
68
+ it was a duplicate of `Layout/SpaceBeforeFirstArg`. Please use
69
+ `Layout/SpaceBeforeFirstArg` instead
70
+ Lint/UselessComparison:
71
+ reason: >
72
+ it has been superseded by
73
+ `Lint/BinaryOperatorWithIdenticalOperands`. Please use
74
+ `Lint/BinaryOperatorWithIdenticalOperands` instead
75
+ Style/BracesAroundHashParameters: true
76
+ Style/MethodMissingSuper:
77
+ reason: >
78
+ it has been superseded by `Lint/MissingSuper`. Please use
79
+ `Lint/MissingSuper` instead
80
+ Style/SpaceAfterControlKeyword:
81
+ alternatives: Layout/SpaceAroundKeyword
82
+ Style/SpaceBeforeModifierKeyword:
83
+ alternatives: Layout/SpaceAroundKeyword
84
+ Style/TrailingComma:
85
+ alternatives:
86
+ - Style/TrailingCommaInArguments
87
+ - Style/TrailingCommaInArrayLiteral
88
+ - Style/TrailingCommaInHashLiteral
89
+ Style/TrailingCommaInLiteral:
90
+ alternatives:
91
+ - Style/TrailingCommaInArrayLiteral
92
+ - Style/TrailingCommaInHashLiteral
93
+
94
+ # Cops split into multiple other cops
95
+ split:
96
+ Style/MethodMissing:
97
+ alternatives:
98
+ - Style/MethodMissingSuper
99
+ - Style/MissingRespondToMissing
100
+
101
+ # Cops that were extracted into a different gem
102
+ extracted:
103
+ Performance/*: rubocop-performance
104
+ Rails/*: rubocop-rails
105
+
106
+ # Cop parameters that have been changed
107
+ # Can be treated as a warning instead of a failure with `severity: warning`
108
+ changed_parameters:
109
+ - cops:
110
+ - Layout/SpaceAroundOperators
111
+ - Style/SpaceAroundOperators
112
+ parameters: MultiSpaceAllowedForOperators
113
+ reason: >
114
+ If your intention was to allow extra spaces for alignment, please
115
+ use `AllowForAlignment: true` instead.
116
+ - cops: Style/Encoding
117
+ parameters:
118
+ - EnforcedStyle
119
+ - SupportedStyles
120
+ - AutoCorrectEncodingComment
121
+ reason: '`Style/Encoding` no longer supports styles. The "never" behavior is always assumed.'
122
+ - cops: Style/IfUnlessModifier
123
+ parameters: MaxLineLength
124
+ reason: >
125
+ `Style/IfUnlessModifier: MaxLineLength` has been removed.
126
+ Use `Layout/LineLength: Max` instead
127
+ - cops: Style/WhileUntilModifier
128
+ parameters: MaxLineLength
129
+ reason: >
130
+ `Style/WhileUntilModifier: MaxLineLength` has been removed.
131
+ Use `Layout/LineLength: Max` instead
132
+ - cops: AllCops
133
+ parameters: RunRailsCops
134
+ reason: |-
135
+ Use the following configuration instead:
136
+ Rails:
137
+ Enabled: true
138
+ - cops: Layout/CaseIndentation
139
+ parameters: IndentWhenRelativeTo
140
+ alternative: EnforcedStyle
141
+ - cops:
142
+ - Lint/BlockAlignment
143
+ - Layout/BlockAlignment
144
+ - Lint/EndAlignment
145
+ - Layout/EndAlignment
146
+ - Lint/DefEndAlignment
147
+ - Layout/DefEndAlignment
148
+ parameters: AlignWith
149
+ alternative: EnforcedStyleAlignWith
150
+ - cops: Rails/UniqBeforePluck
151
+ parameters: EnforcedMode
152
+ alternative: EnforcedStyle
153
+ - cops: Style/MethodCallWithArgsParentheses
154
+ parameters: IgnoredMethodPatterns
155
+ alternative: IgnoredPatterns
156
+ - cops:
157
+ - Performance/Count
158
+ - Performance/Detect
159
+ parameters: SafeMode
160
+ reason: "`SafeMode` has been removed. Use `SafeAutoCorrect` instead."
161
+ - cops: Bundler/GemComment
162
+ parameters: Whitelist
163
+ alternative: IgnoredGems
164
+ - cops:
165
+ - Lint/SafeNavigationChain
166
+ - Lint/SafeNavigationConsistency
167
+ - Style/NestedParenthesizedCalls
168
+ - Style/SafeNavigation
169
+ - Style/TrivialAccessors
170
+ parameters: Whitelist
171
+ alternative: AllowedMethods
172
+ - cops: Style/IpAddresses
173
+ parameters: Whitelist
174
+ alternative: AllowedAddresses
175
+ - cops: Naming/HeredocDelimiterNaming
176
+ parameters: Blacklist
177
+ alternative: ForbiddenDelimiters
178
+ - cops: Naming/PredicateName
179
+ parameters: NamePrefixBlacklist
180
+ alternative: ForbiddenPrefixes
181
+ - cops: Naming/PredicateName
182
+ parameters: NameWhitelist
183
+ alternative: AllowedMethods
184
+ - cops:
185
+ - Metrics/BlockLength
186
+ - Metrics/MethodLength
187
+ parameters: ExcludedMethods
188
+ alternative: IgnoredMethods
189
+ severity: warning
190
+
191
+ # Enforced styles that have been removed or replaced
192
+ changed_enforced_styles:
193
+ - cops: Layout/IndentationConsistency
194
+ parameters: EnforcedStyle
195
+ value: rails
196
+ alternative: indented_internal_methods