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

+5 -5
View File
@@ -17,7 +17,7 @@ import unittest
import unittest.mock as mock
from pathlib import Path
from utils.cache import _reset_cache_for_tests, base
from utils.cache import PROJECT_ROOT, _reset_cache_for_tests, base
from utils.domains.default_primary import default_domain_primary
from utils.paths import FILE_TOKENS
@@ -30,15 +30,15 @@ def _write(path: Path, content: str) -> None:
class TestProjectRootInvariants(unittest.TestCase):
"""`base.PROJECT_ROOT` must point at the actual repo root, not at
"""`PROJECT_ROOT` must point at the actual repo root, not at
`<repo>/utils/`. CI run 24934007615 was caused by exactly this
drift after `utils/cache/data.py` was moved one level deeper.
"""
def test_project_root_resolves_to_repo_root(self):
self.assertTrue((base.PROJECT_ROOT / "roles").is_dir())
self.assertTrue((base.PROJECT_ROOT / "cli").is_dir())
self.assertEqual(base.ROLES_DIR, base.PROJECT_ROOT / "roles")
self.assertTrue((PROJECT_ROOT / "roles").is_dir())
self.assertTrue((PROJECT_ROOT / "cli").is_dir())
self.assertEqual(base.ROLES_DIR, PROJECT_ROOT / "roles")
def test_default_tokens_file_is_secrets_yaml(self):
self.assertEqual(base.DEFAULT_TOKENS_FILE, FILE_TOKENS)
+1 -2
View File
@@ -5,10 +5,9 @@ import textwrap
import unittest
from pathlib import Path
from utils.cache import _reset_cache_for_tests
from utils.cache import PROJECT_ROOT, _reset_cache_for_tests
from utils.cache.applications import get_application_defaults
from utils.cache.base import (
PROJECT_ROOT,
ROLES_DIR,
_deep_merge,
_fingerprint_mapping,