[Twisted-Python] Black enabled in trunk

Tom Most twm at freecog.net
Wed Sep 16 00:02:50 MDT 2020


On Tue, Sep 15, 2020, at 7:26 AM, Kyle Altendorf wrote:
> On 2020-09-14 13:43, Glyph wrote:
> 
> >> On Sep 13, 2020, at 11:45 PM, Tom Most <twm at freecog.net> wrote:
> >> 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
> > 
> > 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...
> 
> It might be worthwhile but I think there is some downside to CI 
> frequently injecting commits (or amending them).

I'm not opposed to it in principle, but is there a version of this that works? That link says "tl;dr: It does not work."

I don't want to develop custom tooling. This project is about moving away from that!

> >> 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.
> 
> Is .git-blame-ignore-revs going to be the next 'newsfile' what with 
> every PR adding lines to it?  Also, for the record, this doesn't address 
> GitHub blame and does require everyone set the previously mentioned git 
> config since it doesn't go with the repo.  :[  Though that's mostly an 
> annoyance with git.

I don't expect so. There aren't that many PRs large enough to benefit from this technique, and large PRs tend to enter the codebase slowly. 

> Oh yeah...  thanks!

You're welcome! 



More information about the Twisted-Python mailing list