-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Lint for invisible Unicode characters other than ZWSP #6105
Conversation
r? @ebroto (rust_highfive has picked a reviewer for you, use r? to override) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
About the open questions:
What other characters should trigger the lint?
I'm really not an expert in this field. Taking a look at this Wikipedia entry, there are some other invisible characters (second table) which could be candidates.
My main concern would be including characters that could be legitimately used in languages I'm not familiar with, so I would prefer to be conservative here. Maybe the WORD JOINER
one could be a candidate? If we are not sure I would prefer not to include others.
What should be done with the lint name?
There's a mechanism for renaming lints. You can find an example in #3554. It's a bit old PR, but self-contained, except for the test about renaming lints, you can omit that.
How to indicate the change in functionality?
A new name for the lint should suffice. What about invisible_characters
that you used when linting?
Oh, I intended this question to a broader audience, not placing the burden of figuring out on you. Just in case somebody would have a stronger opinion here.
I've added WJ, that seems obvious enough. I don't think language support is an issue here - if a character is invisible, I think people should prefer writing out the escape code instead in any language. But I may have wrong assumptions and preferences here.
Thanks, I've renamed the lint to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, let's wait for CI and we can merge it.
Oh, I intended this question to a broader audience, not placing the burden of figuring out on you
Of course! Sorry if that sounded harsh, it was not the intention.
I don't think language support is an issue here - if a character is invisible, I think people should prefer writing out the escape code instead in any language
That makes sense, but I would prefer to be cautious. I think adding those two is a good improvement in any case.
@bors r+ Thanks! |
📌 Commit 572e4c4 has been approved by |
Lint for invisible Unicode characters other than ZWSP This PR extends the existing `zero_width_space` lint to look for other invisible characters as well (in this case, `\\u{ad}` soft hyphen. I feel like this lint is the logical place to add the check, but I also realize the lint name is not particularly flexible, but I also understand that it shouldn't be renamed for compatibility reasons. Open questions: - What other characters should trigger the lint? - What should be done with the lint name? - How to indicate the change in functionality? Motivation behind this PR: rust-lang/rust#77417 - I managed to shoot myself in the foot by an invisible character pasted into my test case.
Not at all, no worries. :) Thanks for the review! |
💔 Test failed - checks-action_test |
@bors retry (missing changelog) |
☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
This PR extends the existing
zero_width_space
lint to look for other invisible characters as well (in this case,\\u{ad}
soft hyphen.I feel like this lint is the logical place to add the check, but I also realize the lint name is not particularly flexible, but I also understand that it shouldn't be renamed for compatibility reasons.
Open questions:
Motivation behind this PR: rust-lang/rust#77417 - I managed to shoot myself in the foot by an invisible character pasted into my test case.
changelog: rename [
zero_width_space
] to [invisible_characters
] and add SHY and WJ to the list.