Skip to content

Commit e66e3c7

Browse files
koicbbatsov
authored andcommitted
Remove print debug methods from default for Lint/Debugger
This PR rolls back the print debug default configuration (rubocop#11518) of `Lint/Debugger` based on the following feedback. - rubocop#11557 (comment) - rubocop#11552 (comment) - rubocop#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 rubocop#11557 to prevent false positives when user configures print debug methods. e.g. rubocop#11517 (comment)
1 parent 0699f73 commit e66e3c7

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* [#11564](https://github.com/rubocop/rubocop/pull/11564): Remove print debug methods from default for `Lint/Debugger`. ([@koic][])

config/default.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1630,13 +1630,12 @@ Lint/Debugger:
16301630
Description: 'Check for debugger calls.'
16311631
Enabled: true
16321632
VersionAdded: '0.14'
1633-
VersionChanged: '1.10'
1633+
VersionChanged: '<<next>>'
16341634
DebuggerMethods:
16351635
# Groups are available so that a specific group can be disabled in
16361636
# a user's configuration, but are otherwise not significant.
16371637
Kernel:
16381638
- binding.irb
1639-
- p
16401639
- Kernel.binding.irb
16411640
Byebug:
16421641
- byebug
@@ -1646,9 +1645,6 @@ Lint/Debugger:
16461645
Capybara:
16471646
- save_and_open_page
16481647
- save_and_open_screenshot
1649-
PP:
1650-
- PP.pp
1651-
- pp
16521648
debug.rb:
16531649
- binding.b
16541650
- binding.break

spec/rubocop/cop/lint/debugger_spec.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,10 @@
7676
^^^^^^^^^^^^^^^^^^ Remove debugger entry point `Kernel.binding.irb`.
7777
RUBY
7878
end
79+
end
80+
81+
context 'when print debug method is configured by user' do
82+
let(:cop_config) { { 'DebuggerMethods' => %w[p] } }
7983

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

0 commit comments

Comments
 (0)