提交 0cebabd5 编写于 作者: L Lluís Vilanova 提交者: Paolo Bonzini

checkpatch: Fix whitespace checks for documentation code blocks

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: NLluís Vilanova <vilanova@ac.upc.edu>
Message-Id: <147325254382.22644.5531276787733455773.stgit@fimbulvetr.bsc.es>
Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
Signed-off-by: NLluís Vilanova <vilanova@ac.upc.edu>
上级 89943de1
......@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册