error-prone-support icon indicating copy to clipboard operation
error-prone-support copied to clipboard

Add explanations / reasoning to the bug patterns

Open philipp-paland opened this issue 2 years ago • 3 comments

Problem

When I look at the documentation of a bug pattern, I can see what the pattern is / wants to enforce, but not why that is better.

Example: https://error-prone.picnic.tech/bugpatterns/AmbiguousJsonCreator/ - I understand that "JsonCreator.Mode should be set for single-argument creators", but I don't know why.

Description of the proposed new feature

Add a section to the documentation of each bug pattern that explains why it's better to follow the rule. Compare with Sonar rules which usually explain the reasoning behind themselves quite well: https://rules.sonarsource.com/java

philipp-paland avatar Feb 18 '23 12:02 philipp-paland

Even error prone itself has better explanations typically, for example: https://errorprone.info/bugpattern/DeadException

philipp-paland avatar Feb 18 '23 12:02 philipp-paland

Hi @therealppa! Thanks for the feedback; indeed we should do better in this regard. We're working on several initiatives to derive better documentation from the code; that should make it easier to maintain the docs. (That said, I see that in this case the code doesn't explain the issue at hand, either; I'll try to dig that up.) I'll leave this issue open for now, until we've reached a hopefully-acceptable baseline.

NB: I see that you're working for @foryouandyourcustomers; if you happen to see Jens Plattfaut, say hi ;)

Stephan202 avatar Feb 18 '23 13:02 Stephan202

Thanks @Stephan202 - I'll say hi when I next see him :)

philipp-paland avatar Feb 19 '23 07:02 philipp-paland