Skip to content
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

Support for extend-exclude #42

Open
MikesAtMIT opened this issue Oct 19, 2023 · 3 comments
Open

Support for extend-exclude #42

MikesAtMIT opened this issue Oct 19, 2023 · 3 comments
Labels
enhancement New feature or request

Comments

@MikesAtMIT
Copy link

I was trying to use this plugin, but it seems like the extend-exclude option in a pyproject.toml file is not honored. When I run black from the command line, it is honored, so it seems like it's just that the plugin doesn't handle the option? Any chance that could be added?

@MikesAtMIT
Copy link
Author

Actually, I think maybe the option that needs to be supported is force-exclude since running on save would pass the name of the file to black, per this post https://stackoverflow.com/a/73296261. When I use force-exclude, the toml behaves as expected when using VSCode, but I prefer Sublime so hoping to get support for this

@thep0y thep0y added the enhancement New feature or request label Oct 21, 2023
@thep0y
Copy link
Owner

thep0y commented Oct 22, 2023

Adding this feature requires changing quite a lot of code. If you are interested in submitting a pull request, it may get done faster. Otherwise it may take many days to complete in my spare time.

@MikesAtMIT
Copy link
Author

Ok, thanks for responding. We ended up just deciding to not exclude files from black at all and changed our toml. The main issue was trying to exclude files that were auto-generated (like django migration files) because most are never edited and so would never trigger black in Sublime. But if they are ever edited and then formatted by black, they generate large diffs that are then hard to separate real changes from formatting changes. We solved it by using precommit to just force formatting on all new files.

Still, perhaps this feature would be useful to others. I saw the commit you just added yesterday. If you are going to add this feature, I'd add force-exclude specifically. For the use case where you are having the plugin run black on save for the open file, exclude and extend-exclude appear to be ignored because you're specifying a file, which I guess overrides those exclude params. But force-exclude will always be honored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants