MCPcopy Create free account
hub / github.com/FSoft-AI4Code/CodeWiki / _walk

Function _walk

codewiki/mcp/tools/analysis.py:247–271  ·  view source on GitHub ↗
(tree: Dict, parents: list[str] | None = None)

Source from the content-addressed store, hash-verified

245 cascade: set[str] = set()
246
247 def _walk(tree: Dict, parents: list[str] | None = None):
248 if parents is None:
249 parents = []
250 for mod_name, mod_info in tree.items():
251 components = mod_info.get("components", [])
252 hit = False
253 for comp in components:
254 comp_file = comp.split("::")[0]
255 for cf in changed_files:
256 if comp_file == cf or comp_file.endswith("/" + cf) or cf.endswith("/" + comp_file):
257 hit = True
258 break
259 # Changed dir contains the component file, or vice versa
260 if cf.startswith(comp_file + "/") or comp_file.startswith(cf + "/"):
261 hit = True
262 break
263 if hit:
264 break
265 if hit:
266 affected.add(mod_name)
267 cascade.update(parents)
268
269 children = mod_info.get("children", {})
270 if isinstance(children, dict) and children:
271 _walk(children, parents + [mod_name])
272
273 _walk(module_tree)
274

Callers 1

_find_affected_modulesFunction · 0.85

Calls 3

getMethod · 0.80
addMethod · 0.80
updateMethod · 0.80

Tested by

no test coverage detected