Comby is ideal for touching up pieces of code. Use it to translate code like this Python 2 to 3 fixer on the right to replace deprecated methods. Easily write one-off refactors or a collection of quickfixes customized to your project. Comby makes finding and changing code easier than regex alone allows and avoids pitfalls like escaping parentheses, quotes, or multiline changes.

comby 'failUnlessEqual(:[a],:[b])' 'assertEqual(:[a],:[b])' example.py

--- example.py

+++ example.py

@@ -1,6 +1,6 @@

def test(self):

r = self.parse("if 1 fooze", 'r3')

- self.failUnlessEqual(

+ self.assertEqual(

r.tree.toStringTree(),

'(if 1 fooze)'

)

Comby is used in everyday developer workflows and academic research.

Have you used Comby in one of your projects or have something to share? Point us to your commit or open a PR and get your project featured here.

Watch the Strange Loop talk to learn more about Comby.

This talk shares the core ideas and motivation behind Comby, and example uses and applications.

Mini abstract: Regex-based search-and-replace falls short of recognizing program syntax that so often correspond to expressions in code. Many approaches and tools that tackle the problem to overcome the limitations of regex matching but remain underdeveloped for easily changing code. Expressive and powerful transformation frameworks, however, can be hard to learn or use. Comby fills a gap by focusing on lightweight program transformation in every language for every programmer.