qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v2] checkpatch: Fix whitespace checks for docume


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [PATCH v2] checkpatch: Fix whitespace checks for documentation code blocks
Date: Wed, 7 Sep 2016 14:54:03 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0


On 07/09/2016 14:49, Lluís Vilanova wrote:
> Prevent blank lines in documentation code blocks to be signalled as
> incorrect trailing whitespace.
> 
> Code blocks in documentation are 4-column aligned, and blank lines in
> them should have exactly 4 columns of trailing whitespace to prevent
> QEMU's wiki to render them as separate code blocks.
> 
> Signed-off-by: Lluís Vilanova <address@hidden>
> ---
>  scripts/checkpatch.pl |   10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index b0096a4..dde3f5f 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -1320,6 +1320,16 @@ sub process {
>                       my $herevet = "$here\n" . cat_vet($rawline) . "\n";
>                       ERROR("DOS line endings\n" . $herevet);
>  
> +             } elsif ($realfile =~ /^docs\/.+\.txt/ ||
> +                      $realfile =~ /^docs\/.+\.md/) {
> +                 if ($rawline =~ /^\+\s+$/ && $rawline !~ /^\+ {4}$/) {
> +                     # TODO: properly check we're in a code block
> +                     #       (surrounding text is 4-column aligned)
> +                     my $herevet = "$here\n" . cat_vet($rawline) . "\n";
> +                     ERROR("code blocks in documentation should have " .
> +                           "empty lines with exactly 4 columns of " .
> +                           "whitespace\n" . $herevet);
> +                 }
>               } elsif ($rawline =~ /^\+.*\S\s+$/ || $rawline =~ /^\+\s+$/) {
>                       my $herevet = "$here\n" . cat_vet($rawline) . "\n";
>                       ERROR("trailing whitespace\n" . $herevet);
> 

Queued for 2.8, thanks.

Paolo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]