From 3b0c77be18f333dd63f901a02735b4f264734dc9 Mon Sep 17 00:00:00 2001 From: Andrew Kvalheim Date: Sun, 5 Apr 2020 08:44:42 -0700 Subject: [PATCH] Remove `save_screenshot` from `Lint/Debugger` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `Capybara::Session#save_screenshot` isn't an entry point; it writes a file noninteractively and is suitable for use in CI. Overview: | Method | Interactive | Reported | | -------------------------- | ----------- | -------- | | `save_page` | No | No | | `save_screenshot` | No | Yes → No | | `save_and_open_page` | Yes | Yes | | `save_and_open_screenshot` | Yes | Yes | --- CHANGELOG.md | 5 +++++ lib/rubocop/cop/lint/debugger.rb | 3 +-- spec/rubocop/cop/lint/debugger_spec.rb | 8 +------- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index faf8b748a8d..44c8d494bf6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,10 @@ * [#7834](https://github.com/rubocop-hq/rubocop/issues/7834): Fix `Lint/UriRegexp` to register offense with array arguments. ([@tejasbubane][]) * [#7841](https://github.com/rubocop-hq/rubocop/issues/7841): Fix an error for `Style/TrailingCommaInBlockArgs` when lambda literal (`->`) has multiple arguments. ([@koic][]) +### Changes + +* Remove Capybara's `save_screenshot` from `Lint/Debugger`. ([@AndrewKvalheim][]) + ## 0.81.0 (2020-04-01) ### New features @@ -4434,3 +4438,4 @@ [@dmolesUC]: https://github.com/dmolesUC [@yuritomanek]: https://github.com/yuritomanek [@egze]: https://github.com/egze +[@AndrewKvalheim]: https://github.com/AndrewKvalheim diff --git a/lib/rubocop/cop/lint/debugger.rb b/lib/rubocop/cop/lint/debugger.rb index f3e95d1193e..39362ea8a49 100644 --- a/lib/rubocop/cop/lint/debugger.rb +++ b/lib/rubocop/cop/lint/debugger.rb @@ -48,8 +48,7 @@ class Debugger < Cop {: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 diff --git a/spec/rubocop/cop/lint/debugger_spec.rb b/spec/rubocop/cop/lint/debugger_spec.rb index 79cea6a4c45..3916b4b8ac9 100644 --- a/spec/rubocop/cop/lint/debugger_spec.rb +++ b/spec/rubocop/cop/lint/debugger_spec.rb @@ -27,9 +27,6 @@ include_examples 'debugger', 'capybara debug method', 'save_and_open_screenshot' - include_examples 'debugger', - 'capybara debug method', - 'save_screenshot' include_examples 'debugger', 'debugger with an argument', 'debugger foo' include_examples 'debugger', 'byebug with an argument', 'byebug foo' include_examples 'debugger', @@ -47,9 +44,6 @@ include_examples 'debugger', 'capybara debug method with an argument', 'save_and_open_screenshot foo' - include_examples 'debugger', - 'capybara debug method with an argument', - 'save_screenshot foo' include_examples 'debugger', 'remote_byebug', 'remote_byebug' include_examples 'debugger', 'web console binding', 'binding.console' @@ -68,7 +62,7 @@ ALL_COMMANDS = %w[debugger byebug console pry remote_pry pry_remote irb save_and_open_page save_and_open_screenshot - save_screenshot remote_byebug].freeze + remote_byebug].freeze ALL_COMMANDS.each do |src| it "does not report an offense for a #{src} in comments" do