ruff/crates/ruff_workspace/src
Takayuki Maeda bd5b3e4f6e
Deduplicate input paths (#20105)
<!--
Thank you for contributing to Ruff/ty! To help us out with reviewing,
please consider the following:

- Does this pull request include a summary of the change? (See below.)
- Does this pull request include a descriptive title? (Please prefix
with `[ty]` for ty pull
  requests.)
- Does this pull request include references to any relevant issues?
-->

## Summary

<!-- What's the purpose of the change? What does it do, and why? -->

Fixes #20035, fixes #19395

This is for deduplicating input paths to avoid processing the same file
multiple times.

This is my first contribution, so I'm sorry if I miss something. Please
tell me if this is needed for this feature.

## Test Plan

<!-- How was it tested? -->

I just added a test `find_python_files_deduplicated` in
eee1020e32/crates/ruff_workspace/src/resolver.rs (L1017)
. This pull request adds changes to `WalkPythonFilesState::finish`,
which is used in `python_files_in_path`, so they affect some commands
such as `analyze`, `format`, `check` and so on. I will add snapshot
tests for them if necessary.

I’ve already confirmed that the same thing happens with ruff check as
well.

```
$ echo "x   = 1" > example/foo.py
$ uvx ruff check example example/foo.py
I002 [*] Missing required import: `from __future__ import annotations`
--> /path/to/example/foo.py:1:1
help: Insert required import: `from __future__ import annotations`

I002 [*] Missing required import: `from __future__ import annotations`
--> /path/to/example/foo.py:1:1
help: Insert required import: `from __future__ import annotations`

Found 2 errors.
[*] 2 fixable with the `--fix` option.
```
2025-09-19 14:40:23 -04:00
..
configuration.rs Stabilize adding future import via config option (#20277) 2025-09-10 09:00:27 -04:00
lib.rs [ty] Document configuration schema (#17950) 2025-05-09 10:47:45 +02:00
options.rs [`ruff`] Add `analyze.string-imports-min-dots` to settings documentation (#20375) 2025-09-16 13:19:34 +02:00
pyproject.rs Remove deprecated macOS config file discovery (#19210) 2025-09-10 09:00:27 -04:00
resolver.rs Deduplicate input paths (#20105) 2025-09-19 14:40:23 -04:00
settings.rs Switch to Rust 2024 edition (#18129) 2025-05-16 13:25:28 +02:00