checkpatch: add warning for lines starting with a '#' in commit log
RFC PATCH 1/1 checkpatch: add warning for lines starting with a '#' in commit log
Commit log lines starting with a '#' can be ignored by git if the corresponding commit message is reworded by a maintainer using git commit --ammend. This minute error can be easily avoided if checkpatch warns for the same.
Add a new check which emits a warning on finding lines starting with a '#'. Also add a quick fix by adding a tab infront of such lines.
--- scripts/checkpatch.pl | 9 +++++++++ 1 file changed, 9 insertions(+)
scripts/checkpatch.pl +9 -0
@@ -2966,6 +2966,15 @@ sub process { $commit_log_possible_stack_dump = 0; } +# Check for lines starting with an # + if ($in_commit_log && $line =~ /^#/) { + if (WARN("POSSIBLE_IGNORED_LINE", + "Commit log lines starting with a '#' might be ignored if the commit message is reworded using git commit --ammend.\n" . $herecurr) + && $fix) { + $fixed[$fixlinenr] =~ s/^#/\t#/; + } + } + # Check for git id commit length and improperly formed commit descriptions if ($in_commit_log && !$commit_log_possible_stack_dump && $line !~ /^\s*(?:Link|Patchwork|http|https|BugLink|base-commit):/i &&
Signature · 6 lines
2.27.0 _______________________________________________ Linux-kernel-mentees mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees
Quoted 3 lines · Dwaipayan Ray
Commit log lines starting with a '#' can be ignored by git if the corresponding commit message is reworded by a maintainer using git commit --ammend. This minute error can be easily avoided if
s/minute/minor/
Quoted 4 lines
checkpatch warns for the same.
Add a new check which emits a warning on finding lines starting with a '#'. Also add a quick fix by adding a tab infront of such lines.
s/infront/in front/
Quoted 11 lines
Suggested-by Peilin Ye <[email protected]>Signed-off-by Dwaipayan Ray <[email protected]>--- scripts/checkpatch.pl | 9 +++++++++ 1 file changed, 9 insertions(+)scripts/checkpatch.pl +0
-0
scripts/checkpatch.pl sub process { · line 2972
Quoted 7 lines
scripts/checkpatch.pl +4
-0@@ -2966,6 +2966,15 @@ sub process { $commit_log_possible_stack_dump = 0; } +# Check for lines starting with an # + if ($in_commit_log && $line =~ /^#/) { + if (WARN("POSSIBLE_IGNORED_LINE", + "Commit log lines starting with a '#' might be ignored if the commit message is reworded using git commit --ammend.\n" . $herecurr)
Also a nitpick, commit --amend isn't the only way to reword it, I did it using rebase -i.
I think something like "Commit log lines starting with a '#' might be dropped by git.\n" is sufficient, without being overspecific?
Otherwise,
Thank you,
Peilin Ye
_______________________________________________
Linux-kernel-mentees mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees
Quoted 37 lines · Peilin Ye
Quoted 3 lines · Dwaipayan Ray
Commit log lines starting with a '#' can be ignored by git if the corresponding commit message is reworded by a maintainer using git commit --ammend. This minute error can be easily avoided if
s/minute/minor/
Quoted 4 lines
checkpatch warns for the same.
Add a new check which emits a warning on finding lines starting with a '#'. Also add a quick fix by adding a tab infront of such lines.
s/infront/in front/
Quoted 11 lines
Suggested-by Peilin Ye <[email protected]>Signed-off-by Dwaipayan Ray <[email protected]>--- scripts/checkpatch.pl | 9 +++++++++ 1 file changed, 9 insertions(+)scripts/checkpatch.pl +0
-0scripts/checkpatch.pl sub process { · line 2972
Quoted 7 lines
scripts/checkpatch.pl +4
-0@@ -2966,6 +2966,15 @@ sub process { $commit_log_possible_stack_dump = 0; } +# Check for lines starting with an # + if ($in_commit_log && $line =~ /^#/) { + if (WARN("POSSIBLE_IGNORED_LINE", + "Commit log lines starting with a '#' might be ignored if the commit message is reworded using git commit --ammend.\n" . $herecurr)Also a nitpick,
commit --amendisn't the only way to reword it, I did it usingrebase -i.
Quoted 2 lines
I think something like "Commit log lines starting with a '#' might be dropped by git.\n" is sufficient, without being overspecific?
I think that might be better. I would probably add dropped by git when the commit message is reworded. I totally forgot that rebase could also do it. Thanks.
Quoted 5 lines
Otherwise,
Tested-by Peilin Ye <[email protected]>
Thanks for the feedback and the tag Peilin.
I will have these changes done.
If Lukas doesn't have any problem with this, I can send it to Joe then.
Thanks & Regards,
Dwaipayan.
_______________________________________________
Linux-kernel-mentees mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees
Quoted 49 lines · Dwaipayan Ray
Quoted 37 lines · Peilin Ye
Quoted 3 lines · Dwaipayan Ray
Commit log lines starting with a '#' can be ignored by git if the corresponding commit message is reworded by a maintainer using git commit --ammend. This minute error can be easily avoided if
s/minute/minor/
Quoted 4 lines
checkpatch warns for the same.
Add a new check which emits a warning on finding lines starting with a '#'. Also add a quick fix by adding a tab infront of such lines.
s/infront/in front/
Quoted 11 lines
Suggested-by Peilin Ye <[email protected]>Signed-off-by Dwaipayan Ray <[email protected]>--- scripts/checkpatch.pl | 9 +++++++++ 1 file changed, 9 insertions(+)scripts/checkpatch.pl +0
-0scripts/checkpatch.pl sub process { · line 2972
Quoted 7 lines
scripts/checkpatch.pl +4
-0@@ -2966,6 +2966,15 @@ sub process { $commit_log_possible_stack_dump = 0; } +# Check for lines starting with an # + if ($in_commit_log && $line =~ /^#/) { + if (WARN("POSSIBLE_IGNORED_LINE", + "Commit log lines starting with a '#' might be ignored if the commit message is reworded using git commit --ammend.\n" . $herecurr)Also a nitpick,
commit --amendisn't the only way to reword it, I did it usingrebase -i.Quoted 2 lines
I think something like "Commit log lines starting with a '#' might be dropped by git.\n" is sufficient, without being overspecific?
I think that might be better. I would probably add
dropped by git when the commit message is reworded. I totally forgot that rebase could also do it. Thanks.Quoted 3 lines
Otherwise,
Quoted 8 lines
Quoted 2 lines
Tested-by Peilin Ye <[email protected]>Thanks for the feedback and the tag Peilin.
I will have these changes done.If Lukas doesn't have any problem with this, I can send it to Joe then.
Looks good to me.
Lukas
Quoted 2 lines
Thanks & Regards,
Dwaipayan.
_______________________________________________
Linux-kernel-mentees mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees
Quoted 3 lines · Dwaipayan Ray
Commit log lines starting with a '#' can be ignored by git if the corresponding commit message is reworded by a maintainer using git commit --ammend. This minute error can be easily avoided if
s/ammend/amend/
Thank you,
Peilin Ye
_______________________________________________
Linux-kernel-mentees mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees