Skip to content

Commit

Permalink
[Fix #11658] Register Object#pry as an offense (#11669)
Browse files Browse the repository at this point in the history
  • Loading branch information
ThHareau committed Mar 13, 2023
1 parent 96911a9 commit ed786ab
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
1 change: 1 addition & 0 deletions changelog/fix_registers_pry_as_an_offense.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* [#11658](https://github.com/rubocop/rubocop/issues/11658): Fix `Lint/Debugger` should not allow pry. ([@ThHareau][])
1 change: 1 addition & 0 deletions config/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1659,6 +1659,7 @@ Lint/Debugger:
- Kernel.binding.remote_pry
- Kernel.binding.pry_remote
- Pry.rescue
- pry
Rails:
- debugger
- Kernel.debugger
Expand Down
18 changes: 14 additions & 4 deletions spec/rubocop/cop/lint/debugger_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,20 @@
end

context 'pry' do
it 'registers an offense for a pry call' do
expect_offense(<<~RUBY)
pry
^^^ Remove debugger entry point `pry`.
RUBY
end

it 'registers an offense for a pry with an argument call' do
expect_offense(<<~RUBY)
pry foo
^^^^^^^ Remove debugger entry point `pry foo`.
RUBY
end

it 'registers an offense for a pry binding call' do
expect_offense(<<~RUBY)
binding.pry
Expand Down Expand Up @@ -300,10 +314,6 @@ def method
RUBY
end

it 'does not register an offense for a `pry` call without binding' do
expect_no_offenses('pry')
end

it 'does not register an offense for a `rescue` call without Pry' do
expect_no_offenses(<<~RUBY)
begin
Expand Down

0 comments on commit ed786ab

Please sign in to comment.