Document pre-commit with --force-exclude#3109
Conversation
cooperlees
left a comment
There was a problem hiding this comment.
Makes sense and works for me.
Only enhancement I could think of is maybe showing or at least stating how to specify multiple directories - i.e. is it two --force-exclude or is it comma separated paths etc.
| args: | ||
| - --force-exclude=tests/ |
There was a problem hiding this comment.
is this the best place to put this? if you're using pre-commit, you might as well use pre-commit's own exclude
I think the more common use-case for force-exclude is for putting it in pyproject.toml, so that this config stay synced between when running black via pre-commit or via the command-line
There was a problem hiding this comment.
I figured it would be better to document Black's own way of doing this - we can easily add another line talking about pre-commit's exclude. I don't have much experience with pyproject.toml, so anything I add to that will need a second pair of eyes.
There was a problem hiding this comment.
I agree with @MarcoGorelli, using --force-exclude in pre-commit-config.yaml is a bit idiosyncratic. Either you use it in pyproject.toml or you use pre-commit's own exclude configuration. I'd personally recommend pre-commit's exclude first, and then --force-exclude, as the latter can be overkill.
cooperlees
left a comment
There was a problem hiding this comment.
Thanks for this. Reading others comments, I agree people should just use pyproject.toml black config to exclude directories rather than the CLI. Here is an example of how we even do it with black on the black repo: https://github.com/psf/black/blob/main/pyproject.toml#L12
I think due to this should we close this PR as we already have this documented in black docs. If you feel it could be better I'd take a PR improving that.
Aren't the entries in |
Description
Closes #3015
Checklist - did you ...