rubocop 1.5.1 → 1.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (115) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE.txt +1 -1
  3. data/README.md +2 -2
  4. data/config/default.yml +111 -14
  5. data/config/obsoletion.yml +196 -0
  6. data/lib/rubocop.rb +20 -1
  7. data/lib/rubocop/cli/command/suggest_extensions.rb +19 -19
  8. data/lib/rubocop/comment_config.rb +6 -6
  9. data/lib/rubocop/config.rb +8 -5
  10. data/lib/rubocop/config_loader.rb +10 -6
  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 +26 -0
  32. data/lib/rubocop/cop/layout/line_length.rb +6 -16
  33. data/lib/rubocop/cop/layout/multiline_method_call_indentation.rb +7 -3
  34. data/lib/rubocop/cop/layout/multiline_operation_indentation.rb +2 -2
  35. data/lib/rubocop/cop/layout/rescue_ensure_alignment.rb +3 -10
  36. data/lib/rubocop/cop/layout/space_around_equals_in_parameter_default.rb +1 -0
  37. data/lib/rubocop/cop/layout/space_before_block_braces.rb +2 -0
  38. data/lib/rubocop/cop/layout/space_before_brackets.rb +62 -0
  39. data/lib/rubocop/cop/layout/space_inside_block_braces.rb +13 -10
  40. data/lib/rubocop/cop/layout/space_inside_hash_literal_braces.rb +2 -2
  41. data/lib/rubocop/cop/lint/ambiguous_assignment.rb +59 -0
  42. data/lib/rubocop/cop/lint/binary_operator_with_identical_operands.rb +7 -2
  43. data/lib/rubocop/cop/lint/deprecated_constants.rb +75 -0
  44. data/lib/rubocop/cop/lint/duplicate_branch.rb +64 -2
  45. data/lib/rubocop/cop/lint/lambda_without_literal_block.rb +44 -0
  46. data/lib/rubocop/cop/lint/non_deterministic_require_order.rb +10 -6
  47. data/lib/rubocop/cop/lint/redundant_cop_disable_directive.rb +2 -1
  48. data/lib/rubocop/cop/lint/redundant_dir_glob_sort.rb +48 -0
  49. data/lib/rubocop/cop/lint/redundant_splat_expansion.rb +50 -17
  50. data/lib/rubocop/cop/lint/shadowed_exception.rb +1 -11
  51. data/lib/rubocop/cop/lint/shadowing_outer_local_variable.rb +13 -0
  52. data/lib/rubocop/cop/lint/unreachable_loop.rb +17 -0
  53. data/lib/rubocop/cop/metrics/utils/code_length_calculator.rb +1 -1
  54. data/lib/rubocop/cop/migration/department_name.rb +1 -1
  55. data/lib/rubocop/cop/mixin/allowed_identifiers.rb +18 -0
  56. data/lib/rubocop/cop/mixin/comments_help.rb +1 -10
  57. data/lib/rubocop/cop/mixin/first_element_line_break.rb +1 -1
  58. data/lib/rubocop/cop/mixin/string_help.rb +4 -1
  59. data/lib/rubocop/cop/naming/accessor_method_name.rb +15 -1
  60. data/lib/rubocop/cop/naming/memoized_instance_variable_name.rb +59 -5
  61. data/lib/rubocop/cop/naming/variable_name.rb +2 -0
  62. data/lib/rubocop/cop/naming/variable_number.rb +1 -8
  63. data/lib/rubocop/cop/registry.rb +10 -0
  64. data/lib/rubocop/cop/style/access_modifier_declarations.rb +3 -1
  65. data/lib/rubocop/cop/style/character_literal.rb +10 -11
  66. data/lib/rubocop/cop/style/collection_methods.rb +14 -1
  67. data/lib/rubocop/cop/style/commented_keyword.rb +22 -5
  68. data/lib/rubocop/cop/style/empty_literal.rb +6 -2
  69. data/lib/rubocop/cop/style/endless_method.rb +102 -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_regexp_escape.rb +24 -8
  91. data/lib/rubocop/cop/style/redundant_return.rb +1 -1
  92. data/lib/rubocop/cop/style/single_line_block_params.rb +30 -7
  93. data/lib/rubocop/cop/style/single_line_methods.rb +33 -2
  94. data/lib/rubocop/cop/style/sole_nested_conditional.rb +25 -9
  95. data/lib/rubocop/cop/style/special_global_vars.rb +1 -13
  96. data/lib/rubocop/cop/style/string_concatenation.rb +26 -1
  97. data/lib/rubocop/cop/style/string_literals.rb +14 -8
  98. data/lib/rubocop/cop/style/string_literals_in_interpolation.rb +4 -3
  99. data/lib/rubocop/cop/style/symbol_proc.rb +5 -4
  100. data/lib/rubocop/cop/util.rb +3 -1
  101. data/lib/rubocop/ext/regexp_node.rb +31 -9
  102. data/lib/rubocop/ext/regexp_parser.rb +21 -3
  103. data/lib/rubocop/formatter/emacs_style_formatter.rb +2 -0
  104. data/lib/rubocop/formatter/simple_text_formatter.rb +2 -0
  105. data/lib/rubocop/formatter/tap_formatter.rb +2 -0
  106. data/lib/rubocop/lockfile.rb +40 -0
  107. data/lib/rubocop/options.rb +9 -9
  108. data/lib/rubocop/rspec/cop_helper.rb +0 -4
  109. data/lib/rubocop/rspec/expect_offense.rb +34 -22
  110. data/lib/rubocop/runner.rb +16 -1
  111. data/lib/rubocop/target_finder.rb +4 -2
  112. data/lib/rubocop/target_ruby.rb +47 -11
  113. data/lib/rubocop/util.rb +16 -0
  114. data/lib/rubocop/version.rb +8 -2
  115. metadata +42 -9
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6385e74786dea3c867437d18cb40ed5715ed391e14c05f9589b9029b5d8e3b82
4
- data.tar.gz: 56ca46faf293f235cecc7e9efc3590f355889b837bf2a9d27c224eb62e5a5ac5
3
+ metadata.gz: 9e14b02ef2156539b9acbf92f0a131cbf5459cccdbb799cf96116f51b61e45c3
4
+ data.tar.gz: 2322dcababa13d2dbc001fc4a6fb8fe8c39e39b0d27869f4b1b5c59aceefa577
5
5
  SHA512:
