ruff
56afb12a - Fix infinite watch loop by ignoring 'uninteresting' watch events (#14809)

Commit
302 days ago
Fix infinite watch loop by ignoring 'uninteresting' watch events (#14809) ## Summary Fixes https://github.com/astral-sh/ruff/issues/14807 I suspect that this broke when we updated notify, although I'm not quiet sure how this *ever* worked... The problem was that the file watcher didn't skip over `Access` events, but Ruff itself accesses the `pyproject.toml` when checking the project. That means, Ruff triggers `Access` events but it also schedules a re-check on every `Access` event... and this goes one forever. This PR skips over `Access` and `Other` event. `Access` events are uninteresting because they're only reads, they don't change any file metadata or content. The `Other` events should be rare and are mainly to inform about file watcher changes... we don't need those. I also added an explicit handling for the `Rescan` event. File watchers emit a `Rescan` event if they failed to capture some file watching changes and it signals that the program should assume that all files might have changed (the program should do a rescan to *get up to date*). ## Test Plan I tested that Ruff no longer loops when running `check --watch`. I verified that Ruff rechecks file after making content changes.
Author
Parents
Loading