Open vprudnikov opened 1 year ago
Hey @vprudnikov! Thanks for reaching out. I can see how our documentation is confusing in this respect, but unfortunately only the last -XepOpt:Refaster:NamePattern
flag is respected. If you want to disable multiple rules then they'll have to be combined, a bit like this, but then as a negation.
I haven't tested it, but in your case the following may work:
-XepOpt:Refaster:NamePattern=^(?!PreconditionsRules\$CheckArgumentWithMessage)(?!ImmutableMapRules\$ImmutableMapOf).*
(The second one should cover all ImmutableMapOf
variants, since it's a prefix match.)
Let us know whether this helps; I'll try to find some time later to clarify the documentation.
@Stephan202 many thanks for a quick answer.
I can confirm that the following option works for me:
-XepOpt:Refaster:NamePattern=^(?!PreconditionsRules\$CheckArgumentWithMessage)(?!ImmutableMapRules\$ImmutableMapOf\d*).*
Hope this issue will help others in case of confusion.
Thanks for the quick feedback @vprudnikov! I've relabelled this as a documentation
issue. My plate is rather full right now, but "one of these days" I'll circle back to this ticket and have a look at better documentation. (And maybe we can even auto-detect or support this case; TBD.)
Can't disable rule using a compiler argument
Minimal Reproducible Example
Here is my configuration in pom.xml
Logs
```sh [INFO] /C:/dev/.../MyClass.java:[30,70] [Refaster Rule] PreconditionsRules.CheckArgumentWithMessage: Refactoring opportunity (see https://error-prone.picnic.tech/refasterrules/PreconditionsRules#CheckArgumentWithMessage) Did you mean 'public DescribedPredicateExpected behavior
The rule doesn't appear in the compiler output.
Setup
17.0.5
2.19.1
0.11.1