Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix an error for
Layout/EmptyLinesAroundExceptionHandlingKeywords
This PR fixes the following error for `Layout/EmptyLinesAroundExceptionHandlingKeywords` when `begin` and `rescue` are on the same line. ```console % echo 'begin; foo; rescue => e; end' | bundle exec rubocop --stdin example.rb -d For /Users/koic/src/github.com/rubocop/rubocop: configuration from /Users/koic/src/github.com/rubocop/rubocop/.rubocop.yml configuration from /Users/koic/.rbenv/versions/3.1.0-dev/lib/ruby/gems/3.1.0/gems/rubocop-performance-1.11.5/config/default.yml configuration from /Users/koic/.rbenv/versions/3.1.0-dev/lib/ruby/gems/3.1.0/gems/rubocop-performance-1.11.5/config/default.yml Default configuration from /Users/koic/src/github.com/rubocop/rubocop/config/default.yml configuration from /Users/koic/.rbenv/versions/3.1.0-dev/lib/ruby/gems/3.1.0/gems/rubocop-rspec-2.5.0/config/default.yml configuration from /Users/koic/.rbenv/versions/3.1.0-dev/lib/ruby/gems/3.1.0/gems/rubocop-rspec-2.5.0/config/default.yml configuration from /Users/koic/.rbenv/versions/3.1.0-dev/lib/ruby/gems/3.1.0/gems/rubocop-rake-0.6.0/config/default.yml configuration from /Users/koic/.rbenv/versions/3.1.0-dev/lib/ruby/gems/3.1.0/gems/rubocop-rake-0.6.0/config/default.yml Inheriting configuration from /Users/koic/src/github.com/rubocop/rubocop/.rubocop_todo.yml Inspecting 1 file Scanning /Users/koic/src/github.com/rubocop/rubocop/example.rb An error occurred while Layout/EmptyLinesAroundExceptionHandlingKeywords cop was inspecting /Users/koic/src/github.com/rubocop/rubocop/example.rb:1:0. The range 29...30 is outside the bounds of the source /Users/koic/.rbenv/versions/3.1.0-dev/lib/ruby/gems/3.1.0/gems/parser-3.0.2.0/lib/parser/source/tree_rewriter.rb:406:in `check_range_validity' /Users/koic/src/github.com/rubocop/rubocop/lib/rubocop/cop/corrector.rb:100:in `check_range_validity' /Users/koic/.rbenv/versions/3.1.0-dev/lib/ruby/gems/3.1.0/gems/parser-3.0.2.0/lib/parser/source/tree_rewriter.rb:398:in `combine' /Users/koic/.rbenv/versions/3.1.0-dev/lib/ruby/gems/3.1.0/gems/parser-3.0.2.0/lib/parser/source/tree_rewriter.rb:194:in `replace' /Users/koic/.rbenv/versions/3.1.0-dev/lib/ruby/gems/3.1.0/gems/parser-3.0.2.0/lib/parser/source/tree_rewriter.rb:218:in `remove' /Users/koic/src/github.com/rubocop/rubocop/lib/rubocop/cop/correctors/empty_line_corrector.rb:13:in `correct' /Users/koic/src/github.com/rubocop/rubocop/lib/rubocop/cop/mixin/empty_lines_around_body.rb:104:in `block in check_line' /Users/koic/src/github.com/rubocop/rubocop/lib/rubocop/cop/base.rb:342:in `correct' /Users/koic/src/github.com/rubocop/rubocop/lib/rubocop/cop/base.rb:127:in `add_offense' ```
- Loading branch information