Skip to content

Commit

Permalink
fix: conflicting anchors check was broken
Browse files Browse the repository at this point in the history
  • Loading branch information
GetPsyched committed Nov 5, 2024
1 parent 4a72703 commit bdb2b66
Showing 1 changed file with 3 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,7 @@ def validate(self, xref_targets: dict[str, XrefTarget]):
orphan_identifiers = self._raw_redirects.keys() - xref_targets.keys()

client_side_redirects = {}
errors = []
server_side_redirects = {}
all_client_locations = set()
conflicting_anchors = set()
divergent_redirects = set()
identifiers_missing_current_outpath = set()
Expand All @@ -146,16 +144,14 @@ def validate(self, xref_targets: dict[str, XrefTarget]):
if '#' in location:
path, anchor = location.split('#')

if location in all_client_locations:
conflicting_anchors.add(location)
else:
all_client_locations.add(location)

if anchor in identifiers_without_redirects:
identifiers_without_redirects.remove(anchor)

if location not in client_side_redirects:
client_side_redirects[location] = f"{xref_targets[identifier].path}#{identifier}"
for identifier, xref_target in xref_targets.items():
if xref_target.path == path and anchor == identifier:
conflicting_anchors.add(anchor)
else:
divergent_redirects.add(location)
else:
Expand All @@ -164,11 +160,6 @@ def validate(self, xref_targets: dict[str, XrefTarget]):
else:
divergent_redirects.add(location)

for target in {location.split('#')[0] for location in all_client_locations}:
identifiers = [identifier for identifier, xref in xref_targets.items() if xref.path == target]
anchors = {location.split('#')[1] for location in all_client_locations}
conflicting_anchors |= anchors.intersection(identifiers)

client_paths_with_server_redirects = {}
for server_from, server_to in server_side_redirects.items():
for client_from, client_to in client_side_redirects.items():
Expand Down

0 comments on commit bdb2b66

Please sign in to comment.