-
Notifications
You must be signed in to change notification settings - Fork 16
[DSEW CPR] Pass through python-black #1577
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
Conversation
Also let me know if you have any objections to this. It doesn't look great in some parts (like where it has to break many composed functions up and it creates too much white space by creating too many lines with just a single open bracket), but at least it gives us consistency. |
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.
Okay this is a really detailed pass but I don't want it to be overwhelming so here's a rough guide:
General case:
- quote normalization is universally 💯
- space-padding around operators, assignment, and parameter specification is universally 💯
- using parens to reduce the need for backslashes and permit the method name to be the first item on a line is almost always 💯
- same-line vs multi-line formatting decisions are too context-dependent to be able to rely on an automated tool 👎
Specifics:
- I marked particularly good reformats with 💯
- I marked particularly bad reformats with "this is worse"
- I marked borderline reformats with "ehhhhhh"
- Anything unmarked is either covered by one of the universal 💯 s above, or was a moderate improvement, neutral, or escaped notice
I'm not 100% sure what this means -- Black doesn't seem to let you turn off particular formatting rules. There does seem to be a mechanism for identifying blocks of code that Black shouldn't touch, but then it wouldn't do the things we do like, and we'd have to maintain an awful lot of those block markers.
dsew_community_profile/delphi_dsew_community_profile/constants.py
Outdated
Show resolved
Hide resolved
dsew_community_profile/delphi_dsew_community_profile/constants.py
Outdated
Show resolved
Hide resolved
header.find("%") < 0, | ||
] | ||
) | ||
) |
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.
this one however is fine, probably because there are fewer levels involved
Hm yea, well it's good to learn that same line versus multi-line decisions are really a big weakness of this tool. Maybe we just keep this a one-off run, keep the parts we like, reject parts we don't, and move on? Like, we're clearly not ready to move to a bot-automated usage, but it's useful if it makes good decisions in like 80% of the cases and we can manually fix the other 20%. |
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.
should we refresh this or trash it?
I could go either way:
In my personal projects, I use black and just accept its formatting, because I prefer to just not think about it. But as for using it on our team, maybe we should poll our developers' preferences instead. |
We can close this, CPR has been deprecated. |
Description
Something of a personal preference, as I am usually into black's output. Some main changes:
Merge after the interpolation work.