You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The docs for B905 state the suggested fix is to use strict=True, but the autofix introduced here autofixes with strict=False.
Either the docs or the autofix should be updated to match the other.
I would argue that the autofix should be changed to strict=True, since that is the option less likely to cause unexpected runtime behavior for users. It might cause runtime exceptions to be raised, but I personally would prefer those to silently continuing with potentially unintended behavior.
I wonder if we use strict=False to avoid changing the semantics / behavior of the code? I think this is probably correct, but we should recommend adding strict not necessarily strict=False in the message?
That also works! Just removing the autofix altogether and letting the user decide what they want. Based on personal experience I'd almost always want strict=True, but I see the counter-argument that it changes behavior, so it might not be a desirable autofix.
The docs for B905 state the suggested fix is to use
strict=True
, but the autofix introduced here autofixes withstrict=False
.Either the docs or the autofix should be updated to match the other.
I would argue that the autofix should be changed to
strict=True
, since that is the option less likely to cause unexpected runtime behavior for users. It might cause runtime exceptions to be raised, but I personally would prefer those to silently continuing with potentially unintended behavior.Keywords: B905, zip-without-explicit-strict
Current ruff version: 0.6.6
Minimal snippet:
Command invoked:
ruff check example.py --target-version=py311 --select=B905
Output:
Expected output:
The text was updated successfully, but these errors were encountered: