-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
check
and format
do not respect the same rules
#9064
Comments
Hi! We do not expect the linter to reimplement the behavior of the formatter. We intend for For example,
And the
The linter and formatter work very differently, so it's challenging for us to provide the same style of diagnostics. We do not expect to encourage usage of lint rules that overlap with the formatter in the long run. |
So in order to lint a project to it's fullest extent, I need to chain hundreds of |
@aaronmarkey You can select rules in your |
Is there a set of rules I can supply |
No, the Perhaps https://docs.astral.sh/ruff/formatter/#conflicting-lint-rules would be helpful if you want lint rules that overlap with formatting. As I said though, we'd highly recommend disabling formatting related lint rules and instead using |
@aaronmarkey, the linter and formatter serve entirely different purposes. Lint is for detecting possible bugs, while format is to standardize whitespace so humans don't have to think about it. I'm not sure which of those purposes you're seeking to achieve, but if you want to run a script that tells you if you have any formatting "violations" (things which would be automatically reformatted), then you can run |
Gonna close based on the explanations above. |
I understand the goal of the design, but inconvenient. |
I've a simple reproducible issue: Ruff's
check
andformat
commands do not respect the same configuration.In some directory the two following files:
I would expect running
ruff check example.py
to have a number of issues related to line length and quote type. However, running that returns0
. But, runningruff format example.py
results in the following file:So my issue: Is it expected that ruff's formatter and checker don't follow one another? If so, why are there shared configs for both at top level which both are documented as following if only the formatter follows them?
The text was updated successfully, but these errors were encountered: