in tools/check-license-header.py [0:0]
def walk_through_dir(d) -> bool:
checked = True
for root, sub_dirs, files in os.walk(d):
ignore = False
for exclude_dir in exclude_dirs:
if exclude_dir in root:
ignore = True
break
if ignore:
continue
for filename in files:
file_path = os.path.join(root, filename)
ignore = False
for exclude_file in exclude_files:
if filename.endswith(exclude_file):
ignore = True
if ignore:
continue
with open(file_path, 'r') as f:
header = ' '.join([
line.strip(ignored_chars) for line in f.readlines() if line.startswith(comment_leading_chars)
]).strip()
print('%s license header in file: %s' % ('✅' if license_header in header else '❌', file_path))
checked &= license_header in header
return checked