From c97d3ddafb7ca222e37c416b9fde7f520a0fa063 Mon Sep 17 00:00:00 2001 From: Charlie Marsh Date: Mon, 18 Dec 2023 11:37:25 -0500 Subject: [PATCH] Add site-packages to default exclusions (#9188) Suggested in https://github.com/astral-sh/ruff-vscode/issues/232#issuecomment-1860788600. This is technically a non-backwards-compatible change, but I would be very surprised if it affected anyone in practice given that `site-packages` is always ignored already in virtual environments. --- BREAKING_CHANGES.md | 37 +++++++++++++++++++++++++++ README.md | 5 ++++ crates/ruff_workspace/src/settings.rs | 1 + docs/configuration.md | 10 ++++++++ 4 files changed, 53 insertions(+) diff --git a/BREAKING_CHANGES.md b/BREAKING_CHANGES.md index 3fcc2337d1a3c4..0558ab5cca1ee3 100644 --- a/BREAKING_CHANGES.md +++ b/BREAKING_CHANGES.md @@ -1,5 +1,42 @@ # Breaking Changes +## 0.1.9 + +### `site-packages` is now excluded by default ([#5513](https://github.com/astral-sh/ruff/pull/5513)) + +Ruff maintains a list of default exclusions, which now consists of the following patterns: + +- `.bzr` +- `.direnv` +- `.eggs` +- `.git-rewrite` +- `.git` +- `.hg` +- `.ipynb_checkpoints` +- `.mypy_cache` +- `.nox` +- `.pants.d` +- `.pyenv` +- `.pytest_cache` +- `.pytype` +- `.ruff_cache` +- `.svn` +- `.tox` +- `.venv` +- `.vscode` +- `__pypackages__` +- `_build` +- `buck-out` +- `build` +- `dist` +- `node_modules` +- `site-packages` +- `venv` + +Previously, the `site-packages` directory was not excluded by default. While `site-packages` tends +to be excluded anyway by virtue of the `.venv` exclusion, this may not be the case when using Ruff +from VS Code outside a virtual environment. + ## 0.1.0 ### The deprecated `format` setting has been removed diff --git a/README.md b/README.md index 7554930ad0460c..588539c85ca27a 100644 --- a/README.md +++ b/README.md @@ -194,20 +194,25 @@ exclude = [ ".git", ".git-rewrite", ".hg", + ".ipynb_checkpoints", ".mypy_cache", ".nox", ".pants.d", + ".pyenv", + ".pytest_cache", ".pytype", ".ruff_cache", ".svn", ".tox", ".venv", + ".vscode", "__pypackages__", "_build", "buck-out", "build", "dist", "node_modules", + "site-packages", "venv", ] diff --git a/crates/ruff_workspace/src/settings.rs b/crates/ruff_workspace/src/settings.rs index 8ee030ea3b42a1..fe7c82a85e37f8 100644 --- a/crates/ruff_workspace/src/settings.rs +++ b/crates/ruff_workspace/src/settings.rs @@ -89,6 +89,7 @@ pub(crate) static EXCLUDE: &[FilePattern] = &[ FilePattern::Builtin("build"), FilePattern::Builtin("dist"), FilePattern::Builtin("node_modules"), + FilePattern::Builtin("site-packages"), FilePattern::Builtin("venv"), ]; diff --git a/docs/configuration.md b/docs/configuration.md index ec1dd0fa577df4..ced72b235fe3f2 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -21,20 +21,25 @@ If left unspecified, Ruff's default configuration is equivalent to: ".git", ".git-rewrite", ".hg", + ".ipynb_checkpoints", ".mypy_cache", ".nox", ".pants.d", + ".pyenv", + ".pytest_cache", ".pytype", ".ruff_cache", ".svn", ".tox", ".venv", + ".vscode", "__pypackages__", "_build", "buck-out", "build", "dist", "node_modules", + "site-packages", "venv", ] @@ -98,20 +103,25 @@ If left unspecified, Ruff's default configuration is equivalent to: ".git", ".git-rewrite", ".hg", + ".ipynb_checkpoints", ".mypy_cache", ".nox", ".pants.d", + ".pyenv", + ".pytest_cache", ".pytype", ".ruff_cache", ".svn", ".tox", ".venv", + ".vscode", "__pypackages__", "_build", "buck-out", "build", "dist", "node_modules", + "site-packages", "venv", ]