<div><br></div><div><br><div class="gmail_quote"><div dir="auto">On Sa., 7. Nov. 2020 at 15:49, Aditya <<a href="mailto:yashsri421@gmail.com">yashsri421@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 7/11/20 5:47 pm, Aditya Srivastava wrote:<br>
> Currently, when a line exceeds 75 characters in a commit message,<br>
> <a href="http://checkpatch.pl" rel="noreferrer" target="_blank">checkpatch.pl</a> gives a warning corresponding to the same.<br>
> <br>
> E.g., running checkpatch on commit a1af2afbd244 ("drm/nouveau/volt:Fix<br>
> for some cards having 0 maximum voltage") we get this warning:<br>
> <br>
> WARNING: Possible unwrapped commit description (prefer a maximum 75<br>
> chars per line)<br>
> <br>
> Some, mostly Fermi, vbioses appear to have zero max voltage. That causes Nouveau to not parse voltage entries, thus users not being able to set higher clocks.<br>
> <br>
> Provide a fix by consuming first 70 chars of the corresponding line,<br>
> then stop at the next whitespace, and substitute it with the consumed<br>
> chars and a newline char.<br>
> <br>
> Signed-off-by: Aditya Srivastava <<a href="mailto:yashsri421@gmail.com" target="_blank">yashsri421@gmail.com</a>><br>
> ---<br>
>  scripts/<a href="http://checkpatch.pl" rel="noreferrer" target="_blank">checkpatch.pl</a> | 7 +++++--<br>
>  1 file changed, 5 insertions(+), 2 deletions(-)<br>
> <br>
> diff --git a/scripts/<a href="http://checkpatch.pl" rel="noreferrer" target="_blank">checkpatch.pl</a> b/scripts/<a href="http://checkpatch.pl" rel="noreferrer" target="_blank">checkpatch.pl</a><br>
> index 5a1096a4e220..ee665208ef02 100755<br>
> --- a/scripts/<a href="http://checkpatch.pl" rel="noreferrer" target="_blank">checkpatch.pl</a><br>
> +++ b/scripts/<a href="http://checkpatch.pl" rel="noreferrer" target="_blank">checkpatch.pl</a><br>
> @@ -2881,8 +2881,11 @@ sub process {<br>
>                     $line =~ /^\s*(?:Fixes:|Link:)/i ||<br>
>                                       # A Fixes: or Link: line<br>
>                     $commit_log_possible_stack_dump)) {<br>
> -                     WARN("COMMIT_LOG_LONG_LINE",<br>
> -                          "Possible unwrapped commit description (prefer a maximum 75 chars per line)\n" . $herecurr);<br>
> +                     if (WARN("COMMIT_LOG_LONG_LINE",<br>
> +                              "Possible unwrapped commit description (prefer a maximum 75 chars per line)\n" . $herecurr) &&<br>
> +                         $fix) {<br>
> +                             $fixed[$fixlinenr] =~ s/(.{70}[^\s]*)\s+/$1\n/g;<br>
> +                     }<br>
>                       $commit_log_long_line = 1;<br>
>               }<br>
>  <br>
> <br>
</blockquote><div dir="auto"><br></div><div dir="auto">Why do you not implement a proper word wrap function?</div><div dir="auto"><br></div><div dir="auto">A single commit tells us very little if this rule in <a href="http://checkpatch.pl">checkpatch.pl</a> really is a good rule or not. A proper evaluation of typical cases of long commit lines would help much more to improve this rule.</div><div dir="auto"><br></div><div dir="auto">Lukas</div><div dir="auto"><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
Changes made in v2:<br>
- Changing newline at whitespace instead of abrupt termination<br>
- The special line cases such as 'Link', 'Fixes' or code addition<br>
lines, etc. seem to be already excluded from this warning in the<br>
if-block statements above the warning statement.<br>
<br>
<br>
Thanks<br>
Aditya<br>
</blockquote></div></div>