Automated Refactoring at Scale
Blog post from Sonar
Rule Graphs are directed graphs for polyglot code transformations in which nodes match and rewrite code, scoped edges determine subsequent evaluations, and captured variables pass contextual values between rules. Their execution begins by matching root rules across files, then performs depth-first traversals using symbol tables for variable bindings, AST-based scope resolution, and queued processing for global edges. PolyglotPiranha validates rule syntax, graph reachability, and capture-variable data flow before execution to prevent runtime errors. To scale across large repositories, it uses textual filtering to avoid unnecessary parsing, orders edits from inner to outer scopes to reduce reparsing, and parallelizes work across files, processor cores, and distributed clusters. In deployments at Uber, the tool applied three automated refactorings across 17.5 million lines of Java, Kotlin, and Swift, generating nearly 5,000 pull requests and deleting more than 200,000 lines of code over six months.
| Trend | Post Mentions | Total Month Mentions | Posts | Companies | MoM |
|---|---|---|---|---|---|
| Developer Experience | 1 | 417 | 202 | 96 | +45% |
Use this post, company, and trend context to find content marketing opportunities, perform competitive analysis, or address product feature gaps via the Plushcap MCP server or the Plushcap API.