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

Failed to create fix for UnnecessaryComprehensionAnyAll: Expected Expression::ListComp #6713

Closed
qarmin opened this issue Aug 21, 2023 · 2 comments · Fixed by #6744
Closed
Labels
bug Something isn't working fixes Related to suggested fixes for violations fuzzer Surfaced via fuzzing.

Comments

@qarmin
Copy link

qarmin commented Aug 21, 2023

Ruff 0.0.285

ruff  *.py --select ALL

file content:

any(x.id for x in bar)
any({x.id for x in bar})

error:

error: Failed to create fix for UnnecessaryComprehensionAnyAll: Expected Expression::ListComp
PY_FILE_TEST_51040573.py:1:1: D100 Missing docstring in public module

PY_FILE_TEST_51040573.py.zip

@dhruvmanila
Copy link
Member

It seems that neither flake8-comprehension or flake8-pie raises a violation when set comprehensions are used. \cc @charliermarsh any idea why this was added in #3824?

Sets are unordered so we might not know when any stops and if it benefits or not. Depending on the reason for the PR, the fix would be either to not flag it for set comprehensions or update the autofix to account for that.

@dhruvmanila dhruvmanila added bug Something isn't working fixes Related to suggested fixes for violations labels Aug 21, 2023
@charliermarsh
Copy link
Member

@dhruvmanila - It still makes sense to avoid allocating the set IMO. We should update the autofix, I think.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fixes Related to suggested fixes for violations fuzzer Surfaced via fuzzing.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants