Skip to content
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

Feature: Check for unintended non-printing characters #13297

Open
jaraco opened this issue Sep 9, 2024 · 4 comments
Open

Feature: Check for unintended non-printing characters #13297

jaraco opened this issue Sep 9, 2024 · 4 comments
Labels
rule Implementing or modifying a lint rule

Comments

@jaraco
Copy link
Contributor

jaraco commented Sep 9, 2024

In jaraco/zipp#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.

@AlexWaygood AlexWaygood changed the title Fature: Check for unintended non-printing characters Feature: Check for unintended non-printing characters Sep 10, 2024
@MichaReiser MichaReiser added the rule Implementing or modifying a lint rule label Sep 10, 2024
@MichaReiser
Copy link
Member

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

@xyb
Copy link

xyb commented Sep 11, 2024

I suggest add --show-all-characters option to show non-printable characters like bat also:

Screenshot 2024-09-11 at 17 26 12

@MichaReiser
Copy link
Member

@xyb, this issue is different. It isn't about showing invisible characters; it's about linting for invisible characters.

@xyb
Copy link

xyb commented Sep 15, 2024

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rule Implementing or modifying a lint rule
Projects
None yet
Development

No branches or pull requests

3 participants