From 9c0331ee54385dadc51b0fc706e73befa93acdbd Mon Sep 17 00:00:00 2001 From: "Pierre R. Mai" Date: Sat, 6 Feb 2021 15:52:19 +0100 Subject: [PATCH] Make handling of enums in rules check more robust Earlier versions of this check erroneously treated the end of an enum as the end of its enclosing message, leading to problems with nested enums if they appeared not at the end of its enclosing messages. Signed-off-by: Pierre R. Mai --- tests/test_rules.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tests/test_rules.py b/tests/test_rules.py index c5c0036f7..d20c96e29 100644 --- a/tests/test_rules.py +++ b/tests/test_rules.py @@ -92,11 +92,10 @@ def test_rules_compliance(self): # Search for a closing brace. matchClosingBrace = re.search("}", statement) - if numMessage > 0 and matchClosingBrace is not None: - numMessage -= 1 - if isEnum is True and matchClosingBrace is not None: isEnum = False + elif numMessage > 0 and matchClosingBrace is not None: + numMessage -= 1 if matchComment is not None: if re.search(r"^[ ]\\\bendrules\b$", comment) is not None: @@ -130,4 +129,4 @@ def test_rules_compliance(self): lineruleCount += 1 if __name__ == '__main__': - unittest.main() \ No newline at end of file + unittest.main()