Co

Codemodder – A new codemod library for Java and Python

Hacker News

Codemodder – A new codemod library for Java and Python

Hi HN, I’m here to show you a new codemod library. In case you’re not familiar with the term "codemod", here’s how it was originally defined AFAICT: > Codemod is a tool/library to assist you with large-scale codebase refactors Codemods are awesome, but I felt they were far from their potential, and so I’m very proud to show you all an early version of a codemod library we’ve built called Codemodder ( https://codemodder.io ) that we think moves the "field" forward. Codemodder supports both Python and Java ( https://github.com/pixee/codemodder-python and https://github.com/pixee/codemodder-java ). The license is AGPL, please don’t kill me. Primarily, what makes Codemodder different is our design philosophy. Instead of trying to write a new library for both finding code and changing code, which is what traditional codemod libraries do, we aim to provide an easy-to-use orchestration library that helps connect idiomatic tools for querying source code and idiomatic tools for mutating source code. So, if you love your current linter, Semgrep, Sonar, or PMD, CodeQL or whatever for querying source code – use them! If you love JavaParser or libCST for changing source code – use them! We’ll provide you with all the glue and make building, testing, packaging and orchestrating them easy. Here are the problems with existing codemod libraries as they exist today, and how Codemodder solves them. 1. They’re not expressive enough. They tend to offer barebones APIs for querying code. There’s simply no way for these libraries to compete with purpose-built static analysis tools for querying code, so we should use them instead. 2. They produce changes without any context. Understanding why a code change is made is important. If the change was obvious to the developer receiving the code change, they probably wouldn’t have made the mistake in the first place! Storytelling is everything, and so we guide you towards making changes that are more likely to be merged. 3. They don’t handle injecting dependencies well. I have to say we’re not great at this yet either, but we have some of the basics and will invest more. 4. Most apps involve multiple languages, but all of today’s codemod libraries are for one language, so they are hard to orchestrate for a single project. We’ve put a lot of work into making sure these libraries are aligned with open source API contracts and formats ( https://github.com/pixee/codemodder-specs ) so they can be orchestrated similarly by downstream automation. The idea is "don’t write another PR comment saying the same thing, write a codemod to just make the change automatically for you every time". We hope you like it, and are excited to get any feedback you might have!

Share card

Actual performance

37points
8comments
Made the leaderboard

Launch Intel predictions

Analyze your own launch →
Indie HackersFits the IH revenue-focused audience · Strong signals: supports · Missing: reddit linkedin, podcasting, created
90%90% predicted probability of success on Indie Hackers, based on ML models trained on real launch data.
best fitHighest predicted score across all platforms for this description.
Product HuntOn track for Day 1 leaderboard · Strong signals: apps, new, context · Missing: mac, agents, macos
83%83% predicted probability of success on Product Hunt, based on ML models trained on real launch data.
Hacker NewsStrong engagement from HN community · Strong signals: excited, exist, open source · Missing: https docs, just released, lua
72%72% predicted probability of success on Hacker News, based on ML models trained on real launch data.
nativeThis product was originally launched on this platform.
TrustMRRLess likely to generate early MRR · Strong signals: apps, way · Missing: mobile apps, ios, personal
39%39% predicted probability of success on TrustMRR, based on ML models trained on real launch data.
AppSumoMay struggle as an AppSumo deal · Missing: plus, platform, intuitive
31%31% predicted probability of success on AppSumo, based on ML models trained on real launch data.
Acquire.comPre-revenue stage for this audience · Missing: arr, mrr, revenue
14%14% predicted probability of success on Acquire.com, based on ML models trained on real launch data.
BetaListMay not resonate with beta-testers · Missing: web3, chat, crypto
0%0% predicted probability of success on BetaList, based on ML models trained on real launch data.

Correct prediction on native model

Similar products

ga
gazpacho, a new Python webscraping library53%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

gazpacho, a new Python webscraping library

Hacker News1
Co
Codemodder – A new codemod library for Java and Python72%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Codemodder – A new codemod library for Java and Python

Hacker News13
Sn
Snowy – a new image library for Python45%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Snowy – a new image library for Python

Hacker News124
A
A Python library for Unicode string collation55%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

A Python library for Unicode string collation

Hacker News4
A
A Python library for accessing Wunderlist67%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

A Python library for accessing Wunderlist

Hacker News1
Oh
Ohne I/O, a Python 3.4+ coroutine library without any I/O55%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Ohne I/O, a Python 3.4+ coroutine library without any I/O

Hacker News2
Co
Combinatorix, yet another combinator library in Python55%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Combinatorix, yet another combinator library in Python

Hacker News4
Tt
Tt Python library67%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Tt Python library

Hacker News1
Py
Python library for GoPro cameras67%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Python library for GoPro cameras

Hacker News131
Py
Python library for parsing Dockerfile65%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Python library for parsing Dockerfile

Hacker News2