utils/checkpackagelib: CommentsMenusPackagesOrder: remove '-comment' state before the '-menu' one

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>
This commit is contained in:
Jerzy Grzegorek 2019-10-05 14:22:15 +02:00 committed by Arnout Vandecappelle (Essensium/Mind)
parent b1c90467d8
commit dd251d68e5

View File

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