From e45da11db4e49b3046e16dd6cbed432c7305c17c Mon Sep 17 00:00:00 2001 From: Dmitry Vorotilin Date: Thu, 4 Nov 2021 19:40:49 +0300 Subject: [PATCH] * Fix rubocop warnings * Bump Ruby to 2.6 as 2.5 is EOL --- .github/workflows/tests.yml | 2 +- .rubocop.yml | 16 +++++++++++----- .rubocop_todo.yml | 8 -------- README.md | 9 +++++---- ferrum.gemspec | 2 +- lib/ferrum/browser.rb | 2 +- lib/ferrum/browser/process.rb | 16 ++++++++-------- lib/ferrum/frame.rb | 3 ++- lib/ferrum/frame/runtime.rb | 6 +----- lib/ferrum/keyboard.rb | 10 +++++----- lib/ferrum/mouse.rb | 4 ++-- lib/ferrum/network.rb | 15 ++++++++------- lib/ferrum/network/auth_request.rb | 6 +++++- lib/ferrum/network/intercepted_request.rb | 6 +++++- lib/ferrum/node.rb | 22 +++++++++++----------- lib/ferrum/page.rb | 21 ++++++++++----------- spec/browser_spec.rb | 2 +- spec/frame_spec.rb | 6 +++--- spec/node_spec.rb | 6 ++---- 19 files changed, 82 insertions(+), 80 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 6adec970..ac5aad25 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -13,7 +13,7 @@ jobs: fail-fast: false matrix: gemfile: [websocket-driver-0.6.x, websocket-driver-0.7.x] - ruby: [2.5, 2.6, 2.7, 3.0] + ruby: [2.6, 2.7, 3.0] runs-on: ubuntu-latest env: diff --git a/.rubocop.yml b/.rubocop.yml index 9ba69eac..f0a59924 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,7 +1,7 @@ inherit_from: .rubocop_todo.yml AllCops: - TargetRubyVersion: 2.5 + TargetRubyVersion: 2.6 NewCops: enable Layout/FirstArrayElementIndentation: @@ -16,13 +16,19 @@ Metrics/BlockLength: - "*.gemspec" Naming/MethodParameterName: + MinNameLength: 2 AllowedNames: - x - y - - id - - to - - on Naming/FileName: Exclude: - - 'gemfiles/websocket-driver-*.gemfile' + - 'gemfiles/*.gemfile' + +Style/MultilineBlockChain: + Exclude: + - spec/**/* + +Metrics/ModuleLength: + Exclude: + - spec/**/* diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 790ef8cf..41253551 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -36,14 +36,6 @@ Metrics/ModuleLength: Metrics/PerceivedComplexity: Max: 14 -# Offense count: 2 -# Cop supports --auto-correct. -# Configuration parameters: Keywords. -# Keywords: TODO, FIXME, OPTIMIZE, HACK, REVIEW -Style/CommentAnnotation: - Exclude: - - 'spec/node_spec.rb' - # Offense count: 45 Style/Documentation: Enabled: false diff --git a/README.md b/README.md index b0d8f4a5..adb96fc8 100644 --- a/README.md +++ b/README.md @@ -858,9 +858,10 @@ browser.add_script_tag(url: "http://example.com/stylesheet.css") # => true browser.add_style_tag(content: "h1 { font-size: 40px; }") # => true ``` -#### bypass_csp(enabled) : `Boolean` +#### bypass_csp(\*\*options) : `Boolean` -* enabled `Boolean`, `true` by default +* options `Hash` + * :enabled `Boolean`, `true` by default ```ruby browser.bypass_csp # => true @@ -1001,7 +1002,7 @@ browser.go_to("https://www.w3schools.com/tags/tag_frame.asp") browser.main_frame.doctype # => "" ``` -#### set_content(html) +#### content = html Sets a content of a given frame. @@ -1011,7 +1012,7 @@ Sets a content of a given frame. browser.go_to("https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe") frame = browser.frames[1] frame.body #