1
0
Fork 0
mirror of https://github.com/Kozea/Radicale.git synced 2025-06-26 16:45:52 +00:00

Finish all checks before failing

This commit is contained in:
Unrud 2020-04-18 13:36:27 +02:00
parent 08fc1c21dc
commit 9586722387

View file

@ -15,6 +15,7 @@ def add_class(element, class_):
def main(): def main():
soup = BeautifulSoup(sys.stdin.buffer, "html.parser") soup = BeautifulSoup(sys.stdin.buffer, "html.parser")
checks_failed = False
# Mark the hierachical levels in the navigation # Mark the hierachical levels in the navigation
nav = soup.select("main nav")[0] nav = soup.select("main nav")[0]
@ -49,7 +50,7 @@ def main():
if element["id"] in visited_ids: if element["id"] in visited_ids:
print("ERROR: Duplicate id %r" % element["id"], print("ERROR: Duplicate id %r" % element["id"],
file=sys.stderr) file=sys.stderr)
exit(1) checks_failed = True
visited_ids.add(element["id"]) visited_ids.add(element["id"])
# Check for dead internal links # Check for dead internal links
@ -57,8 +58,10 @@ def main():
if link["href"][1:] not in visited_ids: if link["href"][1:] not in visited_ids:
print("ERROR: Dead internal link %r" % link["href"], print("ERROR: Dead internal link %r" % link["href"],
file=sys.stderr) file=sys.stderr)
exit(1) checks_failed = True
if checks_failed:
exit(1)
sys.stdout.buffer.write(soup.encode(formatter="html5") + b"\n") sys.stdout.buffer.write(soup.encode(formatter="html5") + b"\n")