Skip to content

feat(analysis): respect.gitignore when walking directories#652

Open
akashchakrabortymsc-cmd wants to merge 14 commits intostjude-rust-labs:mainfrom
akashchakrabortymsc-cmd:fix/respect-gitignore-595
Open

feat(analysis): respect.gitignore when walking directories#652
akashchakrabortymsc-cmd wants to merge 14 commits intostjude-rust-labs:mainfrom
akashchakrabortymsc-cmd:fix/respect-gitignore-595

Conversation

@akashchakrabortymsc-cmd
Copy link

@akashchakrabortymsc-cmd akashchakrabortymsc-cmd commented Feb 22, 2026

Fixes: #595

This PR adds support for respecting .gitignore files when sprocket check or sprocket lint walks directories .wdl files .

Previously the file walker in wdl-analysis did not respect .gitignore files, causing sprocket to analyze files that user had intentionally excluded from git tracking.

The change adds a respect_gitignore Boolean field to config which when enabled passes .git_ignore(true) to the WalkBuilder in analyzer.rs

A test was added to verify that files listed in .gitignore are correctly skipped during analysis.

  • You have read the contributing guide in its entirety.
  • You have not used AI on any parts of this pull request.

For all contributors:

  • You have added a few sentences describing the PR here.
  • You have added yourself or the appropriate individual as the assignee.
  • You have added at least one relevant code reviewer to the PR.
  • Your code builds clean without any errors or warnings.
  • You have added tests (when appropriate).
  • You have added an entry in the CHANGELOG (when appropriate).
  • You have updated the README or other documentation to account for these changes (when appropriate).
  • You have made a PR to the next branch in the sprocket.bio repository (when appropriate).

For PRs containing lint rule changes:

  • You have updated any and all effected entries within RULES.md.
  • You have added a test case in crates/wdl-lint/tests/lints that covers every
    possible diagnostic emitted for the rule within the file where the rule
    is implemented.

@akashchakrabortymsc-cmd akashchakrabortymsc-cmd requested a review from a team as a code owner February 22, 2026 23:30
@akashchakrabortymsc-cmd akashchakrabortymsc-cmd changed the title feat(analysis): repect.gitignore when walking directories feat(analysis): respect.gitignore when walking directories Feb 22, 2026
@akashchakrabortymsc-cmd
Copy link
Author

The make_relative_to_with_symlinks test failure looks like a pre-existing Windows symlink permission issue and is not related to this PR.

All tests in wdl-analysis pass including the new it_respects_gitignore test.

Copy link
Member

@claymcleod claymcleod left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for working on this — the core change (passing .git_ignore() to WalkBuilder) is on the right track. A few things I think should be addressed before this is ready:

  1. Unrelated changes. The Arena.toml diff removes hundreds of ShellCheck diagnostics, and the CHANGELOG reformats *- throughout. These aren't related to the .gitignore feature and make the diff hard to review. Could you revert those files so the PR only contains the .gitignore changes?

  2. Default value. Issue #595 reports that sprocket should respect .gitignore by default. Right now the default is false (opt-in). I think the default should be true so that users get the expected behavior without extra configuration.

  3. CLI integration. The config field exists but there's no way to toggle it from sprocket check or sprocket lint on the command line. It would be good to either wire it up as a CLI flag.

  4. Doc comments. The doc comment on with_respect_gitignore has an incomplete sentence ("the file walker will skip" — skip what?) and uses ' instead of ` in the See link. Small things, but worth fixing.

The test you added looks good. Looking forward to the next iteration!

@akashchakrabortymsc-cmd
Copy link
Author

@claymcleod Thank you sir for the review. Let me know if anything else needs changing!

Copy link
Member

@claymcleod claymcleod left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just realized this: the .sprocketignore support is hardcoded—there's no config toggle or CLI flag to disable it. I'd suggest following the same pattern here: remove respect_gitignore from Config/ConfigInner, remove the --no-gitignore CLI flag and Analysis::no_gitignore plumbing, and just hardcode .git_ignore(true) in the walker. That should simplify things quite a bit and it should be ready to merge after—nice work on the feature, and sorry I didn't catch this earlier!

Co-authored-by: Clay McLeod <3411613+claymcleod@users.noreply.github.com>
Co-authored-by: Clay McLeod <3411613+claymcleod@users.noreply.github.com>
Co-authored-by: Clay McLeod <3411613+claymcleod@users.noreply.github.com>
@akashchakrabortymsc-cmd
Copy link
Author

@claymcleod kindly review and let me know if their anything to change.

Copy link
Member

@claymcleod claymcleod left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey — a few things still need to be addressed here:

  1. The simplification I suggested hasn't been applied. In my last review, I asked to just hardcode .git_ignore(true) in the walker (the same pattern we use for .sprocketignore) and remove respect_gitignore from Config/ConfigInner, the --no-gitignore CLI flag, and the Analysis::no_gitignore plumbing. The current PR still has all of that configuration machinery.

  2. The merge with main broke Arena.toml. The merge commit resolved the conflict by keeping your branch's version of Arena.toml, which had most ShellCheck diagnostics removed. Main has 146 ShellCheck entries; your branch has 90. You'll need to re-merge main and keep main's version of Arena.toml. This file should not show up in the diff when it's complete.

  3. The CHANGELOG bullet reformatting is still present. The existing convention uses *, and the diff still changes them to - throughout the file. Please revert those formatting changes and only add your new entry.

Please make sure all of these are addressed before requesting re-review.

@akashchakrabortymsc-cmd
Copy link
Author

Hey @claymcleod — I've addressed all the feedback from the latest review!
Kindly check and plz let me know if further development is required

Copy link
Author

@akashchakrabortymsc-cmd akashchakrabortymsc-cmd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolve the issue

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.

sprocket check/lint runs on files that are in .gitignore

2 participants