fixed sonarqube scan issues
Sonarqube Scanner / Build and analyze (push) Failing after 22s

This commit is contained in:
Florian Zumpe
2026-06-17 15:12:46 +02:00
parent 2442f8d458
commit 95026aac6e
28 changed files with 973 additions and 184 deletions
+22 -10
View File
@@ -1,17 +1,26 @@
#!/usr/bin/env python3
"""Ändert Routendaten und ersetzt optional die GPX-Datei."""
import argparse
from collections.abc import Sequence
from common import add_common_arguments, ask, ask_path, ask_with_default, client_from_args, run
parser = argparse.ArgumentParser(description="Wegwichtel-Route ändern")
add_common_arguments(parser)
parser.add_argument("--route-id", type=int)
parser.add_argument("--gpx")
args = parser.parse_args()
def action():
def build_parser() -> argparse.ArgumentParser:
parser = argparse.ArgumentParser(description="Wegwichtel-Route ändern")
add_common_arguments(parser)
parser.add_argument("--route-id", type=int)
parser.add_argument("--gpx")
return parser
def main(argv: Sequence[str] | None = None):
args = build_parser().parse_args(argv)
client = client_from_args(args)
route_id = ask("Route-ID", args.route_id, required=True, cast=int)
current = client.request("GET", f"/api/routes/{route_id}")
path = f"/api/routes/{route_id}"
current = client.request("GET", path)
fields = {
"name": ask_with_default("Name", current.get("name", "")),
"description": ask_with_default("Beschreibung", current.get("description", "")),
@@ -19,6 +28,9 @@ def action():
}
gpx = ask_path("Neue GPX-Datei (leer: unverändert)", args.gpx, required=False)
if gpx:
return client.request("PUT", f"/api/routes/{route_id}", fields=fields, files={"gpx": gpx})
return client.request("PUT", f"/api/routes/{route_id}", json_body=fields)
run(action)
return client.request("PUT", path, fields=fields, files={"gpx": gpx})
return client.request("PUT", path, json_body=fields)
if __name__ == "__main__":
run(main)