Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lint/Debugger not detected in begin/end blocks #12372

Closed
fcsonline opened this issue Nov 8, 2023 · 1 comment · Fixed by #12375
Closed

Lint/Debugger not detected in begin/end blocks #12372

fcsonline opened this issue Nov 8, 2023 · 1 comment · Fixed by #12375
Labels

Comments

@fcsonline
Copy link

The current implementation of Lint/Debbuger doesn't detect offenses inside begin / end blocks.

I was able to reproduce this issue in this small reproducible example:

require 'byebug'

byebug

puts(
  begin
    byebug # This one is not detected
    "example"
  end
)

I checked this with the latest version of RuboCop.

Expected behavior

The expected behaviour for this case is to detect both offenses. The one at top level and the one inside the begin end block.

Actual behavior

The current behaviour is that RuboCop only detects the one at top level.

Steps to reproduce the problem

Create a example.rb file with the previous mentioned content, and run RuboCop like this:

bundle exec rubocop --only Lint/Debugger example.rb

Gemfile:

source "https://rubygems.org"

gem 'byebug', '~> 11.1', '>= 11.1.3'
gem 'rubocop', '1.57.2'

RuboCop version

$ [bundle exec] rubocop -V
1.57.2 (using Parser 3.2.2.4, rubocop-ast 1.30.0, running on ruby 3.0.6) [x86_64-linux]
@koic koic added the bug label Nov 9, 2023
koic added a commit to koic/rubocop that referenced this issue Nov 9, 2023
Fixes rubocop#12372.

This PR fixes a false negative for `Lint/Debugger`
when used within method arguments a `begin`...`end` block.
bbatsov pushed a commit that referenced this issue Nov 9, 2023
Fixes #12372.

This PR fixes a false negative for `Lint/Debugger`
when used within method arguments a `begin`...`end` block.
@fcsonline
Copy link
Author

Awesome! Thank you so much for the quick response! You rock!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants