Skip to content

Commit

Permalink
ci: Please pre-commit hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
ewuerger committed Nov 1, 2023
1 parent fa41f2a commit db39fa7
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions capella_git_hooks/fix_links.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
See https://github.com/eclipse/capella/issues/2725 for more information.
"""
from __future__ import annotations

import os
import re
import subprocess
Expand Down Expand Up @@ -57,6 +59,7 @@ def get_unmodified_tracked_files() -> list[str]:
def search_and_replace(
pattern: re.Pattern, value: str, replacement: str
) -> str | None:
"""Return the patched value or the unpatched value."""
while match := pattern.search(value):
index_match = match.span(1)
value = value[: index_match[0]] + replacement + value[index_match[1] :]
Expand All @@ -66,6 +69,7 @@ def search_and_replace(
def fix_semantic_resources(
root: ET._Element, root_repl: str, fragment_repl: str
) -> bool:
"""Patch the semantic resource file paths and return a bool."""
changed = False
danalysis = next(root.iterchildren(DIAGRAM_OVERVIEW_TAG))
for resource in danalysis.iterchildren("semanticResources"):
Expand Down

0 comments on commit db39fa7

Please sign in to comment.