fix(analysis): honor persisted submodule flags in health and dead-code#383
Merged
Merged
Conversation
A repo initialized with --include-submodules records the flag in state.json, but the standalone analysis commands rebuilt the graph with a flagless FileTraverser/GraphBuilder — so repowise health and repowise dead-code scored a different (smaller) file set than was indexed: submodule files vanished from health metrics and dead-code reachability. Read include_submodules/include_nested_repos back from state.json the same way the incremental update path does (missing key = legacy = False) and thread them through both constructions. Read-only commands, so no persisted divergence to migrate. Also drops a pre-existing unused resolve_repo_path import from the touched import block in dead_code_cmd.
|
✅ Health: 7.0 (unchanged)
🩹 Review priority (files here with the most recent bug-fix history — defects cluster, so review these first)
🔥 Hotspots touched (2)
🔗 Hidden coupling (1 file)
📊 Full report · ⭐ Star Repowise · 📥 Install bot · Last updated 2026-06-05 11:32 UTC |
swati510
approved these changes
Jun 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
A repo initialized with
--include-submodulespersists the flag in.repowise/state.json, and the incremental update path reads it back (#381). The standalone analysis commands didn't:repowise healthandrepowise dead-coderebuilt the graph with a flaglessFileTraverser/GraphBuilder, so on a submodule-indexed repo they analyzed a different (smaller) file set than was indexed — submodule files silently vanished from health metrics and dead-code reachability.Fix
Read
include_submodules/include_nested_reposfromstate.jsonthe same wayupdate_cmddoes (missing key = legacy =False) and thread them into both constructions inhealth_cmd.pyanddead_code_cmd.py. Both commands are read-only, so there's no persisted divergence to migrate.Also drops a pre-existing unused
resolve_repo_pathimport from the touched import block indead_code_cmd.py.Tests
tests/unit/cli/test_analysis_cmds_include_submodules.py— CliRunner-based, positive + negative for both commands against a repo with an initialized submodule (mirrorstest_update_include_submodules.py).tests/unit/cli: 453 passedtests/unit: 3783 passed, 2 xfailedruff checkclean on changed files