From b03fb569a59bca67c7ed0dc0f87f845da16f6343 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5kon=20V=2E=20Treider?= Date: Mon, 14 Aug 2023 21:29:11 +0200 Subject: [PATCH] Keep original spacing in docstring --- scripts/custom_checks/docstrings.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/custom_checks/docstrings.py b/scripts/custom_checks/docstrings.py index 41bcdcbae9..731dd84040 100644 --- a/scripts/custom_checks/docstrings.py +++ b/scripts/custom_checks/docstrings.py @@ -100,6 +100,9 @@ def parse_doc(doc): continue if line_indent == args_indent: idx_end = i + if not lines[i - 1].strip(): # Note: i-1 >= 0 + # If last line was empty, we keep the spacing: + idx_end -= 1 break if line_indent > args_indent + 4: # Assume multilines belong to previous line: