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 offenses not found inside lambda assigned to field #12005

Closed
ronocod opened this issue Jun 30, 2023 · 0 comments · Fixed by #12006
Closed

Lint/Debugger offenses not found inside lambda assigned to field #12005

ronocod opened this issue Jun 30, 2023 · 0 comments · Fixed by #12006
Labels

Comments

@ronocod
Copy link

ronocod commented Jun 30, 2023

Expected behavior

RuboCop catches Lint/Debugger offenses across all code in a file.

Actual behavior

Offenses inside a lambda which is being assigned to a field on an object are not found.

Steps to reproduce the problem

In the following file, Rubocop finds a Lint/Debugger offense on line 3, but none on line 4:

# frozen_string_literal: true

binding.pry
x.y = -> { binding.pry }

In this file, it's able to find both offenses:

# frozen_string_literal: true

binding.pry
x = -> { binding.pry }

RuboCop version

1.53.1 (using Parser 3.2.2.3, rubocop-ast 1.29.0, running on ruby 3.1.3) [arm64-darwin22]
@koic koic added the bug label Jun 30, 2023
koic added a commit to koic/rubocop that referenced this issue Jun 30, 2023
Fixes rubocop#12005.

This PR fixes a false negative for `Lint/Debugger`
when using debugger method inside lambda.
bbatsov pushed a commit that referenced this issue Jul 1, 2023
Fixes #12005.

This PR fixes a false negative for `Lint/Debugger`
when using debugger method inside lambda.
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