6
- metadata.gz: 1f7dd2432b886b8a843fb168179d51a1f2944c045261d461a35e3a40942d55de8a837051bb06635482cf29db50f6bb8f4be16bf284a9596d70ab3e1235a296ec
7
- data.tar.gz: 3cdc1f213db45d58d9ae5f2b05a6ed93d9c5cb18bf096e7ff2c848bdf191f70b1af011401a97c70f54a0a63107a24bb60c7eea50284a3f7b9467e522c3d9b183
6
+ metadata.gz: afc301f47f48f46587318215a0d64a246ac9f4007f7c2396867a1c26cff2a467d59ebd30531adaf5dd3eebcaea001f19b34ab4737bebfe4b51dda7f329a0b4f9
7
+ data.tar.gz: ee54178b27d0dc5e058f004a27ea53d581583bf3386bf2fc572b4b16ad6099d849720935a6c632aaade0a3c71ca92129c0b3c9dc4dff80e00977d5141bc02615
@@ -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.
@@ -241,5 +241,5 @@ RuboCop's changelog is available [here](CHANGELOG.md).
241
241
 
242
242
  ## Copyright
243
243
 
244
- Copyright (c) 2012-2020 Bozhidar Batsov. See [LICENSE.txt](LICENSE.txt) for
244
+ Copyright (c) 2012-2021 Bozhidar Batsov. See [LICENSE.txt](LICENSE.txt) for
245
245
  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
@@ -3209,9 +3289,10 @@ Style/ExponentialNotation:
3209
3289
  Style/FloatDivision:
3210
3290
  Description: 'For performing float division, coerce one side only.'
3211
3291
  StyleGuide: '#float-division'
3212
- Reference: 'https://github.com/rubocop-hq/ruby-style-guide/issues/628'
3292
+ Reference: 'https://blog.rubystyle.guide/ruby/2019/06/21/float-division.html'
3213
3293
  Enabled: true
3214
3294
  VersionAdded: '0.72'
3295
+ VersionChanged: '1.6'
3215
3296
  EnforcedStyle: single_coerce
3216
3297
  SupportedStyles:
3217
3298
  - left_coerce
@@ -3327,6 +3408,13 @@ Style/HashEachMethods:
3327
3408
  VersionAdded: '0.80'
3328
3409
  Safe: false
3329
3410
 
3411
+ Style/HashExcept:
3412
+ Description: >-
3413
+ Checks for usages of `Hash#reject`, `Hash#select`, and `Hash#filter` methods
3414
+ that can be replaced with `Hash#except` method.
3415
+ Enabled: pending
3416
+ VersionAdded: '1.7'
3417
+
3330
3418
  Style/HashLikeCase:
3331
3419
  Description: >-
3332
3420
  Checks for places where `case-when` represents a simple 1:1
@@ -3481,6 +3569,7 @@ Style/KeywordParametersOrder:
3481
3569
  StyleGuide: '#keyword-parameters-order'
3482
3570
  Enabled: true
3483
3571
  VersionAdded: '0.90'
3572
+ VersionChanged: '1.7'
3484
3573
 
3485
3574
  Style/Lambda:
3486
3575
  Description: 'Use the new lambda literal syntax for single-line blocks.'
@@ -3519,7 +3608,7 @@ Style/MethodCallWithArgsParentheses:
3519
3608
  StyleGuide: '#method-invocation-parens'
3520
3609
  Enabled: false
3521
3610
  VersionAdded: '0.47'
3522
- VersionChanged: '0.61'
3611
+ VersionChanged: '1.7'
3523
3612
  IgnoreMacros: true
3524
3613
  IgnoredMethods: []
3525
3614
  IgnoredPatterns: []
@@ -3553,7 +3642,7 @@ Style/MethodDefParentheses:
3553
3642
  StyleGuide: '#method-parens'
3554
3643
  Enabled: true
3555
3644
  VersionAdded: '0.16'
3556
- VersionChanged: '0.35'
3645
+ VersionChanged: '1.7'
3557
3646
  EnforcedStyle: require_parentheses
3558
3647
  SupportedStyles:
3559
3648
  - require_parentheses
@@ -3659,6 +3748,7 @@ Style/MultilineMethodSignature:
3659
3748
  Description: 'Avoid multi-line method signatures.'
3660
3749
  Enabled: false
3661
3750
  VersionAdded: '0.59'
3751
+ VersionChanged: '1.7'
3662
3752
 
3663
3753
  Style/MultilineTernaryOperator:
3664
3754
  Description: >-
@@ -3687,7 +3777,8 @@ Style/MutableConstant:
3687
3777
  Description: 'Do not assign mutable objects to constants.'
3688
3778
  Enabled: true
3689
3779
  VersionAdded: '0.34'
3690
- VersionChanged: '0.65'
3780
+ VersionChanged: '1.8'
3781
+ SafeAutoCorrect: false
3691
3782
  EnforcedStyle: literals
3692
3783
  SupportedStyles:
3693
3784
  # literals: freeze literals assigned to constants
@@ -4025,11 +4116,16 @@ Style/RedundantArgument:
4025
4116
  Enabled: pending
4026
4117
  Safe: false
4027
4118
  VersionAdded: '1.4'
4119
+ VersionChanged: '1.7'
4028
4120
  Methods:
4029
4121
  # Array#join
4030
4122
  join: ''
4031
4123
  # String#split
4032
4124
  split: ' '
4125
+ # String#chomp
4126
+ chomp: "\n"
4127
+ # String#chomp!
4128
+ chomp!: "\n"
4033
4129
 
4034
4130
  Style/RedundantAssignment:
4035
4131
  Description: 'Checks for redundant assignment before returning.'
@@ -4272,7 +4368,7 @@ Style/SingleLineBlockParams:
4272
4368
  Description: 'Enforces the names of some block params.'
4273
4369
  Enabled: false
4274
4370
  VersionAdded: '0.16'
4275
- VersionChanged: '0.47'
4371
+ VersionChanged: '1.6'
4276
4372
  Methods:
4277
4373
  - reduce:
4278
4374
  - acc
@@ -4286,7 +4382,7 @@ Style/SingleLineMethods:
4286
4382
  StyleGuide: '#no-single-line-methods'
4287
4383
  Enabled: true
4288
4384
  VersionAdded: '0.9'
4289
- VersionChanged: '0.19'
4385
+ VersionChanged: '1.8'
4290
4386
  AllowIfMethodIsEmpty: true
4291
4387
 
4292
4388
  Style/SlicingWithRange:
@@ -4345,6 +4441,7 @@ Style/StringConcatenation:
4345
4441
  Enabled: true
4346
4442
  Safe: false
4347
4443
  VersionAdded: '0.89'
4444
+ VersionChanged: '1.6'
4348
4445
 
4349
4446
  Style/StringHashKeys:
4350
4447
  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