checkpatch: Don't check for 75 chars per line for create/delete mode lines
PATCH 1/2 checkpatch: Don't check for 75 chars per line for create/delete mode lines
Cover letters have a "create/delete mode <mode> <filename>" line for files added/deleted in the patch series. Ignore these lines when checking for the maximum 75 chars per line limit.
--- scripts/checkpatch.pl | 2 ++ 1 file changed, 2 insertions(+)
scripts/checkpatch.pl +2 -0
@@ -3271,6 +3271,8 @@ sub process { # filename then : $line =~ /^\s*(?:Fixes:|$link_tags_search|$signature_tags)/i || # A Fixes:, link or signature tag line + $line =~ /^\s*(?:delete|create) mode\s+[0-8]+\s+\S+\s*$/i || + # A "create/delete mode <mode> <filename>" line found in cover letters $commit_log_possible_stack_dump)) { WARN("COMMIT_LOG_LONG_LINE", "Prefer a maximum 75 chars per line (possible unwrapped commit description?)\n" . $herecurr);
Signature · 1 line
2.44.0.rc0.258.g7320e95886-goog
PATCH 2/2 checkpatch: Don't check for unified diff format in git sendemail headers
When checkpatch is used as a git sendemail-validate hook, it's also passed in the email header for sanity check. These headers are, as expected, not in unified diff format. So, don't complain about unified diff format for these header files.
--- scripts/checkpatch.pl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
scripts/checkpatch.pl +2 -1
@@ -7689,7 +7689,8 @@ sub process { exit(0); } - if (!$is_patch && $filename !~ /cover-letter\.patch$/) { + if (!$is_patch && $filename !~ /cover-letter\.patch$/ && + $filename !~ /\.git\/\.gitsendemail\.header\.\w+$/) { ERROR("NOT_UNIFIED_DIFF", "Does not appear to be a unified-diff format patch\n"); }
Signature · 1 line
2.44.0.rc0.258.g7320e95886-goog
Joe Perches
maintainerRe: [PATCH 2/2] checkpatch: Don't check for unified diff format in git sendemail headers
Quoted 2 lines · Saravana Kannan
When checkpatch is used as a git sendemail-validate hook, it's also passed in the email header for sanity check.
Why?
If so, why not use a front-end script to stop/remove the file from being scanned by checkpatch?
Quoted 3 lines
These headers are, as expected, not
in unified diff format. So, don't complain about unified diff format for these header files.
Re: [PATCH 2/2] checkpatch: Don't check for unified diff format in git sendemail headers
Quoted 9 lines · Joe Perches
Quoted 2 lines · Saravana Kannan
When checkpatch is used as a git sendemail-validate hook, it's also passed in the email header for sanity check.
Why?
If so, why not use a front-end script to stop/remove the file from being scanned by checkpatch?
Sure, I could do that. But this also makes it easier for people to start using checkpatch. Or I can put up a git hook wrapper script in here for people to symlink into their .git/hooks that does this.
I'd prefer the lazy route of not creating a 1 line wrapper script :)
-Saravana
Quoted 5 lines
Quoted 4 lines
These headers are, as expected, not
in unified diff format. So, don't complain about unified diff format for these header files.
Joe Perches
maintainerRe: [PATCH 2/2] checkpatch: Don't check for unified diff format in git sendemail headers
Quoted 8 lines · Saravana Kannan
Quoted 7 lines · Joe Perches
Quoted 2 lines · Saravana Kannan
When checkpatch is used as a git sendemail-validate hook, it's also passed in the email header for sanity check.
Why?
Quoted 8 lines
Quoted 2 lines
If so, why not use a front-end script to stop/remove the file from being scanned by checkpatch?
Sure, I could do that. But this also makes it easier for people to start using checkpatch. Or I can put up a git hook wrapper script in here for people to symlink into their .git/hooks that does this.
I'd prefer the lazy route of not creating a 1 line wrapper script :)
I'd not. checkpatch is for _patches_.
Don't feed stuff to it that isn't patches and expect good results.
Re: [PATCH 2/2] checkpatch: Don't check for unified diff format in git sendemail headers
Quoted 13 lines · Joe Perches
Quoted 11 lines · Saravana Kannan
Quoted 9 lines · Joe Perches
Quoted 2 lines · Saravana Kannan
When checkpatch is used as a git sendemail-validate hook, it's also passed in the email header for sanity check.
Why?
If so, why not use a front-end script to stop/remove the file from being scanned by checkpatch?
Quoted 8 lines
Quoted 5 lines
Sure, I could do that. But this also makes it easier for people to start using checkpatch. Or I can put up a git hook wrapper script in here for people to symlink into their .git/hooks that does this.
I'd prefer the lazy route of not creating a 1 line wrapper script :)
I'd not. checkpatch is for _patches_.
Don't feed stuff to it that isn't patches and expect good results.
Would you be open to being a maintainer if I add a git hook sendemail-validate wrapper? It feels silly to add myself as a maintainer for a 1-line script. I'd rather give it to you :)
-Saravana
Joe Perches
maintainerRe: [PATCH 2/2] checkpatch: Don't check for unified diff format in git sendemail headers
Quoted 18 lines · Saravana Kannan
Quoted 17 lines · Joe Perches
Quoted 15 lines · Saravana Kannan
Quoted 9 lines · Joe Perches
Quoted 2 lines · Saravana Kannan
When checkpatch is used as a git sendemail-validate hook, it's also passed in the email header for sanity check.
Why?
If so, why not use a front-end script to stop/remove the file from being scanned by checkpatch?
Sure, I could do that. But this also makes it easier for people to start using checkpatch. Or I can put up a git hook wrapper script in here for people to symlink into their .git/hooks that does this.
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
I'd prefer the lazy route of not creating a 1 line wrapper script :)
I'd not. checkpatch is for _patches_.
Don't feed stuff to it that isn't patches and expect good results.Would you be open to being a maintainer if I add a git hook sendemail-validate wrapper? It feels silly to add myself as a maintainer for a 1-line script. I'd rather give it to you :)
<shrug>
I think you need a local script and not one in the tree. Or maybe some different git invocation command. Dunno.
Re: [PATCH 2/2] checkpatch: Don't check for unified diff format in git sendemail headers
In reply to Saravana KannanQuoted 19 lines · Saravana Kannan
Quoted 17 lines · Joe Perches
Quoted 15 lines · Saravana Kannan
Quoted 9 lines · Joe Perches
Quoted 2 lines · Saravana Kannan
When checkpatch is used as a git sendemail-validate hook, it's also passed in the email header for sanity check.
Why?
If so, why not use a front-end script to stop/remove the file from being scanned by checkpatch?
Sure, I could do that. But this also makes it easier for people to start using checkpatch. Or I can put up a git hook wrapper script in here for people to symlink into their .git/hooks that does this.
Quoted 9 lines
Quoted 4 lines
Quoted 1 line
I'd prefer the lazy route of not creating a 1 line wrapper script :)
I'd not. checkpatch is for _patches_.
Don't feed stuff to it that isn't patches and expect good results.Would you be open to being a maintainer if I add a git hook sendemail-validate wrapper? It feels silly to add myself as a maintainer for a 1-line script. I'd rather give it to you :)
I agree with Joe's shrug. We got enough scripts, where very few (actually: probably nobody) know what they are good for.
However, Saravana, if it helps you, feel free to add a section in the checkpatch documentation where you describe which workflow you have and in which files you need to set up what.
So, in case you forget, you will find it in the documentation and possibly it is also helpful to others---if they read the documentation, or some AI bot reads the documentation in the future and then suggests it to someone asking that AI bot---well, that is our brave new world nowadays...
I will maintain that section in the checkpatch documentation for you, if you submit the documentation change as a proper patch.
Lukas
Quoted 6 lines · Saravana Kannan
Cover letters have a "create/delete mode <mode> <filename>" line for files added/deleted in the patch series. Ignore these lines when checking for the maximum 75 chars per line limit.
Signed-off-by Saravana Kannan <[email protected]>
I know patch 2/2 is not going to be picked up. But can we pick up this one please?
-Saravana
Quoted 20 lines
--- scripts/checkpatch.pl | 2 ++ 1 file changed, 2 insertions(+)scripts/checkpatch.pl +2
-1@@ -3271,6 +3271,8 @@ sub process { # filename then : $line =~ /^\s*(?:Fixes:|$link_tags_search|$signature_tags)/i || # A Fixes:, link or signature tag line + $line =~ /^\s*(?:delete|create) mode\s+[0-8]+\s+\S+\s*$/i || + # A "create/delete mode <mode> <filename>" line found in cover letters $commit_log_possible_stack_dump)) { WARN("COMMIT_LOG_LONG_LINE", "Prefer a maximum 75 chars per line (possible unwrapped commit description?)\n" . $herecurr); --2.44.0.rc0.258.g7320e95886-goog