Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
cesarsotovalero committed Apr 4, 2021
2 parents add2628 + 39ab692 commit b3fbeaa
Showing 1 changed file with 21 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,18 @@ private void printDependencies(Map<String, Long> sizeOfDependencies, Set<String>
.forEachRemaining(s -> printString("\t" + s + " (" + getSize(s, sizeOfDependencies) + ")"));
}

/**
* Util function to print the information of the analyzed artifacts.
*
* @param info The usage status (used or unused) and type (direct, transitive, inherited) of artifacts.
* @param sizeOfDependencies The size of the JAR file of the artifact.
* @param dependencies The GAV of the artifact.
*/
private void printInfoOfDependencies(String info, Map<String, Long> sizeOfDependencies, Set<String> dependencies) {
printString(info.toUpperCase() + " [" + dependencies.size() + "]" + ": ");
printDependencies(sizeOfDependencies, dependencies);
}

/**
* Utility method to obtain the size of a dependency from a map of dependency -> size. If the size of the dependency
* cannot be obtained form the map (no key with the name of the dependency exists), then it returns 0.
Expand Down Expand Up @@ -535,30 +547,15 @@ public void execute() throws MojoExecutionException, MojoFailureException {
printString(SEPARATOR);
printString(" D E P C L E A N A N A L Y S I S R E S U L T S");
printString(SEPARATOR);

printString("Used direct dependencies".toUpperCase()
+ " [" + usedDirectArtifactsCoordinates.size() + "]" + ": ");
printDependencies(sizeOfDependencies, usedDirectArtifactsCoordinates);

printString("Used inherited dependencies".toUpperCase()
+ " [" + usedInheritedArtifactsCoordinates.size() + "]" + ": ");
printDependencies(sizeOfDependencies, usedInheritedArtifactsCoordinates);

printString("Used transitive dependencies".toUpperCase()
+ " [" + usedTransitiveArtifactsCoordinates.size() + "]" + ": ");
printDependencies(sizeOfDependencies, usedTransitiveArtifactsCoordinates);

printString("Potentially unused direct dependencies".toUpperCase()
+ " [" + unusedDirectArtifactsCoordinates.size() + "]" + ": ");
printDependencies(sizeOfDependencies, unusedDirectArtifactsCoordinates);

printString("Potentially unused inherited dependencies".toUpperCase()
+ " [" + unusedInheritedArtifactsCoordinates.size() + "]" + ": ");
printDependencies(sizeOfDependencies, unusedInheritedArtifactsCoordinates);

printString("Potentially unused transitive dependencies".toUpperCase()
+ " [" + unusedTransitiveArtifactsCoordinates.size() + "]" + ": ");
printDependencies(sizeOfDependencies, unusedTransitiveArtifactsCoordinates);
printInfoOfDependencies("Used direct dependencies", sizeOfDependencies, usedDirectArtifactsCoordinates);
printInfoOfDependencies("Used inherited dependencies", sizeOfDependencies, usedInheritedArtifactsCoordinates);
printInfoOfDependencies("Used transitive dependencies", sizeOfDependencies, usedTransitiveArtifactsCoordinates);
printInfoOfDependencies("Potentially unused direct dependencies", sizeOfDependencies,
unusedDirectArtifactsCoordinates);
printInfoOfDependencies("Potentially unused inherited dependencies", sizeOfDependencies,
unusedInheritedArtifactsCoordinates);
printInfoOfDependencies("Potentially unused transitive dependencies", sizeOfDependencies,
unusedTransitiveArtifactsCoordinates);

if (!ignoreDependencies.isEmpty()) {
printString(SEPARATOR);
Expand Down

0 comments on commit b3fbeaa

Please sign in to comment.