Best codemod tools to fix deprecated API calls
Updated November 27, 2026
On this page
Which codemod tool should you use?
Pick by language first, then by whether someone already wrote the migration. A codemod someone else maintains beats one you write, and one you write beats find and replace. Here is the pick by situation:
- Pick Codemod's registry if you're on JavaScript or TypeScript and the library or runtime you're upgrading publishes a codemod there. Node.js does, and links it from its deprecations page. Run it before writing anything.
- Pick jscodeshift if you need your own JavaScript or TypeScript migration with real logic: checking scope, renaming imports, handling several call shapes.
- Pick ast-grep if the change is a pattern swap (this call becomes that call) and you want one command, in almost any language, with no transform file.
- Pick OpenRewrite if you're on Java or Kotlin and moving a framework or JDK version, such as Spring Boot or JUnit. Its recipes chain many changes into one run.
- Pick
go fixif you write Go. Since Go 1.26 it applies modernizers and inlines any function its author marked//go:fix inline. - Pick Ruff if you write Python. Its pyupgrade rules (UP) fix many deprecated standard library calls with one flag.
My recommendation: don't pick one tool for the whole company. Use the one that ships with your language (go fix, Ruff) in CI, check the registry before every major upgrade, and keep ast-grep around for the one-off swap. Write a jscodeshift or OpenRewrite transform only when the same change has to land in many files or many repositories. The trade-off is that a written transform is code you now maintain, and it's only worth it if it runs more than once.
What are the best codemod tools?
Six tools cover most deprecated API work, split by language. Prices and licenses below are from each project's own pricing page, license page or npm entry, read Nov 27, 2026.
| Option | Best for | Price |
|---|---|---|
| Codemod (registry and CLI) | Running a migration a library or runtime already published | Community plan $0; Team from $1k a month |
| jscodeshift | Your own JavaScript or TypeScript transform with logic | Free, MIT |
| ast-grep | One-command pattern rewrites in many languages | Free, MIT |
| OpenRewrite | Java and Kotlin framework and JDK upgrades | Free core, Apache 2.0; some recipes source available; Moderne platform priced separately |
go fix | Go modernizers and //go:fix inline migrations | Free, ships with Go |
| Ruff | Python deprecated calls and old syntax | Free, MIT |
Codemod
- Best for: JavaScript and TypeScript upgrades where the maintainers already wrote the migration.
- Price: the Community plan is $0 forever and includes the CLI, public and private codemods and the open-source engine. Team starts at $1k a month with Pro codemods, campaigns and integrations; Enterprise is custom (Codemod pricing, read Nov 27, 2026).
- Pros: a searchable registry (
npx codemod@latest search util-isfound@nodejs/util-is); Node.js's own deprecations page links its codemods; runs refuse a dirty git tree by default, so the diff you review is only the codemod's. - Cons: you're running someone else's transform, so read its source first; quality varies by author; the paid features are aimed at large teams.
- Where it runs: a CLI on your machine or in CI.
jscodeshift
- Best for: a JavaScript or TypeScript migration you write once and run across a large codebase.
- Price: free, MIT licensed (jscodeshift on GitHub; version 17.4.0 on npm, Nov 27, 2026).
- Pros: full access to the syntax tree, so a transform can check what a name refers to before changing it; keeps your formatting where it can; years of examples, since many libraries shipped their codemods on it.
- Cons: you write and test a JavaScript file for every change; the tree API takes an afternoon to learn; it leaves imports you no longer use.
- Where it runs: Node.js, locally or in CI.
ast-grep
- Best for: a pattern swap you can write as code with holes in it, in JavaScript, TypeScript, Python, Go, Rust, Java and more.
- Price: free, MIT licensed (version 0.51.3 of
@ast-grep/clion npm, Nov 27, 2026). - Pros: one command, no transform file; shows a diff before writing; rules can live in YAML and run in CI as a lint with a fix (ast-grep rewrite docs).
- Cons: patterns match shape, not meaning, so a local variable named util matches too; anything past a swap needs rules with conditions; it leaves unused imports behind.
- Where it runs: a single binary, from npm, Homebrew, Cargo or pip.
OpenRewrite
- Best for: Java and Kotlin teams moving Spring Boot, JUnit, Jakarta or a JDK version.
- Price: the core framework is Apache licensed. Recipes with significant contributions from Moderne use the Moderne Source Available License, which lets your team apply them but not resell them (OpenRewrite licensing). Moderne's platform, which runs recipes across many repositories, lists a typical $250K for organizations up to about 1,000 developers (Moderne pricing, read Nov 27, 2026).
- Pros: large catalog of tested recipes; recipes compose, so one upgrade recipe runs dozens of changes; a
rewrite:dryRungoal reports changes without writing them (Maven plugin docs). - Cons: JVM first; needs a Maven or Gradle build that compiles, because recipes use type information; I didn't run it for this page, as this machine has no JDK.
- Where it runs: the Maven plugin (Maven 3.6 and later), the Gradle plugin, or the Moderne CLI.
go fix
- Best for: any Go codebase, and Go library authors deprecating their own functions.
- Price: free, part of the Go toolchain. Go 1.26 rebuilt it around modernizers and a source-level inliner (Go 1.26 release notes).
- Pros: nothing to install; a library author marks a deprecated wrapper with
//go:fix inlineand every caller can migrate with one command; the fixers are meant not to change behavior. - Cons: only Go; inlining works for functions whose body is the replacement, not for changes that need decisions about arguments or errors.
- Where it runs: wherever Go 1.26 or later is installed.
Ruff
- Best for: Python codebases that want deprecated calls fixed as part of linting.
- Price: free, MIT licensed (Ruff docs).
- Pros: one tool for lint and fix; the UP rules cover old standard library aliases and syntax; fast enough to run on every commit.
- Cons: fixes only what its rules know, so a third-party library's deprecations aren't covered; some fixes are marked unsafe and need an extra flag.
- Where it runs: a single binary from pip, uv or Homebrew.
How does each tool fix the same deprecated JavaScript call?
All three JavaScript tools fixed it; only the registry codemod also removed the import it no longer needed. I ran them on Nov 27, 2026 against one file calling util.isArray(), which Node.js deprecated as DEP0044 and made a runtime warning in v22.0.0 (Node.js deprecations). On Node.js 24.21.0 it still works and prints:
node app.js
[ 'a' ] [ 'b' ]
(node:50548) [DEP0044] DeprecationWarning:
The `util.isArray` API is deprecated.
Please use `Array.isArray()` instead.I wrapped the warning onto three lines to fit (Node prints it on one) and left out the hint line after it. The file:
const util = require("node:util");
function toList(value) {
return util.isArray(value) ? value : [value];
}
console.log(toList("a"), toList(["b"]));Codemod: run the published migration
Node's deprecations page itself says an automated migration is available and names npx codemod@latest @nodejs/util-is. In a clean git repository:
npx codemod@latest run @nodejs/util-is \
--no-interactive --disable-analytics
Workflow completed in 2.0s
Run summary
Modified 1
Unmodified 0I left out the lines before the summary. git diff showed the call changed and the require line removed, leaving an empty first line:
-const util = require("node:util");
function toList(value) {
- return util.isArray(value) ? value : [value];
+ return Array.isArray(value) ? value : [value];
}Run from a folder with uncommitted changes, it refused with "You have uncommitted changes" and pointed to --allow-dirty. Good default. Commit first, then the diff you review is only the codemod's.
jscodeshift: write the transform
Here's the whole transform. It finds calls whose callee is util.isArray and swaps the callee:
module.exports = function (file, api) {
const j = api.jscodeshift;
return j(file.source)
.find(j.CallExpression, {
callee: {
object: { name: "util" },
property: { name: "isArray" },
},
})
.forEach((path) => {
path.node.callee = j.memberExpression(
j.identifier("Array"),
j.identifier("isArray")
);
})
.toSource();
};npx jscodeshift@latest -t is-array.js app.js
Results:
0 errors
0 unmodified
0 skipped
1 okI left out its progress lines. The call changed; the require stayed, now unused. Removing it means more transform code: check that nothing else uses util, then delete the declaration.
ast-grep: one command
The pattern is the old code with a hole ($A); the rewrite is the new code with the same hole. Without -U it only shows the diff:
npx --package @ast-grep/cli@latest -- \
ast-grep run -l js \
-p 'util.isArray($A)' \
-r 'Array.isArray($A)' app.js
4 │- return util.isArray(value) ? value : [value];
4│+ return Array.isArray(value) ? value : [value];I kept only the changed lines of its diff. Adding -U wrote the file and printed "Applied 1 changes". Like jscodeshift, it left the require in place.
Can go fix migrate deprecated Go APIs?
Yes, if the deprecated function is marked //go:fix inline: go fix replaces each call with the function's body. Go 1.26 added this source-level inliner so authors can automate their own API migrations (Go 1.26 release notes). I ran it with Go 1.27.3 on a module with a deprecated wrapper:
package strs
import "strings"
// Deprecated: use strings.ToUpper.
//
//go:fix inline
func Upper(s string) string {
return strings.ToUpper(s)
}A caller in main.go used strs.Upper("hi"). Preview first with -diff:
go fix -diff ./...
@@ -2,10 +2,9 @@
import (
"fmt"
-
- "example.com/app/strs"
+ "strings"
)
func main() {
- fmt.Println(strs.Upper("hi"))
+ fmt.Println(strings.ToUpper("hi"))
}I left out the two file header lines. Note that go fix -diff exited with status 1 because it had a change, so it works as a CI check as is. Then go fix ./... wrote the change, fixed the imports, and go run . printed HI. Of the tools here, go fix is the only one that both rewrote the call and cleaned up the imports with nothing to install.
How do you fix deprecated Python calls automatically?
Run Ruff with the UP rules and --fix. I tested assertEquals, an alias deprecated since Python 3.2 and removed in Python 3.12 (What's New in Python 3.12). On 3.12 and later the method is gone, so this is a real break, not a style point. Ruff's rule is UP005 (Ruff UP005). With Ruff 0.17.6:
ruff check --select UP005 test_math.py
UP005 [*] `assertEquals` is deprecated,
use `assertEqual`
--> test_math.py:6:9
help: Replace `assertEqual` with `assertEquals`
Found 1 error.
[*] 1 fixable with `--fix`.I wrapped the first line and left out the code excerpt it prints. Look at the help line: it reads backwards. The fix itself is right:
ruff check --select UP005 --fix test_math.py
Found 1 error (1 fixed, 0 remaining).Line 6 became self.assertEqual(1 + 1, 2). The check exits 1 while the problem is there and 0 once it's fixed, so the same command works in CI. For deprecations in third-party Python libraries, Ruff has no rules; use ast-grep with a Python pattern, or the library's own migration script if it ships one.
What is a codemod, and how is it different from a linter or Dependabot?
A codemod is a program that rewrites your source code, usually by parsing it into a syntax tree, changing the tree and printing it back. A linter reports a problem and sometimes fixes it; a codemod exists to make the change. Ruff and go fix sit in between: linters whose fixes act as codemods.
Dependabot is a different job. It bumps the version in your manifest and opens a pull request, but it doesn't touch the calls in your code that the new version breaks (Dependabot vs Renovate compares the update bots). The usual order is: the bot proposes the bump, CI or the changelog shows what broke, and a codemod fixes the calls.
The step people skip is finding out that a change hits them at all. A codemod needs you to already know that util.isArray is deprecated. To see what changed between the version you're on and the one you're moving to, see how to find breaking changes between two versions.
How do you run a codemod safely on a real codebase?
Commit, preview, apply, then review the diff and run the tests. Every tool above has a preview mode, and you should use it.
- Start from a clean git tree, so the diff is only the codemod's. Codemod's CLI enforces this; for the others, do it yourself.
- Preview:
--dry-runfor Codemod and jscodeshift (-d), no-Ufor ast-grep,go fix -diff, plainruff check,mvn rewrite:dryRunfor OpenRewrite. - Run it on one directory before the whole repository, and read every change in that first batch.
- Apply it, then run your formatter. Codemods print code that parses, not always code that matches your style.
- Remove what it left behind. In the run above, two of the three JavaScript tools left an unused import; your linter's unused-import rule finds them.
- Run the test suite and the type checker. A pattern can match code that only looks like the old call.
- Open it as its own pull request, separate from the version bump, so a reviewer sees a mechanical change on its own.
If a coding agent makes these changes for you, give it the facts it lacks first: the deprecation, the version it landed in and the replacement. Stopping a coding agent from writing retired model IDs shows the same idea for model names.
Where Since.dev fits
Since.dev covers the part before a codemod: knowing that a change hits your code. It tracks breaking releases, deprecations, AI model retirements, API removals and runtime end of life, and when you scan a public repository (free, no sign-in) or connect one, it lists the files and lines each change touches, with the replacement.
- For a change that hits a connected GitHub repository, it can open the fix pull request itself, built and checked before it opens. Free includes 3 a month on public repositories; Pro is $49 a month with 20, private repositories included (pricing, read Nov 27, 2026).
- It isn't a general codemod engine. It doesn't run your own transforms, doesn't open routine version bumps (keep Dependabot for those) and works on GitHub only.
- Coding agents can ask it what changed through the MCP server before they write a call, so fewer deprecated calls get written in the first place.
Fix pull requests open for review, your CI runs, and people decide whether to merge. Nothing merges or deploys.
Questions
What is the best codemod tool for JavaScript?
Check Codemod's registry first, because the library you're upgrading may already publish a migration there; Node.js does. If nothing exists, use ast-grep for a simple pattern swap and jscodeshift when the transform needs logic, such as checking which import a name came from. All three are free.
Is jscodeshift still maintained?
Yes, though releases are spread out. Version 17.4.0, published on npm on July 15, 2026, is the latest as of Nov 27, 2026, and it ran a transform for this page on Node.js 24.21.0 without trouble. Many library codemods still build on it, though newer ones often use ast-grep or Codemod's own engine.
Can ast-grep replace jscodeshift?
For pattern swaps, yes: one command did what an 18-line jscodeshift transform did in the run on this page. For transforms that need to follow scope, rename imports or decide between several rewrites, jscodeshift's full syntax tree API is still easier. Many teams keep both.
Is OpenRewrite free?
The core framework is Apache licensed and free. Recipes with significant contributions from Moderne use the Moderne Source Available License, which lets you apply them to your own code but not resell them. Moderne's commercial platform for running recipes across many repositories is a separate, sales-led purchase.
Does Dependabot fix deprecated API calls?
No. Dependabot updates the version in your manifest and opens a pull request; it doesn't edit the code that calls the changed API. You fix those calls by hand or with a codemod, ideally in a separate pull request.
How do I make CI fail when code uses a deprecated API?
Run the fixer in check mode: go fix -diff exits 1 when it has a change, and ruff check with the UP rules exits 1 while a deprecated alias remains. For JavaScript, an ast-grep rule in a YAML file runs as a lint in CI. Each of these points at the line, so the fix is one command away.
Related guides
Comparisons
- jscodeshift vs ast-grep: which should you use?jscodeshift vs ast-grep on the same fix: TypeScript, formatting, speed, CI checks and price, with both run on a real Node.js deprecation and timed.
- Dependabot vs Renovate: which should you use?Dependabot vs Renovate on the same criteria: hosts, config, PR limits, automerge, security updates and price, with both configs validated and a dry run.
How-to
- How to find the breaking changes between two versions of a packageHow to find breaking changes between two versions of a package: list the releases in between, read each changelog, diff the code. Commands for npm, PyPI, Go.
- How to check your dependencies for breaking changes before you upgradeHow to check dependencies for breaking changes before upgrading: the commands, a real failing upgrade, CI that fails on deprecations, and where notices appear.
- How to stop a coding agent from writing retired model IDsCoding agents write model IDs from old training data. Five guardrails, each run and tested: one models file, AGENTS.md, an MCP lookup, a hook and a CI check.

Put your code on continuous maintenance.
Scan a public repository now, or give your agent one line.
See how out of date your code is.
Tell your agent what changed since it was trained.
claude mcp add --transport http since https://api.since.dev/mcpCodex, Cursor and any MCP client use https://api.since.dev/mcp.