diff options
author | MyungJoo Ham <myungjoo.ham@samsung.com> | 2017-04-05 20:19:55 +0900 |
---|---|---|
committer | MyungJoo Ham <myungjoo.ham@samsung.com> | 2017-04-05 20:21:58 +0900 |
commit | a2041c6fa367550b665190d4b3f348a13b8963f7 (patch) | |
tree | 0d0ba2ff4c445c757b5038353cda745887b506bf | |
parent | 1ce3a14db230f4e89b1d327ccb6e0949685ddc86 (diff) | |
download | building-blocks-a2041c6fa367550b665190d4b3f348a13b8963f7.tar.gz building-blocks-a2041c6fa367550b665190d4b3f348a13b8963f7.tar.bz2 building-blocks-a2041c6fa367550b665190d4b3f348a13b8963f7.zip |
RULE: rule check on RULE 5.4
Change-Id: Ia804e4f662c931c3b70f28e648f0129f7bfc4a15
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
-rwxr-xr-x | rule_checker.py | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/rule_checker.py b/rule_checker.py index eaa574f..28e1658 100755 --- a/rule_checker.py +++ b/rule_checker.py @@ -117,13 +117,36 @@ def ruleCheckInc(file): continue else: # If it's just a package, skip checking. - c = re.sub(r'^\s*((Suggests)|(Requires)):\s*%{name}-', r'', line) - if c == line: + cname = re.sub(r'^\s*((Suggests)|(Requires)):\s*%{name}-', r'', line) + if cname == line: continue c = re.sub(r'^\s*((Suggests)|(Requires)):\s*%{name}-sub[12]-', r'', line) c = re.sub(r'\s*', r'', c) c = re.sub(r'\n', r'', c) + # RULE 5.4 + if n[:6] != "preset" and n[:7] != "feature": + level = blocks[n].level + clevel = 0 + if cname[:4] == 'root': + clevel = 0 + elif cname[:4] == 'sub1': + clevel = 1 + elif cname[:4] == 'sub2': + clevel = 2 + elif cname[:4] == 'sub3': + clevel = 3 + if (clevel - 1) != level: + error += 1 + print("ERROR: RULE 5.4. Non preset/feature block cannot have non-direct chile block as its dependents (Requires/Suggests). Level Mismatch") + report(file, lc, line) + continue + if c[:len(n)] != n: + error += 1 + print("ERROR: RULE 5.4. Non preset/feature block cannot have non-direct chile block as its dependents (Requires/Suggests). Child from another hierarchy.") + report(file, lc, line) + continue + cs = blocks[n].children cs.append(c) blocks[n]._replace(children = cs) |