gitignore icon indicating copy to clipboard operation
gitignore copied to clipboard

Update Python.gitignore for .ruff_cache/

Open csauge opened this issue 2 years ago • 5 comments

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

csauge avatar May 01 '23 18:05 csauge

See also #4199

covracer avatar May 23 '23 15:05 covracer

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 https://github.com/astral-sh/ruff/issues/204 and https://github.com/astral-sh/ruff/pull/208

JasperJuergensen avatar Jul 03 '23 07:07 JasperJuergensen

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

stdedos avatar Oct 14 '23 12:10 stdedos

@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.

paduszyk avatar Nov 07 '23 15:11 paduszyk

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 https://github.com/github/gitignore/pull/4199 and https://github.com/github/gitignore/pull/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

stankudrow avatar Jan 14 '24 18:01 stankudrow