-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Apply excludes before normalising symlinks #3527
Comments
This is a tough one to get right. I wonder if we could just simplify it add a config option (in pyproject.toml) to not follow symlink at all? I feel that would help your use case here. Thoughts? |
Given the fact that symlinks pointing outside the project are rejected already, not following symlinks at all would be the easiest option. There should be no need to follow symlinks since black has no need to get the module hierarchy right (one file at a time). Even without following symlinks, it should be possible to use the current configuration options to reach any file within the project. |
I'm in favour of this, at least for the gitignore excludes; I was surprised this was the current behaviour when making #3751 |
Is your feature request related to a problem? Please describe.
Our project contains symlinks like this:
We would like to avoid black spending time formatting/complaining about the same files twice, so we make the excludes regex match
/a/b/
.This doesn't help because the excludes are evaluated after normalising the path to
/x/y/
.We cannot put that in the excludes because we do want to format the files.
Describe the solution you'd like
Excludes could be evaluated before normalising the path, or at least before evaluating symlinks.
Describe alternatives you've considered
Perhaps it would be best to evaluate excludes both before and after normalising the path.
There is also a use case for the way it is now, if we did want to exclude the files completely without listing all paths to them in the excludes.
The text was updated successfully, but these errors were encountered: