mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-30 13:51:37 +00:00
Respect --force-exclude for lint.exclude and format.exclude (#8393)
## Summary We typically avoid enforcing exclusions if a file was passed to Ruff directly on the CLI. However, we also allow `--force-exclude`, which ignores excluded files _even_ if they're passed to Ruff directly. This is really important for pre-commit, which always passes changed files -- we need to exclude files passed by pre-commit if they're in the `exclude` lists. Turns out the new `lint.exclude` and `format.exclude` settings weren't respecting `--force-exclude`. Closes https://github.com/astral-sh/ruff/issues/8391.
This commit is contained in:
parent
38358980f1
commit
1642f4dbd9
7 changed files with 139 additions and 37 deletions
|
@ -483,10 +483,6 @@ pub fn python_file_at_path(
|
|||
pyproject_config: &PyprojectConfig,
|
||||
transformer: &dyn ConfigurationTransformer,
|
||||
) -> Result<bool> {
|
||||
if !pyproject_config.settings.file_resolver.force_exclude {
|
||||
return Ok(true);
|
||||
}
|
||||
|
||||
// Normalize the path (e.g., convert from relative to absolute).
|
||||
let path = fs::normalize_path(path);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue