[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [Libguestfs] [PATCH libnbd] python: Make flake8 output more useful



On Mon, Apr 26, 2021 at 01:24:48PM +0300, Nir Soffer wrote:
> On Mon, Apr 26, 2021 at 10:26 AM Richard W.M. Jones <rjones redhat com> wrote:
> >
> > On Sun, Apr 25, 2021 at 11:36:15PM +0300, Nir Soffer wrote:
> > > Add .flake8 configuration file enabling show_source and statistics. This
> > > makes flake8 output more useful for handling bug reports like:
> > > https://gitlab.com/nbdkit/libnbd/-/issues/4
> >
> > ...
> >
> > >  python/.flake8 | 6 ++++++
> >
> > I suspect this will be ignored if we're using srcdir != builddir (not
> > that this works at the moment).  The documentation is confusing about
> > how exactly the file is found mentioning only the "project" directory
> > whatever that means.
> 
> I think .flake8 file is searched in the directories where the source is,
> so this should work also in out of tree builds. This works for me for pytest
> in another project using out of tree build.
> 
> >   https://flake8.pycqa.org/en/latest/user/configuration.html
> >
> > Should we add the equivalent command line parameters instead?
> 
> We can, but using a configuration file makes it easier to document why
> certain configuration is used. For example why you want to disable certain
> checks.
> 
> When you have a configuration file, you can actually drop the pycodestyle.sh
> script, since running flake8 /path/to/dir is enough to check all the *.py files
> under that tree.

We'll have to keep pycodestyle.sh because it checks if flake8 is
available before running it.

I'm still happy with the original patch if you wish to push it.

Rich.

> > Anyway, as it's only optional configuration, ACK.
> >
> > Rich.
> >
> > >  1 file changed, 6 insertions(+)
> > >  create mode 100644 python/.flake8
> > >
> > > diff --git a/python/.flake8 b/python/.flake8
> > > new file mode 100644
> > > index 0000000..0e1dec1
> > > --- /dev/null
> > > +++ b/python/.flake8
> > > @@ -0,0 +1,6 @@
> > > +[flake8]
> > > +# Print the source code generating the error/warning in question.
> > > +show_source = True
> > > +
> > > +# Count the number of occurrences of each error/warning code and print a report.
> > > +statistics = True
> > > --
> > > 2.26.3
> >
> > --
> > Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
> > Read my programming and virtualization blog: http://rwmj.wordpress.com
> > virt-p2v converts physical machines to virtual machines.  Boot with a
> > live CD or over the network (PXE) and turn machines into KVM guests.
> > http://libguestfs.org/virt-v2v
> >

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-builder quickly builds VMs from scratch
http://libguestfs.org/virt-builder.1.html


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]