fix(codescan): clear the mechanical CodeQL notes and lint them away (WIP)

Work-in-progress commit on the collective code-scanning sidetree, so main
can be merged in; the single quality-high gate runs on the integration
branch before the pull request.

Fixes the CodeQL notes py/import-and-import-from, py/unused-import,
py/unused-global-variable, py/empty-except, py/mixed-tuple-returns and
py/unused-local-variable across 194 files, and adds one lint per rule under
tests/lint/repository/python/ so none of them can come back:
test_import_and_import_from, test_unused_imports_hidden_from_ruff,
test_unused_global_variables, test_empty_except, test_mixed_tuple_returns,
test_unused_local_variables, plus test_modules_import.

Accepted security finding: MEDUSA-MP-SCAN-2056 (low) on
utils/i18n/client.py:21, an import line matched by a keyword heuristic;
operator-confirmed false positive.

🎯 Fix: 85 %
💥 Break: 8 %
💸 Cost: –
⏱️ Time: –
🛡️ Security: 100 %
🏆 Score: 78
🚦 Gate: ⛔ fix 85 % < 90, break 8 % > 5

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
kevinveenbirkenbachandClaude Opus 5.5 committed 2026-11-13 18:44:29 +00:00
1 parent 3fdfce419e
commit 326f063bd3
194 files changed
+1663 -590

No files matched your search

@@ -10,8 +10,9 @@ from pathlib import Path
from tempfile import TemporaryDirectory
from utils.i18n.catalog import catalog_path, new_catalog, write_catalog
from utils.i18n.client import Outcome
from utils.i18n.languages import LANGUAGES_FILE
from utils.i18n.libretranslate import SERVICE_KEY, SERVICES_FILE, Outcome
from utils.i18n.libretranslate import SERVICE_KEY, SERVICES_FILE
cli = importlib.import_module("cli.build.i18n.__main__")
@@ -74,7 +75,9 @@ class TestTranslate(unittest.TestCase):
self.root = _checkout(self)
_catalog(self.root, "de", "Hallo")
def _run(self, requested: list[str] | None = None) -> tuple[int, mock.Mock, mock.Mock]:
def _run(
self, requested: list[str] | None = None
) -> tuple[int, mock.Mock, mock.Mock]:
started = mock.Mock(return_value=contextlib.nullcontext("http://lt"))
client = mock.Mock()
client.return_value.translate.side_effect = lambda texts, code: Outcome(