diff options
author | MyungJoo Ham <myungjoo.ham@samsung.com> | 2017-03-16 16:22:58 +0900 |
---|---|---|
committer | MyungJoo Ham <myungjoo.ham@samsung.com> | 2017-03-16 16:22:58 +0900 |
commit | 9818461b7b9a107343c735f06c6aa1f7fbdfb7c7 (patch) | |
tree | cf304a21fe7350ae5ab27eea53e2f9deab954934 /rule_checker.py | |
parent | 5238f3d5df712068e905be5b59cd765d56b9af39 (diff) | |
download | building-blocks-9818461b7b9a107343c735f06c6aa1f7fbdfb7c7.tar.gz building-blocks-9818461b7b9a107343c735f06c6aa1f7fbdfb7c7.tar.bz2 building-blocks-9818461b7b9a107343c735f06c6aa1f7fbdfb7c7.zip |
RULE: add rulechk 1.6/1.7. fix block defs accordingly
Change-Id: If83c96417c4318c2fafef70993c5ebd799f99c9e
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Diffstat (limited to 'rule_checker.py')
-rwxr-xr-x | rule_checker.py | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/rule_checker.py b/rule_checker.py index 539ee8a..abf4212 100755 --- a/rule_checker.py +++ b/rule_checker.py @@ -8,6 +8,11 @@ # This does not check all rules of "RULES" # This is a prototype with a lot of work in progress +# TODO: Context-Aware Rule Check. (inter-block relations) +# Check if root exists for RULE 1-6 +# Check if sub1 exists for RULE 1-7 +# Check if a block is "Suggested/Required" by another block (orphan check) + from __future__ import print_function @@ -76,14 +81,30 @@ def ruleCheckInc(file): report(file, lc, line) continue - # RULE 1-5 + 1-9 / there is - in the name + # RULE 1-9 for root block (1-5) if re.search('^\s*%package\s*root', line) and \ - not re.search('^\s*%package\s*root-[a-zA-Z0-9_]*\s*$', line): + not re.search('^\s*%package\s*root-[a-zA-Z0-9_]+\s*$', line): error += 1 print("ERROR: RULE 1.9 not met with root (RULE 1.5)") report(file, lc, line) continue + # RULE 1-9 for sub1 block (1-6) + if re.search('^\s*%package\s*sub1', line) and \ + not re.search('^\s*%package\s*sub1-[a-zA-Z0-9_]+-[a-zA-Z0-9_]+\s*$', line): + error += 1 + print("ERROR: RULE 1.9 not met with sub1 (RULE 1.6)") + report(file, lc, line) + continue + + # RULE 1-9 for sub2 block (1-7) + if re.search('^\s*%package\s*sub2', line) and \ + not re.search('^\s*%package\s*sub2-[a-zA-Z0-9_]+-[a-zA-Z0-9_]+-[a-zA-Z0-9_]+\s*$', line): + error += 1 + print("ERROR: RULE 1.9 not met with sub1 (RULE 1.7)") + report(file, lc, line) + continue + |