Fix black
exclude
parameter in pyproject.toml
#5216
Merged
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.
@gvwilson observed an issue where running
python commands.py codegen
on a fresh pull frommain
shows a LARGE number of changed files viagit status
. Furthermore the new files seem to not haveblack
formatting applied (they are full of single-quoted strings, etc.).This issue turns out to be caused by the
[tool.black]
exclude
parameter inpyproject.toml
. The regular expression was missing a leading and trailing/
character, which caused it to match every file path containing one of the listed strings, rather than just including directories with those names.Since the directory
graph_objs
contains the stringjs
, this caused a significant number of files to be excluded fromblack
formatting. Some files were also excluded because their path containeddist
.This PR adds leading and trailing
/
characters to the regex so that only directories of those names are excluded, as in the example here. (yes, not Windows-friendly but there are already `/'s in the exclude).Ultimately we need to clean all of this up and switch to
ruff
but this is a simple fix in the meantime.How to test
python commands.py codegen
git status
. You should see zero unstaged changes.You can also run these steps on
main
to compare; runningpython commands.py codegen
onmain
results in a large number of unstaged changes.