From 63a2a4b074f09bc7b6fe1b5e7f50de18033e52a4 Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Wed, 18 Oct 2023 04:32:09 -0400 Subject: [PATCH] Fix `Performance/DeletePrefix` cop (#27448) --- .rubocop_todo.yml | 6 ------ app/models/featured_tag.rb | 2 +- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 980339f496..bee9e71552 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -100,12 +100,6 @@ Naming/VariableNumber: - 'spec/models/domain_block_spec.rb' - 'spec/models/user_spec.rb' -# This cop supports unsafe autocorrection (--autocorrect-all). -# Configuration parameters: SafeMultiline. -Performance/DeletePrefix: - Exclude: - - 'app/models/featured_tag.rb' - Performance/MapMethodChain: Exclude: - 'app/models/feed.rb' diff --git a/app/models/featured_tag.rb b/app/models/featured_tag.rb index 587dcf9912..df23114a3e 100644 --- a/app/models/featured_tag.rb +++ b/app/models/featured_tag.rb @@ -51,7 +51,7 @@ class FeaturedTag < ApplicationRecord private def strip_name - self.name = name&.strip&.gsub(/\A#/, '') + self.name = name&.strip&.delete_prefix('#') end def set_tag