-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Closed
Labels
cliRelated to the command-line interfaceRelated to the command-line interface
Description
Summary
Take the following simple example:
def mvce(keys, values):
return {key: value for key, value in zip(keys, values)}and run: ruff check --select=C416 mvce.py:
mvce.py:2:12: C416 Unnecessary dict comprehension (rewrite using `dict()`)
|
1 | def mvce(keys, values):
2 | return {key: value for key, value in zip(keys, values)}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ C416
|
= help: Rewrite using `dict()`
Found 1 error.
No fixes available (1 hidden fix can be enabled with the `--unsafe-fixes` option).
but running ruff check --select=C416 --statistics mvce.py:
1 C416 [*] unnecessary-comprehension
[*] fixable with `ruff check --fix`
Is this intentional? There is a fix available, but it's unsafe, so at the very least the summary line for --statistics is inaccurate in that it also requires --unsafe-fixes.
I have a simple fix to only count unsafe fixes if --unsafe-fixes is set, and can make a PR if this isn't intentional behaviour.
In either case, should the summary be updated to mention unsafe fixes?
Version
ruff 0.11.0+2 (6311412 2025-03-14)
Metadata
Metadata
Assignees
Labels
cliRelated to the command-line interfaceRelated to the command-line interface