utils/checkpackagelib: CommentsMenusPackagesOrder: remove '-comment' state before...
authorJerzy Grzegorek <jerzy.m.grzegorek@gmail.com>
Sat, 5 Oct 2019 12:22:15 +0000 (14:22 +0200)
committerArnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Mon, 7 Oct 2019 21:39:21 +0000 (23:39 +0200)
A comment is considered an alternative delimiter like a menu. I.e.,
a menu that comes after a comment should not be considered a submenu of
that comment. Therefore, remove the '-comment' state before adding the
'-menu' one.

Signed-off-by: Jerzy Grzegorek <jerzy.m.grzegorek@gmail.com>
Cc: Ricardo Martincoski <ricardo.martincoski@gmail.com>
Reviewed-by: Ricardo Martincoski <ricardo.martincoski@gmail.com>
Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
utils/checkpackagelib/lib_config.py

index fc0df3dd173fb1152f65ddcce9b71dceab7b9ea6..499660feb72abac421bb5a8168d45ea3d05bef2d 100644 (file)
@@ -107,6 +107,9 @@ class CommentsMenusPackagesOrder(_CheckFunction):
                     self.state += "-if"
 
                 elif text.startswith("menu"):
+                    if self.state.endswith("-comment"):
+                        self.state = self.state[:-8]
+
                     self.state += "-menu"
 
             self.initialize_level_elements(text)