DoxyGen: Fixed broken links
- Link from General to PACK.xsd
- Link from General to CPRJ.xsd
- Link to Realtek
- Enhanced pack-lint config to reduce broken link warnings.
Change-Id: Ie1a597a26bb9ac79511a976ea7a9467181be108a
diff --git a/linter.py b/linter.py
index 1dcb486..cdbb0ed 100644
--- a/linter.py
+++ b/linter.py
@@ -280,10 +280,13 @@
"""Documentation"""
self.debug("Using pattern '%s'", pattern)
for html in iglob(pattern, recursive=True):
- self.info("%s: Checking links ...", html)
parser = AdvancedHTMLParser()
parser.parseFile(html)
links = parser.getElementsByTagName("a")
+ if links:
+ self.info("%s: Checking links ...", html)
+ else:
+ self.debug("%s: No links found...", html)
for l in links:
href = l.getAttribute("href")
if href:
@@ -292,6 +295,9 @@
try:
self.info("%s: Checking link to %s...", html, href.geturl())
r = requests.head(href.geturl(), headers={'user-agent' : "packlint/1.0"}, timeout=10)
+ if r.status_code >= 400:
+ self.debug(f'HEAD method failed with HTTP-{r.status_code}, falling back to GET method.')
+ r = requests.get(href.geturl(), headers={'user-agent': "packlint/1.0"}, timeout=10)
r.raise_for_status()
except (requests.exceptions.ConnectionError, requests.exceptions.HTTPError) as e:
exc_info = None