Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 19 additions & 5 deletions tools/python/verify_doc_links.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@
"/bootstrapper/catalog_upload.json",
]

excluded_paths = [
"node_modules",
"temp",
]

script_folder = abspath(dirname(__file__))
project_root_dir = abspath(dirname(dirname(script_folder)))
github_repo_master_path = "{}/blob/master".format(GITHUB_REPO.rstrip("/"))
Expand All @@ -40,16 +45,25 @@ def find_md_files() -> [str]:
print(" " + path_expr.lstrip("/"))
print("")

md_files_list_of_lists = [glob(project_root_dir + path_expr, recursive=True)
for path_expr in md_file_path_expressions]
list_of_lists = [glob(project_root_dir + path_expr, recursive=True)
for path_expr in md_file_path_expressions]

flattened_list = list(itertools.chain(*list_of_lists))

filtered_list = [path for path in flattened_list
if not any(s in path for s in excluded_paths)]

return sorted(list(itertools.chain(*md_files_list_of_lists)))
return sorted(filtered_list)


def get_links_from_md_file(md_file_path: str) -> [(int, str, str)]: # -> [(line, link_text, URL)]
def get_links_from_md_file(md_file_path: str) -> [(int, str, str)]: # -> [(line, link_text, URL)]

with open(md_file_path, "r") as f:
md_file_content = f.read()
try:
md_file_content = f.read()
except ValueError as e:
print(f"Error trying to load file {md_file_path}")
raise e

folder = relpath(dirname(md_file_path), project_root_dir)

Expand Down