How to format files but not check them? #19593
Replies: 3 comments 1 reply
-
|
Running |
Beta Was this translation helpful? Give feedback.
This comment was marked as spam.
This comment was marked as spam.
-
|
You can scope the exclude to linting only β # pyproject.toml
[tool.ruff.lint]
extend-exclude = ["migrations/**"]
# (no exclude under [tool.ruff.format] β these files will still be formatted)Or in [lint]
extend-exclude = ["migrations/**"]After that:
Use Quick way to verify it's set up right: ruff check --show-settings | grep -A 5 "exclude"
ruff format --show-settings | grep -A 5 "exclude"You should see Refs: |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello
I use ruff in some project both for linting and formatting. Our migrations folder is full of files (most of them are autogenerated) so I don't want ruff to check these files and fail if there is an issue. To do this, I added this folder in the
excludeparameter in the configuration.However, from time to time, I write a custom migration ((I am using PyCharm and ruff plugin) and would like ruff to format my code but ruff correctly does not because it is an excluded file.
Is it possible to configure ruff so that when it encounters a file, it formats it but when checking the whole project, it does not fail if there is an issue?
Thank you
Beta Was this translation helpful? Give feedback.
All reactions