chore(lint): apply ruff --fix (4443 auto-fixes)

Auto-fixed categories:
- F401: unused imports removed
- I001: import blocks sorted
- W293: trailing whitespace stripped
- UP035: deprecated typing imports replaced
- SIM: simplify suggestions applied
- ARG: unused args prefixed with underscore
- T201: print statements removed
- F841: unused variables removed
- RUF059: unpacked variables prefixed

Remaining ~1500 unfixable errors (C901, B904, N806, E402) require manual work.

Backend smoke tests: 13/13 passed.
This commit is contained in:
2026-05-14 11:20:17 +03:00
parent a9a5eff518
commit c6189876b3
337 changed files with 4677 additions and 4515 deletions

View File

@@ -9,9 +9,9 @@ import curses
import json
import os
import sys
from datetime import datetime, timezone
from datetime import UTC, datetime
from types import SimpleNamespace
from typing import List, Optional, Any, Dict
from typing import Any
# Standardize sys.path for direct execution from project root or scripts dir.
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
@@ -28,11 +28,11 @@ from src.models.clean_release import (
CleanProfilePolicy,
ComplianceViolation,
ProfileType,
RegistryStatus,
ReleaseCandidate,
ReleaseCandidateStatus,
ResourceSourceEntry,
ResourceSourceRegistry,
RegistryStatus,
ReleaseCandidateStatus,
)
from src.services.clean_release.approval_service import approve_candidate
from src.services.clean_release.artifact_catalog_loader import load_bootstrap_artifacts
@@ -124,7 +124,7 @@ class TuiFacadeAdapter:
created_by=actor,
)
def get_overview(self, *, candidate_id: str) -> Dict[str, Any]:
def get_overview(self, *, candidate_id: str) -> dict[str, Any]:
candidate = self.repository.get_candidate(candidate_id)
manifests = self.repository.get_manifests_by_candidate(candidate_id)
latest_manifest = (
@@ -206,11 +206,11 @@ class CleanReleaseTUI:
self.facade = TuiFacadeAdapter(self.repo)
self.candidate_id = self._resolve_candidate_id()
self.status: Any = "READY"
self.checks_progress: List[Dict[str, Any]] = []
self.violations_list: List[ComplianceViolation] = []
self.report_id: Optional[str] = None
self.last_error: Optional[str] = None
self.overview: Dict[str, Any] = {}
self.checks_progress: list[dict[str, Any]] = []
self.violations_list: list[ComplianceViolation] = []
self.report_id: str | None = None
self.last_error: str | None = None
self.overview: dict[str, Any] = {}
self.refresh_overview()
curses.start_color()
@@ -230,7 +230,7 @@ class CleanReleaseTUI:
return repo
def _bootstrap_demo_repository(self, repository: CleanReleaseRepository) -> None:
now = datetime.now(timezone.utc)
now = datetime.now(UTC)
policy = CleanProfilePolicy(
policy_id="POL-ENT-CLEAN",
policy_version="1",
@@ -240,7 +240,7 @@ class CleanReleaseTUI:
prohibited_artifact_categories=["test-data"],
effective_from=now,
)
setattr(policy, "immutable", True)
policy.immutable = True
repository.save_policy(policy)
registry = ResourceSourceRegistry(
@@ -257,10 +257,10 @@ class CleanReleaseTUI:
updated_at=now,
updated_by="system",
)
setattr(registry, "immutable", True)
setattr(registry, "allowed_hosts", ["internal-repo.company.com"])
setattr(registry, "allowed_schemes", ["https"])
setattr(registry, "allowed_source_types", ["artifactory"])
registry.immutable = True
registry.allowed_hosts = ["internal-repo.company.com"]
registry.allowed_schemes = ["https"]
registry.allowed_source_types = ["artifactory"]
repository.save_registry(registry)
candidate = ReleaseCandidate(
id="2026.03.03-rc1",
@@ -307,10 +307,10 @@ class CleanReleaseTUI:
if not bootstrap_path:
return
with open(bootstrap_path, "r", encoding="utf-8") as bootstrap_file:
with open(bootstrap_path, encoding="utf-8") as bootstrap_file:
payload = json.load(bootstrap_file)
now = datetime.now(timezone.utc)
now = datetime.now(UTC)
candidate = ReleaseCandidate(
id=payload.get("candidate_id", "candidate-1"),
version=payload.get("version", "1.0.0"),
@@ -523,7 +523,7 @@ class CleanReleaseTUI:
result = self.facade.run_compliance(
candidate_id=self.candidate_id, actor="operator"
)
except Exception as exc: # noqa: BLE001
except Exception as exc:
self.status = CheckFinalStatus.FAILED
self.last_error = str(exc)
self.refresh_screen()
@@ -563,7 +563,7 @@ class CleanReleaseTUI:
self.violations_list = []
self.checks_progress = []
self.last_error = f"Manifest built: {manifest.id}"
except Exception as exc: # noqa: BLE001
except Exception as exc:
self.last_error = str(exc)
self.refresh_overview()
self.refresh_screen()
@@ -585,7 +585,7 @@ class CleanReleaseTUI:
try:
self.facade.approve_latest(candidate_id=self.candidate_id, actor="operator")
self.last_error = None
except Exception as exc: # noqa: BLE001
except Exception as exc:
self.last_error = str(exc)
self.refresh_overview()
self.refresh_screen()
@@ -598,7 +598,7 @@ class CleanReleaseTUI:
try:
self.facade.publish_latest(candidate_id=self.candidate_id, actor="operator")
self.last_error = None
except Exception as exc: # noqa: BLE001
except Exception as exc:
self.last_error = str(exc)
self.refresh_overview()
self.refresh_screen()
@@ -611,7 +611,7 @@ class CleanReleaseTUI:
try:
self.facade.publish_latest(candidate_id=self.candidate_id, actor="operator")
self.last_error = None
except Exception as exc: # noqa: BLE001
except Exception as exc:
self.last_error = str(exc)
self.refresh_overview()
self.refresh_screen()