Skip to content

Commit

Permalink
Remove save_screenshot from Lint/Debugger (revival)
Browse files Browse the repository at this point in the history
  • Loading branch information
ybiquitous authored and marcandre committed Oct 22, 2020
1 parent 26dfdf8 commit 25c22bc
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 18 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Expand Up @@ -7,6 +7,10 @@
* [#8895](https://github.com/rubocop-hq/rubocop/pull/8895): Add new `Lint/EmptyBlock` cop. ([@fatkodima][])
* [#7549](https://github.com/rubocop-hq/rubocop/issues/7549): Add new `Style/ArgumentsForwarding` cop. ([@koic][])

### Changes

* [#8920](https://github.com/rubocop-hq/rubocop/pull/8920): Remove Capybara's `save_screenshot` from `Lint/Debugger`. ([@ybiquitous][])

## 1.0.0 (2020-10-21)

### New features
Expand Down
5 changes: 2 additions & 3 deletions lib/rubocop/cop/lint/debugger.rb
Expand Up @@ -37,7 +37,7 @@ class Debugger < Base

RESTRICT_ON_SEND = %i[
debugger byebug remote_byebug pry remote_pry pry_remote console rescue
save_and_open_page save_and_open_screenshot save_screenshot irb
save_and_open_page save_and_open_screenshot irb
].freeze

def_node_matcher :kernel?, <<~PATTERN
Expand All @@ -53,8 +53,7 @@ class Debugger < Base
{:pry :remote_pry :pry_remote :console} ...)
(send (const {nil? (cbase)} :Pry) :rescue ...)
(send nil? {:save_and_open_page
:save_and_open_screenshot
:save_screenshot} ...)}
:save_and_open_screenshot} ...)}
PATTERN

def_node_matcher :binding_irb_call?, <<~PATTERN
Expand Down
16 changes: 1 addition & 15 deletions spec/rubocop/cop/lint/debugger_spec.rb
Expand Up @@ -51,13 +51,6 @@
RUBY
end

it 'reports an offense for save_screenshot' do
expect_offense(<<~RUBY)
save_screenshot
^^^^^^^^^^^^^^^ Remove debugger entry point `save_screenshot`.
RUBY
end

context 'with an argument' do
it 'reports an offense for save_and_open_page' do
expect_offense(<<~RUBY)
Expand All @@ -72,13 +65,6 @@
^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Remove debugger entry point `save_and_open_screenshot foo`.
RUBY
end

it 'reports an offense for save_screenshot' do
expect_offense(<<~RUBY)
save_screenshot foo
^^^^^^^^^^^^^^^^^^^ Remove debugger entry point `save_screenshot foo`.
RUBY
end
end
end

Expand Down Expand Up @@ -161,7 +147,7 @@
end

%w[debugger byebug console pry remote_pry pry_remote irb save_and_open_page
save_and_open_screenshot save_screenshot remote_byebug].each do |src|
save_and_open_screenshot remote_byebug].each do |src|
it "does not report an offense for a #{src} in comments" do
expect_no_offenses("# #{src}")
end
Expand Down

0 comments on commit 25c22bc

Please sign in to comment.