From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 9ADD8A034C; Wed, 9 Nov 2022 18:39:21 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8200B400EF; Wed, 9 Nov 2022 18:39:21 +0100 (CET) Received: from mail-pg1-f173.google.com (mail-pg1-f173.google.com [209.85.215.173]) by mails.dpdk.org (Postfix) with ESMTP id E65D3400D4 for ; Wed, 9 Nov 2022 18:39:19 +0100 (CET) Received: by mail-pg1-f173.google.com with SMTP id 6so8688468pgm.6 for ; Wed, 09 Nov 2022 09:39:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iol.unh.edu; s=unh-iol; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=BAfxsISEVMbFYCvTiTp5vlKjUaqAe3NpQdS1km5GyFw=; b=fQcm2XQ0sPmfJAHW+vVb7twXbz6gmrcOV7QDT7MZhJUwF2dc83w44FbslqbV2xQwFD wwmtN4aRP1+KGRgyaCcauA1QsPPKrVWgqpfSkHcekE+ZsiLLhUGPv5JDUGfBw9xSjhW/ SgCJNFLojrlWOkLn0cOFRzdFUhJhQlLQas4EE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=BAfxsISEVMbFYCvTiTp5vlKjUaqAe3NpQdS1km5GyFw=; b=2QZ7L0OhTmLodWfBcxxGE3nzAo3gCqwmJOuL/laWn5GeIFDx88gfBkCt2SU5ZKjYoW CyO00eRfoyyr3BHTreAu3NDeQmmv+Hv2l3Lg7of3ppLdDQk+K0gNBB3JKD7bGOGyxO4x H3lfJNyWToN/oG37PEElGdvhalaV4j48ROIc7Pmkt6tFoJxn9V28pP7PeJI2eJtCaHr2 tLmIYJdttPTkZKiFH/TaCExgLQASjDexf/NXp8QO0TaqmgFKm7UNWa9CvlZx6j9qGdAx ygv7XFgbj+tuYp/aN5CMEmse2rMoEcVIwM8bwhPu2a/nFBD6sQ9WNZpG+VVTPNKfh6KC rFBQ== X-Gm-Message-State: ACrzQf0MQEe82SPinBvYXnAFRjbfwrJd4yfRGeBlAOCd/iZ8JhjACrRg e3u6WzKGlOK/JOD6WJ+5P7oEiWdb1hjsA/tY3eLqVg== X-Google-Smtp-Source: AMsMyM62qOJBDv6kUDA4pBVMTmVQziiqH0TMLZR/EZ8iCPyBltK5m+1zaW6k5cbCOT7km98Szcii3yw6PH8J3MBfyXM= X-Received: by 2002:a63:e04:0:b0:46f:75bc:8bec with SMTP id d4-20020a630e04000000b0046f75bc8becmr53441806pgl.559.1668015557623; Wed, 09 Nov 2022 09:39:17 -0800 (PST) MIME-Version: 1.0 References: <20221109170921.625192-1-thomas@monjalon.net> In-Reply-To: <20221109170921.625192-1-thomas@monjalon.net> From: Owen Hilyard Date: Wed, 9 Nov 2022 12:38:41 -0500 Message-ID: Subject: Re: [PATCH] devtools: set DTS directory to format check To: Thomas Monjalon Cc: dev@dpdk.org, juraj.linkes@pantheon.tech, Lijuan Tu Content-Type: multipart/alternative; boundary="000000000000cad86305ed0d2208" X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org --000000000000cad86305ed0d2208 Content-Type: text/plain; charset="UTF-8" On Wed, Nov 9, 2022 at 12:09 PM Thomas Monjalon wrote: > The script was running on the current directory. > If not in the DTS directory, it would re-format every Python files. > > A new positional argument is added to specify the directory to check. > In most cases, the (new) default value should be enough. > > While updating argument handling, > the usage is printed in case of wrong argument. > > Signed-off-by: Thomas Monjalon > --- > devtools/dts-check-format.sh | 14 ++++++++++---- > 1 file changed, 10 insertions(+), 4 deletions(-) > > diff --git a/devtools/dts-check-format.sh b/devtools/dts-check-format.sh > index dc07150775..eb1bdd2a01 100755 > --- a/devtools/dts-check-format.sh > +++ b/devtools/dts-check-format.sh > @@ -3,11 +3,10 @@ > # Copyright(c) 2022 University of New Hampshire > > usage() { > - echo "Run formatting and linting programs for DTS. Usage:" > - > + echo 'Usage: $(basename $0) [options] [directory]' > + echo 'Options:' > # Get source code comments after getopts arguments and print them > both > grep -E '[a-zA-Z]+\) +#' "$0" | tr -d '#' > - exit 0 > } > > format=true > @@ -17,7 +16,9 @@ lint=true > while getopts "hfl" arg; do > case $arg in > h) # Display this message > + echo 'Run formatting and linting programs for DTS.' > usage > + exit 0 > ;; > f) # Don't run formatters > format=false > @@ -25,10 +26,15 @@ while getopts "hfl" arg; do > l) # Don't run linter > lint=false > ;; > - *) > + ?) > + usage > + exit 1 > esac > done > +shift $(($OPTIND - 1)) > > +directory=${1:-$(dirname $0)/../dts} > +cd $directory || exit 1 > > errors=0 > > -- > 2.36.1 > > Looks good to me. Reviewed-by: Owen Hilyard --000000000000cad86305ed0d2208 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Wed, Nov 9, 2022 at 12:09 PM Thomas Mo= njalon <thomas@monjalon.net&g= t; wrote:
The script was running on the current directory.
If not in the DTS directory, it would re-format every Python files.

A new positional argument is added to specify the directory to check.
In most cases, the (new) default value should be enough.

While updating argument handling,
the usage is printed in case of wrong argument.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
=C2=A0devtools/dts-check-format.sh | 14 ++++++++++----
=C2=A01 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/devtools/dts-check-format.sh b/devtools/dts-check-format.sh index dc07150775..eb1bdd2a01 100755
--- a/devtools/dts-check-format.sh
+++ b/devtools/dts-check-format.sh
@@ -3,11 +3,10 @@
=C2=A0# Copyright(c) 2022 University of New Hampshire

=C2=A0usage() {
-=C2=A0 =C2=A0 =C2=A0 =C2=A0echo "Run formatting and linting programs = for DTS. Usage:"
-
+=C2=A0 =C2=A0 =C2=A0 =C2=A0echo 'Usage: $(basename $0) [options] [dire= ctory]'
+=C2=A0 =C2=A0 =C2=A0 =C2=A0echo 'Options:'
=C2=A0 =C2=A0 =C2=A0 =C2=A0 # Get source code comments after getopts argume= nts and print them both
=C2=A0 =C2=A0 =C2=A0 =C2=A0 grep -E '[a-zA-Z]+\) +#' "$0"= | tr -d '#'
-=C2=A0 =C2=A0 =C2=A0 =C2=A0exit 0
=C2=A0}

=C2=A0format=3Dtrue
@@ -17,7 +16,9 @@ lint=3Dtrue
=C2=A0while getopts "hfl" arg; do
=C2=A0 =C2=A0 =C2=A0 =C2=A0 case $arg in
=C2=A0 =C2=A0 =C2=A0 =C2=A0 h) # Display this message
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0echo 'Run forma= tting and linting programs for DTS.'
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 usage
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0exit 0
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ;;
=C2=A0 =C2=A0 =C2=A0 =C2=A0 f) # Don't run formatters
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 format=3Dfalse
@@ -25,10 +26,15 @@ while getopts "hfl" arg; do
=C2=A0 =C2=A0 =C2=A0 =C2=A0 l) # Don't run linter
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 lint=3Dfalse
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ;;
-=C2=A0 =C2=A0 =C2=A0 =C2=A0*)
+=C2=A0 =C2=A0 =C2=A0 =C2=A0?)
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0usage
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0exit 1
=C2=A0 =C2=A0 =C2=A0 =C2=A0 esac
=C2=A0done
+shift $(($OPTIND - 1))

+directory=3D${1:-$(dirname $0)/../dts}
+cd $directory || exit 1

=C2=A0errors=3D0

--
2.36.1


Looks good to me.

Reviewed-by: = Owen Hilyard <ohilyard@iol.unh.e= du>=C2=A0
--000000000000cad86305ed0d2208--