On Fri, Jul 29, 2022 at 10:55:42AM +0000, Juraj Linkeš wrote:
> .gitignore contains standard Python-related files.
> 
> Apart from that, add configuration for Python tools used in DTS:
> Poetry, dependency and package manager
> Black, formatter
> Pylama, static analysis
> Isort, import sorting
> 
> .editorconfig modifies the line length to 88, which is the default Black
> uses. It seems to be the best of all worlds. [0]
> 
> [0] 
> https://black.readthedocs.io/en/stable/the_black_code_style/current_style.html#line-length
> 
> Signed-off-by: Owen Hilyard <ohily...@iol.unh.edu>
> Signed-off-by: Juraj Linkeš <juraj.lin...@pantheon.tech>

Thanks for the work on this. Some review comments inline below.

/Bruce

> ---
>  dts/.editorconfig  |   7 +
>  dts/.gitignore     |  14 ++
>  dts/README.md      |  15 ++
>  dts/poetry.lock    | 474 +++++++++++++++++++++++++++++++++++++++++++++
>  dts/pylama.ini     |   8 +
>  dts/pyproject.toml |  43 ++++
>  6 files changed, 561 insertions(+)
>  create mode 100644 dts/.editorconfig
>  create mode 100644 dts/.gitignore
>  create mode 100644 dts/README.md
>  create mode 100644 dts/poetry.lock
>  create mode 100644 dts/pylama.ini
>  create mode 100644 dts/pyproject.toml
> 
> diff --git a/dts/.editorconfig b/dts/.editorconfig
> new file mode 100644
> index 0000000000..657f959030
> --- /dev/null
> +++ b/dts/.editorconfig
> @@ -0,0 +1,7 @@
> +# SPDX-License-Identifier: BSD-3-Clause
> +# Copyright(c) 2022 PANTHEON.tech s.r.o.
> +# See https://editorconfig.org/ for syntax reference.
> +#
> +
> +[*.py]
> +max_line_length = 88

It seems strange to have two different editorconfig settings in DPDK. Is
there a reason that:
a) we can't use 79, the current DPDK default and recommended length by
   pycodestyle? Or alternatively:
b) change all of DPDK to use the 88 setting?

Also, 88 seems an unusual number. How was it chosen/arrived at?

> diff --git a/dts/.gitignore b/dts/.gitignore
> new file mode 100644
> index 0000000000..9c49935b6f
> --- /dev/null
> +++ b/dts/.gitignore
> @@ -0,0 +1,14 @@
> +# SPDX-License-Identifier: BSD-3-Clause
> +# Copyright(c) 2022 PANTHEON.tech s.r.o.
> +#
> +
> +# Byte-compiled / optimized / DLL files
> +__pycache__/
> +*.py[cod]
> +*$py.class
> +
> +# IDE files
> +.idea
> +
> +# DTS results
> +output

I think this should be ok to merge into the main DPDK .gitignore file.

> diff --git a/dts/README.md b/dts/README.md
> new file mode 100644
> index 0000000000..d8f88f97fe
> --- /dev/null
<snip>
> diff --git a/dts/pylama.ini b/dts/pylama.ini
> new file mode 100644
> index 0000000000..23fc709b5a
> --- /dev/null
> +++ b/dts/pylama.ini
> @@ -0,0 +1,8 @@
> +# SPDX-License-Identifier: BSD-3-Clause
> +# Copyright(c) 2022 University of New Hampshire
> +#
> +
> +[pylama]
> +format = pylint
> +linters = pep8,pycodestyle,pylint
> +ignore = F0401,C0111,E731,E266,E501,E203

I think it would be good to comment on what these ignored values are, so we
can look to remove them in future, or minimise the list.
>From checking the docs, is the below correct?

E203 - whitespace before ‘,’, ‘;’, or ‘:’
E266 - too many leading ‘#’ for block comment
E501 - line too long
E731 - do not assign a lambda expression, use a def
C0111 - Missing %s docstring
F0401 - Unable to import %s

Some of these - particularly the first 2 above - look like they should be
relatively easy to fix and remove the need for ignoring the errors. Are the
standards violations in our DTS code or in some dependencies we import or
code taken from elsewhere?

> diff --git a/dts/pyproject.toml b/dts/pyproject.toml

<Snip for brevity>

Reply via email to