ruff icon indicating copy to clipboard operation
ruff copied to clipboard

Ruff is removing used imports

Open lcsvcn opened this issue 1 year ago • 2 comments

Removing used imports (probably wrong classified as "unused"

ruff check . --fix --verbose
ruff format --verbose

Here is autoformat configured with commands above: Screenshot 2024-05-23 at 14 36 51

here is a function that is using the import: Screenshot 2024-05-23 at 14 37 29

The ruff format insists in remove used import, it was not first time, but now it is first time it was doing several times in a row.

lcsvcn avatar May 23 '24 17:05 lcsvcn

Can you please include a full reproducible example, like a Python file that demonstrates the bug? That snippet alone isn’t enough (and can’t be copy-pasted) since it doesn’t contain any imports.

charliermarsh avatar May 23 '24 17:05 charliermarsh

Might be a duplicate of https://github.com/astral-sh/ruff/issues/8691

zanieb avatar May 23 '24 18:05 zanieb

Closing as a dupe, looks that way.

charliermarsh avatar May 26 '24 17:05 charliermarsh

I think it's actually slightly different than #8691.

charliermarsh avatar May 28 '24 01:05 charliermarsh