Use char-wise width instead of str-width#12135
Merged
dhruvmanila merged 4 commits intomainfrom Jul 1, 2024
Merged
Conversation
Contributor
|
2e76825 to
0cd98a3
Compare
CodSpeed Performance ReportMerging #12135 will not alter performanceComparing Summary
|
MichaReiser
reviewed
Jul 1, 2024
Member
There was a problem hiding this comment.
Hmm, why is this considered to be a binary file?
Member
Author
There was a problem hiding this comment.
It contains \0 character. I think I'll just inline the source code of that file as a separate test case to not do this.
Member
Author
There was a problem hiding this comment.
I think it's just the diff tab that renders it like that. The normal GitHub view is as: https://github.com/astral-sh/ruff/blob/dhruv/char-wise-width/crates/ruff_linter/resources/test/fixtures/pycodestyle/E501_4.py
MichaReiser
reviewed
Jul 1, 2024
MichaReiser
approved these changes
Jul 1, 2024
70928fb to
b49f0d6
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR updates various references in the linter to compute the line-width for summing the width of each
charin astrinstead of computing the width of thestritself.Refer to #12133 for more details.
fixes: #12130
Test Plan
Add a file with null (
\0) character which is zero-width. Run this test case onmainto make sure it panics and switch over to this branch to make sure it doesn't panic now.