public inbox for linux-kernel@vger.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 v2] checkpatch: Allow to pass config directory
Date: Thu, 26 Mar 2026 16:47:35 +0100	[thread overview]
Message-ID: <20260326154735.GB7157@pevik> (raw)
In-Reply-To: <20260224181623.89904-1-pvorel@suse.cz>

Hi all,

> checkpatch.pl searches for .checkpatch.conf in $HOME and .scripts
> (in current working directory). Allow to pass directory via
> CHECKPATCH_CONFIG_DIR environment variable. This allows to directly use
> project configuration file for projects which vendored checkpatch.pl
> (e.g. LTP or u-boot).

Gentle ping for a feedback.

Kind regards,
Petr

> While at it, document all directories in help.

> Suggested-by: Joe Perches <joe@perches.com>
> Signed-off-by: Petr Vorel <pvorel@suse.cz>
> ---
> NOTE: if you don't like the way how directories are printed in help
> (user's home directory path instead of $HOME) I can change it.

> $ ./scripts/checkpatch.pl -h
> ...
> When FILE is - read standard input.

> CONFIGURATION FILE

> Script searches for a configuration file .checkpatch.conf in path:
> $CHECKPATCH_CONFIG_DIR:.:/home/foo:.scripts

> Link to v1:
> https://lore.kernel.org/lkml/20260202144221.76765-1-pvorel@suse.cz/
> https://lore.kernel.org/lkml/20260202144221.76765-2-pvorel@suse.cz/

> Changes v1->v2:
> * Use environment variable instead of --conf-dir option (Joe Perches)
> NOTE: I'd slightly prefer using --conf-dir (more convenient for user).
> * squash documentation into this commit

> Kind regards,
> Petr

>  scripts/checkpatch.pl | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)

> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index bec7930cdd66..e47fec115ee7 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -57,6 +57,8 @@ my %ignore_type = ();
>  my @ignore = ();
>  my $help = 0;
>  my $configuration_file = ".checkpatch.conf";
> +my $def_configuration_dirs = ".:$ENV{HOME}:.scripts";
> +my $env_config_dir = 'CHECKPATCH_CONFIG_DIR';
>  my $max_line_length = 100;
>  my $ignore_perl_version = 0;
>  my $minimum_perl_version = 5.10.0;
> @@ -146,6 +148,10 @@ Options:
>    -h, --help, --version      display this help and exit

>  When FILE is - read standard input.
> +
> +CONFIGURATION FILE
> +Script searches for a configuration file $configuration_file in path:
> +\$$env_config_dir:$def_configuration_dirs
>  EOM

>  	exit($exitcode);
> @@ -1531,8 +1537,10 @@ sub which {

>  sub which_conf {
>  	my ($conf) = @_;
> +	my $paths = $ENV{$env_config_dir} . ':' if exists($ENV{$env_config_dir});
> +	$paths .= $def_configuration_dirs;

> -	foreach my $path (split(/:/, ".:$ENV{HOME}:.scripts")) {
> +	foreach my $path (split(/:/, $paths)) {
>  		if (-e "$path/$conf") {
>  			return "$path/$conf";
>  		}

  reply	other threads:[~2026-03-26 15:47 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-24 18:16 [PATCH v2] checkpatch: Allow to pass config directory Petr Vorel
2026-03-26 15:47 ` Petr Vorel [this message]
2026-03-26 17:48 ` Simon Glass
2026-03-26 20:50   ` Petr Vorel
2026-03-27  0:06     ` Joe Perches
2026-03-27  9:50       ` 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=20260326154735.GB7157@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox