Skip to content

Commit 6f673dc

Browse files
committed
tools: Commented lines with spaces/tabs will also be ignored now
The script check-imports.py will now ignore commented lines with spaces/tabs, and this fix also pointed the check to the correct src folder. Fixes: nodejs#29226
1 parent 3f7f560 commit 6f673dc

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

tools/check-imports.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66
import sys
77

88
def check_negative_cases(line, imported):
9-
return re.match('using \w+::{0};'.format(imported), line) or re.match('^(\/\/)', line)
9+
return re.match('using \w+::{0};'.format(imported), line) or re.match('^( )*(\t)*(\/\/)', line)
1010

1111

1212
def do_exist(file_name, lines, imported):
13-
if not any(not check_negative_cases(line, imported) and
14-
re.search('(\b{0}\b)'.format(imported), line) for line in lines):
13+
if not any((not check_negative_cases(line, imported)) and
14+
re.search(r'(\b{0}\b)'.format(imported), line) for line in lines):
1515
print('File "{0}" does not use "{1}"'.format(file_name, imported))
1616
return False
1717
return True
@@ -42,4 +42,4 @@ def is_valid(file_name):
4242
else:
4343
return valid
4444

45-
sys.exit(0 if all(map(is_valid, glob.iglob('src/*.cc'))) else 1)
45+
sys.exit(0 if all(map(is_valid, glob.iglob('../src/*.cc'))) else 1)

0 commit comments

Comments
 (0)