[fix] Don't skip hidden dot-directories when walking a directory argument#948
Open
dduugg wants to merge 1 commit into
Open
[fix] Don't skip hidden dot-directories when walking a directory argument#948dduugg wants to merge 1 commit into
dduugg wants to merge 1 commit into
Conversation
…ment WalkBuilder ignores hidden files by default, so `rubyfmt --check .` (or `-i .`) silently never visits .rb files under dot-directories like .buildkite/ or .github/ even when they're tracked in git and not excluded by any .gitignore/.rubyfmtignore pattern. Passing an explicit file path bypasses the walk entirely and is unaffected, which made the gap easy to miss: `rubyfmt --check .buildkite/pipeline.rb` catches problems that `rubyfmt --check .` does not. Un-hide dotfiles in the walk and explicitly filter out .git, since that's the one dot-directory we never want to walk into regardless.
dduugg
force-pushed
the
fix-hidden-directory-walk
branch
from
July 15, 2026 20:26
eb48a1f to
ed4d2cf
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #947.
file_walker_builderbuilds anignore::WalkBuilderfor directory arguments but never disables the crate's default hidden-file skip, sorubyfmt --check .(or-i .) never visits.rbfiles under dot-directories like.buildkite/or.github/— even when they're tracked in git and not excluded by any.gitignore/.rubyfmtignorepattern. Passing an explicit file path bypasses the walker entirely and is unaffected, which is what made this easy to miss:rubyfmt --check .buildkite/pipeline.rbfinds problems thatrubyfmt --check .silently skips.Fix
builder.hidden(false)so the walk no longer treats dotfiles/dot-directories as ignored-by-default.builder.filter_entry(...)to explicitly keep.gitexcluded, since un-hiding would otherwise walk into it too..gitignore/.rubyfmtignorehandling is untouched — both still exclude the same paths they did before, for hidden and non-hidden files alike.Testing
test_format_directory_with_changes_in_hidden_directory: a.rbfile under a hidden directory gets formatted in-place when the parent directory is passed. Confirmed this fails without the fix (assertion left == right failed, file unmodified).test_format_directory_ignores_git_directory: a.rbfile under.git/is still left untouched.cargo test: 460 passed, 0 failed.cargo clippy,cargo fmt --check,make lint: clean.