diff --git a/tools/check-imports.py b/tools/check-imports.py index b71b4a9271dfc4..3aee9bf3b96ca6 100755 --- a/tools/check-imports.py +++ b/tools/check-imports.py @@ -5,10 +5,13 @@ import re import sys +def check_negative_cases(line, imported): + return re.match('using \w+::{0};'.format(imported), line) or re.match('^(\/\/)', line) + def do_exist(file_name, lines, imported): - if not any(not re.match('using \w+::{0};'.format(imported), line) and - re.search(imported, line) for line in lines): + if not any(not check_negative_cases(line, imported) and + re.search('(\b{0}\b)'.format(imported), line) for line in lines): print('File "{0}" does not use "{1}"'.format(file_name, imported)) return False return True