make sure mccacbe catches the syntax errors as warnings

This commit is contained in:
Tarek Ziade 2012-08-14 18:16:24 +02:00
parent 2c1d836b31
commit dd92d52f06

View file

@ -231,7 +231,7 @@ def get_code_complexity(code, min=7, filename='stdin'):
complex = []
try:
ast = parse(code)
except AttributeError:
except (AttributeError, SyntaxError):
e = sys.exc_info()[1]
sys.stderr.write("Unable to parse %s: %s\n" % (filename, e))
return 0