DPDK patches and discussions
 help / color / mirror / Atom feed
From: Dean Marx <dmarx@iol.unh.edu>
To: Luca Vizzarro <luca.vizzarro@arm.com>
Cc: probb@iol.unh.edu, yoan.picchi@foss.arm.com,
	Honnappa.Nagarahalli@arm.com,  paul.szczepanek@arm.com,
	dev@dpdk.org
Subject: Re: [PATCH v2] dts: add test case docstring checks to format script
Date: Thu, 6 Nov 2025 13:11:24 -0500	[thread overview]
Message-ID: <CABD7UXNVrNEOtfs_4chWpy3-meVkF8cCE=PD-X+ST42nzW7UAg@mail.gmail.com> (raw)
In-Reply-To: <6zyctvaihjdlgn3es3z2s3d3ae6ifc33vcqcobhylvz26m7ney@4nzef5s5lxnw>

On Wed, Aug 27, 2025 at 11:46 AM Luca Vizzarro <luca.vizzarro@arm.com> wrote:
>
> Hi Dean,
>
> thank you for your patch! Looks mostly good, a couple of comments
> though.
>
> On Tue, Aug 26, 2025 at 04:07:20PM +0000, Dean Marx wrote:
> > diff --git a/devtools/dts-check-docstrings.py b/devtools/dts-check-docstrings.py
> > new file mode 100755
> > index 0000000000..0baee6e383
> > --- /dev/null
> > +++ b/devtools/dts-check-docstrings.py
> > @@ -0,0 +1,52 @@
>
> Consider adding a shebang here, like it's already done with the other
> scripts.

Heard

>
> > +# SPDX-License-Identifier: BSD-3-Clause
> > +# Copyright(c) 2025 University of New Hampshire
> > +
> > +import sys
> > +from ast import FunctionDef, Name, walk, get_docstring, parse
> > +from pathlib import Path
> > +
> > +BASE_DIR = Path(__file__).resolve().parent  # dpdk/
>
> The hint is actually wrong, this is dpdk/devtools. I think you meant to
> make this:
>
>     BASE_DIR = Path(__file__).resolve().parent.parent
>
> > +TESTS_DIR = BASE_DIR.parent / "dts" / "tests"  # dts/tests/
>
> and this would just be:
>
>     TESTS_DIR = BASE_DIR / "dts" / "tests"

Thanks for catching this, I hadn't realized

>
> > +
> > +
> > +def has_test_decorator(node: FunctionDef) -> bool:
> > +    """Return True if function has @func_test or @perf_test decorator."""
> > +    for decorator in node.decorator_list:
> > +        if isinstance(decorator, Name) and decorator.id in {"func_test", "perf_test"}:
>
> I wouldn't hard code the decorator names like this. Put this in a
> constant at the top instead:
>
>     DECORATOR_NAMES = {"func_test", "perf_test"}

I'll add this to the new version

>
> > +            return True
> > +    return False
> <snip>
> > diff --git a/devtools/dts-check-format.sh b/devtools/dts-check-format.sh
> > index 907eed1293..da6e6f34ee 100755
> > --- a/devtools/dts-check-format.sh
> > +++ b/devtools/dts-check-format.sh
> > @@ -86,7 +86,14 @@ if $lint; then
> >               ruff check --fix
> >               errors=$((errors + $?))
> >
> > +             docstring_script_path=$(dirname "$0")
> > +             docstring_script_path=$(cd "$docstring_script_path" && pwd)
> > +             docstring_script="$docstring_script_path/dts-check-docstrings.py"
> > +             python "$docstring_script"
> > +             errors=$((errors + $?))
> > +
>
> I wouldn't insert this with the ruff if scope. This can still stay under
> the lint if block, but give it its own.

Okay, I'll add a docstringcheck variable in the check-format script to
give it its own if block

  reply	other threads:[~2025-11-06 18:11 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-20 19:38 [PATCH v1] " Dean Marx
2025-08-26 20:07 ` [PATCH v2] " Dean Marx
2025-08-27 15:46   ` Luca Vizzarro
2025-11-06 18:11     ` Dean Marx [this message]
2025-11-06 18:13   ` [PATCH v3] " Dean Marx

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CABD7UXNVrNEOtfs_4chWpy3-meVkF8cCE=PD-X+ST42nzW7UAg@mail.gmail.com' \
    --to=dmarx@iol.unh.edu \
    --cc=Honnappa.Nagarahalli@arm.com \
    --cc=dev@dpdk.org \
    --cc=luca.vizzarro@arm.com \
    --cc=paul.szczepanek@arm.com \
    --cc=probb@iol.unh.edu \
    --cc=yoan.picchi@foss.arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).