diff --git a/.rubocop.yml b/.rubocop.yml index dfa76a47..ae3657ec 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -126,6 +126,9 @@ Layout/CaseIndentation: Layout/IndentFirstArrayElement: EnforcedStyle: consistent +Layout/IndentationWidth: + IgnoredPatterns: ['^\s*module'] + Security/YAMLLoad: Exclude: - 'lib/capybara/spec/**/*' diff --git a/lib/capybara/helpers.rb b/lib/capybara/helpers.rb index 7615f62b..b8efce39 100644 --- a/lib/capybara/helpers.rb +++ b/lib/capybara/helpers.rb @@ -3,7 +3,7 @@ module Capybara # @api private module Helpers - module_function # rubocop:disable Layout/IndentationWidth + module_function ## # @deprecated diff --git a/lib/capybara/node/actions.rb b/lib/capybara/node/actions.rb index a66eeecc..d0f308aa 100644 --- a/lib/capybara/node/actions.rb +++ b/lib/capybara/node/actions.rb @@ -305,12 +305,12 @@ module Capybara synchronize(Capybara::Queries::BaseQuery.wait(options, session_options.default_max_wait_time)) do begin find(:select, from, options) - rescue Capybara::ElementNotFound => select_error # _rubocop:disable Naming/RescuedExceptionsVariableName + rescue Capybara::ElementNotFound => select_error raise if %i[selected with_selected multiple].any? { |option| options.key?(option) } begin find(:datalist_input, from, options) - rescue Capybara::ElementNotFound => dlinput_error # _rubocop:disable Naming/RescuedExceptionsVariableName + rescue Capybara::ElementNotFound => dlinput_error raise Capybara::ElementNotFound, "#{select_error.message} and #{dlinput_error.message}" end end diff --git a/lib/capybara/queries/selector_query.rb b/lib/capybara/queries/selector_query.rb index ab43560a..bc20eb63 100644 --- a/lib/capybara/queries/selector_query.rb +++ b/lib/capybara/queries/selector_query.rb @@ -89,7 +89,7 @@ module Capybara matches_system_filters?(node) && matches_node_filters?(node, node_filter_errors) && matches_filter_block?(node) - rescue *(node.respond_to?(:session) ? node.session.driver.invalid_element_errors : []) # _rubocop:disable Naming/RescuedExceptionsVariableName + rescue *(node.respond_to?(:session) ? node.session.driver.invalid_element_errors : []) false end diff --git a/lib/capybara/selenium/extensions/html5_drag.rb b/lib/capybara/selenium/extensions/html5_drag.rb index f5207e73..a2fc8048 100644 --- a/lib/capybara/selenium/extensions/html5_drag.rb +++ b/lib/capybara/selenium/extensions/html5_drag.rb @@ -4,7 +4,7 @@ class Capybara::Selenium::Node module Html5Drag # Implement methods to emulate HTML5 drag and drop - private # rubocop:disable Layout/IndentationWidth + private def html5_drag_to(element) driver.execute_script MOUSEDOWN_TRACKER diff --git a/lib/capybara/selenium/patches/atoms.rb b/lib/capybara/selenium/patches/atoms.rb index bf32386f..e283984c 100644 --- a/lib/capybara/selenium/patches/atoms.rb +++ b/lib/capybara/selenium/patches/atoms.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module CapybaraAtoms -private # rubocop:disable Layout/IndentationWidth +private def read_atom(function) @atoms ||= Hash.new do |hash, key| diff --git a/lib/capybara/server/checker.rb b/lib/capybara/server/checker.rb index 05a6fd04..f6c6c88f 100644 --- a/lib/capybara/server/checker.rb +++ b/lib/capybara/server/checker.rb @@ -12,7 +12,7 @@ module Capybara def request(&block) ssl? ? https_request(&block) : http_request(&block) - rescue *TRY_HTTPS_ERRORS # _rubocop:disable Naming/RescuedExceptionsVariableName + rescue *TRY_HTTPS_ERRORS res = https_request(&block) @ssl = true res diff --git a/lib/capybara/session.rb b/lib/capybara/session.rb index 3a1bafe3..1ebe5c6b 100644 --- a/lib/capybara/session.rb +++ b/lib/capybara/session.rb @@ -736,9 +736,7 @@ module Capybara # @param [Hash] options a customizable set of options # def save_and_open_screenshot(path = nil, **options) - # rubocop:disable Lint/Debugger - save_screenshot(path, options).tap { |s_path| open_file(s_path) } - # rubocop:enable Lint/Debugger + save_screenshot(path, options).tap { |s_path| open_file(s_path) } # rubocop:disable Lint/Debugger end def document diff --git a/lib/capybara/window.rb b/lib/capybara/window.rb index c52c6365..22ac451f 100644 --- a/lib/capybara/window.rb +++ b/lib/capybara/window.rb @@ -49,7 +49,7 @@ module Capybara # @return [Boolean] whether this window is the window in which commands are being executed def current? @driver.current_window_handle == @handle - rescue @driver.no_such_window_error # _rubocop:disable Naming/RescuedExceptionsVariableName + rescue @driver.no_such_window_error false end