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 detecting issues inside block #12244

Closed
Drowze opened this issue Oct 4, 2023 · 1 comment · Fixed by #12245
Closed

Lint/Debugger not detecting issues inside block #12244

Drowze opened this issue Oct 4, 2023 · 1 comment · Fixed by #12245
Labels

Comments

@Drowze
Copy link
Contributor

Drowze commented Oct 4, 2023

When e.g.: binding.pry is inside a block, Lint/Debugger is failing to flag the issue.


Expected behavior

I would expect Lint/Debugger to always flag a code with binding.pry, regardless of where it is.

Actual behavior

Lint/Debugger is not detecting binding.pry calls when they happen inside block.

Steps to reproduce the problem

Given:

def uri_escaped_path(uri)
  uri.path = uri.path.gsub(%r{[^/]+}) do |segment|
    binding.pry
    CGI.escape(segment.to_s.encode("UTF-8")).gsub("+", "%20").gsub("%7E", "~")
  end
  uri
end

When I run rubocop --only Lint/Debugger, nothing is flagged.

See:
Screenshot 2023-10-04 at 09 48 25

RuboCop version

$ rubocop -V
1.56.4 (using Parser 3.2.2.4, rubocop-ast 1.29.0, running on ruby 3.2.2) [x86_64-darwin22]
@Drowze
Copy link
Contributor Author

Drowze commented Oct 4, 2023

Debugged a bit and I see this bug was introduced between 1.45.1 and 1.46.0.

@koic koic added the bug label Oct 4, 2023
koic added a commit to koic/rubocop that referenced this issue Oct 4, 2023
Fixes rubocop#12244.

This PR fixes a false negative for `Lint/Debugger`
when using debugger method inside block.
bbatsov pushed a commit that referenced this issue Oct 5, 2023
Fixes #12244.

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