From: Petr Vorel <pvorel@suse.cz>
To: Joe Perches <joe@perches.com>
Cc: linux-kernel@vger.kernel.org, Andy Whitcroft <apw@canonical.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: Mon, 23 Feb 2026 22:38:33 +0100 [thread overview]
Message-ID: <20260223213833.GA22557@pevik> (raw)
In-Reply-To: <38980cd5299bbf9939e40a3a1f2b0c98e20c5f34.camel@perches.com>
> On Mon, 2026-02-23 at 16:53 +0100, Petr Vorel wrote:
> > On Mon, 2026-02-02 at 15:42 +0100, Petr Vorel wrote:
> > > > This allows to directly use project configuration file for projects
> > > > which vendored checkpatch.pl (e.g. LTP or u-boot).
> []
> > > Extend 'sub which_conf {' and the perhaps the code that uses it
> > > if you really need this capability.
> > Thanks for a hint. If there is a chance it will be accepted I'll have look on
> > it. We would certainly appreciated not having to carry yet another checkpatch.pl
> > patch in LTP.
> []
> > > Though I think it's not all that useful.
> []
> > We use LTP in makefile targets run from various subdirectories. For that we
> > define our checkpatch.pl options (--ignore list and others) in certain Makefile.
> > Then we have b4 configuration, where we also use checkpatch.pl options.
> > Mixing cd to rootdir and passing path to the sources is of course doable
> > (to reach config file in .scripts in project root directory) but quite ugly.
> > Also, allowing to pass a configuration file (quite common feature for any
> > software) would allow to run checkpatch.pl with different configs for different
> > projects.
> Right now the HOME environment variable is used in which_conf.
Yes (and that's not enough for the case I described).
> Perhaps prepend a CHECKPATCH_CONFIG environment where the right
> <somedir>.checkpatch.conf would be found?
Sure, if you prefer not processing @ARGV twice (and modifying it), using
environment variable works as well. The reason I touched @ARGV was to be
slightly more convenient for user with a bit more complicated code. But when
variable is properly documented, there is practically no difference (if I ignore
the fact that in the future somebody writes bash-completion support, which will
ignore environment variables).
Anyway, thanks for being open to the idea. I'll send a patch based on the code
you proposed.
Kind regards,
Petr
> Maybe something like the below and executed with something like
> $ CHECKPATCH_CONFIG=<dir> <path_to>checkpatch.pl etc...
> ---
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index e56374662ff7..355542d7d5a9 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -1532,7 +1532,11 @@ sub which {
> sub which_conf {
> my ($conf) = @_;
> - foreach my $path (split(/:/, ".:$ENV{HOME}:.scripts")) {
> + my $env_config_path = 'CHECKPATCH_CONFIG';
> + my $paths = $ENV{$env_config_path} . ':' if exists($ENV{$env_config_path});
> + $paths .= ".:$ENV{'HOME'}:.scripts";
> +
> + foreach my $path (split(/:/, $paths)) {
> if (-e "$path/$conf") {
> return "$path/$conf";
> }
prev parent reply other threads:[~2026-02-23 21:38 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
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 [this message]
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=20260223213833.GA22557@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.