Lint or format rule to get rid of "irregular whitespaces" #14674
QuentinFchx
started this conversation in
Ideas
Replies: 1 comment
-
I think having this part of Ruff makes sense, especially in cases where it results in a syntax error because of it. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
Context
/ U+00A0) which is causing SyntaxErrors.
Very often on MacOS, when typing swiftly, I inadvertently insert non-breaking spaces in my code.
Especially after pipes
|
(used for union types) : the keyboard combination for the pipe is (⌥ + Shift + L), I don't release ⌥ quickly enough and then ⌥ + Space insert a non-breaking space (I guess I'm not the only one... 😅
More generally, I guess these space-like characters in the code are usually not wanted and hard to detect (they look like regular spaces), if ruff could help with getting rid of those it would be awesome.
Idea
Would it be in the scope of ruff to add a (formatting ?) rule that would convert such chars into normal whitespaces, as long as they're not part of a string or a comment?
Other lint tools implement a similar behaviour, such as eslint with the no-irregular-whitespace rule
Thank you in advance :)
Beta Was this translation helpful? Give feedback.
All reactions