All of lore.kernel.org
 help / color / mirror / Atom feed
From: Petr Vorel <pvorel@suse.cz>
To: linux-kernel@vger.kernel.org
Cc: Andy Whitcroft <apw@canonical.com>, Joe Perches <joe@perches.com>,
	Dwaipayan Ray <dwaipayanray1@gmail.com>,
	Lukas Bulwahn <lukas.bulwahn@gmail.com>,
	Kory Maincent <kory.maincent@bootlin.com>,
	Tom Rini <trini@konsulko.com>,
	Simon Glass <simon.glass@canonical.com>,
	Kuan-Wei Chiu <visitorckw@gmail.com>
Subject: Re: [PATCH 2/2] checkpatch: Add --conf-dir option
Date: Fri, 20 Feb 2026 12:47:12 +0100	[thread overview]
Message-ID: <20260220114712.GA383689@pevik> (raw)
In-Reply-To: <20260202144221.76765-2-pvorel@suse.cz>

Hi,

gently ping about the patchset. We can keep the functionality out of tree,
but I suppose more project which use checkpatch.pl would benefit from it.

Kind regards,
Petr

> This allows to directly use project configuration file for projects
> which vendored checkpatch.pl (e.g. LTP or u-boot).

> Options from the configuration file has been read before processing
> command line options with Getopt::Long since the start (000d1cc1829f9)
> because options read from config file needs to be unshifted from command
> line arguments (@ARGV) before processing with Getopt::Long. Therefore
> parse --conf-dir with direct reading @ARGV.

> Signed-off-by: Petr Vorel <pvorel@suse.cz>
> ---
> @ARGV can be probably processed cleaner.

> Kind regards,
> Petr

>  scripts/checkpatch.pl | 31 +++++++++++++++++++++++++++++--
>  1 file changed, 29 insertions(+), 2 deletions(-)

> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index 8fffdf9e7f85f..7e19287d452d8 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -58,6 +58,7 @@ my @ignore = ();
>  my $help = 0;
>  my $configuration_file = ".checkpatch.conf";
>  my $def_configuration_dirs = ".:$ENV{HOME}:.scripts";
> +my $configuration_dir = "";
>  my $max_line_length = 100;
>  my $ignore_perl_version = 0;
>  my $minimum_perl_version = 5.10.0;
> @@ -144,12 +145,14 @@ Options:
>                               is a terminal ('auto'). Default is 'auto'.
>    --kconfig-prefix=WORD      use WORD as a prefix for Kconfig symbols (default
>                               ${CONFIG_})
> +  --conf-dir=DIR             directory with $configuration_file configuration file
> +                             (default:$def_configuration_dirs)
>    -h, --help, --version      display this help and exit

>  When FILE is - read standard input.

>  Script searches for a configuration file $configuration_file in path:
> -$def_configuration_dirs
> +$def_configuration_dirs (can be overwritten by --conf-dir)
>  EOM

>  	exit($exitcode);
> @@ -241,7 +244,31 @@ sub list_types {
>  	exit($exitcode);
>  }

> -my $conf = which_conf($configuration_file, $def_configuration_dirs);
> +# parse --conf-dir before the other options
> +my @argv;
> +while (@ARGV) {
> +	my $arg = shift @ARGV;
> +	if ($arg eq '--conf-dir') {
> +		$configuration_dir = shift @ARGV;
> +		die "--conf-dir requires value" unless ($configuration_dir);
> +	} elsif ($arg =~ /^--conf-dir=(.+)$/) {
> +		$configuration_dir = $1;
> +		die "--conf-dir requires value" unless ($configuration_dir);
> +	} else {
> +		push @argv, $arg;
> +	}
> +}
> +@ARGV = @argv;
> +
> +my $conf;
> +if ($configuration_dir) {
> +	die "Dir. $configuration_dir does not exist" unless (-d $configuration_dir);
> +	$conf = "$configuration_dir/$configuration_file";
> +	die "File $conf does not exist" unless (-f $conf);
> +} else {
> +	$conf = which_conf($configuration_file, $def_configuration_dirs);
> +}
> +
>  if (-f $conf) {
>  	my @conf_args;
>  	open(my $conffile, '<', "$conf")

  reply	other threads:[~2026-02-20 11:47 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-02 14:42 [PATCH 1/2] checkpatch: Document config file in help Petr Vorel
2026-02-02 14:42 ` [PATCH 2/2] checkpatch: Add --conf-dir option Petr Vorel
2026-02-20 11:47   ` Petr Vorel [this message]
2026-02-20 17:13   ` Joe Perches
2026-02-23 15:53     ` Petr Vorel
2026-02-23 17:08       ` Joe Perches
2026-02-23 21:38         ` Petr Vorel

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=20260220114712.GA383689@pevik \
    --to=pvorel@suse.cz \
    --cc=apw@canonical.com \
    --cc=dwaipayanray1@gmail.com \
    --cc=joe@perches.com \
    --cc=kory.maincent@bootlin.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lukas.bulwahn@gmail.com \
    --cc=simon.glass@canonical.com \
    --cc=trini@konsulko.com \
    --cc=visitorckw@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.