summaryrefslogtreecommitdiff
path: root/rule_checker.py
diff options
context:
space:
mode:
authorMyungJoo Ham <myungjoo.ham@samsung.com>2017-04-10 19:10:13 +0900
committerMyungJoo Ham <myungjoo.ham@samsung.com>2017-04-10 19:10:13 +0900
commit3511c910969e613d655c67bbb4427e11a728b83e (patch)
tree6bf6d39f6a9bca2c8488197e82c742e83a12f6bc /rule_checker.py
parentca968ed30bb3f0c0d41a3182a7f7d890c2355f8e (diff)
downloadbuilding-blocks-3511c910969e613d655c67bbb4427e11a728b83e.tar.gz
building-blocks-3511c910969e613d655c67bbb4427e11a728b83e.tar.bz2
building-blocks-3511c910969e613d655c67bbb4427e11a728b83e.zip
- Added a rule - Added the rule check in rule checker - Corrected violating blocks. Change-Id: I5e1006a1dafeb35a5344a2da8e1eef316898d3ff Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Diffstat (limited to 'rule_checker.py')
-rwxr-xr-xrule_checker.py16
1 files changed, 15 insertions, 1 deletions
diff --git a/rule_checker.py b/rule_checker.py
index 910f680..2578d5f 100755
--- a/rule_checker.py
+++ b/rule_checker.py
@@ -23,6 +23,7 @@ def print_v(*args):
Block = collections.namedtuple('Block', 'name level parent children description files')
blocks = {}
+referedblock = []
def report(file, lc, code):
print(file + ":Line " + str(lc) + " |"+code)
@@ -30,6 +31,8 @@ def report(file, lc, code):
def ruleCheckInterBlock():
global blocks
+ global referedblock
+
error = 0
warning = 0
root_suggested = {}
@@ -70,15 +73,24 @@ def ruleCheckInterBlock():
if found == 0:
error += 1
print("ERROR: Orphaned sub block. The block "+n+" is not registered at the parent block "+p+" although "+p+" exists.")
-
# TODO: Add more rules here?
+ # Check if Required/Suggested blocks exist in this repo
+ for refered in referedblock:
+ if not refered in blocks:
+ error += 1
+ print("ERROR: A nonexisting block '"+refered+"' is refered.")
+
+
+
+
return (error, warning)
def ruleCheckInc(file):
global blocks
+ global referedblock
print_v("Checking "+file)
@@ -153,6 +165,8 @@ def ruleCheckInc(file):
report(file, lc, line)
continue
+ referedblock.append(cname[5:].strip())
+
cs = blocks[n].children
cs.append(c)
blocks[n]._replace(children = cs)