mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 02:30:34 +02:00 
			
		
		
		
	checkpatch: add warning for lines starting with a '#' in commit log
Commit log lines starting with '#' are dropped by git as comments. Add a check to emit a warning for these lines. Also add a --fix option to insert a space before the leading '#' in such lines. Link: https://lkml.kernel.org/r/20201202205740.127986-1-dwaipayanray1@gmail.com Signed-off-by: Dwaipayan Ray <dwaipayanray1@gmail.com> Suggested-by: Joe Perches <joe@perches.com> Suggested-by: Peilin Ye <yepeilin.cs@gmail.com> Tested-by: Peilin Ye <yepeilin.cs@gmail.com> Acked-by: Joe Perches <joe@perches.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
		
							parent
							
								
									70eb2275ff
								
							
						
					
					
						commit
						084a617acf
					
				
					 1 changed files with 9 additions and 0 deletions
				
			
		| 
						 | 
					@ -3033,6 +3033,15 @@ sub process {
 | 
				
			||||||
			$commit_log_possible_stack_dump = 0;
 | 
								$commit_log_possible_stack_dump = 0;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Check for lines starting with a #
 | 
				
			||||||
 | 
							if ($in_commit_log && $line =~ /^#/) {
 | 
				
			||||||
 | 
								if (WARN("COMMIT_COMMENT_SYMBOL",
 | 
				
			||||||
 | 
									 "Commit log lines starting with '#' are dropped by git as comments\n" . $herecurr) &&
 | 
				
			||||||
 | 
								    $fix) {
 | 
				
			||||||
 | 
									$fixed[$fixlinenr] =~ s/^/ /;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Check for git id commit length and improperly formed commit descriptions
 | 
					# Check for git id commit length and improperly formed commit descriptions
 | 
				
			||||||
		if ($in_commit_log && !$commit_log_possible_stack_dump &&
 | 
							if ($in_commit_log && !$commit_log_possible_stack_dump &&
 | 
				
			||||||
		    $line !~ /^\s*(?:Link|Patchwork|http|https|BugLink|base-commit):/i &&
 | 
							    $line !~ /^\s*(?:Link|Patchwork|http|https|BugLink|base-commit):/i &&
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue