From aa6a07108643acc1762efa34ea39c6421389b66b Mon Sep 17 00:00:00 2001 From: Mark Zhuang Date: Fri, 25 Oct 2024 14:45:06 +0800 Subject: [PATCH] doc:style: do not use multiple empty lines Enable LINE_SPACING but only check multiple blank lines now Change-Id: I332d4d414a04eec8fc54b49d416a954d30592219 Signed-off-by: Mark Zhuang Reviewed-on: https://review.openocd.org/c/openocd/+/8365 Reviewed-by: zapb Reviewed-by: Jan Matyas Tested-by: jenkins Reviewed-by: Antonio Borneo --- .checkpatch.conf | 1 - doc/manual/style.txt | 2 +- tools/scripts/checkpatch.pl | 4 ++++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.checkpatch.conf b/.checkpatch.conf index 01be7a909..b95dbe271 100644 --- a/.checkpatch.conf +++ b/.checkpatch.conf @@ -14,7 +14,6 @@ --ignore ENOSYS --ignore FILE_PATH_CHANGES --ignore GERRIT_CHANGE_ID ---ignore LINE_SPACING --ignore LOGICAL_CONTINUATIONS --ignore MACRO_WITH_FLOW_CONTROL --ignore PARENTHESIS_ALIGNMENT diff --git a/doc/manual/style.txt b/doc/manual/style.txt index fa08f4de9..e8a375cdd 100644 --- a/doc/manual/style.txt +++ b/doc/manual/style.txt @@ -45,7 +45,7 @@ OpenOCD project. - use TAB characters for indentation; do NOT use spaces. - displayed TAB width is 4 characters. - use Unix line endings ('\\n'); do NOT use DOS endings ('\\r\\n') -- limit adjacent empty lines to at most two (2). +- do NOT use multiple empty lines. - remove any trailing empty lines at the end of source files - do not "comment out" code from the tree nor put it within a block @code diff --git a/tools/scripts/checkpatch.pl b/tools/scripts/checkpatch.pl index 1011b3305..89f0a2178 100755 --- a/tools/scripts/checkpatch.pl +++ b/tools/scripts/checkpatch.pl @@ -4040,6 +4040,7 @@ sub process { } } +if (!$OpenOCD) { # check for missing blank lines after struct/union declarations # with exceptions for various attributes and macros if ($prevline =~ /^[\+ ]};?\s*$/ && @@ -4059,6 +4060,7 @@ sub process { fix_insert_line($fixlinenr, "\+"); } } +} # !$OpenOCD # check for multiple consecutive blank lines if ($prevline =~ /^[\+ ]\s*$/ && @@ -4073,6 +4075,7 @@ sub process { $last_blank_line = $linenr; } +if (!$OpenOCD) { # check for missing blank lines after declarations # (declarations must have the same indentation and not be at the start of line) if (($prevline =~ /\+(\s+)\S/) && $sline =~ /^\+$1\S/) { @@ -4118,6 +4121,7 @@ sub process { } } } +} # !$OpenOCD # check for spaces at the beginning of a line. # Exceptions: