[Feature request] Add an annotation to allow ignoring comments for Refaster templates
- Dominant language
- Java
- Stars
- 7.2k
- Forks
- 820
- Avg merge
- 5h 9m
- Merged PRs (30d)
- 50
Description
I'm using `error_prone_refaster-2.24.1.jar` and `error_prone_core-2.24.1-with-dependencies.jar` to refactor code. Given the following class to refactor:
```
import java.util.*;
public class RefasterExample {
public void method2() {
Arrays.asList(//
"bad");
Arrays.asList(/**/
"bad");
Arrays.asList("good");
}
}
```
and the following template:
```
static class ExampleRule {
@BeforeTemplate List match(String o) {
return Arrays.asList(o);
}
@AfterTemplate List optimizedMethod(String o) {
return Arrays.asList("debug: " + o);
}
}
```
then only the "good" line will be refactored:
```
@@ -6,5 +7,5 @@
Arrays.asList(/**/
"bad");
- Arrays.asList("good");
+ Arrays.asList("debug: " + "good");
}
}
```
It would be nice to have a possibility to ignore comments. Maybe with a parameter to configure which comments should be ignored (A regular expression? `Predicate`?).
Contributor guide
Assessment
This issue has not been assessed yet.