From f6ea0e0ff26ea4c8111d76c4b6bbbcd0e55258c1 Mon Sep 17 00:00:00 2001 From: Geremia Taglialatela Date: Sun, 21 Jan 2024 17:52:11 +0100 Subject: [PATCH] Fix Style/SafeNavigation offenses --- .rubocop_todo.yml | 8 -------- lib/hawk/http.rb | 2 +- lib/hawk/model/active.rb | 2 +- 3 files changed, 2 insertions(+), 10 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 15280c8..75d373a 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -233,14 +233,6 @@ Style/RedundantSelfAssignment: Exclude: - 'lib/hawk/model/proxy.rb' -# This cop supports unsafe autocorrection (--autocorrect-all). -# Configuration parameters: ConvertCodeThatCanStartToReturnNil, AllowedMethods, MaxChainLength. -# AllowedMethods: present?, blank?, presence, try, try! -Style/SafeNavigation: - Exclude: - - 'lib/hawk/http.rb' - - 'lib/hawk/model/active.rb' - # This cop supports unsafe autocorrection (--autocorrect-all). Style/ZeroLengthPredicate: Exclude: diff --git a/lib/hawk/http.rb b/lib/hawk/http.rb index 32ada61..3f2d5d7 100644 --- a/lib/hawk/http.rb +++ b/lib/hawk/http.rb @@ -124,7 +124,7 @@ def response_handler(response) it = [meth, url].join(' ') if response.timed_out? - what, secs = if response.connect_time && response.connect_time.zero? + what, secs = if response.connect_time&.zero? # Connect failed [:connect, req.options[:connecttimeout]] else diff --git a/lib/hawk/model/active.rb b/lib/hawk/model/active.rb index 1f913a8..931314c 100644 --- a/lib/hawk/model/active.rb +++ b/lib/hawk/model/active.rb @@ -53,7 +53,7 @@ def save! else def save! persist! - @changed_attributes && @changed_attributes.clear + @changed_attributes&.clear true end end