<div dir="ltr">To kind of summarize your problem, at one point[0] you had this code:<div><br></div><div>    from pulp_smash.api import _P3_TASK_END_STATES as P3_TASK_END_STATES  # noqa: F401<br></div><div><br></div><div>Then you ran black with a line length of 79 so black tried to make a best guess as to where the comment should go:</div><div><br></div><div>   from pulp_smash.api import (</div><div>       _P3_TASK_END_STATES as P3_TASK_END_STATES</div><div>   )  # noqa: F401</div><div><br></div><div>However, for flake8, the noqa comment has to go on the same line as the import. Moving the comment back to the import line fixed the problem though and black didn't try to reformat this again. In such edge cases, I think manual intervention will have to be necessary as black probably won't be able to format code according to every other Python tool.</div><div><div><br></div><div>[0] <a href="https://git.io/fj6IM" target="_blank">https://git.io/fj6IM</a><br clear="all"><div><div dir="ltr" class="m_8743421585439966904gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><br></div><div>David<br></div></div></div></div></div></div></div></div><br></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Jul 3, 2019 at 10:32 AM Brian Bouterse <<a href="mailto:bbouters@redhat.com" target="_blank">bbouters@redhat.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Black has at least 1 issue open where code it produces isn't compatible with flake8  <a href="https://github.com/python/black/issues/195" target="_blank">https://github.com/python/black/issues/195</a>. I recently ran into this with a contribution to pulp-smash. <br></div><div><br></div><div>I believe if we adopt black as the auto-formatter we shouldn't edit it manually afterwards. For this reason I recommend disabling flake8 in the near-term until black resolves at least issue 195. What do you think?<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Jul 3, 2019 at 9:42 AM David Davis <<a href="mailto:daviddavis@redhat.com" target="_blank">daviddavis@redhat.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">I agree. I've opened a Pulp task for us to consider adding it to plugin_template:<div><br></div><div><a href="https://pulp.plan.io/issues/5073" target="_blank">https://pulp.plan.io/issues/5073</a><br clear="all"><div><div dir="ltr" class="gmail-m_8743421585439966904gmail-m_-5358015743027338205gmail-m_4729389480202914113gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><br></div><div>David<br></div></div></div></div></div></div></div></div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Jul 3, 2019 at 9:14 AM Bruno Rocha <<a href="mailto:brocha@redhat.com" target="_blank">brocha@redhat.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><br clear="all"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">I guess, one could add a convenience / maintain script to run something<br>
like 'make black'. Over time more (source) maintenance task may come up.</blockquote><div><br></div><div>that is exaclty where pre-commit is useful, it can run black/flake8/whatever by a commit hook, and/or on demand using `pre-commit run` command. <br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Jul 3, 2019 at 9:59 AM Matthias Dellweg <<a href="mailto:dellweg@atix.de" target="_blank">dellweg@atix.de</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">I guess, one could add a convenience / maintain script to run something<br>
like 'make black'. Over time more (source) maintenance task may come up.<br>
<br>
On Wed, 3 Jul 2019 09:26:26 -0300<br>
Bruno Rocha <<a href="mailto:brocha@redhat.com" target="_blank">brocha@redhat.com</a>> wrote:<br>
<br>
> There is the possibility to keep only flake8 and it will also run<br>
> Black checks with <a href="https://pypi.org/project/flake8-black/" rel="noreferrer" target="_blank">https://pypi.org/project/flake8-black/</a> plugin.<br>
> <br>
> Then it is dev responsability to format the code in Black style or to<br>
> use a pre-commit if want.<br>
> <br>
> On Wed, Jul 3, 2019 at 8:50 AM Ina Panova <<a href="mailto:ipanova@redhat.com" target="_blank">ipanova@redhat.com</a>> wrote:<br>
> <br>
> > Seems like there are usecases where flake8 might be handy. Let's<br>
> > keep it for now.<br>
> > We can always drop it later, after people get more used to black.<br>
> ><br>
> ><br>
> > --------<br>
> > Regards,<br>
> ><br>
> > Ina Panova<br>
> > Senior Software Engineer| Pulp| Red Hat Inc.<br>
> ><br>
> > "Do not go where the path may lead,<br>
> >  go instead where there is no path and leave a trail."<br>
> ><br>
> ><br>
> > On Thu, Jun 27, 2019 at 9:24 PM David Davis <<a href="mailto:daviddavis@redhat.com" target="_blank">daviddavis@redhat.com</a>><br>
> > wrote: <br>
> >> Flake8 is a wrapper for pycodestyle, pyflakes, and mccabe. We<br>
> >> probably could just use the last two without pycodestyle. That<br>
> >> said I lean toward just keeping flake8 I suppose. It makes some of<br>
> >> the configuration stuff easy.<br>
> >><br>
> >> David<br>
> >><br>
> >><br>
> >> On Thu, Jun 27, 2019 at 3:12 PM Bruno Rocha <<a href="mailto:brocha@redhat.com" target="_blank">brocha@redhat.com</a>><br>
> >> wrote: <br>
> >>> If you set pre-commit hooks it is possible to have flake-8 to be<br>
> >>> executed automatically after black format.<br>
> >>><br>
> >>> example:<br>
> >>> <a href="https://github.com/rochacbruno/dynaconf/blob/master/.pre-commit-config.yaml#L31" rel="noreferrer" target="_blank">https://github.com/rochacbruno/dynaconf/blob/master/.pre-commit-config.yaml#L31</a><br>
> >>><br>
> >>><br>
> >>> Bruno Rocha<br>
> >>><br>
> >>> Senior Quality Engineer - Cloud Management QE - Pulp Project<br>
> >>> *irc*: rochacbruno<br>
> >>><br>
> >>> *social*: <a href="http://about.me/rochacbruno" rel="noreferrer" target="_blank">http://about.me/rochacbruno</a><br>
> >>><br>
> >>> “Progress is the realization of utopia.”<br>
> >>> <<a href="https://red.ht/sig" rel="noreferrer" target="_blank">https://red.ht/sig</a>><br>
> >>><br>
> >>><br>
> >>> On Thu, Jun 27, 2019 at 3:59 PM Simon Baatz <<a href="mailto:gmbnomis@gmail.com" target="_blank">gmbnomis@gmail.com</a>><br>
> >>> wrote: <br>
> >>>> On Thu, Jun 27, 2019 at 07:58:38AM -0400, David Davis wrote:  <br>
> >>>> >    Follow up question to adding support for black: should we<br>
> >>>> > drop  <br>
> >>>> flake8?  <br>
> >>>> >    We shouldn't need it anymore since black is pep8 compliant<br>
> >>>> > but I'm happy to keep it around at least temporarily if people<br>
> >>>> > prefer?  <br>
> >>>><br>
> >>>> Please do not drop it. While black is pep8 compliant, flake8 does<br>
> >>>> more than pure code formatting checks. For example, the<br>
> >>>> following code is absolutely fine for black:<br>
> >>>><br>
> >>>>    import os<br>
> >>>><br>
> >>>>    d = {1: 2, 1: 3}<br>
> >>>><br>
> >>>><br>
> >>>> flake8 will complain about the unused import and the problem<br>
> >>>> with the dict keys.<br>
> >>>><br>
> >>>> _______________________________________________<br>
> >>>> Pulp-dev mailing list<br>
> >>>> <a href="mailto:Pulp-dev@redhat.com" target="_blank">Pulp-dev@redhat.com</a><br>
> >>>> <a href="https://www.redhat.com/mailman/listinfo/pulp-dev" rel="noreferrer" target="_blank">https://www.redhat.com/mailman/listinfo/pulp-dev</a><br>
> >>>>  <br>
> >>> _______________________________________________  <br>
> >> Pulp-dev mailing list<br>
> >> <a href="mailto:Pulp-dev@redhat.com" target="_blank">Pulp-dev@redhat.com</a><br>
> >> <a href="https://www.redhat.com/mailman/listinfo/pulp-dev" rel="noreferrer" target="_blank">https://www.redhat.com/mailman/listinfo/pulp-dev</a><br>
> >>  <br>
> > _______________________________________________<br>
> > Pulp-dev mailing list<br>
> > <a href="mailto:Pulp-dev@redhat.com" target="_blank">Pulp-dev@redhat.com</a><br>
> > <a href="https://www.redhat.com/mailman/listinfo/pulp-dev" rel="noreferrer" target="_blank">https://www.redhat.com/mailman/listinfo/pulp-dev</a> <br>
_______________________________________________<br>
Pulp-dev mailing list<br>
<a href="mailto:Pulp-dev@redhat.com" target="_blank">Pulp-dev@redhat.com</a><br>
<a href="https://www.redhat.com/mailman/listinfo/pulp-dev" rel="noreferrer" target="_blank">https://www.redhat.com/mailman/listinfo/pulp-dev</a><br>
</blockquote></div>
_______________________________________________<br>
Pulp-dev mailing list<br>
<a href="mailto:Pulp-dev@redhat.com" target="_blank">Pulp-dev@redhat.com</a><br>
<a href="https://www.redhat.com/mailman/listinfo/pulp-dev" rel="noreferrer" target="_blank">https://www.redhat.com/mailman/listinfo/pulp-dev</a><br>
</blockquote></div>
_______________________________________________<br>
Pulp-dev mailing list<br>
<a href="mailto:Pulp-dev@redhat.com" target="_blank">Pulp-dev@redhat.com</a><br>
<a href="https://www.redhat.com/mailman/listinfo/pulp-dev" rel="noreferrer" target="_blank">https://www.redhat.com/mailman/listinfo/pulp-dev</a><br>
</blockquote></div>
</blockquote></div>