Skip to content

[fix] Don't skip hidden dot-directories when walking a directory argument#948

Open
dduugg wants to merge 1 commit into
fables-tales:trunkfrom
dduugg:fix-hidden-directory-walk
Open

[fix] Don't skip hidden dot-directories when walking a directory argument#948
dduugg wants to merge 1 commit into
fables-tales:trunkfrom
dduugg:fix-hidden-directory-walk

Conversation

@dduugg

@dduugg dduugg commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Fixes #947.

file_walker_builder builds an ignore::WalkBuilder for directory arguments but never disables the crate's default hidden-file skip, so rubyfmt --check . (or -i .) 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 walker entirely and is unaffected, which is what made this easy to miss: rubyfmt --check .buildkite/pipeline.rb finds problems that rubyfmt --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 .git excluded, since un-hiding would otherwise walk into it too.

.gitignore/.rubyfmtignore handling is untouched — both still exclude the same paths they did before, for hidden and non-hidden files alike.

Testing

  • Added test_format_directory_with_changes_in_hidden_directory: a .rb file 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).
  • Added test_format_directory_ignores_git_directory: a .rb file under .git/ is still left untouched.
  • cargo test: 460 passed, 0 failed.
  • cargo clippy, cargo fmt --check, make lint: clean.

…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
dduugg force-pushed the fix-hidden-directory-walk branch from eb48a1f to ed4d2cf Compare July 15, 2026 20:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Directory-argument walk silently skips hidden dot-directories (.buildkite/, .github/, etc.)

1 participant