From 3db84989039c2dbba5dc6797092fa7cbbbcb7db8 Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Thu, 16 Jan 2025 04:09:06 -0500 Subject: [PATCH] Fix `Style/MutableConstant` cop (#33602) --- .rubocop_todo.yml | 9 --------- app/models/tag.rb | 8 ++++---- app/services/delete_account_service.rb | 2 +- lib/mastodon/migration_warning.rb | 2 +- 4 files changed, 6 insertions(+), 15 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 38aec67befa..f2d3418b64a 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -69,15 +69,6 @@ Style/MapToHash: Exclude: - 'app/models/status.rb' -# This cop supports unsafe autocorrection (--autocorrect-all). -# Configuration parameters: EnforcedStyle. -# SupportedStyles: literals, strict -Style/MutableConstant: - Exclude: - - 'app/models/tag.rb' - - 'app/services/delete_account_service.rb' - - 'lib/mastodon/migration_warning.rb' - # Configuration parameters: AllowedMethods. # AllowedMethods: respond_to_missing? Style/OptionalBooleanParameter: diff --git a/app/models/tag.rb b/app/models/tag.rb index c9115b905b3..d29cd220f03 100644 --- a/app/models/tag.rb +++ b/app/models/tag.rb @@ -35,11 +35,11 @@ class Tag < ApplicationRecord has_one :trend, class_name: 'TagTrend', inverse_of: :tag, dependent: :destroy HASHTAG_SEPARATORS = "_\u00B7\u30FB\u200c" - HASHTAG_FIRST_SEQUENCE_CHUNK_ONE = "[[:word:]_][[:word:]#{HASHTAG_SEPARATORS}]*[[:alpha:]#{HASHTAG_SEPARATORS}]" - HASHTAG_FIRST_SEQUENCE_CHUNK_TWO = "[[:word:]#{HASHTAG_SEPARATORS}]*[[:word:]_]" - HASHTAG_FIRST_SEQUENCE = "(#{HASHTAG_FIRST_SEQUENCE_CHUNK_ONE}#{HASHTAG_FIRST_SEQUENCE_CHUNK_TWO})" + HASHTAG_FIRST_SEQUENCE_CHUNK_ONE = "[[:word:]_][[:word:]#{HASHTAG_SEPARATORS}]*[[:alpha:]#{HASHTAG_SEPARATORS}]".freeze + HASHTAG_FIRST_SEQUENCE_CHUNK_TWO = "[[:word:]#{HASHTAG_SEPARATORS}]*[[:word:]_]".freeze + HASHTAG_FIRST_SEQUENCE = "(#{HASHTAG_FIRST_SEQUENCE_CHUNK_ONE}#{HASHTAG_FIRST_SEQUENCE_CHUNK_TWO})".freeze HASHTAG_LAST_SEQUENCE = '([[:word:]_]*[[:alpha:]][[:word:]_]*)' - HASHTAG_NAME_PAT = "#{HASHTAG_FIRST_SEQUENCE}|#{HASHTAG_LAST_SEQUENCE}" + HASHTAG_NAME_PAT = "#{HASHTAG_FIRST_SEQUENCE}|#{HASHTAG_LAST_SEQUENCE}".freeze HASHTAG_RE = %r{(?