Skip to content
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

Additional configuration file .ruff.toml #2988

Closed
s0undt3ch opened this issue Feb 17, 2023 · 10 comments · Fixed by #3221
Closed

Additional configuration file .ruff.toml #2988

s0undt3ch opened this issue Feb 17, 2023 · 10 comments · Fixed by #3221
Labels
question Asking for support or clarification

Comments

@s0undt3ch
Copy link

First of all, Thank You for this blazing fast tool!
I must also say that some of my smaller projects(because it will be easier and faster) will get migrated to ruff pretty soon.

There are however a few big projects which it will not be that easy to fix in one batch.
They even have parts where the rules are not the same.
The good news is, while they are not in a monorepo, ruff's monorepo support and configuration extending by means of additional pyproject.toml and ruff.toml will simplify this.
We will not be using additional pyproject.toml files since, as I mentioned, they are big, but non monorepo, projects.
That leaves us with ruff.toml.
However, I feel like a .ruff.toml would be something that would immediately "say", this is a local configuration file as opposed to something that the project requires to make it work.

Would it be possible to, additionally, check for, and support, .ruff.toml configuration files?

@not-my-profile
Copy link
Contributor

We will not be using additional pyproject.toml files since, as I mentioned, they are big, but non monorepo, projects.

I don't understand this at all. What is the problem with using pyproject.toml files?

@s0undt3ch
Copy link
Author

I don't understand this at all. What is the problem with using pyproject.toml files?

We use pyproject.toml at the root of the repo.
When I say we won't use it, I'm referring to directories within the repo, it'll be confusing since pyproject.toml is used to configure a project. Having more than one suggests more projects, and thus a monorepo layout, which is not the case.

@charliermarsh
Copy link
Member

Ah yeah, ruff.toml is designed for this purpose. So the question is whether we'd support .ruff.toml -- which wouldn't change semantics at all, right? Just the nomenclature?

My initial reaction is that I'd rather not support multiple file names... and yet, ESLint does expect everything except package.json to be dot-prefixed: https://eslint.org/docs/latest/use/configure/configuration-files#configuration-file-formats. So there's definitely precedent.

@charliermarsh charliermarsh added the question Asking for support or clarification label Feb 17, 2023
@s0undt3ch
Copy link
Author

ruff.toml and .ruff.toml would do and behave the exact same way.
It's just a matter of making it "less" visible if there's a need to have a few of them on the repository.

@charliermarsh
Copy link
Member

Yeah totally understand. Lemme think on it for a bit! It's a reasonable request.

@s0undt3ch
Copy link
Author

For additional context on why we would need multiple config files, we have some rules we apply to our application code, and the rules for tests are a bit more relaxed.

@s0undt3ch
Copy link
Author

Yeah totally understand. Lemme think on it for a bit! It's a reasonable request.

Thank You.

@KyleKing
Copy link

KyleKing commented Feb 17, 2023

I personally would use .ruff.toml, if available. Other major Python tools support: .flake8, .mypy.ini, .pylintrc, etc.

For additional context on why we would need multiple config files, we have some rules we apply to our application code, and the rules for tests are a bit more relaxed.

I don't know if you have considered it, but you may want to try per-file-ignores rather than multiple configuration files. This is from one of my projects:

[per-file-ignores]
'*tests/*.py' = [
    'ANN201',  # Missing return type annotation for public function
    'S101',    # Matches 'assert'
]

@s0undt3ch
Copy link
Author

I don't know if you have considered it, but you may want to try per-file-ignores rather than multiple configuration files.

Just started testing the tool.
Didn't know it supported globs. Good to know.

@charliermarsh
Copy link
Member

Yeah per-file-ignores is the recommended route for sub-package configuration if all you need to do is turn rules off (which is common for tests).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Asking for support or clarification
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants