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

Update Python.gitignore for .ruff_cache/ #4289

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

csauge
Copy link

@csauge csauge commented May 1, 2023

Add Ruff cache in gitignore.
Ruff is becoming a very popular tool often run in pre-commit and aim to replace Flake8 (plus dozens of plugins), isort, pydocstyle, yesqa, eradicate, pyupgrade, and autoflake, all while executing tens or hundreds of times faster than any individual tool.

Reasons for making this change:
Ruff is run in pre-commit thus .ruff_cache/ could be included accidently in git.
Actually this is similar to .mypy_cache/ which is also run in pre-commit.

Links to documentation supporting these rule changes:
https://github.com/charliermarsh/ruff in section configuration we can see the exclude of .ruff_cache and .mypy_cache

Add ruff cache. 
ruff tool: https://github.com/charliermarsh/ruff
ruff is becoming a very popular tool often run in pre-commit and aim to replace Flake8 (plus dozens of plugins), isort, pydocstyle, yesqa, eradicate, pyupgrade, and autoflake, all while executing tens or hundreds of times faster than any individual tool.
@covracer
Copy link

See also #4199

@JasperJuergensen
Copy link

I think this is not required, as ruff will add a .gitignore file to the .ruff_cache folder with * as content effectively ignoring the folder.

See astral-sh/ruff#204 and astral-sh/ruff#208

@stdedos
Copy link

stdedos commented Oct 14, 2023

It is nicer to have it there.

e.g. PyCharm's excluded folders (and https://plugins.jetbrains.com/plugin/17288-foldable-projectview) work based on these ignore

@paduszyk
Copy link

paduszyk commented Nov 7, 2023

@JasperJuergensen pytest does the same - it also adds .gitignore with * to its cache dir. But .pytest_cache it's included in the template... The same regards nox, for instance.

@stankudrow
Copy link

stankudrow commented Jan 14, 2024

I agree that it is nice to have .ruff_cache directory similarly to .mypy_cache and .pytest_cache directories. The ruff project is steadily developing and becoming widespread, so it is good to have already the section for it.

Also was mentioned in #4199 and #4274 PRs.

For instance, without the .ruff_cache line in .gitignore file this directory is not grayed:
ruff_cache_not_ignored

When added:
ruff_cache_ignored

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