Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
[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. |
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 jobBut can the unused imports also be removed (static and non-static) ?