No error after outer quotes are changed per Q003 if inner quotes are still escaped
Possibly related #69 , #77
-
'str\'i\'ng'Q003 -
"str\'i\'ng"No errors
The first line gives Q003 while the second line emits no errors. I took the ultimate aim of Q003 to be to eliminate escaped quotes wherever possible: if I am correct, then I suggest we should emit an additional error to actually do the un-escaping.
I don't have a considered opinion about what that should look like, but if the pump needs priming it could be something like Q004 "Remove unnecessarily escaped quotes."
Seems like a reasonable request :+1:
I think that Q004 "Remove unnecessarily escaped quotes" sounds good to me =) (no period needed)
There's a plugin flake8-strings that says on the tin that is does this, but I haven't tried it. MIT license. Maybe we could crib from there.
This seems reasonable to me, but I think a little nuiance is needed to handle cases of literal backslashes:
-
'str\'i\'ng- Q003 -
"str\'i\'ng"- Q004 -
"str\\'i\\'ng"- Acceptable, since\\'is intended to produce the literal\'rather than to escape' -
r"str\'i\'ng"- Acceptable, since\'is interpreted literally by raw strings
There are probably more cases to consider along these lines too!