From c355723fe5b20d0d0ccd34bbc334e832f8b9b695 Mon Sep 17 00:00:00 2001 From: Razvan Azamfirei Date: Tue, 20 Jun 2023 11:36:47 -0400 Subject: [PATCH] fix desc auto-correct order --- Library/Homebrew/rubocops/shared/desc_helper.rb | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/Library/Homebrew/rubocops/shared/desc_helper.rb b/Library/Homebrew/rubocops/shared/desc_helper.rb index 89b16cb94a..36c0c0a851 100644 --- a/Library/Homebrew/rubocops/shared/desc_helper.rb +++ b/Library/Homebrew/rubocops/shared/desc_helper.rb @@ -74,10 +74,8 @@ module RuboCop desc_problem "Description shouldn't end with a full stop." end - # Check if the desc contains Unicode characters in the So (emojis or other symbols) range. - if regex_match_group(desc, /\p{So}/) - desc_problem "Description shouldn't contain Unicode emojis or symbols." - end + # Check if the desc contains Unicode emojis or symbols (Unicode Other Symbols category). + desc_problem "Description shouldn't contain Unicode emojis or symbols." if regex_match_group(desc, /\p{So}/) # Check if the desc length exceeds maximum length. return if desc_length <= MAX_DESC_LENGTH @@ -108,10 +106,10 @@ module RuboCop correction.gsub!(/(ommand ?line)/i, "ommand-line") correction.gsub!(/(^|[^a-z])#{@name}([^a-z]|$)/i, "\\1\\2") + correction.gsub!(/\s?\p{So}/, "") correction.gsub!(/^\s+/, "") correction.gsub!(/\s+$/, "") correction.gsub!(/\.$/, "") - correction.gsub!(/\s?\p{So}/, "") corrector.replace(@offensive_node.source_range, "#{quote}#{correction}#{quote}") end