-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
C415 doc and/or implementation is broken #7773
Labels
documentation
Improvements or additions to documentation
Comments
Yeah, that's definitely wrong. |
Need to figure out whether it's the docs, implementation, or both. Thanks! |
And I'm indeed doing something wrong: if
But that still leaves two issues:
|
(Ruff does print warnings with |
charliermarsh
added a commit
that referenced
this issue
Oct 3, 2023
## Summary Two of the three listed examples were wrong: one was semantically incorrect, another was _correct_ but not actually within the scope of the rule. Good motivation for us to start linting documentation examples :) Closes #7773.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The documentation for C415 (https://docs.astral.sh/ruff/rules/unnecessary-subscript-reversal/) states that it makes the following changes:
But unless I'm doing something wrong, it doesn't:
Notice no warnings.
The reason I was checking this in the first place was that the first example (changing
reversed(iterable[::-1])
toreversed(iterable)
) is obviously wrong: if Ruff did that, it would result in the eventual order of the output being the wrong way. Possibly Ruff should output justiterable
in this case, though it doesn't feel like a common issue.The text was updated successfully, but these errors were encountered: