Codebase intelligence for AI and humans: code health scores, auto-generated docs, git analytics, dead code detection, and architectural decisions via MCP.
Python aicode-complexitycode-healthcode-intelligencecode-qualitydead-codedeveloper-toolsdocumentationgit-analyticsmcpopen-sourcepythonrefactoringstatic-analysistechnical-debt
fix(dead-code): keep only genuinely narrow scopes in the uncalled-symbol pool (#1646)
Raghav Chamadiya338705154b99
diff --git a/docs/reference/COMPUTED_GLOSSARY.md b/docs/reference/COMPUTED_GLOSSARY.mdindex 40bbe5da4..9051f97c0 100644--- a/docs/reference/COMPUTED_GLOSSARY.md+++ b/docs/reference/COMPUTED_GLOSSARY.md@@ -190,7 +190,7 @@ workspace overlays, MCP responses, and CLI output.| Dead-code finding | A graph/git finding persisted to `dead_code_findings`. | `DeadCodeAnalyzer` | `{kind: "unused_export", file_path: "src/api.py", confidence: 0.7}` || Unreachable file | File with no incoming imports, not an entry point/test/config/contract/whitelisted file. | `_detect_unreachable_files()` | `src/legacy_adapter.py` || Unused export | Public symbol in an imported file that no importer names. | `_detect_unused_exports()` | `symbol_name: "OldClient"` |-| Unused internal | Private/internal symbol with no incoming `calls` edges. | `_detect_unused_internals()` | `_parse_legacy_token` |+| Unused internal | Private symbol with no incoming `calls` edges. | `_detect_unused_internals()` | `_parse_legacy_token` || Zombie package | Monorepo top-level package with no external package importers. | `_detect_zombie_packages()` | `packages/old-sdk` || Dead-code confidence | Heuristic certainty based on age, recent commits, importers, dynamic imports, and deprecation hints. | `DeadCodeAnalyzer` | `1.0` for year-old unreachable file || Safe-to-delete flag | Whether confidence passes delete threshold and dynamic patterns do not block deletion. | `_make_unreachable_finding()` and other passes | `safe_to_delete: true` |diff --git a/packages/cli/src/repowise/cli/commands/dead_code_cmd.py b/packages/cli/src/repowise/cli/commands/dead_code_cmd.pyindex 1d4f3c8b4..3cb25824e 100644--- a/packages/cli/src/repowise/cli/commands/dead_code_cmd.py+++ b/packages/cli/src/repowise/cli/commands/dead_code_cmd.py@@ -46,7 +46,7 @@ from repowise.core.analysis.dead_code.risk_factors import RISK_CAP_CONFIDENCE@click.option("--include-internals/--no-include-internals",default=False,- help="Detect unused private/internal symbols (higher false-positive rate, off by default).",+ help="Detect unused private symbols (higher false-positive rate, off by default).",)@click.option("--include-zombie-packages/--no-include-zombie-packages",diff --git a/packages/core/src/repowise/core/analysis/dead_code/analyzer.py b/packages/core/src/repowise/core/analysis/dead_code/analyzer.pyindex cee432ef7..ffaffc037 100644--- a/packages/core/src/repowise/core/analysis/dead_code/analyzer.py+++ b/packages/core/src/repowise/core/analysis/dead_code/analyzer.py@@ -1331,7 +1331,7 @@ class DeadCodeAnalyzer:dynamic_patterns: tuple[str, ...],whitelist: set[str],) -> list[DeadCodeFindingData]:- """Detect private/internal symbols with zero incoming call edges.+ """Detect private symbols with zero incoming call edges.On by default. These carry a higher false-positive rate than the otherdetectors, which is why they land at a lower confidence. Disable with@@ -1352,7 +1352,12 @@ class DeadCodeAnalyzer:# private symbols used across a package's files carry real# ``calls`` edges and no longer read as universally uncalled. The# blanket exemption that Phase 2 added has been lifted.- if node_data.get("visibility") not in ("private", "internal"):+ # ``internal`` is not narrow: assembly-wide in C#, module-wide in+ # Swift and Kotlin, crate-wide in Rust. A legitimate user can sit+ # anywhere in the module, so a missing inbound call edge is not+ # evidence of deadness. Nothing else observes ``internal`` either,+ # which drops an unmodified C# top-level type out of both passes.+ if node_data.get("visibility") != "private":continuefile_path = node_data.get("file_path", "")if not file_path: