Re: [PATCH v1] checkpatch: allow build files to reference other build files

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 01/12/2024, Joe Perches wrote:
> On Fri, 2024-01-12 at 10:34 -0800, Will McVicker wrote:
> > Add an exception to the EMBEDDED_FILENAME warning for build files. This
> > fixes the below warnings where the Kconfig and Makefile files reference
> > other similarly named build files.
> > 
> >   WARNING:EMBEDDED_FILENAME: It's generally not useful to have the
> >   filename in the file
> >   #24: FILE: Kconfig:34:
> >   +source "drivers/willmcvicker/Kconfig"
> > 
> >   WARNING:EMBEDDED_FILENAME: It's generally not useful to have the
> >   filename in the file
> >   #36: FILE: Makefile:667:
> >   +	} > Makefile
> 
> No need to wrap here I think.

You're right. I'll update in v2.

> 
> > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> []
> > @@ -3785,7 +3785,9 @@ sub process {
> >  		}
> >  
> >  # check for embedded filenames
> > -		if ($rawline =~ /^\+.*\b\Q$realfile\E\b/) {
> > +		if ($rawline =~ /^\+.*\b\Q$realfile\E\b/ &&
> > +			$realfile !~ /Kconfig.*/ &&
> > +			$realfile !~ /Makefile.*/) {
> 
> Align to open parenthesis please.
> It's not useful to have .* before the /

I was following other references in this file, but looks like you're right that
it's not needed. Your recommendation passed the tests I have. So I'll update
the regex in v2.

Thanks,
Will

> 
> So perhaps better to be
> 
> 		if ($rawline =~ /^\+.*\b\Q$realfile\E\b/ &&
> 		    $realfile !~ /(?:Kconfig|Makefile)/) {
> 	
> >  			WARN("EMBEDDED_FILENAME",
> >  			     "It's generally not useful to have the filename in the file\n" . $herecurr);
> >  		}
> 




[Index of Archives]     [Linux&nblp;USB Development]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite Secrets]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux