Mercurial > hg
changeset 28920:cdf331b54eb8
import-checker: track SyntaxErrors
We don't really need to report SyntaxErrors, since in theory
docchecker or a test will catch them, but they happen, and
we can't just have the code crash, so for now, we're reporting
them.
author | timeless <timeless@mozdev.org> |
---|---|
date | Wed, 13 Apr 2016 16:36:19 +0000 |
parents | a94f34306bb9 |
children | 02ee31a50002 |
files | contrib/import-checker.py |
diffstat | 1 files changed, 11 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/contrib/import-checker.py Mon Apr 11 22:34:04 2016 +0000 +++ b/contrib/import-checker.py Wed Apr 13 16:36:19 2016 +0000 @@ -587,12 +587,17 @@ localmods[modname] = source_path for localmodname, source_path in sorted(localmods.items()): for src, modname in sources(source_path, localmodname): - used_imports[modname] = sorted( - imported_modules(src, modname, localmods, ignore_nested=True)) - for error, lineno in verify_import_convention(modname, src, - localmods): - any_errors = True - print('%s:%d: %s' % (source_path, lineno, error)) + try: + used_imports[modname] = sorted( + imported_modules(src, modname, localmods, + ignore_nested=True)) + for error, lineno in verify_import_convention(modname, src, + localmods): + any_errors = True + print('%s:%d: %s' % (source_path, lineno, error)) + except SyntaxError as e: + print('%s:%d: SyntaxError: %s' % + (source_path, e.lineno, e)) cycles = find_cycles(used_imports) if cycles: firstmods = set()