fix(oxfmt): Always respect ignored files even specified#16632
Conversation
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
There was a problem hiding this comment.
Pull request overview
This PR fixes oxfmt to always respect ignored files, even when explicitly specified on the command line. The key change is refactoring Walk::build() to pre-filter target paths against ignore rules before passing them to the walker, ensuring that explicitly specified files are still ignored if they match ignore patterns.
- Refactored path normalization logic into
Walk::build()for better code locality - Added pre-filtering of target paths using
GitignoreBuilderto respect ignore rules - Changed
Walk::build()return type toResult<Option<Self>, String>to distinguish between errors and valid no-files-found states - Added comprehensive test coverage for various ignore scenarios including explicit file specification and the
--no-error-on-unmatched-patternflag
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| apps/oxfmt/src/cli/walk.rs | Core logic changes: inlined path normalization, added pre-filtering of target paths against ignore rules, removed OverrideBuilder in favor of unified GitignoreBuilder approach, improved code style with .into_iter() and .then_some() |
| apps/oxfmt/src/cli/format.rs | Updated to handle new Result<Option<Walk>, String> return type with appropriate error messages for the Ok(None) case |
| apps/oxfmt/test/ignore_and_override.test.ts | Added test cases for explicitly specified files being ignored and --no-error-on-unmatched-pattern flag behavior |
| apps/oxfmt/test/snapshots/ignore_and_override.test.ts.snap | Updated snapshots to reflect new behavior where ignored files are always respected |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Merge activity
|
b13c044 to
02f59ba
Compare

Fixes #16621