Skip to content

Commit

Permalink
Remove print debug methods from default for Lint/Debugger
Browse files Browse the repository at this point in the history
This PR rolls back the print debug default configuration (#11518) of `Lint/Debugger`
based on the following feedback.

- #11557 (comment)
- #11552 (comment)
- #11518 (comment)

It seems like it was a bad idea to mix debugger and print debug methods by default.

This PR updates `Lint/Debugger` cop defaults to handle only debugger methods as per the cop name.
OTOH, it leaves the logic in #11557 to prevent false positives when user configures
print debug methods. e.g. #11517 (comment)
  • Loading branch information
koic authored and bbatsov committed Feb 11, 2023
1 parent 0699f73 commit e66e3c7
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* [#11564](https://github.com/rubocop/rubocop/pull/11564): Remove print debug methods from default for `Lint/Debugger`. ([@koic][])
6 changes: 1 addition & 5 deletions config/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1630,13 +1630,12 @@ Lint/Debugger:
Description: 'Check for debugger calls.'
Enabled: true
VersionAdded: '0.14'
VersionChanged: '1.10'
VersionChanged: '<<next>>'
DebuggerMethods:
# Groups are available so that a specific group can be disabled in
# a user's configuration, but are otherwise not significant.
Kernel:
- binding.irb
- p
- Kernel.binding.irb
Byebug:
- byebug
Expand All @@ -1646,9 +1645,6 @@ Lint/Debugger:
Capybara:
- save_and_open_page
- save_and_open_screenshot
PP:
- PP.pp
- pp
debug.rb:
- binding.b
- binding.break
Expand Down
4 changes: 4 additions & 0 deletions spec/rubocop/cop/lint/debugger_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@
^^^^^^^^^^^^^^^^^^ Remove debugger entry point `Kernel.binding.irb`.
RUBY
end
end

context 'when print debug method is configured by user' do
let(:cop_config) { { 'DebuggerMethods' => %w[p] } }

it 'registers an offense for a p call' do
expect_offense(<<~RUBY)
Expand Down

0 comments on commit e66e3c7

Please sign in to comment.