Custom Defined Steps

You can define your own custom steps and seamlessly make them of the cpg query language, using scala's enrich my library pattern. E.g. let's say you want to define a step publicExampleOrg on method:

implicit class MyMethodTraversals(method: Traversal[Method]) {
def publicExampleOrg = method.fullName(".*org.example.*").isPublic
}

To try it out, you can just paste this into the joern repl. Usage: cpg.method.publicExampleOrg

Note: tab completion works, i.e. if you type cpg.method.pu<TAB> it will auto-complete.