From 3741eb3d177da66fea0740ffc4ad4409b986cc94 Mon Sep 17 00:00:00 2001 From: Geremia Taglialatela Date: Sat, 4 Jan 2025 12:54:47 +0100 Subject: [PATCH] Enable some `Lint` cops to prevent warnings 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