fix desc auto-correct order
This commit is contained in:
parent
b1baca7720
commit
c355723fe5
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user