google / error-prone

Catch common Java mistakes as compile-time errors
https://errorprone.info
Apache License 2.0
6.85k stars 743 forks source link

XepPatchChecks, default checks and refaster check #595

Open BKer opened 7 years ago

BKer commented 7 years ago

Hi,

At the moment I’m on my phone, so typing isn’t the most comfortable thing to do.

I tried to combine -XepPatchChecks with a refaster check. When, deliberately adding errors the checks generate a patch file, however the custom refaster check is not present in the patch file. Running refaster without the other checks generates the patch file with the custom refaster refactorings. This is my -XepPatchChecks parameter passed to the compiler: -XepPatchChecks:MissingOverride,DefaultCharset,DeadException,refaster:/path/to/my/CustomRule.refaster How can I have a patch file containing both the modifications made by the default checks and my custom refaster rule? I hope someone can point me into the right direction :)

eaftan commented 7 years ago

@nglorioso, can you take a look?

nick-someone commented 7 years ago

https://github.com/google/error-prone/blob/master/check_api/src/main/java/com/google/errorprone/ErrorProneOptions.java#L322 currently we don't allow concatenating Refaster rules and built-in checkers. We should allow this, but it's a bit hacky due to the way these are constructed (there's a separation from the options parsing and loading the built-in checkers).

We have plans to improve the experience here, but I can see if this functionality is easy to wedge into the command line flags without being too awkward :)