History

checkpatch: improve Gerrit Change-Id: test

The Gerrit Change-Id: entry is sometimes placed after a Signed-off-by: line. When this occurs, the Gerrit warning is not currently emitted as the first Signed-off-by: signature sets a flag to stop looking. Change the test to add a test for the --- patch separator and emit the warning before any before the --- and also before any diff file name.

Joe Perches committed 6 years ago

Commit 44d303e1 parent 713a09d1 file · +10 −3Browse files

Showing the changes to scripts/checkpatch.pl (1 of 1 file). Show all

Unified · Split

scripts/checkpatch.pl+10−3
@@ -2335,6 +2335,7 @@ sub process { · 2334 unmodified lines
2335 my $is_binding_patch = -1;2335 my $is_binding_patch = -1;
2336 my $in_header_lines = $file ? 0 : 1;2336 my $in_header_lines = $file ? 0 : 1;
2337 my $in_commit_log = 0; #Scanning lines before patch2337 my $in_commit_log = 0; #Scanning lines before patch
2338 my $has_patch_separator = 0; #Found a --- line
2338 my $has_commit_log = 0; #Encountered lines before patch2339 my $has_commit_log = 0; #Encountered lines before patch
2339 my $commit_log_lines = 0; #Number of commit log lines2340 my $commit_log_lines = 0; #Number of commit log lines
2340 my $commit_log_possible_stack_dump = 0;2341 my $commit_log_possible_stack_dump = 0;
@@ -2660,6 +2661,12 @@ sub process { · 319 unmodified lines
2660 }2661 }
2661 }2662 }
2662 2663
2664# Check for patch separator
2665 if ($line =~ /^---$/) {
2666 $has_patch_separator = 1;
2667 $in_commit_log = 0;
2668 }
2669
2663# Check if MAINTAINERS is being updated. If so, there's probably no need to2670# Check if MAINTAINERS is being updated. If so, there's probably no need to
2664# emit the "does MAINTAINERS need updating?" message on file add/move/delete2671# emit the "does MAINTAINERS need updating?" message on file add/move/delete
2665 if ($line =~ /^\s*MAINTAINERS\s*\|/) {2672 if ($line =~ /^\s*MAINTAINERS\s*\|/) {
@@ -2759,10 +2766,10 @@ sub process { · 93 unmodified lines
2759 "A patch subject line should describe the change not the tool that found it\n" . $herecurr);2766 "A patch subject line should describe the change not the tool that found it\n" . $herecurr);
2760 }2767 }
2761 2768
2762# Check for unwanted Gerrit info2769# Check for Gerrit Change-Ids not in any patch context
2763 if ($in_commit_log && $line =~ /^\s*change-id:/i) {2770 if ($realfile eq '' && !$has_patch_separator && $line =~ /^\s*change-id:/i) {
2764 ERROR("GERRIT_CHANGE_ID",2771 ERROR("GERRIT_CHANGE_ID",
2765 "Remove Gerrit Change-Id's before submitting upstream.\n" . $herecurr);2772 "Remove Gerrit Change-Id's before submitting upstream\n" . $herecurr);
2766 }2773 }
2767 2774
2768# Check if the commit log is in a possible stack dump2775# Check if the commit log is in a possible stack dump

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t