Skip to content

Bananeweizen/rewrite-templating

 
 

Repository files navigation

Rewrite Templating

Support before/after templating as seen in Google Refaster.

ci Apache 2.0 Maven Central Revved up by Develocity Contributing Guide

Input

Allows you to defined one or more @BeforeTemplate annotated methods and a single @AfterTemplate method.

package foo;

import com.google.errorprone.refaster.annotation.AfterTemplate;
import com.google.errorprone.refaster.annotation.BeforeTemplate;

public class UseStringIsEmpty {
    @BeforeTemplate
    boolean before(String s) {
        return s.length() > 0;
    }

    @AfterTemplate
    boolean after(String s) {
        return !s.isEmpty();
    }
}

Output

This results in a recipe that can be used to transform code that matches the @BeforeTemplate to the @AfterTemplate.

Contributing

We appreciate all types of contributions. See the contributing guide for detailed instructions on how to get started.

About

Automated templating using code snippets.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 100.0%