lkml.org 
[lkml]   [2022]   [Sep]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v7] checkpatch: warn for non-standard fixes tag style
From
Date
On Wed, 2022-09-14 at 12:02 +0200, Niklas Söderlund wrote:
> Add a warning for fixes tags that does not follow community conventions.
[]
> * Changes since v6
> - Update first check to make sure that there is a likely SHA1 of some
> minimum length after the fixes line.

https://lore.kernel.org/lkml/2febb7893346b6234983453de7c037536e479bfc.camel@perches.com/

The goal here should be to identify a line that looks like a commit
reference.

So find lines that starts with 'fixes' and have a SHA1 commit id as
broadly as reasonable.

Did you run the grep pattern and look at the results?

One grep pattern to verify the non canonical fixes format that
are mistakenly used is:

$ git log --since=5-years-ago --no-merges --grep='^\s*fixes' -i --format=email -P | \
grep -P -i '^\s*fixes' | \
grep -P -v '^Fixes: [0-9a-f]{12,12}\s*\(".*")'

[]

There are many different styles.
Parenthesea are sometimes not used.

> + if ($line =~ /(\s*fixes:?)\s+([0-9a-f]{5,})\s+($balanced_parens)/i) {

How about some pattern like

/fixes\s*:?\s*(?:commit:?\s*)?[0-9a-f]{5,}/i

or maybe even more broadly:

/fixes\b.*\b[0-9a-f]{5,}\b/i

\
 
 \ /
  Last update: 2022-09-14 18:10    [W:0.061 / U:0.184 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site