I usually tend to loathe the quality of any of my codes that are more than a couple of weeks old. In some of them, the problem has a consistent pattern. I wanted to write a script that changed those chunks of code to a better one. Ctrl-F however, is too dump of a way to handle this task. What if, without worrying about the details, one could declaratively state what is it that one is trying to search and get back a location of all the chunks that matches the criteria?

What it does

Get a large code base where large is at least 1000. Search for the queries below:

  • Find all the lambda functions that have a single argument and are called no more than twice.
  • Find anything that's nested at least three levels deep.
  • Find all the if statements that are part of a class method that has been initialized or will have been so.

Find them with Ctrl-F or regex or whatever. I dare you!

Built With

Share this project: