rubocop 1.7.0 → 1.8.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.
Files changed (32) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE.txt +1 -1
  3. data/README.md +2 -2
  4. data/config/default.yml +61 -9
  5. data/lib/rubocop.rb +6 -1
  6. data/lib/rubocop/comment_config.rb +6 -6
  7. data/lib/rubocop/cop/layout/empty_line_between_defs.rb +1 -1
  8. data/lib/rubocop/cop/layout/multiline_operation_indentation.rb +2 -2
  9. data/lib/rubocop/cop/layout/space_before_brackets.rb +10 -12
  10. data/lib/rubocop/cop/lint/deprecated_constants.rb +75 -0
  11. data/lib/rubocop/cop/lint/lambda_without_literal_block.rb +44 -0
  12. data/lib/rubocop/cop/lint/non_deterministic_require_order.rb +10 -6
  13. data/lib/rubocop/cop/lint/redundant_cop_disable_directive.rb +2 -1
  14. data/lib/rubocop/cop/lint/redundant_dir_glob_sort.rb +48 -0
  15. data/lib/rubocop/cop/mixin/allowed_identifiers.rb +18 -0
  16. data/lib/rubocop/cop/mixin/comments_help.rb +1 -10
  17. data/lib/rubocop/cop/mixin/first_element_line_break.rb +1 -1
  18. data/lib/rubocop/cop/naming/variable_name.rb +2 -0
  19. data/lib/rubocop/cop/naming/variable_number.rb +1 -8
  20. data/lib/rubocop/cop/style/empty_literal.rb +6 -2
  21. data/lib/rubocop/cop/style/endless_method.rb +102 -0
  22. data/lib/rubocop/cop/style/hash_like_case.rb +2 -1
  23. data/lib/rubocop/cop/style/if_inside_else.rb +8 -3
  24. data/lib/rubocop/cop/style/method_call_with_args_parentheses.rb +4 -0
  25. data/lib/rubocop/cop/style/nested_parenthesized_calls.rb +4 -0
  26. data/lib/rubocop/cop/style/raise_args.rb +3 -2
  27. data/lib/rubocop/cop/style/redundant_return.rb +1 -1
  28. data/lib/rubocop/cop/style/single_line_methods.rb +29 -2
  29. data/lib/rubocop/cop/style/sole_nested_conditional.rb +1 -1
  30. data/lib/rubocop/target_ruby.rb +47 -11
  31. data/lib/rubocop/version.rb +1 -1
  32. metadata +12 -7
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fe0d2cef28b14b92436ce28d483594398761fe11474f23e2577630e4c74d877d
4
- data.tar.gz: 4c06f9d71ffc6b08ad14e9fbb574bcca19cfccc231c36aee75f23c7753643893
3
+ metadata.gz: 9e14b02ef2156539b9acbf92f0a131cbf5459cccdbb799cf96116f51b61e45c3
4
+ data.tar.gz: 2322dcababa13d2dbc001fc4a6fb8fe8c39e39b0d27869f4b1b5c59aceefa577
5
5
  SHA512:
6
- metadata.gz: a395e4004802da434ac704d5aec675b16637d464edc7d9305ec03c739a8d85f57f59d19f31187e93c7f37e9bcd7df6ec0b92df951de8e4508b169637cc7fb190
7
- data.tar.gz: bac84ae15f62dafabde785bb46bf9e67d4554979fc09a431ee949b61ae03edac8897a6a914f153667eb6abdf803e73efe0a117c691d36d3ff73599ca3b41a13c
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.7', 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
@@ -1197,7 +1198,6 @@ Layout/SpaceBeforeBrackets:
1197
1198
  StyleGuide: '#space-in-brackets-access'
1198
1199
  Enabled: pending
1199
1200
  VersionAdded: '1.7'
1200
- Safe: false
1201
1201
 
1202
1202
  Layout/SpaceBeforeComma:
1203
1203
  Description: 'No spaces before commas.'
@@ -1469,6 +1469,34 @@ Lint/DeprecatedClassMethods:
1469
1469
  Enabled: true
1470
1470
  VersionAdded: '0.19'
1471
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
+
1472
1500
  Lint/DeprecatedOpenSSLConstant:
1473
1501
  Description: "Don't use algorithm constants for `OpenSSL::Cipher` and `OpenSSL::Digest`."
1474
1502
  Enabled: true
@@ -1674,6 +1702,11 @@ Lint/InterpolationCheck:
1674
1702
  VersionAdded: '0.50'
1675
1703
  VersionChanged: '0.87'
1676
1704
 
1705
+ Lint/LambdaWithoutLiteralBlock:
1706
+ Description: 'Checks uses of lambda without a literal block.'
1707
+ Enabled: pending
1708
+ VersionAdded: '1.8'
1709
+
1677
1710
  Lint/LiteralAsCondition:
1678
1711
  Description: 'Checks of literals used in conditions.'
1679
1712
  Enabled: true
@@ -1836,6 +1869,11 @@ Lint/RedundantCopEnableDirective:
1836
1869
  Enabled: true
1837
1870
  VersionAdded: '0.76'
1838
1871
 
1872
+ Lint/RedundantDirGlobSort:
1873
+ Description: 'Checks for redundant `sort` method to `Dir.glob` and `Dir[]`.'
1874
+ Enabled: pending
1875
+ VersionAdded: '1.8'
1876
+
1839
1877
  Lint/RedundantRequireStatement:
1840
1878
  Description: 'Checks for unnecessary `require` statement.'
1841
1879
  Enabled: true
@@ -2502,10 +2540,12 @@ Naming/VariableName:
2502
2540
  StyleGuide: '#snake-case-symbols-methods-vars'
2503
2541
  Enabled: true
2504
2542
  VersionAdded: '0.50'
2543
+ VersionChanged: '1.8'
2505
2544
  EnforcedStyle: snake_case
2506
2545
  SupportedStyles:
2507
2546
  - snake_case
2508
2547
  - camelCase
2548
+ AllowedIdentifiers: []
2509
2549
 
2510
2550
  Naming/VariableNumber:
2511
2551
  Description: 'Use the configured style when numbering symbols, methods and variables.'
@@ -3197,6 +3237,17 @@ Style/EndBlock:
3197
3237
  VersionAdded: '0.9'
3198
3238
  VersionChanged: '0.81'
3199
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
+
3200
3251
  Style/EvalWithLocation:
3201
3252
  Description: 'Pass `__FILE__` and `__LINE__` to `eval` method, as they are used by backtraces.'
3202
3253
  Enabled: true
@@ -3726,7 +3777,8 @@ Style/MutableConstant:
3726
3777
  Description: 'Do not assign mutable objects to constants.'
3727
3778
  Enabled: true
3728
3779
  VersionAdded: '0.34'
3729
- VersionChanged: '0.65'
3780
+ VersionChanged: '1.8'
3781
+ SafeAutoCorrect: false
3730
3782
  EnforcedStyle: literals
3731
3783
  SupportedStyles:
3732
3784
  # literals: freeze literals assigned to constants
@@ -4330,7 +4382,7 @@ Style/SingleLineMethods:
4330
4382
  StyleGuide: '#no-single-line-methods'
4331
4383
  Enabled: true
4332
4384
  VersionAdded: '0.9'
4333
- VersionChanged: '1.7'
4385
+ VersionChanged: '1.8'
4334
4386
  AllowIfMethodIsEmpty: true
4335
4387
 
4336
4388
  Style/SlicingWithRange:
@@ -7,7 +7,7 @@ require 'rainbow'
7
7
  require 'set'
8
8
  require 'forwardable'
9
9
  require 'regexp_parser'
10
- require 'unicode/display_width/no_string_ext'
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'
@@ -61,6 +61,7 @@ require_relative 'rubocop/cop/mixin/annotation_comment'
61
61
  require_relative 'rubocop/cop/mixin/array_min_size'
62
62
  require_relative 'rubocop/cop/mixin/array_syntax'
63
63
  require_relative 'rubocop/cop/mixin/alignment'
64
+ require_relative 'rubocop/cop/mixin/allowed_identifiers'
64
65
  require_relative 'rubocop/cop/mixin/allowed_methods'
65
66
  require_relative 'rubocop/cop/mixin/auto_corrector'
66
67
  require_relative 'rubocop/cop/mixin/check_assignment'
@@ -262,6 +263,7 @@ require_relative 'rubocop/cop/lint/constant_definition_in_block'
262
263
  require_relative 'rubocop/cop/lint/constant_resolution'
263
264
  require_relative 'rubocop/cop/lint/debugger'
264
265
  require_relative 'rubocop/cop/lint/deprecated_class_methods'
266
+ require_relative 'rubocop/cop/lint/deprecated_constants'
265
267
  require_relative 'rubocop/cop/lint/deprecated_open_ssl_constant'
266
268
  require_relative 'rubocop/cop/lint/disjunctive_assignment_in_constructor'
267
269
  require_relative 'rubocop/cop/lint/duplicate_branch'
@@ -295,6 +297,7 @@ require_relative 'rubocop/cop/lint/implicit_string_concatenation'
295
297
  require_relative 'rubocop/cop/lint/inherit_exception'
296
298
  require_relative 'rubocop/cop/lint/ineffective_access_modifier'
297
299
  require_relative 'rubocop/cop/lint/interpolation_check'
300
+ require_relative 'rubocop/cop/lint/lambda_without_literal_block'
298
301
  require_relative 'rubocop/cop/lint/literal_as_condition'
299
302
  require_relative 'rubocop/cop/lint/literal_in_interpolation'
300
303
  require_relative 'rubocop/cop/lint/loop'
@@ -318,6 +321,7 @@ require_relative 'rubocop/cop/lint/raise_exception'
318
321
  require_relative 'rubocop/cop/lint/rand_one'
319
322
  require_relative 'rubocop/cop/lint/redundant_cop_disable_directive'
320
323
  require_relative 'rubocop/cop/lint/redundant_cop_enable_directive'
324
+ require_relative 'rubocop/cop/lint/redundant_dir_glob_sort'
321
325
  require_relative 'rubocop/cop/lint/redundant_require_statement'
322
326
  require_relative 'rubocop/cop/lint/redundant_safe_navigation'
323
327
  require_relative 'rubocop/cop/lint/redundant_splat_expansion'
@@ -446,6 +450,7 @@ require_relative 'rubocop/cop/style/empty_else'
446
450
  require_relative 'rubocop/cop/style/empty_lambda_parameter'
447
451
  require_relative 'rubocop/cop/style/empty_literal'
448
452
  require_relative 'rubocop/cop/style/empty_method'
453
+ require_relative 'rubocop/cop/style/endless_method'
449
454
  require_relative 'rubocop/cop/style/encoding'
450
455
  require_relative 'rubocop/cop/style/end_block'
451
456
  require_relative 'rubocop/cop/style/eval_with_location'
@@ -47,6 +47,12 @@ module RuboCop
47
47
  )
48
48
  end
49
49
 
50
+ def comment_only_line?(line_number)
51
+ non_comment_token_line_numbers.none? do |non_comment_line_number|
52
+ non_comment_line_number == line_number
53
+ end
54
+ end
55
+
50
56
  private
51
57
 
52
58
  def extra_enabled_comments_with_names(extras:, names:)
@@ -166,12 +172,6 @@ module RuboCop
166
172
  @all_cop_names ||= Cop::Registry.global.names - [REDUNDANT_DISABLE]
167
173
  end
168
174
 
169
- def comment_only_line?(line_number)
170
- non_comment_token_line_numbers.none? do |non_comment_line_number|
171
- non_comment_line_number == line_number
172
- end
173
- end
174
-
175
175
  def non_comment_token_line_numbers
176
176
  @non_comment_token_line_numbers ||= begin
177
177
  non_comment_tokens = processed_source.tokens.reject(&:comment?)
@@ -210,7 +210,7 @@ module RuboCop
210
210
  end
211
211
 
212
212
  def end_loc(node)
213
- if node.def_type? && node.endless?
213
+ if (node.def_type? || node.defs_type?) && node.endless?
214
214
  node.loc.expression.end
215
215
  else
216
216
  node.loc.end
@@ -16,14 +16,14 @@ module RuboCop
16
16
  # if a +
17
17
  # b
18
18
  # something &&
19
- # something_else
19
+ # something_else
20
20
  # end
21
21
  #
22
22
  # # good
23
23
  # if a +
24
24
  # b
25
25
  # something &&
26
- # something_else
26
+ # something_else
27
27
  # end
28
28
  #
29
29
  # @example EnforcedStyle: indented
@@ -6,10 +6,6 @@ module RuboCop
6
6
  # Checks for space between the name of a receiver and a left
7
7
  # brackets.
8
8
  #
9
- # This cop is marked as unsafe because it can occur false positives
10
- # for `do_something [this_is_an_array_literal_argument]` that take
11
- # an array without parentheses as an argument.
12
- #
13
9
  # @example
14
10
  #
15
11
  # # bad
@@ -25,21 +21,23 @@ module RuboCop
25
21
  MSG = 'Remove the space before the opening brackets.'
26
22
 
27
23
  def on_send(node)
28
- return if node.parenthesized? || node.parent&.send_type?
29
24
  return unless (first_argument = node.first_argument)
30
25
 
31
26
  begin_pos = first_argument.source_range.begin_pos
32
-
33
- return unless (range = offense_range(node, first_argument, begin_pos))
27
+ return unless (range = offense_range(node, begin_pos))
34
28
 
35
29
  register_offense(range)
36
30
  end
37
31
 
38
32
  private
39
33
 
40
- def offense_range(node, first_argument, begin_pos)
41
- if space_before_brackets?(node, first_argument)
42
- range_between(node.loc.selector.end_pos, begin_pos)
34
+ def offense_range(node, begin_pos)
35
+ if reference_variable_with_brackets?(node)
36
+ receiver_end_pos = node.receiver.source_range.end_pos
37
+ selector_begin_pos = node.loc.selector.begin_pos
38
+ return if receiver_end_pos >= selector_begin_pos
39
+
40
+ range_between(receiver_end_pos, selector_begin_pos)
43
41
  elsif node.method?(:[]=)
44
42
  end_pos = node.receiver.source_range.end_pos
45
43
 
@@ -55,8 +53,8 @@ module RuboCop
55
53
  end
56
54
  end
57
55
 
58
- def space_before_brackets?(node, first_argument)
59
- node.receiver.nil? && first_argument.array_type? && node.arguments.size == 1
56
+ def reference_variable_with_brackets?(node)
57
+ node.receiver&.variable? && node.method?(:[]) && node.arguments.size == 1
60
58
  end
61
59
  end
62
60
  end
@@ -0,0 +1,75 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RuboCop
4
+ module Cop
5
+ module Lint
6
+ # This cop checks for deprecated constants.
7
+ #
8
+ # It has `DeprecatedConstants` config. If there is an alternative method, you can set
9
+ # alternative value as `Alternative`. And you can set the deprecated version as
10
+ # `DeprecatedVersion`. These options can be omitted if they are not needed.
11
+ #
12
+ # DeprecatedConstants:
13
+ # 'DEPRECATED_CONSTANT':
14
+ # Alternative: 'alternative_value'
15
+ # DeprecatedVersion: 'deprecated_version'
16
+ #
17
+ # By default, `NIL`, `TRUE`, `FALSE` and `Random::DEFAULT` are configured.
18
+ #
19
+ # @example
20
+ #
21
+ # # bad
22
+ # NIL
23
+ # TRUE
24
+ # FALSE
25
+ # Random::DEFAULT # Return value of Ruby 2 is `Random` instance, Ruby 3.0 is `Random` class.
26
+ #
27
+ # # good
28
+ # nil
29
+ # true
30
+ # false
31
+ # Random.new # `::DEFAULT` has been deprecated in Ruby 3, `.new` is compatible with Ruby 2.
32
+ #
33
+ class DeprecatedConstants < Base
34
+ extend AutoCorrector
35
+
36
+ SUGGEST_GOOD_MSG = 'Use `%<good>s` instead of `%<bad>s`%<deprecated_message>s.'
37
+ DO_NOT_USE_MSG = 'Do not use `%<bad>s`%<deprecated_message>s.'
38
+
39
+ def on_const(node)
40
+ constant = node.absolute? ? consntant_name(node, node.short_name.to_s) : node.source
41
+ return unless (deprecated_constant = deprecated_constants[constant])
42
+
43
+ alternative = deprecated_constant['Alternative']
44
+ version = deprecated_constant['DeprecatedVersion']
45
+
46
+ add_offense(node, message: message(alternative, node.source, version)) do |corrector|
47
+ corrector.replace(node, alternative)
48
+ end
49
+ end
50
+
51
+ private
52
+
53
+ def consntant_name(node, nested_constant_name)
54
+ return nested_constant_name unless node.namespace.const_type?
55
+
56
+ consntant_name(node.namespace, "#{node.namespace.short_name}::#{nested_constant_name}")
57
+ end
58
+
59
+ def message(good, bad, deprecated_version)
60
+ deprecated_message = ", deprecated since Ruby #{deprecated_version}" if deprecated_version
61
+
62
+ if good
63
+ format(SUGGEST_GOOD_MSG, good: good, bad: bad, deprecated_message: deprecated_message)
64
+ else
65
+ format(DO_NOT_USE_MSG, bad: bad, deprecated_message: deprecated_message)
66
+ end
67
+ end
68
+
69
+ def deprecated_constants
70
+ cop_config.fetch('DeprecatedConstants', {})
71
+ end
72
+ end
73
+ end
74
+ end
75
+ end
@@ -0,0 +1,44 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RuboCop
4
+ module Cop
5
+ module Lint
6
+ # This cop checks uses of lambda without a literal block.
7
+ # It emulates the following warning in Ruby 3.0:
8
+ #
9
+ # % ruby -vwe 'lambda(&proc {})'
10
+ # ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-darwin19]
11
+ # -e:1: warning: lambda without a literal block is deprecated; use the proc without
12
+ # lambda instead
13
+ #
14
+ # This way, proc object is never converted to lambda.
15
+ # Auto-correction replaces with compatible proc argument.
16
+ #
17
+ # @example
18
+ #
19
+ # # bad
20
+ # lambda(&proc { do_something })
21
+ # lambda(&Proc.new { do_something })
22
+ #
23
+ # # good
24
+ # proc { do_something }
25
+ # Proc.new { do_something }
26
+ # lambda { do_something } # If you use lambda.
27
+ #
28
+ class LambdaWithoutLiteralBlock < Base
29
+ extend AutoCorrector
30
+
31
+ MSG = 'lambda without a literal block is deprecated; use the proc without lambda instead.'
32
+ RESTRICT_ON_SEND = %i[lambda].freeze
33
+
34
+ def on_send(node)
35
+ return if node.parent&.block_type? || !node.first_argument
36
+
37
+ add_offense(node) do |corrector|
38
+ corrector.replace(node, node.first_argument.source.delete('&'))
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
44
+ end
@@ -11,6 +11,11 @@ module RuboCop
11
11
  # that are hard to debug. To ensure this doesn't happen,
12
12
  # always sort the list.
13
13
  #
14
+ # `Dir.glob` and `Dir[]` sort globbed results by default in Ruby 3.0.
15
+ # So all bad cases are acceptable when Ruby 3.0 or higher are used.
16
+ #
17
+ # This cop will be deprecated and removed when supporting only Ruby 3.0 and higher.
18
+ #
14
19
  # @example
15
20
  #
16
21
  # # bad
@@ -23,8 +28,6 @@ module RuboCop
23
28
  # require file
24
29
  # end
25
30
  #
26
- # @example
27
- #
28
31
  # # bad
29
32
  # Dir.glob(Rails.root.join(__dir__, 'test', '*.rb')) do |file|
30
33
  # require file
@@ -35,28 +38,28 @@ module RuboCop
35
38
  # require file
36
39
  # end
37
40
  #
38
- # @example
39
- #
40
41
  # # bad
41
42
  # Dir['./lib/**/*.rb'].each(&method(:require))
42
43
  #
43
44
  # # good
44
45
  # Dir['./lib/**/*.rb'].sort.each(&method(:require))
45
46
  #
46
- # @example
47
- #
48
47
  # # bad
49
48
  # Dir.glob(Rails.root.join('test', '*.rb'), &method(:require))
50
49
  #
51
50
  # # good
52
51
  # Dir.glob(Rails.root.join('test', '*.rb')).sort.each(&method(:require))
53
52
  #
53
+ # # good - Respect intent if `sort` keyword option is specified in Ruby 3.0 or higher.
54
+ # Dir.glob(Rails.root.join(__dir__, 'test', '*.rb'), sort: false).each(&method(:require))
55
+ #
54
56
  class NonDeterministicRequireOrder < Base
55
57
  extend AutoCorrector
56
58
 
57
59
  MSG = 'Sort files before requiring them.'
58
60
 
59
61
  def on_block(node)
62
+ return if target_ruby_version >= 3.0
60
63
  return unless node.body
61
64
  return unless unsorted_dir_loop?(node.send_node)
62
65
 
@@ -70,6 +73,7 @@ module RuboCop
70
73
  end
71
74
 
72
75
  def on_block_pass(node)
76
+ return if target_ruby_version >= 3.0
73
77
  return unless method_require?(node)
74
78
  return unless unsorted_dir_pass?(node.parent)
75
79
 
@@ -61,7 +61,8 @@ module RuboCop
61
61
  end
62
62
 
63
63
  def comment_range_with_surrounding_space(range)
64
- if previous_line_blank?(range)
64
+ if previous_line_blank?(range) &&
65
+ processed_source.comment_config.comment_only_line?(range.line)
65
66
  # When the previous line is blank, it should be retained
66
67
  range_with_surrounding_space(range: range, side: :right)
67
68
  else
@@ -0,0 +1,48 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RuboCop
4
+ module Cop
5
+ module Lint
6
+ # Sort globbed results by default in Ruby 3.0.
7
+ # This cop checks for redundant `sort` method to `Dir.glob` and `Dir[]`.
8
+ #
9
+ # @example
10
+ #
11
+ # # bad
12
+ # Dir.glob('./lib/**/*.rb').sort.each do |file|
13
+ # end
14
+ #
15
+ # Dir['./lib/**/*.rb'].sort.each do |file|
16
+ # end
17
+ #
18
+ # # good
19
+ # Dir.glob('./lib/**/*.rb').each do |file|
20
+ # end
21
+ #
22
+ # Dir['./lib/**/*.rb'].each do |file|
23
+ # end
24
+ #
25
+ class RedundantDirGlobSort < Base
26
+ extend AutoCorrector
27
+ extend TargetRubyVersion
28
+
29
+ minimum_target_ruby_version 3.0
30
+
31
+ MSG = 'Remove redundant `sort`.'
32
+ RESTRICT_ON_SEND = %i[sort].freeze
33
+ GLOB_METHODS = %i[glob []].freeze
34
+
35
+ def on_send(node)
36
+ return unless (receiver = node.receiver)
37
+ return unless receiver.receiver.const_type? && receiver.receiver.short_name == :Dir
38
+ return unless GLOB_METHODS.include?(receiver.method_name)
39
+
40
+ add_offense(node.loc.selector) do |corrector|
41
+ corrector.remove(node.loc.selector)
42
+ corrector.remove(node.loc.dot)
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RuboCop
4
+ module Cop
5
+ # This module encapsulates the ability to allow certain identifiers in a cop.
6
+ module AllowedIdentifiers
7
+ SIGILS = '@$' # if a variable starts with a sigil it will be removed
8
+
9
+ def allowed_identifier?(name)
10
+ allowed_identifiers.include?(name.to_s.delete(SIGILS))
11
+ end
12
+
13
+ def allowed_identifiers
14
+ cop_config.fetch('AllowedIdentifiers', [])
15
+ end
16
+ end
17
+ end
18
+ end
@@ -22,16 +22,7 @@ module RuboCop
22
22
  end
23
23
 
24
24
  def begin_pos_with_comment(node)
25
- annotation_line = node.first_line - 1
26
- first_comment = nil
27
-
28
- processed_source.comments_before_line(annotation_line)
29
- .reverse_each do |comment|
30
- if comment.location.line == annotation_line
31
- first_comment = comment
32
- annotation_line -= 1
33
- end
34
- end
25
+ first_comment = processed_source.ast_with_comments[node].first
35
26
 
36
27
  start_line_position(first_comment || node)
37
28
  end
@@ -21,7 +21,7 @@ module RuboCop
21
21
  end
22
22
 
23
23
  def check_children_line_break(node, children, start = node)
24
- return if children.size < 2
24
+ return if children.empty?
25
25
 
26
26
  line = start.first_line
27
27
 
@@ -20,6 +20,7 @@ module RuboCop
20
20
  # # good
21
21
  # fooBar = 1
22
22
  class VariableName < Base
23
+ include AllowedIdentifiers
23
24
  include ConfigurableNaming
24
25
 
25
26
  MSG = 'Use %<style>s for variable names.'
@@ -27,6 +28,7 @@ module RuboCop
27
28
  def on_lvasgn(node)
28
29
  name, = *node
29
30
  return unless name
31
+ return if allowed_identifier?(name)
30
32
 
31
33
  check_name(node, name, node.loc.name)
32
34
  end
@@ -97,6 +97,7 @@ module RuboCop
97
97
  # expect(Open3).to receive(:capture3)
98
98
  #
99
99
  class VariableNumber < Base
100
+ include AllowedIdentifiers
100
101
  include ConfigurableNumbering
101
102
 
102
103
  MSG = 'Use %<style>s for %<identifier_type>s numbers.'
@@ -139,14 +140,6 @@ module RuboCop
139
140
 
140
141
  format(MSG, style: style, identifier_type: identifier_type)
141
142
  end
142
-
143
- def allowed_identifier?(name)
144
- allowed_identifiers.include?(name.to_s.delete('@'))
145
- end
146
-
147
- def allowed_identifiers
148
- cop_config.fetch('AllowedIdentifiers', [])
149
- end
150
143
  end
151
144
  end
152
145
  end
@@ -32,8 +32,12 @@ module RuboCop
32
32
  def_node_matcher :str_node, '(send (const {nil? cbase} :String) :new)'
33
33
  def_node_matcher :array_with_block,
34
34
  '(block (send (const {nil? cbase} :Array) :new) args _)'
35
- def_node_matcher :hash_with_block,
36
- '(block (send (const {nil? cbase} :Hash) :new) args _)'
35
+ def_node_matcher :hash_with_block, <<~PATTERN
36
+ {
37
+ (block (send (const {nil? cbase} :Hash) :new) args _)
38
+ (numblock (send (const {nil? cbase} :Hash) :new) ...)
39
+ }
40
+ PATTERN
37
41
 
38
42
  def on_send(node)
39
43
  return unless (message = offense_message(node))
@@ -0,0 +1,102 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RuboCop
4
+ module Cop
5
+ module Style
6
+ # This cop checks for endless methods.
7
+ #
8
+ # It can enforce either the use of endless methods definitions
9
+ # for single-lined method bodies, or disallow endless methods.
10
+ #
11
+ # Other method definition types are not considered by this cop.
12
+ #
13
+ # The supported styles are:
14
+ # * allow_single_line (default) - only single line endless method definitions are allowed.
15
+ # * allow_always - all endless method definitions are allowed.
16
+ # * disallow - all endless method definitions are disallowed.
17
+ #
18
+ # NOTE: Incorrect endless method definitions will always be
19
+ # corrected to a multi-line definition.
20
+ #
21
+ # @example EnforcedStyle: allow_single_line (default)
22
+ # # good
23
+ # def my_method() = x
24
+ #
25
+ # # bad, multi-line endless method
26
+ # def my_method() = x.foo
27
+ # .bar
28
+ # .baz
29
+ #
30
+ # @example EnforcedStyle: allow_always
31
+ # # good
32
+ # def my_method() = x
33
+ #
34
+ # # good
35
+ # def my_method() = x.foo
36
+ # .bar
37
+ # .baz
38
+ #
39
+ # @example EnforcedStyle: disallow
40
+ # # bad
41
+ # def my_method; x end
42
+ #
43
+ # # bad
44
+ # def my_method() = x.foo
45
+ # .bar
46
+ # .baz
47
+ #
48
+ class EndlessMethod < Base
49
+ include ConfigurableEnforcedStyle
50
+ extend TargetRubyVersion
51
+ extend AutoCorrector
52
+
53
+ minimum_target_ruby_version 3.0
54
+
55
+ CORRECTION_STYLES = %w[multiline single_line].freeze
56
+ MSG = 'Avoid endless method definitions.'
57
+ MSG_MULTI_LINE = 'Avoid endless method definitions with multiple lines.'
58
+
59
+ def on_def(node)
60
+ if style == :disallow
61
+ handle_disallow_style(node)
62
+ else
63
+ handle_allow_style(node)
64
+ end
65
+ end
66
+
67
+ private
68
+
69
+ def handle_allow_style(node)
70
+ return unless node.endless?
71
+ return if node.single_line? || style == :allow_always
72
+
73
+ add_offense(node, message: MSG_MULTI_LINE) do |corrector|
74
+ correct_to_multiline(corrector, node)
75
+ end
76
+ end
77
+
78
+ def handle_disallow_style(node)
79
+ return unless node.endless?
80
+
81
+ add_offense(node) do |corrector|
82
+ correct_to_multiline(corrector, node)
83
+ end
84
+ end
85
+
86
+ def correct_to_multiline(corrector, node)
87
+ replacement = <<~RUBY.strip
88
+ def #{node.method_name}#{arguments(node)}
89
+ #{node.body.source}
90
+ end
91
+ RUBY
92
+
93
+ corrector.replace(node, replacement)
94
+ end
95
+
96
+ def arguments(node, missing = '')
97
+ node.arguments.any? ? node.arguments.source : missing
98
+ end
99
+ end
100
+ end
101
+ end
102
+ end
@@ -68,7 +68,8 @@ module RuboCop
68
68
  length = cop_config['MinBranchesCount'] || 3
69
69
  return length if length.is_a?(Integer) && length.positive?
70
70
 
71
- raise 'MinBranchesCount needs to be a positive integer!'
71
+ warn Rainbow('`MinBranchesCount` needs to be a positive integer!').red
72
+ exit!
72
73
  end
73
74
  end
74
75
  end
@@ -82,12 +82,10 @@ module RuboCop
82
82
  def autocorrect(corrector, node)
83
83
  if node.modifier_form?
84
84
  correct_to_elsif_from_modifier_form(corrector, node)
85
- end_range = node.parent.loc.end
86
85
  else
87
86
  correct_to_elsif_from_if_inside_else_form(corrector, node, node.condition)
88
- end_range = node.loc.end
89
87
  end
90
- corrector.remove(range_by_whole_lines(end_range, include_final_newline: true))
88
+ corrector.remove(range_by_whole_lines(find_end_range(node), include_final_newline: true))
91
89
  corrector.remove(
92
90
  range_by_whole_lines(node.if_branch.source_range, include_final_newline: true)
93
91
  )
@@ -110,6 +108,13 @@ module RuboCop
110
108
  corrector.remove(condition)
111
109
  end
112
110
 
111
+ def find_end_range(node)
112
+ end_range = node.loc.end
113
+ return end_range if end_range
114
+
115
+ find_end_range(node.parent)
116
+ end
117
+
113
118
  def allow_if_modifier_in_else_branch?(else_branch)
114
119
  allow_if_modifier? && else_branch&.modifier_form?
115
120
  end
@@ -157,6 +157,10 @@ module RuboCop
157
157
  include OmitParentheses
158
158
  extend AutoCorrector
159
159
 
160
+ def self.autocorrect_incompatible_with
161
+ [Style::NestedParenthesizedCalls]
162
+ end
163
+
160
164
  def on_send(node)
161
165
  send(style, node) # call require_parentheses or omit_parentheses
162
166
  end
@@ -19,6 +19,10 @@ module RuboCop
19
19
 
20
20
  MSG = 'Add parentheses to nested method call `%<source>s`.'
21
21
 
22
+ def self.autocorrect_incompatible_with
23
+ [Style::MethodCallWithArgsParentheses]
24
+ end
25
+
22
26
  def on_send(node)
23
27
  return unless node.parenthesized?
24
28
 
@@ -81,11 +81,12 @@ module RuboCop
81
81
  return node.source if message_nodes.size > 1
82
82
 
83
83
  argument = message_nodes.first.source
84
+ exception_class = exception_node.const_name || exception_node.receiver.source
84
85
 
85
86
  if node.parent && requires_parens?(node.parent)
86
- "#{node.method_name}(#{exception_node.const_name}.new(#{argument}))"
87
+ "#{node.method_name}(#{exception_class}.new(#{argument}))"
87
88
  else
88
- "#{node.method_name} #{exception_node.const_name}.new(#{argument})"
89
+ "#{node.method_name} #{exception_class}.new(#{argument})"
89
90
  end
90
91
  end
91
92
 
@@ -66,7 +66,7 @@ module RuboCop
66
66
  end
67
67
 
68
68
  def correct_with_arguments(return_node, corrector)
69
- if return_node.arguments.size > 1
69
+ if return_node.children.size > 1
70
70
  add_brackets(corrector, return_node)
71
71
  elsif hash_without_braces?(return_node.first_argument)
72
72
  add_braces(corrector, return_node.first_argument)
@@ -8,6 +8,10 @@ module RuboCop
8
8
  #
