-
Notifications
You must be signed in to change notification settings - Fork 30
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
[Refactoring] Code clarifications, Unit Tests, Responsibilities #109
[Refactoring] Code clarifications, Unit Tests, Responsibilities #109
Conversation
Codecov Report
@@ Coverage Diff @@
## master #109 +/- ##
=============================================
+ Coverage 23.17% 39.96% +16.79%
- Complexity 86 178 +92
=============================================
Files 29 40 +11
Lines 1027 1126 +99
Branches 138 84 -54
=============================================
+ Hits 238 450 +212
+ Misses 758 635 -123
- Partials 31 41 +10 Continue to review full report at Codecov.
|
I'm actually working on a second version that completely removes the dependency to Maven in the core, so the core will be even more testable and integrate better with Gradle (no need to duplicate business code in the plugin projects) |
@cesarsotovalero I think I'm done for the most part. Please feel free to tell me if you like this refactoring or not, and the things you want me to change/improve. For this second part, I totally removed the maven coupling from the core, and moved some logic into there. The idea behind that is that the plugin (maven or gradle) provides the right context for the core to execute, then exploit the result. Some more things may need to be moved to the core later, though. Also, I ran the depclean on itself, replaced the poms with the deblaoted ones, and the project still works with no more unused dependencies, so I hope the refactoring didn't break anything. I did not work on the Gradle project yet, so this may be broken at the moment. |
There is actually an issue with the debloated pom (rewrite is not working as expected), so I'll look into that. |
57296b7
to
af5fca6
Compare
SonarCloud Quality Gate failed. |
Hi @afillatre, |
@cesarsotovalero thanks for accepting it ! I still have some improvements to add, and some proposals to make |
…RT-KTH#109) * [Refactoring] Code clarifications, Unit Tests, Responsibilities * More cleanup * Remove maven dependencies from core * Cleanup and use debloated poms * De-duplicate dependencies before generating debloated pom * More refactoring into separate classes. * Move logic in the core, so it's independent from a specific dependency manager * Fix Gradle plugin * Try updating JDK to 17 * Change gradle build in GitHub actions to JDK 11 Co-authored-by: César Soto Valero <[email protected]>
In order to go further with the project I had the need to better understand the process behind dependency exploration and consolidation. I rewrote a great part of the depclean-core for it to be easier to understand, more testable, and with better responsibility segregation (or so I hope).
Also I added some logs that also make it clearer what happens in the process.
The
DeclaredDependencyGraph
calculate the dependencies and their related classes. TheActualUsedClasses
collects the classes that actual are used in the project, and that match detected classes from the dependencies. Then, theProjectDependencyAnalysisBuilder
prepares the analysis result to be passed to the Maven Plugin.I think much work is still needed since some code is still out of place in the Mojo rather than in the core (for responsibility and testability), but I hope this is a good first step.