mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 02:30:34 +02:00 
			
		
		
		
	checkpatch: use a list of "link" tags
The following commit will allow the use of a similar "link" tag. Because there is a possibility that other similar tags will be added in the future and to reduce the number of places where the code will be modified to allow this new tag, a list with all these "link" tags is now used. Two variables are created from it: one to search for such tags and one to print all tags in a warning message. Link: https://lkml.kernel.org/r/20230314-doc-checkpatch-closes-tag-v4-3-d26d1fa66f9f@tessares.net Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net> Suggested-by: Joe Perches <joe@perches.com> Acked-by: Joe Perches <joe@perches.com> Cc: Andy Whitcroft <apw@canonical.com> Cc: Bagas Sanjaya <bagasdotme@gmail.com> Cc: Daniel Vetter <daniel@ffwll.ch> Cc: David Airlie <airlied@gmail.com> Cc: Dwaipayan Ray <dwaipayanray1@gmail.com> Cc: Jonathan Corbet <corbet@lwn.net> Cc: Kai Wasserbäch <kai@dev.carbon-project.org> Cc: Konstantin Ryabitsev <konstantin@linuxfoundation.org> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Lukas Bulwahn <lukas.bulwahn@gmail.com> Cc: Thorsten Leemhuis <linux@leemhuis.info> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
		
							parent
							
								
									c917a872ce
								
							
						
					
					
						commit
						f94e40ea27
					
				
					 1 changed files with 20 additions and 4 deletions
				
			
		| 
						 | 
					@ -620,6 +620,22 @@ our $signature_tags = qr{(?xi:
 | 
				
			||||||
	Cc:
 | 
						Cc:
 | 
				
			||||||
)};
 | 
					)};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					our @link_tags = qw(Link);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#Create a search and print patterns for all these strings to be used directly below
 | 
				
			||||||
 | 
					our $link_tags_search = "";
 | 
				
			||||||
 | 
					our $link_tags_print = "";
 | 
				
			||||||
 | 
					foreach my $entry (@link_tags) {
 | 
				
			||||||
 | 
						if ($link_tags_search ne "") {
 | 
				
			||||||
 | 
							$link_tags_search .= '|';
 | 
				
			||||||
 | 
							$link_tags_print .= ' or ';
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						$entry .= ':';
 | 
				
			||||||
 | 
						$link_tags_search .= $entry;
 | 
				
			||||||
 | 
						$link_tags_print .= "'$entry'";
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					$link_tags_search = "(?:${link_tags_search})";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
our $tracing_logging_tags = qr{(?xi:
 | 
					our $tracing_logging_tags = qr{(?xi:
 | 
				
			||||||
	[=-]*> |
 | 
						[=-]*> |
 | 
				
			||||||
	<[=-]* |
 | 
						<[=-]* |
 | 
				
			||||||
| 
						 | 
					@ -3250,8 +3266,8 @@ sub process {
 | 
				
			||||||
					# file delta changes
 | 
										# file delta changes
 | 
				
			||||||
		      $line =~ /^\s*(?:[\w\.\-\+]*\/)++[\w\.\-\+]+:/ ||
 | 
							      $line =~ /^\s*(?:[\w\.\-\+]*\/)++[\w\.\-\+]+:/ ||
 | 
				
			||||||
					# filename then :
 | 
										# filename then :
 | 
				
			||||||
		      $line =~ /^\s*(?:Fixes:|Link:|$signature_tags)/i ||
 | 
							      $line =~ /^\s*(?:Fixes:|$link_tags_search|$signature_tags)/i ||
 | 
				
			||||||
					# A Fixes: or Link: line or signature tag line
 | 
										# A Fixes:, link or signature tag line
 | 
				
			||||||
		      $commit_log_possible_stack_dump)) {
 | 
							      $commit_log_possible_stack_dump)) {
 | 
				
			||||||
			WARN("COMMIT_LOG_LONG_LINE",
 | 
								WARN("COMMIT_LOG_LONG_LINE",
 | 
				
			||||||
			     "Possible unwrapped commit description (prefer a maximum 75 chars per line)\n" . $herecurr);
 | 
								     "Possible unwrapped commit description (prefer a maximum 75 chars per line)\n" . $herecurr);
 | 
				
			||||||
| 
						 | 
					@ -3266,13 +3282,13 @@ sub process {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Check for odd tags before a URI/URL
 | 
					# Check for odd tags before a URI/URL
 | 
				
			||||||
		if ($in_commit_log &&
 | 
							if ($in_commit_log &&
 | 
				
			||||||
		    $line =~ /^\s*(\w+):\s*http/ && $1 ne 'Link') {
 | 
							    $line =~ /^\s*(\w+:)\s*http/ && $1 !~ /^$link_tags_search$/) {
 | 
				
			||||||
			if ($1 =~ /^v(?:ersion)?\d+/i) {
 | 
								if ($1 =~ /^v(?:ersion)?\d+/i) {
 | 
				
			||||||
				WARN("COMMIT_LOG_VERSIONING",
 | 
									WARN("COMMIT_LOG_VERSIONING",
 | 
				
			||||||
				     "Patch version information should be after the --- line\n" . $herecurr);
 | 
									     "Patch version information should be after the --- line\n" . $herecurr);
 | 
				
			||||||
			} else {
 | 
								} else {
 | 
				
			||||||
				WARN("COMMIT_LOG_USE_LINK",
 | 
									WARN("COMMIT_LOG_USE_LINK",
 | 
				
			||||||
				     "Unknown link reference '$1:', use 'Link:' instead\n" . $herecurr);
 | 
									     "Unknown link reference '$1', use $link_tags_print instead\n" . $herecurr);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue