After thinking this over more, I agree we should continue to use flake8. The situation I experienced is not typical when all of the code was pre-black formatted so I think we're good. Even if you have to fix it manually the second auto-commit black run will work correctly so I think that will be ok too.
On Wed, Jul 3, 2019 at 10:58 AM David Davis <davidda...@redhat.com> wrote: > To kind of summarize your problem, at one point[0] you had this code: > > from pulp_smash.api import _P3_TASK_END_STATES as P3_TASK_END_STATES > # noqa: F401 > > 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: > > from pulp_smash.api import ( > _P3_TASK_END_STATES as P3_TASK_END_STATES > ) # noqa: F401 > > 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. > > [0] https://git.io/fj6IM > > David > > > On Wed, Jul 3, 2019 at 10:32 AM Brian Bouterse <bbout...@redhat.com> > wrote: > >> Black has at least 1 issue open where code it produces isn't compatible >> with flake8 https://github.com/python/black/issues/195. I recently ran >> into this with a contribution to pulp-smash. >> >> 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? >> >> On Wed, Jul 3, 2019 at 9:42 AM David Davis <davidda...@redhat.com> wrote: >> >>> I agree. I've opened a Pulp task for us to consider adding it to >>> plugin_template: >>> >>> https://pulp.plan.io/issues/5073 >>> >>> David >>> >>> >>> On Wed, Jul 3, 2019 at 9:14 AM Bruno Rocha <bro...@redhat.com> wrote: >>> >>>> >>>> I guess, one could add a convenience / maintain script to run something >>>>> like 'make black'. Over time more (source) maintenance task may come >>>>> up. >>>> >>>> >>>> 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. >>>> >>>> On Wed, Jul 3, 2019 at 9:59 AM Matthias Dellweg <dell...@atix.de> >>>> wrote: >>>> >>>>> I guess, one could add a convenience / maintain script to run something >>>>> like 'make black'. Over time more (source) maintenance task may come >>>>> up. >>>>> >>>>> On Wed, 3 Jul 2019 09:26:26 -0300 >>>>> Bruno Rocha <bro...@redhat.com> wrote: >>>>> >>>>> > There is the possibility to keep only flake8 and it will also run >>>>> > Black checks with https://pypi.org/project/flake8-black/ plugin. >>>>> > >>>>> > Then it is dev responsability to format the code in Black style or to >>>>> > use a pre-commit if want. >>>>> > >>>>> > On Wed, Jul 3, 2019 at 8:50 AM Ina Panova <ipan...@redhat.com> >>>>> wrote: >>>>> > >>>>> > > Seems like there are usecases where flake8 might be handy. Let's >>>>> > > keep it for now. >>>>> > > We can always drop it later, after people get more used to black. >>>>> > > >>>>> > > >>>>> > > -------- >>>>> > > Regards, >>>>> > > >>>>> > > Ina Panova >>>>> > > Senior Software Engineer| Pulp| Red Hat Inc. >>>>> > > >>>>> > > "Do not go where the path may lead, >>>>> > > go instead where there is no path and leave a trail." >>>>> > > >>>>> > > >>>>> > > On Thu, Jun 27, 2019 at 9:24 PM David Davis <davidda...@redhat.com >>>>> > >>>>> > > wrote: >>>>> > >> Flake8 is a wrapper for pycodestyle, pyflakes, and mccabe. We >>>>> > >> probably could just use the last two without pycodestyle. That >>>>> > >> said I lean toward just keeping flake8 I suppose. It makes some of >>>>> > >> the configuration stuff easy. >>>>> > >> >>>>> > >> David >>>>> > >> >>>>> > >> >>>>> > >> On Thu, Jun 27, 2019 at 3:12 PM Bruno Rocha <bro...@redhat.com> >>>>> > >> wrote: >>>>> > >>> If you set pre-commit hooks it is possible to have flake-8 to be >>>>> > >>> executed automatically after black format. >>>>> > >>> >>>>> > >>> example: >>>>> > >>> >>>>> https://github.com/rochacbruno/dynaconf/blob/master/.pre-commit-config.yaml#L31 >>>>> > >>> >>>>> > >>> >>>>> > >>> Bruno Rocha >>>>> > >>> >>>>> > >>> Senior Quality Engineer - Cloud Management QE - Pulp Project >>>>> > >>> *irc*: rochacbruno >>>>> > >>> >>>>> > >>> *social*: http://about.me/rochacbruno >>>>> > >>> >>>>> > >>> “Progress is the realization of utopia.” >>>>> > >>> <https://red.ht/sig> >>>>> > >>> >>>>> > >>> >>>>> > >>> On Thu, Jun 27, 2019 at 3:59 PM Simon Baatz <gmbno...@gmail.com> >>>>> > >>> wrote: >>>>> > >>>> On Thu, Jun 27, 2019 at 07:58:38AM -0400, David Davis wrote: >>>>> > >>>> > Follow up question to adding support for black: should we >>>>> > >>>> > drop >>>>> > >>>> flake8? >>>>> > >>>> > We shouldn't need it anymore since black is pep8 compliant >>>>> > >>>> > but I'm happy to keep it around at least temporarily if people >>>>> > >>>> > prefer? >>>>> > >>>> >>>>> > >>>> Please do not drop it. While black is pep8 compliant, flake8 >>>>> does >>>>> > >>>> more than pure code formatting checks. For example, the >>>>> > >>>> following code is absolutely fine for black: >>>>> > >>>> >>>>> > >>>> import os >>>>> > >>>> >>>>> > >>>> d = {1: 2, 1: 3} >>>>> > >>>> >>>>> > >>>> >>>>> > >>>> flake8 will complain about the unused import and the problem >>>>> > >>>> with the dict keys. >>>>> > >>>> >>>>> > >>>> _______________________________________________ >>>>> > >>>> Pulp-dev mailing list >>>>> > >>>> Pulp-dev@redhat.com >>>>> > >>>> https://www.redhat.com/mailman/listinfo/pulp-dev >>>>> > >>>> >>>>> > >>> _______________________________________________ >>>>> > >> Pulp-dev mailing list >>>>> > >> Pulp-dev@redhat.com >>>>> > >> https://www.redhat.com/mailman/listinfo/pulp-dev >>>>> > >> >>>>> > > _______________________________________________ >>>>> > > Pulp-dev mailing list >>>>> > > Pulp-dev@redhat.com >>>>> > > https://www.redhat.com/mailman/listinfo/pulp-dev >>>>> _______________________________________________ >>>>> Pulp-dev mailing list >>>>> Pulp-dev@redhat.com >>>>> https://www.redhat.com/mailman/listinfo/pulp-dev >>>>> >>>> _______________________________________________ >>>> Pulp-dev mailing list >>>> Pulp-dev@redhat.com >>>> https://www.redhat.com/mailman/listinfo/pulp-dev >>>> >>> _______________________________________________ >>> Pulp-dev mailing list >>> Pulp-dev@redhat.com >>> https://www.redhat.com/mailman/listinfo/pulp-dev >>> >>
_______________________________________________ Pulp-dev mailing list Pulp-dev@redhat.com https://www.redhat.com/mailman/listinfo/pulp-dev