From f9e6d39e8e0615d3a71ea1aef9d0d1e206f4c42c Mon Sep 17 00:00:00 2001 From: "Yann E. MORIN" Date: Sat, 7 Sep 2024 19:31:23 +0200 Subject: [PATCH] utils/check-package: require exactly 1 TAB and 2 SP on help text 1st line Test that the first line starts exactly with one TAB and exactly two spaces before the text. Signed-off-by: Yann E. MORIN Cc: Florian Fainelli Cc: Ricardo Martincoski Signed-off-by: Thomas Petazzoni --- utils/checkpackagelib/lib_config.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/utils/checkpackagelib/lib_config.py b/utils/checkpackagelib/lib_config.py index f26ca0d898..bf975d7a3b 100644 --- a/utils/checkpackagelib/lib_config.py +++ b/utils/checkpackagelib/lib_config.py @@ -154,6 +154,7 @@ class CommentsMenusPackagesOrder(_CheckFunction): class HelpText(_CheckFunction): HELP_TEXT_FORMAT = re.compile(r"^\t .{,62}$") + HELP_TEXT_FORMAT_1 = re.compile(r"^\t \S.{,61}$") URL_ONLY = re.compile(r"^(http|https|git)://\S*$") def before(self): @@ -170,12 +171,18 @@ class HelpText(_CheckFunction): return if text.strip() == "help": self.help_text = True + self.help_first_line = True return if not self.help_text: return - if self.HELP_TEXT_FORMAT.match(text.rstrip()): + if self.help_first_line: + help_text_match = self.HELP_TEXT_FORMAT_1 + self.help_first_line = False + else: + help_text_match = self.HELP_TEXT_FORMAT + if help_text_match.match(text.rstrip()): return if self.URL_ONLY.match(text.strip()): return