standardrb / standard

Ruby's bikeshed-proof linter and formatter 🚲
Other
2.64k stars 204 forks source link

change regex percent literal delimiter to singlequote #626

Open Epigene opened 2 months ago

Epigene commented 2 months ago

Curly braces are a part of Regex syntax (.{3,}, .{,9} etc.), so if the literal contains curlybraces, I have to use some other unspecified fallback delimiters. Bikeshedding ensues. Let's use delimiters that are not a part of Regex syntax and are less likely to appear in them - singlequotes. This goes nicely with string literals using doublequotes.

searls commented 2 months ago

Though I don't use it myself, my understanding is that %r{} is quite common and popular, so this would be a pretty major change. Additionally, I just scanned the regexes in the app that I'm building and a full third of them contain ' characters, so this would be a pretty disruptive change AFAICT.

Would welcome other perspectives here