1
0
Fork 0
mirror of https://github.com/matomo-org/matomo-icons.git synced 2024-09-19 17:03:45 +02:00

add test for unnecessary files

This commit is contained in:
Lukas Winkler 2017-11-16 22:20:01 +01:00
parent 80e8427253
commit 94a65f18c3

View file

@ -158,8 +158,9 @@ def test_if_build_script_is_deleting_all_unneeded_files():
for pattern in build_script_regex.findall(build_script): for pattern in build_script_regex.findall(build_script):
deleted_files.extend(glob(pattern)) deleted_files.extend(glob(pattern))
for file in all_files: for file in all_files:
if not any(s in file for s in deleted_files) and not (file.startswith("./dist") or file.startswith("./tmp")) \ if not any(s in file for s in deleted_files) and not (
and file != "./README.md": file.startswith("./dist") or file.startswith("./tmp") or file.startswith("./vendor")
) and file != "./README.md":
print("{file} should be deleted by the build script".format(file=file)) print("{file} should be deleted by the build script".format(file=file))
error = True error = True
@ -175,6 +176,8 @@ def test_if_icons_are_indicated_to_be_improvable():
def look_for_search_and_social_icon(source, mode, outputdir): def look_for_search_and_social_icon(source, mode, outputdir):
global error
correct_files = []
for i, element in source.items(): for i, element in source.items():
if mode == "searchengines": if mode == "searchengines":
search_engine = element[0] search_engine = element[0]
@ -184,7 +187,14 @@ def look_for_search_and_social_icon(source, mode, outputdir):
url = next((url for url in urls if "{}" not in url and "/" not in url), False) url = next((url for url in urls if "{}" not in url and "/" not in url), False)
if url and not image_exists(outputdir + url): if url and not image_exists(outputdir + url):
print(url) print("icon for {icon} is missing".format(icon=url))
error = True
correct_files.append(url)
# print(correct_files)
for filetype in ["svg", "png", "gif", "jpg", "ico"]:
for file in glob(outputdir + "*.{ext}".format(ext=filetype)):
if os.path.splitext(os.path.basename(file))[0] not in correct_files:
print("{file} is not necessary".format(file=file))
def test_if_all_search_and_social_sites_have_an_icon(): def test_if_all_search_and_social_sites_have_an_icon():