-
Notifications
You must be signed in to change notification settings - Fork 201
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
[PiranhaJava] Ability to detect and removed stale code for specific use-cases #104
Comments
In an email, @pranavsb had proposed the following solution:
To elaborate further on that, update the properties.json file to accept an additional configuration for test methods which will wrap an XP API, and then check for those methods in
Yes. Enabling RemoveUnusedImports errorprone check should help here. |
Thanks @mkr-plse for the inputs. On #1, we tried some options, but the implementation was getting complicated. When we intercept From this, we are able to extract the methodName as Any suggestion to take this forward? |
If you call evalExpr on the argument expression to Specifically, expression representing |
Interesting, thanks @mkr-plse . Let me try Ie., in this example of |
See getXPAPI. |
Further refactored the code Delete the accidentally added DS store files switching back to macos 11 tryinh macos-latest again reverting the other changes too switching back to macos 11 fixing the workflow fixing the build warning trying to resolve build error Made the matcher nicer and added more corner cases Addressed the issues mentioned in the PR and offline Added support for then* pattern Added delete statement logic for specific patterns menntioned in issue uber#104
Fixed the Swift CI issue Addressed the issues mentioned in the PR and offline Added support for then* pattern Added delete statement logic for specific patterns menntioned in issue uber#104
@sivacoder We have implemented the functionality discussed in this issue, and it is available for use in our latest release(0.1.6). |
Closing this issue. Please reopen if any problems arise. |
In the past we have made PR's to Piranha to support additional usage patterns. Also, thanks to all the new functionalities added to Piranha Java last few months.
We are in the final stage of putting Piranha to pre-production for our java based micro services. We have hit this two blockers and need your support for this:
Case 1: Tests using the mocked frameworks (mockito) where the same feature flag is used
when(featureUtil.isFlagEnabled("stale_flag").thenReturn(true);
is converted to
when(true).thenReturn(true);
With this change, build is failing as Mockito is classified as "Unnecessary Mocking". Any way to get going on this?
Case 2: Removing Unused Imports (Static and Non-Static) after Piranha cleaning up:
Imagine a code like
import com.test.FlagUtil;
if (flagUtil.isFlagEnabled("stale_flag")) {
// Do some job
}
is converted to
import com.test.FlagUtil;
// Do some job
But can the unused imports also be removed (static and non-static) ?
The text was updated successfully, but these errors were encountered: