> On Sep 13, 2020, at 11:45 PM, Tom Most <t...@freecog.net> wrote:
>
> Hi all,
>
> Craig and I have been working to land a switch to The Black Coding Style
> <https://black.readthedocs.io/en/stable/the_black_code_style.html>. It's in!
> The tree has been reformatted
> <https://github.com/twisted/twisted/commit/bc96c774be6e307e8e3e4d39780d37b045d0973a>.
> Some notable changes:
Happy to hear we're making progress on this! I'm the tiniest bit grumpy that
this went forward without having the follow-up work already landed or
ready-to-land simultaneously — my experience suggests that the fact that this
is now complete means that neither you nor Craig will ever contribute to
Twisted, or in fact ever answer your email, ever again — but if we can get it
all landed promptly I will be over the moon :-).
> * 3-2-1 blank lines are replaced by PEP 8 style 2-1-1.
> * String syntax uses "double quotes".
>
> Run this command to exclude the formatting from git blame
> <https://github.com/twisted/twisted/blob/trunk/.git-blame-ignore-revs>:
>
> git config blame.ignoreRevsFile .git-blame-ignore-revs
>
> There are two new Tox testenvs. To check style:
>
> tox -e black
>
> To adjust the formatting:
>
> tox -e black-reformat
>
> The formatting is checked by a new GitHub Actions lint built.
Could we possibly use something like this:
https://github.com/cclauss/autoblack <https://github.com/cclauss/autoblack>
to just do the formatting rather than "check" if it's correct? PR templates
are all well and good but the best checklist item is the one that's already
checked off...
> There is some follow-up work planned:
>
> * Many PRs have conflicts (more on this below).
> * Various wiki pages need updates. I've done a few, but there are probably
> more.
> * The coding standard should be updated
> <https://twistedmatrix.com/trac/ticket/9957#ticket>.
> * The PR template needs an update
> <https://twistedmatrix.com/trac/ticket/9956#ticket>.
> * A few examples need reformatting <https://tm.tl/#9952> (they weren't
> formatted because they fail to lint).
>
> Inevitably, changes like this cause conflicts. For small PRs it's easiest to
> merge forward and then run tox -e black-reformat. For larger ones it can help
> to apply formatting before merge. To do this:
>
> * Run black on the files your branch changes (be sure to use Black 20.8b1,
> not an older version)
> * Commit the result, like `git commit -am "Fade to black"`
> * Add that commit to .git-blame-ignore-revs to avoid polluting git blame.
> * Merge forward. You can ignore formatting while performing the merge.
> * Then run `tox -e black-reformat` to ensure you are in sync. Commit any
> changes it generates.
Can we please get this bulleted list in the form of a tool that people can run
against a PR, so we don't need everyone to write their own bespoke shell script
for fixing up their Twisted PRs? This is the thing I'm the most worried about
- I'd like to have it done automatically because I'm seriously worried about
work in progress getting abandoned because somebody backs themselves into a
corner with an apparently intractable mega-conflict by not knowing how to
properly use Git to apply this sort of modification.
-g
_______________________________________________
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
https://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python