Open daniil-berg opened 3 months ago
I think this is a bit different @MichaReiser. In mypy, specifying files
lets you run mypy
without passing it any files (and it uses that list as the default).
So the ask here is that you can set files
in the configuration, and ruff check
would default to checking those files (instead of .
).
But I think that's roughly the same, isn't it?
A comma-separated list of paths which should be checked by mypy if none are given on the command line. Supports recursive file globbing using glob, where (e.g. .py) matches files in the current directory and / (e.g. /*.py) matches files in any directories below the current one. User home directory and environment variables will be expanded.
You can set exclude
and include
and that specifies the paths that Ruff checks by default. You can explicitly pass files to ruff check
that aren't covered by the set defined by exclude
/include
and ruff will check those files (unless force-exclude
is specified)
@MichaReiser Maybe I am misunderstanding the logic of those directives. Would you be so kind and provide the correct configuration to accomplish the following:
ruff check
(without any following positional arguments) should operate on the directories src
and tests
only.Yeah you might be right. It might be possible but you would at least need to override include
but then there's https://github.com/astral-sh/ruff/issues/9019
It would be nice, if I could specify the files to check, format, etc. via the ruff configuration file (in my case
pyproject.toml
). I thought of something analogous to thefiles
directive ofmypy
.Maybe I missed something, but I found no mention of this ability to specify files in the
ruff
documentation and found no issues about it, when I searched for the termsfiles config
here.Just trying out something like this gave me an error for commands like
ruff check
orruff format
:I assume this is expected and not a bug. Therefore please consider this a humble feature request.