Skip to content

Commit

Permalink
Retire Lint/UselessElseWithoutRescue cop
Browse files Browse the repository at this point in the history
Ruby 2.6 does not support `begin` ... `else` syntax.
So `Lint/UselessElse` can't work because it causes a parsing error.
  • Loading branch information
koic committed Apr 24, 2022
1 parent e5b53f6 commit 6d0b336
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 88 deletions.
10 changes: 3 additions & 7 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,9 @@ task documentation_syntax_check: :yard_for_generate_documentation do
buffer = Parser::Source::Buffer.new('<code>', 1)
buffer.source = example.text

# Ruby 2.6 or higher does not support a syntax used in
# `Lint/UselessElseWithoutRescue` cop's example.
parser = if cop == RuboCop::Cop::Lint::UselessElseWithoutRescue
Parser::Ruby25.new(RuboCop::AST::Builder.new)
# Ruby 2.7 raises a syntax error in
# `Lint/CircularArgumentReference` cop's example.
elsif cop == RuboCop::Cop::Lint::CircularArgumentReference
# Ruby 2.7 raises a syntax error in
# `Lint/CircularArgumentReference` cop's example.
parser = if cop == RuboCop::Cop::Lint::CircularArgumentReference
Parser::Ruby26.new(RuboCop::AST::Builder.new)
# Ruby 3.0 raises a syntax error in
# `Lint/NumberedParameterAssignment` cop's example.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* [#10577](https://github.com/rubocop/rubocop/pull/10577): **(Breaking)** Retire `Lint/UselessElseWithoutRescue` cop. ([@koic][])
5 changes: 0 additions & 5 deletions config/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2329,11 +2329,6 @@ Lint/UselessAssignment:
Enabled: true
VersionAdded: '0.11'

Lint/UselessElseWithoutRescue:
Description: 'Checks for useless `else` in `begin..end` without `rescue`.'
Enabled: true
VersionAdded: '0.17'

Lint/UselessMethodDefinition:
Description: 'Checks for useless method definitions.'
Enabled: true
Expand Down
1 change: 0 additions & 1 deletion lib/rubocop.rb
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,6 @@
require_relative 'rubocop/cop/lint/uri_regexp'
require_relative 'rubocop/cop/lint/useless_access_modifier'
require_relative 'rubocop/cop/lint/useless_assignment'
require_relative 'rubocop/cop/lint/useless_else_without_rescue'
require_relative 'rubocop/cop/lint/useless_method_definition'
require_relative 'rubocop/cop/lint/useless_ruby2_keywords'
require_relative 'rubocop/cop/lint/useless_setter_call'
Expand Down
45 changes: 0 additions & 45 deletions lib/rubocop/cop/lint/useless_else_without_rescue.rb

This file was deleted.

30 changes: 0 additions & 30 deletions spec/rubocop/cop/lint/useless_else_without_rescue_spec.rb

This file was deleted.

0 comments on commit 6d0b336

Please sign in to comment.