9
9
  # Endless methods added in Ruby 3.0 are also accepted by this cop.
10
10
  #
11
+ # If `Style/EndlessMethod` is enabled with `EnforcedStyle: allow` or
12
+ # `allow_always`, single-line methods will be auto-corrected to endless
13
+ # methods if there is only one statement in the body.
14
+ #
11
15
  # @example
12
16
  # # bad
13
17
  # def some_method; body end
@@ -47,6 +51,28 @@ module RuboCop
47
51
  private
48
52
 
49
53
  def autocorrect(corrector, node)
54
+ if correct_to_endless?(node.body)
55
+ correct_to_endless(corrector, node)
56
+ else
57
+ correct_to_multiline(corrector, node)
58
+ end
59
+ end
60
+
61
+ def allow_empty?
62
+ cop_config['AllowIfMethodIsEmpty']
63
+ end
64
+
65
+ def correct_to_endless?(body_node)
66
+ endless_method_config = config.for_cop('Style/EndlessMethod')
67
+
68
+ return false unless endless_method_config['Enabled']
69
+ return false if endless_method_config['EnforcedStyle'] == 'disallow'
70
+ return false unless body_node
71
+
72
+ !(body_node.begin_type? || body_node.kwbegin_type?)
73
+ end
74
+
75
+ def correct_to_multiline(corrector, node)
50
76
  each_part(node.body) do |part|
