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 <yann.morin.1998@free.fr> Cc: Florian Fainelli <f.fainelli@gmail.com> Cc: Ricardo Martincoski <ricardo.martincoski@datacom.com.br> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com> (cherry picked from commit f9e6d39e8e0615d3a71ea1aef9d0d1e206f4c42c) Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
This commit is contained in:
parent
df7308ffef
commit
939e1df1d0
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user