Skip to content

Commit

Permalink
Do not verify links in project dependencies (machine-learning-exchang…
Browse files Browse the repository at this point in the history
…e#320)

Resolves machine-learning-exchange#319

Signed-off-by: Christian Kadner <ckadner@us.ibm.com>
Signed-off-by: Krishna Kumar <krishnakumar@ibm.com>
  • Loading branch information
ckadner authored and krishnakumar27 committed Mar 30, 2022
1 parent 64a225a commit b05742a
Showing 1 changed file with 19 additions and 5 deletions.
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

0 comments on commit b05742a

Please sign in to comment.