lintr
lintr copied to clipboard
allow_avoidable_escapes (?) in single_quotes_linter()
A handy parameter for single_quotes_linter()
would throw a lint on literals that use "
but have escaped "
that could be avoided by using '
instead:
"a string" # fine
'another' # lint, uses '
"a third \"string\" that escapes double-quotes" # lint: " is avoidable by using '
"a fourth \"string\" that 'escapes' both quotes" # fine -- both quote characters are used; let the user choose which quote to use
open to names on the parameter
Further down, it could suggest raw strings in case there are many chars to escape.
Maybe the feature could be called use_smart_escaping = TRUE
?
I do like the idea but worry about suggesting an R 4 dependency, maybe off by default until 4.x.y is released? or even 5.0.0?