-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PLE2510, PLE2512, PLE2513, PLE2514, and PLE2515 fixes add escape sequences to raw strings #13294
Comments
@dscorbett how do you find all these incorrect fixes. Very impressive and thanks for opening an issue! |
Converting the raw string to a regular string might not be trivial. I think it would also be reasonable to remove the fix for raw strings. |
I don’t know how hard it is to implement in Ruff, but theoretically, converting raw strings to regular strings should be straightforward. Each I find all these incorrect fixes by reading the rule descriptions and/or implementations and thinking of edge cases that might have been missed. Basically, it’s glass-box fuzz-testing done manually. |
Wow, that's a very impressive skill! |
I can work on this one. If I understand this correctly, I can start by adding the replacement logic here, right? I am a first time contributor Also, I am probably missing something here, but where should I add replacement tests? |
Awesome and welcome. Yes, this looks about right
You can add them to this file The tests are defined here ruff/crates/ruff_linter/src/rules/pylint/mod.rs Lines 91 to 102 in 52d27be
|
The fixes for PLE2510, PLE2512, PLE2513, PLE2514, and PLE2515 add escape sequences to raw strings, which is an invalid change because raw strings don’t support escape sequences. The fixes should convert the raw strings to normal strings first.
I’m using Python 3.10 for this example because literal null characters are syntax errors in later versions.
The text was updated successfully, but these errors were encountered: