On Mon, Apr 26, 2021 at 10:26 AM Richard W.M. Jones <rjones(a)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.
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