fix desc auto-correct order

This commit is contained in:
Razvan Azamfirei 2023-06-20 11:36:47 -04:00
parent b1baca7720
commit c355723fe5
No known key found for this signature in database
GPG Key ID: 62E97BFCB12046BD

View File

@ -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