Skip to content

feat: respect .gitignore files when collecting inputs - #575

Merged
woodruffw merged 10 commits into
mainfrom
ww/gitignore
Feb 27, 2025
Merged

feat: respect .gitignore files when collecting inputs#575
woodruffw merged 10 commits into
mainfrom
ww/gitignore

Conversation

@woodruffw

Copy link
Copy Markdown
Member

This uses the excellent ignore crate to honor .gitignore while collecting inputs.

For the moment, we only honor .gitignore and its family of files (including the global .gitignore and .git/info/exclude). We don't honor .ignore or similar files, although we could in the future.

Additionally, in the future we could easily honor our own .zizmorignore or similar file, although I don't love the idea of a separate config file for this. Instead, that could perhaps go in zizmor.yml and be configured via ignore's support for overrides.

Closes #556.

@woodruffw woodruffw added enhancement New feature or request cli labels Feb 27, 2025
@woodruffw woodruffw self-assigned this Feb 27, 2025
@woodruffw

Copy link
Copy Markdown
Member Author

This works well for me locally, but I'm realizing that I don't have a great regression testcase for ensuring this doesn't accidentally break things. So I'm going to work on that first before merging here.

Audit inputs shouldn't be sorted by inclusion order,
but by key. Switching to `ignore` for directory walks
revealed that we were accidentally depending on the inclusion
order, which was not consistent.
@woodruffw
woodruffw enabled auto-merge (squash) February 27, 2025 06:37
@woodruffw
woodruffw merged commit f3f356c into main Feb 27, 2025
@woodruffw
woodruffw deleted the ww/gitignore branch February 27, 2025 06:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature: Do not scan directories that are gitignore'd

1 participant