Replies: 2 comments
-
I'm sorry this happened to you. The CLI makes it easy to put the file name in the wrong position, which is quite destructive if not inside a project. I'm not a huge fan of having the CLI behave differently wheter a user is inside a project or not but we could at least consider to ask for confirmation (at least once) |
Beta Was this translation helpful? Give feedback.
-
It seems like ruff has competing desires. It wants to run over an entire workspace by default. It doesn't want to detect whether it is running inside a Python project. It doesn't (I assume) want to be easily misused to make irreversible changes. I think, in general, ruff can pick two of the three. I wrote out some more but realized it was just me getting upset. I appreciate the consideration. ruff is a great tool, just wish it was harder to stub my toe on it. |
Beta Was this translation helpful? Give feedback.
-
I'm really not a fan that
ruff check
andruff format
recursively update every python file in the current directory when run without positional arguments.Today was the second time this hit me, this time inconveniently while I was in my home directory; I spent a half hour removing spurious edits across dozens of repositories.
For reference, this was the innocuous seeming command (DO NOT RUN THIS, this will rewrite all python scripts in the current directory and not just script.py):
I often work on loose Python scripts that are not part of larger Python project, so reformatting directory trees at a time is often not what I want; it goes without saying that reformatting my entire home directory is never what I want.
If this must be the default, perhaps let's look for a pyproject.toml file first? This behavior seems sane only when running ruff within a Python project.
Beta Was this translation helpful? Give feedback.
All reactions