[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 46/58] checkpatch: Fix whitespace checks for document
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PULL 46/58] checkpatch: Fix whitespace checks for documentation code blocks |
Date: |
Tue, 13 Sep 2016 19:16:17 +0200 |
From: Lluís Vilanova <address@hidden>
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>
Message-Id: <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
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);
--
1.8.3.1
- [Qemu-devel] [PULL 38/58] sclpconsolelm: remove bogus check for -EAGAIN, (continued)
- [Qemu-devel] [PULL 38/58] sclpconsolelm: remove bogus check for -EAGAIN, Paolo Bonzini, 2016/09/13
- [Qemu-devel] [PULL 37/58] ipmi: check return of qemu_chr_fe_write() for errors, Paolo Bonzini, 2016/09/13
- [Qemu-devel] [PULL 40/58] char: convert qemu_chr_fe_write to qemu_chr_fe_write_all, Paolo Bonzini, 2016/09/13
- [Qemu-devel] [PULL 39/58] hw: replace most use of qemu_chr_fe_write with qemu_chr_fe_write_all, Paolo Bonzini, 2016/09/13
- [Qemu-devel] [PULL 42/58] i8257: Make device "i8257" unavailable with -device, Paolo Bonzini, 2016/09/13
- [Qemu-devel] [PULL 43/58] kvm-all: drop kvm_setup_guest_memory, Paolo Bonzini, 2016/09/13
- [Qemu-devel] [PULL 41/58] Revert "megasas: remove useless check for cmd->frame", Paolo Bonzini, 2016/09/13
- [Qemu-devel] [PULL 36/58] default-configs: remove CONFIG_PIIX_PCI, Paolo Bonzini, 2016/09/13
- [Qemu-devel] [PULL 45/58] atomics: Use __atomic_*_n() variant primitives, Paolo Bonzini, 2016/09/13
- [Qemu-devel] [PULL 44/58] atomics: Remove redundant barrier()'s, Paolo Bonzini, 2016/09/13
- [Qemu-devel] [PULL 46/58] checkpatch: Fix whitespace checks for documentation code blocks,
Paolo Bonzini <=
- [Qemu-devel] [PULL 47/58] optionrom: do not rely on compiler's bswap optimization, Paolo Bonzini, 2016/09/13
- [Qemu-devel] [PULL 51/58] cutils: Remove SPLAT macro, Paolo Bonzini, 2016/09/13
- [Qemu-devel] [PULL 54/58] cutils: Remove aarch64 buffer zero checking, Paolo Bonzini, 2016/09/13
- [Qemu-devel] [PULL 49/58] ppc: do not redefine CPUPPCState, Paolo Bonzini, 2016/09/13
- [Qemu-devel] [PULL 53/58] cutils: Rearrange buffer_is_zero acceleration, Paolo Bonzini, 2016/09/13
- [Qemu-devel] [PULL 50/58] cutils: Move buffer_is_zero and subroutines to a new file, Paolo Bonzini, 2016/09/13
- [Qemu-devel] [PULL 52/58] cutils: Export only buffer_is_zero, Paolo Bonzini, 2016/09/13
- [Qemu-devel] [PULL 56/58] cutils: Add test for buffer_is_zero, Paolo Bonzini, 2016/09/13
- [Qemu-devel] [PULL 58/58] cutils: Add generic prefetch, Paolo Bonzini, 2016/09/13
- [Qemu-devel] [PULL 55/58] cutils: Remove ppc buffer zero checking, Paolo Bonzini, 2016/09/13