1+ # *******************************************************************************
2+ # Copyright (c) 2026 Contributors to the Eclipse Foundation
3+ #
4+ # See the NOTICE file(s) distributed with this work for additional
5+ # information regarding copyright ownership.
6+ #
7+ # This program and the accompanying materials are made available under the
8+ # terms of the Apache License Version 2.0 which is available at
9+ # https://www.apache.org/licenses/LICENSE-2.0
10+ #
11+ # SPDX-License-Identifier: Apache-2.0
12+ # *******************************************************************************
113import argparse
214import re
315import sys
@@ -51,18 +63,16 @@ def generate_markdown_table(broken_links: list[BrokenLink]) -> str:
5163 table += "|----------|-------------|-----------|\n "
5264
5365 for link in broken_links :
54- table += (
55- f"| { link .location } | { link .line_nr } | { link .reasoning } |\n "
56- )
66+ table += f"| { link .location } | { link .line_nr } | { link .reasoning } |\n "
5767
5868 return table
5969
6070
6171def generate_issue_body (broken_links : list [BrokenLink ]) -> str :
6272 markdown_table = generate_markdown_table (broken_links )
6373 return f"""
64- # Broken Links Report.
65- **Last updated: { datetime .now ().strftime (' %d-%m-%Y %H:%M' )} **
74+ # Broken Links Report.
75+ **Last updated: { datetime .now ().strftime (" %d-%m-%Y %H:%M" )} **
6676
6777The following broken links were detected in the documentation:
6878{ markdown_table }
@@ -71,9 +81,10 @@ def generate_issue_body(broken_links: list[BrokenLink]) -> str:
7181
7282> To test locally if all link issues are resolved use `bazel run //:docs_link_check`
7383
74- ---
84+ ---
7585This issue will be auto updated regularly if link issues are found.
76- You may close it if you wish, though a new one will be created if link issues are still present.
86+ You may close it if you wish.
87+ Though a new one will be created if link issues are still present.
7788
7889"""
7990
@@ -85,11 +96,11 @@ def strip_ansi_codes(text: str) -> str:
8596
8697
8798if __name__ == "__main__" :
88- argparse = argparse .ArgumentParser (
99+ arg = argparse .ArgumentParser (
89100 description = "Parse broken links from Sphinx log and generate issue body."
90101 )
91- argparse .add_argument ("logfile" , type = str , help = "Path to the Sphinx log file." )
92- args = argparse .parse_args ()
102+ arg .add_argument ("logfile" , type = str , help = "Path to the Sphinx log file." )
103+ args = arg .parse_args ()
93104 with open (args .logfile ) as f :
94105 log_content_raw = f .read ()
95106 log_content = strip_ansi_codes (log_content_raw )
0 commit comments