From 258c93f956c64b3f3b7aaf5de01df5b2d805accb Mon Sep 17 00:00:00 2001 From: Geremia Taglialatela Date: Sun, 5 Jan 2025 17:13:28 +0100 Subject: [PATCH] Enable some `Lint` cops to prevent warnings (#951) Parity with ActiveAdmin to prevent introduction of new warnings Manually fix a `Lint/UselessAssignment` warning Ref: activeadmin/activeadmin#8597 --- .rubocop.yml | 9 +++++++++ lib/inherited_resources/base_helpers.rb | 4 ++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 951d8129..86153825 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -48,6 +48,15 @@ Layout/TrailingWhitespace: Layout/TrailingEmptyLines: Enabled: true +Lint/AmbiguousOperator: + Enabled: true + +Lint/AmbiguousRegexpLiteral: + Enabled: true + +Lint/UselessAssignment: + Enabled: true + Minitest: Enabled: true diff --git a/lib/inherited_resources/base_helpers.rb b/lib/inherited_resources/base_helpers.rb index a352ea39..ae889637 100644 --- a/lib/inherited_resources/base_helpers.rb +++ b/lib/inherited_resources/base_helpers.rb @@ -297,7 +297,7 @@ def smart_resource_url if respond_to? :show url = resource_url rescue nil end - url ||= smart_collection_url + url || smart_collection_url end # URL to redirect to when redirect implies collection url. @@ -309,7 +309,7 @@ def smart_collection_url if respond_to? :parent, true url ||= parent_url rescue nil end - url ||= root_url rescue nil + url || root_url rescue nil end # memoize the extraction of attributes from params