Large-Scale Automated Source Code Refactoring with OpenRewrite
docs.openrewrite.org
docs.openrewrite.org
https://www.kernel.org/doc/html/latest/dev-tools/coccinelle....
One of our early partners has over 250 million lines of Java code alone. I don't think they're unusual. Every large scale organization we've worked with has a similar situation though the circumstances are different.
For Netflix, the easy answer is probably "microservices", but also there is more going on behind the scenes than it seems. They had to become at least partially their own content producer, so there is a great deal of tech around the studio itself. There's a rich data platform. There are 200+ repositories in Netflix OSS, 100+ in Netflix Skunkworks, and then there are the larger projects like Spinnaker (50+ repositories).
Software engineering has reached a level of industrialization, it's not cottage industry anymore. And that's why I'm so fascinated by this project -- software supply chain activities are masquerading as technical debt, and engineers are left with the responsibility of it. It's time we start applying automation where we can.
OpenRewrite originated to do transformations of code, specifically to remove a Netflix proprietary logging library and replace it with in SLF4J. The predecessor of OpenRewrite was Gradle Lint (https://github.com/nebula-plugins/gradle-lint-plugin), commonly used to update Gradle build configuration. OpenRewrite added search after transformation and search can be very flexible (search for all usages of a particular package/any method, not just a specific method invocation). Instead of being DSL based, OpenRewrite provides a set of building blocks called recipes that can be combined together to create more powerful recipes. When building blocks are not enough, you can write a custom recipe in the same language as what you are managing. Java for Java and TypeScript for JavaScript/TypeScript (coming soon).
For example, you can see JUnit 4 to 5 migration recipe contains a set of pre-built and custom recipes. https://docs.openrewrite.org/reference/recipes/java/testing/...
You can see recipes in action on the Moderne product brief. https://moderne.io/product/ https://www.youtube.com/watch?v=uR9EPALJKjI&t=1s
OpenRewrite also supports YAML based IaaC transformation, XML, Terraform HCL, etc. Typescript language binding is being built now.
We feel like to do this well, you really have to respect the idiosyncracies of each language and build for them.