Open jaraco opened 2 months ago
I'm rather surprised that we don't already have that. There's an existing rule to catch ambiguous unicode characters, but it doesn't cover invisible characters.
I'm very much in favor of adding the rule. We would have to think about if it should be a new rule or be added to the above mentioned rule
I suggest add --show-all-characters
option to show non-printable characters like bat also:
@xyb, this issue is different. It isn't about showing invisible characters; it's about linting for invisible characters.
@MichaReiser I agree this is a separate request, but it's related because it would be confusing if Ruff reports an invisible character without helping the user fix it. If you agree, I'll go ahead and create a new issue to track this requirement.
In https://github.com/jaraco/zipp/pull/125, I learned that users can, intentionally or not, sneak non-printable characters into the code through otherwise innocuous pull requests. This particular one was caught by
mach lint
in a downstream system. It would be nice if ruff could catch such changes. I'm not confident it's possible, but I wanted to flag it as a feature for consideration.