51
77
  LineBreakCorrector.break_line_before(
52
78
  range: part, node: node, corrector: corrector,
@@ -62,8 +88,9 @@ module RuboCop
62
88
  move_comment(node, corrector)
63
89
  end
64
90
 
65
- def allow_empty?
66
- cop_config['AllowIfMethodIsEmpty']
91
+ def correct_to_endless(corrector, node)
92
+ replacement = "def #{node.method_name}(#{node.arguments.source}) = #{node.body.source}"
93
+ corrector.replace(node, replacement)
67
94
  end
68
95
 
69
96
  def each_part(body)
@@ -100,7 +100,7 @@ module RuboCop
100
100
  def correct_for_comment(corrector, node, if_branch)
101
101
  return if config.for_cop('Style/IfUnlessModifier')['Enabled']
102
102
 
103
- comments = processed_source.comments_before_line(if_branch.source_range.line)
103
+ comments = processed_source.ast_with_comments[if_branch]
104
104
  comment_text = comments.map(&:text).join("\n") << "\n"
105
105
 
106
106
  corrector.insert_before(node.loc.keyword, comment_text) unless comments.empty?
@@ -44,33 +44,61 @@ module RuboCop
44
44
  # The target ruby version may be found in a .ruby-version file.
45
45
  # @api private
46
46
  class RubyVersionFile < Source
47
- FILENAME = '.ruby-version'
47
+ RUBY_VERSION_FILENAME = '.ruby-version'
48
+ RUBY_VERSION_PATTERN = /\A(?:ruby-)?(?<version>\d+\.\d+)/.freeze
48
49
 
49
50
  def name
50
- "`#{FILENAME}`"
51
+ "`#{RUBY_VERSION_FILENAME}`"
51
52
  end
52
53
 
53
54
  private
54
55
 
56
+ def filename
57
+ RUBY_VERSION_FILENAME
58
+ end
59
+
60
+ def pattern
61
+ RUBY_VERSION_PATTERN
62
+ end
63
+
55
64
  def find_version
56
- file = ruby_version_file
65
+ file = version_file
57
66
  return unless file && File.file?(file)
58
67
 
59
- # rubocop:disable Lint/MixedRegexpCaptureTypes
60
- # `(ruby-)` is not a capture type.
61
- File.read(file).match(/\A(ruby-)?(?<version>\d+\.\d+)/) do |md|
62
- # rubocop:enable Lint/MixedRegexpCaptureTypes
68
+ File.read(file).match(pattern) do |md|
63
69
  md[:version].to_f
64
70
  end
65
71
  end
66
72
 
67
- def ruby_version_file
68
- @ruby_version_file ||=
69
- @config.find_file_upwards(FILENAME,
73
+ def version_file
74
+ @version_file ||=
75
+ @config.find_file_upwards(filename,
70
76
  @config.base_dir_for_path_parameters)
71
77
  end
72
78
  end
73
79
 
80
+ # The target ruby version may be found in a .tool-versions file, in a line
81
+ # starting with `ruby`.
82
+ # @api private
83
+ class ToolVersionsFile < RubyVersionFile
84
+ TOOL_VERSIONS_FILENAME = '.tool-versions'
85
+ TOOL_VERSIONS_PATTERN = /\Aruby (?:ruby-)?(?<version>\d+\.\d+)/.freeze
86
+
87
+ def name
88
+ "`#{TOOL_VERSIONS_FILENAME}`"
89
+ end
90
+
91
+ private
92
+
93
+ def filename
94
+ TOOL_VERSIONS_FILENAME
95
+ end
96
+
97
+ def pattern
98
+ TOOL_VERSIONS_PATTERN
99
+ end
100
+ end
101
+
74
102
  # The lock file of Bundler may identify the target ruby version.
75
103
  # @api private
76
104
  class BundlerLockFile < Source
@@ -194,7 +222,15 @@ module RuboCop
194
222
  KNOWN_RUBIES
195
223
  end
196
224
 
197
- SOURCES = [RuboCopConfig, RubyVersionFile, BundlerLockFile, GemspecFile, Default].freeze
225
+ SOURCES = [
226
+ RuboCopConfig,
227
+ RubyVersionFile,
228
+ ToolVersionsFile,
229
+ BundlerLockFile,
230
+ GemspecFile,
231
+ Default
232
+ ].freeze
233
+
198
234
  private_constant :SOURCES
199
235
 
200
236
  def initialize(config)
@@ -3,7 +3,7 @@
3
3
  module RuboCop
4
4
  # This module holds the RuboCop version information.
5
5
  module Version
6
- STRING = '1.7.0'
6
+ STRING = '1.8.0'
7
7
 
8
8
  MSG = '%<version>s (using Parser %<parser_version>s, '\
9
9
  'rubocop-ast %<rubocop_ast_version>s, ' \
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubocop
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.0
4
+ version: 1.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bozhidar Batsov
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: exe
12
12
  cert_chain: []
13
- date: 2020-12-25 00:00:00.000000000 Z
13
+ date: 2021-01-07 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: parallel
@@ -32,14 +32,14 @@ dependencies:
32
32
  requirements:
33
33
  - - ">="
34
34
  - !ruby/object:Gem::Version
35
- version: 2.7.1.5
35
+ version: 3.0.0.0
36
36
  type: :runtime
37
37
  prerelease: false
38
38
  version_requirements: !ruby/object:Gem::Requirement
39
39
  requirements:
40
40
  - - ">="
41
41
  - !ruby/object:Gem::Version
42
- version: 2.7.1.5
42
+ version: 3.0.0.0
43
43
  - !ruby/object:Gem::Dependency
44
44
  name: rainbow
45
45
  requirement: !ruby/object:Gem::Requirement
@@ -137,7 +137,7 @@ dependencies:
137
137
  version: 1.4.0
138
138
  - - "<"
139
139
  - !ruby/object:Gem::Version
140
- version: '2.0'
140
+ version: '3.0'
141
141
  type: :runtime
142
142
  prerelease: false
143
143
  version_requirements: !ruby/object:Gem::Requirement
@@ -147,7 +147,7 @@ dependencies:
147
147
  version: 1.4.0
148
148
  - - "<"
149
149
  - !ruby/object:Gem::Version
150
- version: '2.0'
150
+ version: '3.0'
151
151
  - !ruby/object:Gem::Dependency
152
152
  name: bundler
153
153
  requirement: !ruby/object:Gem::Requirement
@@ -368,6 +368,7 @@ files:
368
368
  - lib/rubocop/cop/lint/constant_resolution.rb
369
369
  - lib/rubocop/cop/lint/debugger.rb
370
370
  - lib/rubocop/cop/lint/deprecated_class_methods.rb
371
+ - lib/rubocop/cop/lint/deprecated_constants.rb
371
372
  - lib/rubocop/cop/lint/deprecated_open_ssl_constant.rb
372
373
  - lib/rubocop/cop/lint/disjunctive_assignment_in_constructor.rb
373
374
  - lib/rubocop/cop/lint/duplicate_branch.rb
@@ -401,6 +402,7 @@ files:
401
402
  - lib/rubocop/cop/lint/ineffective_access_modifier.rb
402
403
  - lib/rubocop/cop/lint/inherit_exception.rb
403
404
  - lib/rubocop/cop/lint/interpolation_check.rb
405
+ - lib/rubocop/cop/lint/lambda_without_literal_block.rb
404
406
  - lib/rubocop/cop/lint/literal_as_condition.rb
405
407
  - lib/rubocop/cop/lint/literal_in_interpolation.rb
406
408
  - lib/rubocop/cop/lint/loop.rb
@@ -424,6 +426,7 @@ files:
424
426
  - lib/rubocop/cop/lint/rand_one.rb
425
427
  - lib/rubocop/cop/lint/redundant_cop_disable_directive.rb
426
428
  - lib/rubocop/cop/lint/redundant_cop_enable_directive.rb
429
+ - lib/rubocop/cop/lint/redundant_dir_glob_sort.rb
427
430
  - lib/rubocop/cop/lint/redundant_require_statement.rb
428
431
  - lib/rubocop/cop/lint/redundant_safe_navigation.rb
429
432
  - lib/rubocop/cop/lint/redundant_splat_expansion.rb
@@ -485,6 +488,7 @@ files:
485
488
  - lib/rubocop/cop/metrics/utils/repeated_csend_discount.rb
486
489
  - lib/rubocop/cop/migration/department_name.rb
487
490
  - lib/rubocop/cop/mixin/alignment.rb
491
+ - lib/rubocop/cop/mixin/allowed_identifiers.rb
488
492
  - lib/rubocop/cop/mixin/allowed_methods.rb
489
493
  - lib/rubocop/cop/mixin/annotation_comment.rb
490
494
  - lib/rubocop/cop/mixin/array_min_size.rb
@@ -627,6 +631,7 @@ files:
627
631
  - lib/rubocop/cop/style/empty_method.rb
628
632
  - lib/rubocop/cop/style/encoding.rb
629
633
  - lib/rubocop/cop/style/end_block.rb
634
+ - lib/rubocop/cop/style/endless_method.rb
630
635
  - lib/rubocop/cop/style/eval_with_location.rb
631
636
  - lib/rubocop/cop/style/even_odd.rb
632
637
  - lib/rubocop/cop/style/expand_path_arguments.rb
@@ -851,7 +856,7 @@ metadata:
851
856
  homepage_uri: https://rubocop.org/
852
857
  changelog_uri: https://github.com/rubocop-hq/rubocop/blob/master/CHANGELOG.md
853
858
  source_code_uri: https://github.com/rubocop-hq/rubocop/
854
- documentation_uri: https://docs.rubocop.org/rubocop/1.7/
859
+ documentation_uri: https://docs.rubocop.org/rubocop/1.8/
855
860
  bug_tracker_uri: https://github.com/rubocop-hq/rubocop/issues
856
861
  post_install_message:
857
862
  rdoc_options: []