-
Notifications
You must be signed in to change notification settings - Fork 918
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
10575: Allow black to format migrations + reformat #10578
10575: Allow black to format migrations + reformat #10578
Conversation
@@ -7,7 +7,6 @@ exclude: > | |||
| assets | |||
| static | |||
| bedrock/externalfiles/files_cache | |||
| ^.*\b(migrations)\b.*$ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removing this allows pre-commit
-driven checks to INCLUDE migrations after all, but changing it up here will also mean the scope of other tools will increase to include migrations
. Can you see a reason not to allow this @robhudson ? I'm happy to rework this if it breaks any behaviour you wanted to retain :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that opens it up to flake8
as well which is good. The front-end checks may already filter by extension so that should be fine as well.
This brings it into line with isort running on all things. Note: removing the `migrations` dir from the exclusions will broaden the scope of other tools that pre-commit uses, but this makes sense as black and isort will be targetting these, so why not flake8 too?
c1a4a46
to
d4cfb38
Compare
@@ -6,3 +6,6 @@ | |||
|
|||
# Migrate Python imports using isort | |||
ab38b080abbff26e6968ced9267f3c576bb9e5fa | |||
|
|||
# Allow Black to reformat migrations | |||
329890d484ff62fc05d6ca764801f56a6baaf748 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Depending on how this merges this may not be right after. Just something to keep an eye on.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yeah, it won't fly because it'll be a squashed commit. Will fix after merge
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🍰
Description
This changeset updates the config for
black
to no longer ignore themigrations
directories, making it consistent with the scope of reach we have forisort
.This means they will be autoformatted in the future, so all existing migrations have been reformatted with
black
, now, too. Almost all changes are just single quotes to double quotes, plus a file where a hanging indent was improved.Issue / Bugzilla link
Resolves #10570
Testing
black
edit to a migration file (and to a non-migration python file), stage them and try to commit them -pre-commit
will catch them, fix them (but leaving it unstaged for git) and stop the commit, as expected