diff --git a/pyproject.toml b/pyproject.toml index 6c781a8..2d9428d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -72,3 +72,19 @@ markers = [ "installer: Tests verifying installer and packaging", "live: End-to-end tests requiring real user credentials", ] + +[tool.ruff] +line-length = 120 +target-version = "py310" +extend-exclude = ["legacy", ".venv"] + +[tool.ruff.lint] +# Bug-catching rules only, so CI gives a real signal today. +# E9 - syntax / IO errors F63 - comparison & assert mistakes +# F7 - misplaced statements F82 - undefined names +# F811 - redefinition of an in-use name +# Style and modernization rules (UP, I, BLE, S, SIM, RUF) are intentionally +# left off: the codebase currently has ~1200 such findings, and enabling them +# wholesale would keep CI red instead of catching defects. Burn them down in +# a dedicated pass, then extend this list. +select = ["E9", "F63", "F7", "F82", "F811"] diff --git a/scripts/live_provision_and_validate.py b/scripts/live_provision_and_validate.py index 7c49a5e..5617cab 100644 --- a/scripts/live_provision_and_validate.py +++ b/scripts/live_provision_and_validate.py @@ -14,7 +14,7 @@ import os import sys import time from pathlib import Path -from typing import Any, Dict, List, Optional +from typing import Tuple, Any, Dict, List, Optional REPO_ROOT = Path(__file__).resolve().parent.parent for p in [ diff --git a/src/antigravity_provider/router/auto_assigner.py b/src/antigravity_provider/router/auto_assigner.py index 75d631d..7beb300 100644 --- a/src/antigravity_provider/router/auto_assigner.py +++ b/src/antigravity_provider/router/auto_assigner.py @@ -335,7 +335,8 @@ class AutoAssigner: "provider_label": provider_label, "logical_role": log_role, "tier": tier, - "is_main": is_main, + "is_main": (pid == main_ag and pcfg.provider == "antigravity") + or (pid == main_codex and pcfg.provider == "openai-codex"), "identity": ident.primary_identifier() if is_auth else "Не авторизован", "plan": ident.plan.display_name if is_auth else "Тариф: неизвестен", "quota_str": relevant_bucket.formatted_remaining() if relevant_bucket else "Квота: доступна", diff --git a/src/antigravity_provider/router/hermes_hub_app.py b/src/antigravity_provider/router/hermes_hub_app.py index c58806b..ef360cf 100644 --- a/src/antigravity_provider/router/hermes_hub_app.py +++ b/src/antigravity_provider/router/hermes_hub_app.py @@ -47,7 +47,7 @@ from antigravity_provider.router.adapters import get_adapter from antigravity_provider.router.ui.theme import Theme from antigravity_provider.router.ui.assets import AssetManager -from antigravity_provider.router.ui.components import HubButton +from antigravity_provider.router.ui.components import HubButton, HubModal from antigravity_provider.router.ui.add_account_wizard import AddAccountWizard from antigravity_provider.router.unified_health import ( @@ -370,7 +370,7 @@ class HermesHubApp(ctk.CTk): except Exception as e: if not self._shutting_down: try: - self.after(0, lambda: self._on_data_error(str(e))) + self.after(0, lambda err=str(e): self._on_data_error(err)) except Exception: pass @@ -522,9 +522,9 @@ class HermesHubApp(ctk.CTk): if not self._shutting_down: try: if on_error: - self.after(0, lambda: on_error(str(e))) + self.after(0, lambda err=str(e): on_error(err)) else: - self.after(0, lambda: self._show_toast(f"❌ Ошибка: {e}")) + self.after(0, lambda err=str(e): self._show_toast(f"❌ Ошибка: {err}")) except Exception: pass diff --git a/src/antigravity_provider/router/ui/assets.py b/src/antigravity_provider/router/ui/assets.py index 48a4c9a..6f1d53d 100644 --- a/src/antigravity_provider/router/ui/assets.py +++ b/src/antigravity_provider/router/ui/assets.py @@ -3,7 +3,7 @@ from __future__ import annotations import os from pathlib import Path -from typing import Dict, Optional, Tuple +from typing import Any, Dict, Optional, Tuple try: from PIL import Image