-
Notifications
You must be signed in to change notification settings - Fork 39
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
Prefer BugCheckerRefactoringTestHelper#doTest(TestMode.TEXT_MATCH)
over alternatives
#389
Comments
.doTest(TestMode.TEXT_MATCH)
over alternativesBugCheckerRefactoringTestHelper#doTest(TestMode.TEXT_MATCH)
over alternatives
Likewise for |
Thanks for pointing out, forgot to mention that. The implementation of |
Tweaked the ticket to also cover the following rewrite: |
Will pick this one up 🙂 Should this be a Refaster rule? |
Nice @mlrprananta! I don't think this can be a Refaster rule. Rather, it sounds like a slight extension of what's being worked on in #450. WDYT @rickie @cernat-catalin? |
Identification and qualifying the type definitely fall into that one! We could extend the rule to also replace certain identifiers 🤔 . Maybe it would be better to have two separate rules and factor out some of the logic for identifier identification 🙃. |
Problem
This is specific to the
BugCheckerRefactoringTestHelper
which is used in replacement tests for BugPatterns.There are two
TestMode
s, namelyAST_MATCH
andTEXT_MATCH
. During multiple code reviews we noticed that usingAST_MATCH
can hide bugs. Therefore we always preferTEXT_MATCH
.Besides that, we do not like the statically imported
TEXT_MATCH
, as it results in having a little less context. Therefore we want to rewrite all these occurrences as well, using Refaster.Description of the proposed new feature
We would like to rewrite the following code using Refaster:
to:
Considerations
The rewrite from
TestMode.AST_MATCH
toTestMode.TEXT_MATCH
is not a behavior preserving one. It's important to make a note about that by using@Description
on the Refaster rule.The text was updated successfully, but these errors were encountered: