From baf5ebff5156b582e80c6cb2006a476a92ae65ef Mon Sep 17 00:00:00 2001 From: Sam Date: Sun, 12 Apr 2026 17:32:42 +1000 Subject: [PATCH 1/3] fix: remove 20 unused imports across 15 files MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Removes imports and one unused variable flagged by desloppify's auto/unused detector. No logic changes — import-only cleanup. --- desloppify/app/commands/helpers/queue_progress.py | 3 --- desloppify/app/commands/helpers/transition_messages.py | 6 +----- desloppify/app/commands/persona_qa/profiles.py | 2 -- desloppify/app/commands/plan/triage/stage_queue.py | 2 -- desloppify/app/commands/plan/triage/stages/helpers.py | 2 +- desloppify/app/commands/scan/reporting/agent_context.py | 4 ---- desloppify/engine/_plan/sync/pipeline.py | 1 - desloppify/engine/_scoring/state_integration_subjective.py | 2 -- desloppify/engine/_scoring/subjective/core.py | 5 ----- desloppify/engine/detectors/advocacy_language.py | 1 - desloppify/engine/detectors/advocacy_security.py | 1 - desloppify/languages/_framework/frameworks/registry.py | 2 -- desloppify/tests/commands/plan/test_strategist.py | 2 -- desloppify/tests/engine/test_schema_scores_json_default.py | 2 +- desloppify/tests/plan/test_queue_metadata.py | 3 --- 15 files changed, 3 insertions(+), 35 deletions(-) diff --git a/desloppify/app/commands/helpers/queue_progress.py b/desloppify/app/commands/helpers/queue_progress.py index 9c9490d52..719243a9b 100644 --- a/desloppify/app/commands/helpers/queue_progress.py +++ b/desloppify/app/commands/helpers/queue_progress.py @@ -10,9 +10,6 @@ from desloppify.base.exception_sets import PLAN_LOAD_EXCEPTIONS from desloppify.app.commands.helpers.dynamic_loaders import load_score_update_module from desloppify.base.output.terminal import colorize -from desloppify.engine._plan.refresh_lifecycle import ( - current_lifecycle_phase, -) from desloppify.engine.plan_state import load_plan from desloppify.state_scoring import score_snapshot from desloppify.engine._work_queue.core import QueueBuildOptions diff --git a/desloppify/app/commands/helpers/transition_messages.py b/desloppify/app/commands/helpers/transition_messages.py index 573ca9061..6f648e4f9 100644 --- a/desloppify/app/commands/helpers/transition_messages.py +++ b/desloppify/app/commands/helpers/transition_messages.py @@ -10,11 +10,7 @@ from desloppify.base.config import load_config from desloppify.base.output.user_message import print_user_message -from desloppify.engine._plan.refresh_lifecycle import ( - LIFECYCLE_PHASE_EXECUTE, - LIFECYCLE_PHASE_SCAN, - user_facing_mode, -) +from desloppify.engine._plan.refresh_lifecycle import user_facing_mode logger = logging.getLogger(__name__) diff --git a/desloppify/app/commands/persona_qa/profiles.py b/desloppify/app/commands/persona_qa/profiles.py index 78410af60..15a8561d5 100644 --- a/desloppify/app/commands/persona_qa/profiles.py +++ b/desloppify/app/commands/persona_qa/profiles.py @@ -2,8 +2,6 @@ from __future__ import annotations -import glob -import os from pathlib import Path from typing import Any diff --git a/desloppify/app/commands/plan/triage/stage_queue.py b/desloppify/app/commands/plan/triage/stage_queue.py index 993b20642..5ca15e167 100644 --- a/desloppify/app/commands/plan/triage/stage_queue.py +++ b/desloppify/app/commands/plan/triage/stage_queue.py @@ -6,13 +6,11 @@ from desloppify.base.output.terminal import colorize from desloppify.engine._plan.triage.lifecycle import ( - clear_triage_stage_skips, has_triage_in_queue, inject_triage_stages, ) from desloppify.engine.plan_ops import purge_ids from desloppify.engine.plan_state import PlanModel -from desloppify.engine.plan_triage import TRIAGE_STAGE_IDS STAGE_ORDER = ["strategize", "observe", "reflect", "organize", "enrich", "sense-check"] diff --git a/desloppify/app/commands/plan/triage/stages/helpers.py b/desloppify/app/commands/plan/triage/stages/helpers.py index bf1860d8f..36f09b761 100644 --- a/desloppify/app/commands/plan/triage/stages/helpers.py +++ b/desloppify/app/commands/plan/triage/stages/helpers.py @@ -4,7 +4,7 @@ from desloppify.base.output.terminal import colorize from desloppify.engine._plan.constants import is_synthetic_id -from desloppify.engine._state.issue_semantics import is_review_work_item, is_triage_finding +from desloppify.engine._state.issue_semantics import is_review_work_item from desloppify.engine.plan_triage import TRIAGE_IDS from ..review_coverage import ( diff --git a/desloppify/app/commands/scan/reporting/agent_context.py b/desloppify/app/commands/scan/reporting/agent_context.py index dc2e248ed..a45ca4ed9 100644 --- a/desloppify/app/commands/scan/reporting/agent_context.py +++ b/desloppify/app/commands/scan/reporting/agent_context.py @@ -10,10 +10,6 @@ from desloppify import state as state_mod from desloppify.base.output.user_message import print_user_message from desloppify.app.commands.helpers.rendering import _count_cluster_remaining -from desloppify.app.commands.update_skill import ( - resolve_interface, - update_installed_skill, -) from desloppify.base import registry as registry_mod from desloppify.app import skill_docs as skill_docs_mod from desloppify.base.exception_sets import PLAN_LOAD_EXCEPTIONS diff --git a/desloppify/engine/_plan/sync/pipeline.py b/desloppify/engine/_plan/sync/pipeline.py index cca275443..661aa6cd9 100644 --- a/desloppify/engine/_plan/sync/pipeline.py +++ b/desloppify/engine/_plan/sync/pipeline.py @@ -11,7 +11,6 @@ WORKFLOW_COMMUNICATE_SCORE_ID, WORKFLOW_CREATE_PLAN_ID, WORKFLOW_DEFERRED_DISPOSITION_ID, - WORKFLOW_IMPORT_SCORES_ID, WORKFLOW_RUN_SCAN_ID, WORKFLOW_SCORE_CHECKPOINT_ID, QueueSyncResult, diff --git a/desloppify/engine/_scoring/state_integration_subjective.py b/desloppify/engine/_scoring/state_integration_subjective.py index 4261feb43..dba17de05 100644 --- a/desloppify/engine/_scoring/state_integration_subjective.py +++ b/desloppify/engine/_scoring/state_integration_subjective.py @@ -2,8 +2,6 @@ from __future__ import annotations -from copy import deepcopy - from desloppify.engine._scoring.policy.core import matches_target_score _SUBJECTIVE_TARGET_RESET_THRESHOLD = 2 diff --git a/desloppify/engine/_scoring/subjective/core.py b/desloppify/engine/_scoring/subjective/core.py index 45d1b99a0..af32ca3b4 100644 --- a/desloppify/engine/_scoring/subjective/core.py +++ b/desloppify/engine/_scoring/subjective/core.py @@ -56,11 +56,6 @@ def _compute_dimension_score( if isinstance(assessment, dict) else 0.0 ) - integrity_penalty = ( - assessment.get("integrity_penalty") - if isinstance(assessment, dict) - else None - ) reset_pending = bool( isinstance(assessment, dict) and ( diff --git a/desloppify/engine/detectors/advocacy_language.py b/desloppify/engine/detectors/advocacy_language.py index adc53a70c..ce51900bc 100644 --- a/desloppify/engine/detectors/advocacy_language.py +++ b/desloppify/engine/detectors/advocacy_language.py @@ -10,7 +10,6 @@ from __future__ import annotations import logging -import os import re from dataclasses import dataclass, field from pathlib import Path diff --git a/desloppify/engine/detectors/advocacy_security.py b/desloppify/engine/detectors/advocacy_security.py index dd7c3faca..d6765fde7 100644 --- a/desloppify/engine/detectors/advocacy_security.py +++ b/desloppify/engine/detectors/advocacy_security.py @@ -16,7 +16,6 @@ from __future__ import annotations import logging -import os import re from pathlib import Path from typing import Any diff --git a/desloppify/languages/_framework/frameworks/registry.py b/desloppify/languages/_framework/frameworks/registry.py index fe2bb5fb0..db8aa3e82 100644 --- a/desloppify/languages/_framework/frameworks/registry.py +++ b/desloppify/languages/_framework/frameworks/registry.py @@ -2,8 +2,6 @@ from __future__ import annotations -from collections.abc import Iterable - from .types import FrameworkSpec FRAMEWORK_SPECS: dict[str, FrameworkSpec] = {} diff --git a/desloppify/tests/commands/plan/test_strategist.py b/desloppify/tests/commands/plan/test_strategist.py index e586182bd..236a612a1 100644 --- a/desloppify/tests/commands/plan/test_strategist.py +++ b/desloppify/tests/commands/plan/test_strategist.py @@ -5,8 +5,6 @@ import argparse from types import SimpleNamespace -import pytest - import desloppify.app.commands.plan.triage.stages.strategize as strategize_mod from desloppify.app.cli_support.parser_groups_plan_impl_sections_triage_commit_scan import ( _add_triage_subparser, diff --git a/desloppify/tests/engine/test_schema_scores_json_default.py b/desloppify/tests/engine/test_schema_scores_json_default.py index c08eb8576..51c3aa876 100644 --- a/desloppify/tests/engine/test_schema_scores_json_default.py +++ b/desloppify/tests/engine/test_schema_scores_json_default.py @@ -9,7 +9,7 @@ import dataclasses import json -from pathlib import Path, PurePosixPath +from pathlib import Path import pytest diff --git a/desloppify/tests/plan/test_queue_metadata.py b/desloppify/tests/plan/test_queue_metadata.py index a12c06927..4917353ce 100644 --- a/desloppify/tests/plan/test_queue_metadata.py +++ b/desloppify/tests/plan/test_queue_metadata.py @@ -2,8 +2,6 @@ from __future__ import annotations -import pytest - from desloppify.base.registry import DETECTORS from desloppify.engine._plan.cluster_semantics import ( EXECUTION_POLICY_EPHEMERAL_AUTOPROMOTE, @@ -15,7 +13,6 @@ cluster_is_active, infer_cluster_execution_policy, infer_cluster_execution_status, - normalize_cluster_semantics, ) from desloppify.engine._plan.auto_cluster_sync_issue import ( _auto_cluster_execution_status, From be5665525a9e9e04e04fe2ac4d2b086148f395f0 Mon Sep 17 00:00:00 2001 From: Sam Date: Sun, 12 Apr 2026 17:55:19 +1000 Subject: [PATCH 2/3] chore: trigger CR review From c2aa5870943bdaa293db2ab1133d1e00435f97e5 Mon Sep 17 00:00:00 2001 From: Sam Date: Sun, 12 Apr 2026 19:14:02 +1000 Subject: [PATCH 3/3] fix: remove 9 additional unused imports found by ruff F401 runner_parallel/__init__.py: Path cxx/__init__.py: make_tool_phase python/__init__.py: COMMON_ZONE_RULES, Zone, ZoneRule typescript/__init__.py: TS_COMPLEXITY_SIGNALS, TS_GOD_RULES, TS_SKIP_DIRS, TS_SKIP_NAMES dict_keys/_BULK_READ_METHODS etc. are intentional re-exports (used by visitor.py). --- desloppify/app/commands/review/runner_parallel/__init__.py | 1 - desloppify/languages/cxx/__init__.py | 1 - desloppify/languages/python/__init__.py | 1 - desloppify/languages/typescript/__init__.py | 6 ------ 4 files changed, 9 deletions(-) diff --git a/desloppify/app/commands/review/runner_parallel/__init__.py b/desloppify/app/commands/review/runner_parallel/__init__.py index add34aa41..bdf8f3043 100644 --- a/desloppify/app/commands/review/runner_parallel/__init__.py +++ b/desloppify/app/commands/review/runner_parallel/__init__.py @@ -6,7 +6,6 @@ import logging import threading from concurrent.futures import ThreadPoolExecutor -from pathlib import Path from desloppify.base.discovery.file_paths import safe_write_text diff --git a/desloppify/languages/cxx/__init__.py b/desloppify/languages/cxx/__init__.py index 0698eeb8a..92a1a210c 100644 --- a/desloppify/languages/cxx/__init__.py +++ b/desloppify/languages/cxx/__init__.py @@ -14,7 +14,6 @@ LangConfig, LangSecurityResult, ) -from desloppify.languages._framework.generic_parts.tool_factories import make_tool_phase from desloppify.languages._framework.registry.registration import register_full_plugin from desloppify.languages._framework.registry.state import register_lang_hooks from desloppify.languages._framework.treesitter.phases import all_treesitter_phases diff --git a/desloppify/languages/python/__init__.py b/desloppify/languages/python/__init__.py index 539e95703..482f16036 100644 --- a/desloppify/languages/python/__init__.py +++ b/desloppify/languages/python/__init__.py @@ -5,7 +5,6 @@ from typing import TYPE_CHECKING, Any from desloppify.base.discovery.source import find_py_files -from desloppify.engine.policy.zones import COMMON_ZONE_RULES, Zone, ZoneRule from desloppify.languages._framework.base.phase_builders import ( detector_phase_security, detector_phase_signature, diff --git a/desloppify/languages/typescript/__init__.py b/desloppify/languages/typescript/__init__.py index 02e0d0fd9..b8bbbed03 100644 --- a/desloppify/languages/typescript/__init__.py +++ b/desloppify/languages/typescript/__init__.py @@ -34,12 +34,6 @@ phase_logs, phase_unused, ) -from desloppify.languages.typescript.phases_config import ( - TS_COMPLEXITY_SIGNALS, - TS_GOD_RULES, - TS_SKIP_DIRS, - TS_SKIP_NAMES, -) from desloppify.languages.typescript.phases_coupling import phase_coupling from desloppify.languages.typescript.phases_smells import phase_smells from desloppify.languages.typescript.phases_structural import phase_structural