Stop Guessing What Your Code Change Will Break
Ever changed one function, thought it was a small edit, then spent the next hour tracing through five other files to figure out what broke? That's the problem I set out to fix. A while back, someone commented on a related post describing a tool they hand wrote for C++ codebases. It parsed every file's #include statements, built a dependency graph, and used that to show how far a change in one…
A Python developer was frustrated by the inconvenience of changing one function, only to discover that it led to unexpected errors in multiple files. This prompted them to develop a tool that could automatically analyze the impact of a code change. The tool, named Change Impact Analyzer, is a Visual Studio Code extension that works by parsing all Python files in a project using a tool called tree-sitter, and then utilizing a language server (pylsp) to understand how different parts of the code interact with each other.
When a user makes changes and saves the files, the extension identifies the specific edits made using git. It then traces the ripple effect of these changes, determining all other pieces of code that depend on the modified code, directly or indirectly. The extension also employs a language model (LLM) to explain the potential risks in simple English, offering a recommendation on what to do next.
Should the user decide to proceed with the change, an "fix agent" is available to automatically update all affected code segments to maintain functionality. All of this occurs within a pop-up window in the user's editor, prompting confirmation before any modifications are made. The extension is currently in its early stages, available for tryouts and feedback via its GitHub repository and Visual Studio Code marketplace listing.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.