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

Remove save_screenshot from Lint/Debugger (revival) #8920

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Expand Up @@ -6,6 +6,10 @@

* [#8895](https://github.com/rubocop-hq/rubocop/pull/8895): Add new `Lint/EmptyBlock` cop. ([@fatkodima][])

### 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