Skip to content

Commit

Permalink
add whitespace check for rosdep files (fix ros#3089)
Browse files Browse the repository at this point in the history
  • Loading branch information
dirk-thomas committed Feb 13, 2014
1 parent 5d66e0f commit 2a02118
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions scripts/check_rosdep.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,21 @@ def my_assert(val):
print_test("building yaml dict...")
try:
ydict = yaml.load(buf)

# ensure that values don't contain whitespaces
def walk(node):
if isinstance(node, dict):
for key, value in node.items():
walk(key)
walk(value)
if isinstance(node, list):
for value in node:
walk(value)
if isinstance(node, str) and re.search(r'\s', node):
print_err("value '%s' must not contain whitespaces" % node)
my_assert(False)
walk(ydict)

except Exception as e:
print_err("could not build the dict: %s" % (str(e)))
my_assert(False)
Expand Down

0 comments on commit 2a02118

Please sign in to comment.