Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rewrite buildDescription(tree).addFix(fix).build() to describeMatch(tree, fix) #369

Open
1 of 2 tasks
rickie opened this issue Nov 25, 2022 · 1 comment
Open
1 of 2 tasks

Comments

@rickie
Copy link
Member

rickie commented Nov 25, 2022

Problem

In commit google/error-prone@570f0bf the DescribeMatch BugChecker got removed from Error Prone with the explanation that it got ported to Refaster. As we cannot see these kind of changes, we have to write these Refaster rules ourselves 😄.

Description of the proposed new feature

  • Support a stylistic preference.
  • Avoid a common gotcha, or potential problem.

I would like to rewrite the following code:

return buildDescription(tree).addFix(fix).build();

to:

return describeMatch(tree, fix);

Considerations

In the test code of the deleted BugChecker there is an edge case where it shouldn't propose a fix in the abstract class BugChecker { itself. However, to be honest, I don't think we need to take this case into account.

We might need to introduce a new Refaster rule collection for this Refaster rule or list it under AssortedRules.

@rickie rickie added good first issue Good for newcomers new feature labels Nov 25, 2022
@Stephan202
Copy link
Member

I looked into this a few months ago, but for some reason this doesn't seem to work with Refaster as one would expect. My code is here; perhaps I overlooked something? (I did not yet attach a debugger.)

@rickie rickie removed the good first issue Good for newcomers label Dec 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants