Open VascoSch92 opened 8 months ago
Yeah that makes a lot of sense. I think we do some very basic verification today but it is limited to whether the pyproject.toml is valid. But we don't perform any validation to catch potential errors in the configuration.
This is related to https://github.com/astral-sh/ruff/issues/10227
You can also verify these configuration files via their JSON schemas
e.g. https://github.com/astral-sh/ruff/blob/main/ruff.schema.json / https://www.schemastore.org/json/
Yeah that makes a lot of sense. I think we do some very basic verification today but it is limited to whether the pyproject.toml is valid. But we don't perform any validation to catch potential errors in the configuration. This is related to https://github.com/astral-sh/ruff/issues/10227
I understand. Regarding issue https://github.com/astral-sh/ruff/issues/10227, I wanted to inquire about implementing rules to verify configuration files (and I see that the config file of Ruff can be one of these :-( ;-) ).
My idea is to introduce additional checks/verifications on the Ruff configuration file to potentially block linting or formatting if the configuration file is ambiguous. For example:
select
section.ignore
section.select
and ignore
sections simultaneously.select
section.By implementing these checks, we can ensure that the Ruff configuration file is unambiguous before proceeding with linting or formatting. This could help for the following cases:
You can also verify these configuration files via their JSON schemas e.g. https://github.com/astral-sh/ruff/blob/main/ruff.schema.json / https://www.schemastore.org/json/
Yes, but this is just for the structure not for the content right?
You can also run ruff check --show-settings
to view the final, resolved settings for your project.
+1 to this, I accidentally ran into Ensuring there are no rules that appear both in the select and ignore sections simultaneously.
when updating an old POC to use latest ruff. Went to write an internal test and realized this is something ruff could be handling itself
Ruff-version : 0.3.3
Hello everyone,
I'm concerned about the configuration file for Ruff (
pyproject.toml
,ruff.toml
, ...).Are there checks for this configuration file? I'm asking not only about the syntax but also about the content.
I'm asking because of several reasons:
To clarify my point of view, here is a snippet of the configuration file that I use:
Problems:
"ARG002"
is included in bothselect
andignore
. As my project doesn't have unused arguments, I don't know if the rule is ignored or it is just satisfied.lint.flake8-quotes.inline-quotes = "double"
andquote-style = "single"
. Which rule are we applying? In this case the first one but I had to run ruff and check the output.At the end of the day, I'm just asking to add checks to make the config file free of situations where there may be some confusion
Thanks for your answer
PS: Ruff is really nice, you are doing a great job :-)