Automatically ignore files specified in .gitignore#1234
Merged
charliermarsh merged 2 commits intomainfrom Dec 14, 2022
Merged
Conversation
charliermarsh
commented
Dec 14, 2022
| let files: Vec<Result<DirEntry, walkdir::Error>> = WalkDir::new(path) | ||
| let files: Vec<Result<DirEntry, ignore::Error>> = Walk::new(path) | ||
| .into_iter() | ||
| .filter_entry(|entry| { |
Member
Author
There was a problem hiding this comment.
I want to use WalkBuilder, which should be pretty much a drop-in replacement for WalkDir (and let's me use the same filter_entry), but it's requiring that the lifetime of any variable in the closure if 'static? So I can't iteratively build up the shared resolver like I am now.
Member
Author
There was a problem hiding this comment.
The current code could be slow if you had a very large directory that wasn't marked as .gitignore but was excluded by Ruff. E.g., if you had a monorepo with a bunch of directories that contained JS files, we'd spend time traversing all of those.
4476361 to
dbcc455
Compare
dbcc455 to
7ecf000
Compare
12 tasks
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.
This is somewhat inefficient as I have to do two filesystem passes right now -- need to find a way to fix that...
Resolves #174.
Resolves #777.