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.
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
[
flake8-pyi
] ImplementPYI059
(generic-not-last-base-class
) #11233[
flake8-pyi
] ImplementPYI059
(generic-not-last-base-class
) #11233Changes from 12 commits
51ea306
1f303fd
586c8d1
16ac12a
68aa934
7e3a5d2
97a9f93
84a3edd
3cf3ed3
ed30b1a
26df9fe
281cf09
2c82817
587d5a2
0b28a2e
6fce0fd
fc70de6
7750c91
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
I don't really understand what's going on here, I'm afraid :(
Is this the best name for this variable? Would you mind adding some comments to this function to explain how it works (preferably with some examples)?
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.
I'm trying to find the first index in the source code after
Generic[...],
, which doesn't contain a whitespace.Basically, deleting just
Generic[T]
and the comma after it would leave a trailing whitespace around (usually a space).Without the whitespace detection, this code:
would be autofixed into:
i.e. The space before
Bar
was not deleted.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.
I'm honestly not sure if this is the best way to write this, please feel free to refactor or comment on this.
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.
I think deleting a positional argument from a function call during autofix is common enough that once we finalize on the way it should be done this can be lifted to make a helper instead.
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.
Ah... in fact...
ruff/crates/ruff_linter/src/fix/edits.rs
Lines 155 to 237 in 12b5c3a
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.
I'm so sorry, I completely forgot that we had those helpers!
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.
I also didn't find them, so partly on me :P it uses the Tokenizer which is pretty clever
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.
I'll go ahead and refactor it.