DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Juraj Linkeš" <juraj.linkes@pantheon.tech>
To: Thomas Monjalon <thomas@monjalon.net>, "dev@dpdk.org" <dev@dpdk.org>
Cc: Lijuan Tu <lijuan.tu@intel.com>, Owen Hilyard <ohilyard@iol.unh.edu>
Subject: RE: [PATCH] devtools: set DTS directory to format check
Date: Thu, 10 Nov 2022 09:27:52 +0000	[thread overview]
Message-ID: <464c6b5616664baa90655f6236fde2b2@pantheon.tech> (raw)
In-Reply-To: <20221109170921.625192-1-thomas@monjalon.net>



> -----Original Message-----
> From: Thomas Monjalon <thomas@monjalon.net>
> Sent: Wednesday, November 9, 2022 6:09 PM
> To: dev@dpdk.org
> Cc: Juraj Linkeš <juraj.linkes@pantheon.tech>; Lijuan Tu
> <lijuan.tu@intel.com>; Owen Hilyard <ohilyard@iol.unh.edu>
> Subject: [PATCH] devtools: set DTS directory to format check
> 
> 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>
> ---
>  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]'

Double quotes here, otherwise $0 won't be expanded.

> +	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
> 

I'd like to include the information of where we're doing the fomatting in the console output, e.g.:
echo "Formatting in $(pwd):"

We're silently chaning the directory, so this would be useful when running with no argument and the script doesn't change anything - as a confirmation that it ran over the files we wanted to.

>  errors=0
> 
> --
> 2.36.1
> 

Other than that,
Reviewed-by: Juraj Linkeš <juraj.linkes@pantheon.tech>
Tested-by: Juraj Linkeš <juraj.linkes@pantheon.tech>


  parent reply	other threads:[~2022-11-10  9:27 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-09 17:09 Thomas Monjalon
2022-11-09 17:38 ` Owen Hilyard
2022-11-10  9:27 ` Juraj Linkeš [this message]
2022-11-10 10:26   ` Thomas Monjalon
2022-11-10 10:53     ` Juraj Linkeš
2022-11-11 10:06       ` Juraj Linkeš
2022-11-11 10:12         ` Thomas Monjalon
2022-11-23 11:22 ` [PATCH v2] " Thomas Monjalon
2022-11-23 13:41   ` Juraj Linkeš
2022-11-23 15:56     ` Thomas Monjalon

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=464c6b5616664baa90655f6236fde2b2@pantheon.tech \
    --to=juraj.linkes@pantheon.tech \
    --cc=dev@dpdk.org \
    --cc=lijuan.tu@intel.com \
    --cc=ohilyard@iol.unh.edu \
    --cc=thomas@monjalon.net \
    /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).