You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I always steered people towards find | grep -E | grep -Ev | xargs black to do custom file matching. But that doesn't work on Windows. We need support for --include= and --exclude= within Black.
They hold regular expressions. The former is "what gets included on recursive searches", the latter "what gets dropped on recursive searches". You can pass multiple --include and multiple --exclude. Checks for --exclude are done first, checks for --include later.
--include= would have a default that is now stores in PYTHON_EXTENSIONS (".pyi?$" in regex form) --exclude= would have a default that is now stored in BLACKLISTED_DIRECTORIES
@ambv I have couple of implementation detail questions about this:
This regex should be applied on the entire path when considering whether to include/exclude something, correct? Not just the name (as is currently done with the includes). So one could pass test\/secrets to --exclude and it would drop files/test/secrets/* but not files/test/notsecrets/?
I'm wondering how to handle directories in the regexes. Initially, I though something like build\/ would be fine, but pathlib strips trailing slashes from the path. I'd prefer to do it this way, since \/build doesn't always work (if its a directory at the root of wherever black is searching from, the path will just be ('build') - do you think it be sensible to just append a '/' to the path when applying the regex if the child is a directory?
I always steered people towards
find | grep -E | grep -Ev | xargs black
to do custom file matching. But that doesn't work on Windows. We need support for--include=
and--exclude=
within Black.They hold regular expressions. The former is "what gets included on recursive searches", the latter "what gets dropped on recursive searches". You can pass multiple
--include
and multiple--exclude
. Checks for--exclude
are done first, checks for--include
later.--include=
would have a default that is now stores in PYTHON_EXTENSIONS (".pyi?$" in regex form)--exclude=
would have a default that is now stored in BLACKLISTED_DIRECTORIESThis functionality is required by pypa/pip#5425.
The text was updated successfully, but these errors were encountered: