fix dangling enclosed comma

This commit is contained in:
Max Eisner 2022-08-10 17:49:18 +02:00
parent a175d6b7a1
commit ab6a4d757a
No known key found for this signature in database
GPG Key ID: 4BF122C22879F0C8

View File

@ -532,6 +532,7 @@ module RuboCop
@offensive_node.source.sub(/shells: \[(:bash|:zsh|:fish)\]/, "") @offensive_node.source.sub(/shells: \[(:bash|:zsh|:fish)\]/, "")
.sub(", )", ")") # clean up dangling trailing comma .sub(", )", ")") # clean up dangling trailing comma
.sub("(, ", "(") # clean up dangling leading comma .sub("(, ", "(") # clean up dangling leading comma
.sub(", , ", ", ") # clean up dangling enclosed comma
else else
@offensive_node.source.sub(/shells: \[(:bash|:zsh|:fish)\]/, @offensive_node.source.sub(/shells: \[(:bash|:zsh|:fish)\]/,
"shells: [#{shells.join(", ")}]") "shells: [#{shells.join(", ")}]")