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."
|
desc_problem "Description shouldn't end with a full stop."
|
||||||
end
|
end
|
||||||
|
|
||||||
# Check if the desc contains Unicode characters in the So (emojis or other symbols) range.
|
# Check if the desc contains Unicode emojis or symbols (Unicode Other Symbols category).
|
||||||
if regex_match_group(desc, /\p{So}/)
|
desc_problem "Description shouldn't contain Unicode emojis or symbols." if regex_match_group(desc, /\p{So}/)
|
||||||
desc_problem "Description shouldn't contain Unicode emojis or symbols."
|
|
||||||
end
|
|
||||||
|
|
||||||
# Check if the desc length exceeds maximum length.
|
# Check if the desc length exceeds maximum length.
|
||||||
return if desc_length <= MAX_DESC_LENGTH
|
return if desc_length <= MAX_DESC_LENGTH
|
||||||
@ -108,10 +106,10 @@ module RuboCop
|
|||||||
|
|
||||||
correction.gsub!(/(ommand ?line)/i, "ommand-line")
|
correction.gsub!(/(ommand ?line)/i, "ommand-line")
|
||||||
correction.gsub!(/(^|[^a-z])#{@name}([^a-z]|$)/i, "\\1\\2")
|
correction.gsub!(/(^|[^a-z])#{@name}([^a-z]|$)/i, "\\1\\2")
|
||||||
|
correction.gsub!(/\s?\p{So}/, "")
|
||||||
correction.gsub!(/^\s+/, "")
|
correction.gsub!(/^\s+/, "")
|
||||||
correction.gsub!(/\s+$/, "")
|
correction.gsub!(/\s+$/, "")
|
||||||
correction.gsub!(/\.$/, "")
|
correction.gsub!(/\.$/, "")
|
||||||
correction.gsub!(/\s?\p{So}/, "")
|
|
||||||
|
|
||||||
corrector.replace(@offensive_node.source_range, "#{quote}#{correction}#{quote}")
|
corrector.replace(@offensive_node.source_range, "#{quote}#{correction}#{quote}")
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user