Add --root
flag to specify project configuration
#160
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.
For #110 there are use cases where projects might have multiple pyproject.toml files in the repo for various configurations but we want to store all the
ufmt
/usort
/black
configuration in one place. Currently there is no easy way to do this without callingufmt
directly on the root of the project which can be super expensive in large projects.This adds a new flag so you can specify the root. This works well for the general configuration but I want to point out one area where it does not work correctly, specifically with excludes.
Say you have this set up
all other files are empty. Then if you format the root you would expect only
b
to be formatted. If you format thea
directory thena.py
will get formatted currently as well.works as expected. the issue is now with the new flag in this PR, specifying the root and formatting directory
a
doesn't do what we expectThe issue is that overriding the
root
here is insufficient, we would also need to tellTrailrunner
about it too, see https://github.com/omnilib/trailrunner/blob/main/trailrunner/core.py#L170So this flag will help with some configuration but it might be confusing in terms of the excludes unless we also patch the other library to allow you to set the root.