According to the explanation from this source, the .checkpatch.conf
file that specifies the configuration options for checkpatch.pl
tool must be in the top-level directory of the project.
Would it be possible that we put checkpatch.conf
on some other location and somehow specify the path to it in checkpatch.pl
(or somewhere else)?
I tried to do it the following way in checkpatch.pl
file:
my $configuration_file = "<path_to_the>/.checkpatch.conf";
but to no avail.
So, in addition to (or perhaps instead of) changing the value assigned to the $configuration_file variable, you need to slightly alter the which_conf subroutine.
The original sub routine is:
sub which_conf {
my ($conf) = @_;
foreach my $path (split(/:/, ".:$ENV{HOME}:.scripts")) {
if (-e "$path/$conf") {
return "$path/$conf";
}
}
return "";
}
this takes a configuration file name as input and returns the path to the first occurrence of the file found in a list of predefined directories. Here's how it works:
So it's likely the reason that simply changing the value of $configuration_file does not work is because it's getting evaluated as /some/base/path/<path_to_the>/.checkpatch.conf which will not exist.
I would try instead of altering $configuration_file variable at all, adding the base path you want it to search to find your checkpatch.conf file using a colon as a delimiter.
foreach my $path (split(/:/, ".:$ENV{HOME}:.scripts:./my/sub/path"))
or
foreach my $path (split(/:/, ".:$ENV{HOME}:.scripts:/my/full/path"))