2021-10-15 13:55:14

by Cai,Huoqing

[permalink] [raw]
Subject: [PATCH 1/2] checkpatch: Add check item for RFC tags is outside the subject prefix

Some patches have been sent, the RFC tag of which is
outside the subject prefix is incorrect. like this:
"Subject: [PATCH v2] RFC:"

Perfer "Subject: [RFC PATCH v2]" to "Subject: [PATCH v2] RFC:",
so add check item for it.

Signed-off-by: Cai Huoqing <[email protected]>
---
scripts/checkpatch.pl | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index c27d2312cfc3..802f78904247 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -3121,6 +3121,12 @@ sub process {
"A patch subject line should describe the change not the tool that found it\n" . $herecurr);
}

+# Check if RFC tags is outside the subject prefix
+ if ($in_header_lines && $line =~ /^Subject:.*patch\s*.*]\s*rfc:/i) {
+ WARN("RFC_TAG_PREFIX",
+ "RFC tag is outside subject prefix, try \"git format-patch --rfc\"\n" . $herecurr);
+ }
+
# Check for Gerrit Change-Ids not in any patch context
if ($realfile eq '' && !$has_patch_separator && $line =~ /^\s*change-id:/i) {
if (ERROR("GERRIT_CHANGE_ID",
--
2.25.1


2021-10-15 13:55:14

by Cai,Huoqing

[permalink] [raw]
Subject: [PATCH 2/2] docs: checkpatch: Add the description for RFC_TAG_PREFIX waining messsage

A check item for RFC tags is added to checkpatch.pl,
which will report RFC_TAG_PREFIX warning. so add
the description for RFC_TAG_PREFIX.

Signed-off-by: Cai Huoqing <[email protected]>
---
Documentation/dev-tools/checkpatch.rst | 10 ++++++++++
1 file changed, 10 insertions(+)

diff --git a/Documentation/dev-tools/checkpatch.rst b/Documentation/dev-tools/checkpatch.rst
index b52452bc2963..0da827af3d93 100644
--- a/Documentation/dev-tools/checkpatch.rst
+++ b/Documentation/dev-tools/checkpatch.rst
@@ -554,6 +554,16 @@ Commit message

See: https://www.kernel.org/doc/html/latest/process/submitting-patches.html#describe-your-changes

+ **RFC_TAG_PREFIX**
+ RFC tag is outside subject prefix.
+ RFC tag outside subject prefix is incorrect like this::
+
+ Subject: [PATCH v2] RFC:
+
+ Perfer::
+
+ Subject: [RFC PATCH v2]
+
**FROM_SIGN_OFF_MISMATCH**
The author's email does not match with that in the Signed-off-by:
line(s). This can be sometimes caused due to an improperly configured
--
2.25.1

2021-10-17 10:49:55

by Joe Perches

[permalink] [raw]
Subject: Re: [PATCH 1/2] checkpatch: Add check item for RFC tags is outside the subject prefix

On Fri, 2021-10-15 at 15:58 +0800, Cai Huoqing wrote:
> Some patches have been sent, the RFC tag of which is
> outside the subject prefix is incorrect. like this:
> "Subject: [PATCH v2] RFC:"
>
> Perfer "Subject: [RFC PATCH v2]" to "Subject: [PATCH v2] RFC:",
> so add check item for it.

typo of prefer but does this matter enough to make it a test?

Same typo in next patch.

> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
[]
> @@ -3121,6 +3121,12 @@ sub process {
> "A patch subject line should describe the change not the tool that found it\n" . $herecurr);
> }
>
> +# Check if RFC tags is outside the subject prefix
> + if ($in_header_lines && $line =~ /^Subject:.*patch\s*.*]\s*rfc:/i) {
> + WARN("RFC_TAG_PREFIX",
> + "RFC tag is outside subject prefix, try \"git format-patch --rfc\"\n" . $herecurr);
> + }
> +
> # Check for Gerrit Change-Ids not in any patch context
> if ($realfile eq '' && !$has_patch_separator && $line =~ /^\s*change-id:/i) {
> if (ERROR("GERRIT_CHANGE_ID",