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

Run on pyproject.toml or ruff.toml change #79

Open
almahdi404 opened this issue Mar 25, 2024 · 4 comments
Open

Run on pyproject.toml or ruff.toml change #79

almahdi404 opened this issue Mar 25, 2024 · 4 comments

Comments

@almahdi404
Copy link

Currently ruff runs on py or pyi file change.

But shouldn't it also run when pyproject.toml or ruff.toml is changed?

@CoderJoshDK
Copy link
Contributor

The problem is that pre-commit will only run on the file changed. There is not a way to check for a config change and then run ruff on all files (not without making this whole system wildly more complicated.) You can manually have it ran on all-files when you make changes. Otherwise, you would need always_run. But that would be excessive most of the time.

When you make a change to your config, you can run:

> pre-commit run ruff --all-files # `ruff` is the `id` of the pre-commit hook you are referencing
ruff.....................................................................Passed

> pre-commit run ruff-format --all-files
ruff-format..............................................................Passed

@charliermarsh
Copy link
Member

We do lint the pyproject.toml itself though, so we could add toml to the list of supported files. We did this in the past and then had to revert it: #44 (comment). But I believe newer versions of Ruff don't suffer from the same problem, so we could re-add.

@almahdi404
Copy link
Author

pre-commit passes changed files as arguments to the entry.

What if ruff cli runs on the whole project if the arguments include pyproject.toml or ruff.toml

@CoderJoshDK
Copy link
Contributor

That could work. You should open an issue in ruff. It would solve this issue. But I have no idea if it would be approved.

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

No branches or pull requests

3 participants