You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by mi...@apache.org on 2016/01/31 02:06:57 UTC
svn commit: r1727773 -
/maven/plugins/trunk/maven-project-info-reports-plugin/src/main/java/org/apache/maven/report/projectinfo/DependencyConvergenceReport.java
Author: michaelo
Date: Sun Jan 31 01:06:57 2016
New Revision: 1727773
URL: http://svn.apache.org/viewvc?rev=1727773&view=rev
Log:
[MPIR-340] Omit legend and dependency details in Dependency Convergence if there is 100 % convergence
Modified:
maven/plugins/trunk/maven-project-info-reports-plugin/src/main/java/org/apache/maven/report/projectinfo/DependencyConvergenceReport.java
Modified: maven/plugins/trunk/maven-project-info-reports-plugin/src/main/java/org/apache/maven/report/projectinfo/DependencyConvergenceReport.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-project-info-reports-plugin/src/main/java/org/apache/maven/report/projectinfo/DependencyConvergenceReport.java?rev=1727773&r1=1727772&r2=1727773&view=diff
==============================================================================
--- maven/plugins/trunk/maven-project-info-reports-plugin/src/main/java/org/apache/maven/report/projectinfo/DependencyConvergenceReport.java (original)
+++ maven/plugins/trunk/maven-project-info-reports-plugin/src/main/java/org/apache/maven/report/projectinfo/DependencyConvergenceReport.java Sun Jan 31 01:06:57 2016
@@ -80,7 +80,7 @@ public class DependencyConvergenceReport
/** URL for the 'icon_error_sml.gif' image */
private static final String IMG_ERROR_URL = "images/icon_error_sml.gif";
- private static final int PERCENTAGE = 100;
+ private static final int FULL_CONVERGENCE = 100;
// ----------------------------------------------------------------------
// Mojo parameters
@@ -180,19 +180,25 @@ public class DependencyConvergenceReport
sink.sectionTitle1_();
DependencyAnalyzeResult dependencyResult = analyzeDependencyTree();
+ int convergence = calculateConvergence( dependencyResult );
- // legend
- generateLegend( locale, sink );
-
- sink.lineBreak();
+ if ( convergence < FULL_CONVERGENCE )
+ {
+ // legend
+ generateLegend( locale, sink );
+ sink.lineBreak();
+ }
// stats
generateStats( locale, sink, dependencyResult );
sink.section1_();
- // convergence
- generateConvergence( locale, sink, dependencyResult );
+ if ( convergence < FULL_CONVERGENCE )
+ {
+ // convergence
+ generateConvergence( locale, sink, dependencyResult );
+ }
sink.body_();
sink.flush();
@@ -570,7 +576,7 @@ public class DependencyConvergenceReport
int snapshotCount = result.getSnapshotCount();
int conflictingCount = result.getConflictingCount();
- int convergence = (int) ( ( (double) depCount / (double) artifactCount ) * PERCENTAGE );
+ int convergence = calculateConvergence( result );
// Create report
sink.table();
@@ -633,7 +639,7 @@ public class DependencyConvergenceReport
sink.text( getI18nString( locale, "stats.convergence" ) );
sink.tableHeaderCell_();
sink.tableCell();
- if ( convergence < PERCENTAGE )
+ if ( convergence < FULL_CONVERGENCE )
{
iconError( locale, sink );
}
@@ -653,7 +659,7 @@ public class DependencyConvergenceReport
sink.text( getI18nString( locale, "stats.readyrelease" ) );
sink.tableHeaderCell_();
sink.tableCell();
- if ( convergence >= PERCENTAGE && snapshotCount <= 0 )
+ if ( convergence >= FULL_CONVERGENCE && snapshotCount <= 0 )
{
iconSuccess( locale, sink );
sink.nonBreakingSpace();
@@ -668,7 +674,7 @@ public class DependencyConvergenceReport
sink.bold();
sink.text( getI18nString( locale, "stats.readyrelease.error" ) );
sink.bold_();
- if ( convergence < PERCENTAGE )
+ if ( convergence < FULL_CONVERGENCE )
{
sink.lineBreak();
sink.text( getI18nString( locale, "stats.readyrelease.error.convergence" ) );
@@ -961,6 +967,12 @@ public class DependencyConvergenceReport
return children;
}
+ private int calculateConvergence( DependencyAnalyzeResult result )
+ {
+ return (int) ( ( (double) result.getDependencyCount()
+ / (double) result.getArtifactCount() ) * FULL_CONVERGENCE );
+ }
+
/**
* Internal object
*/