Ignore pyproject.toml missing tool.black section #4204
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.
Fixes #2863
This is pretty desirable in a monorepo situation where you have configuration in the root since it will mean you don't have to reconfigure every project.
The good news for backward compatibility is that
find_project_root
continues to stop at any git or hg root, so in all cases repo root coincides with a pyproject.toml missing tool.black, we'll continue to have the project root as before and end up using default config as before (i.e. we're unlikely to randomly start using the user config).The other thing we need to be a little careful about is that changing find_project_root logic affects what
exclude
is relative to. Since we only change in cases where there is no config, this only applies where users were usingexclude
via command line arg (and had pyproject.toml missingtool.black
in a dir that was not repo root).Finally, for the few who could be affected, the fix is to put an empty
[tool.black]
in pyproject.toml