-
Notifications
You must be signed in to change notification settings - Fork 2k
B905's autofix sets strict=False, but the suggested fix is strict=True #13581
Copy link
Copy link
Closed
Labels
ruleImplementing or modifying a lint ruleImplementing or modifying a lint rule
Description
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.
Keywords: B905, zip-without-explicit-strict
Current ruff version: 0.6.6
Minimal snippet:
zip(a, b)Command invoked:
ruff check example.py --target-version=py311 --select=B905
Output:
example.py:1:1: B905 [*] `zip()` without an explicit `strict=` parameter
|
1 | zip(a, b)
| ^^^^^^^^^ B905
|
= help: Add explicit `strict=False`
Found 1 error.
[*] 1 fixable with the `--fix` option.
Expected output:
...
= help: Add explicit `strict=True`
...
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
ruleImplementing or modifying a lint ruleImplementing or modifying a lint rule