Skip to content

Commit

Permalink
Also compute global totals for booleans.
Browse files Browse the repository at this point in the history
  • Loading branch information
handstandsam committed Jul 5, 2024
1 parent 0595ed6 commit 7cc0f66
Showing 1 changed file with 26 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,18 @@ import com.squareup.invert.internal.models.CollectedDependenciesForProject
import com.squareup.invert.internal.models.CollectedOwnershipForProject
import com.squareup.invert.internal.models.CollectedPluginsForProject
import com.squareup.invert.internal.models.CollectedStatsForProject
import com.squareup.invert.models.*
import com.squareup.invert.models.CollectedStatType.BOOLEAN
import com.squareup.invert.models.CollectedStatType.CODE_REFERENCES
import com.squareup.invert.models.CollectedStatType.DI_PROVIDES_AND_INJECTS
import com.squareup.invert.models.CollectedStatType.NUMERIC
import com.squareup.invert.models.CollectedStatType.STRING
import com.squareup.invert.models.ConfigurationName
import com.squareup.invert.models.DependencyId
import com.squareup.invert.models.GradlePath
import com.squareup.invert.models.GradlePluginId
import com.squareup.invert.models.Stat
import com.squareup.invert.models.StatKey
import com.squareup.invert.models.StatMetadata
import com.squareup.invert.models.js.ConfigurationsJsReportModel
import com.squareup.invert.models.js.DependenciesJsReportModel
import com.squareup.invert.models.js.DirectDependenciesJsReportModel
Expand Down Expand Up @@ -37,7 +48,20 @@ object InvertJsReportUtils {

fun computeGlobalStats(allProjectsStatsData: StatsJsReportModel): Map<StatMetadata, Int> {
val globalStats: Map<StatMetadata, Int> = allProjectsStatsData.statInfos.values
.filter { it.statType == CollectedStatType.NUMERIC }
.filter {
when (it.statType) {
BOOLEAN,
NUMERIC -> {
true
}

STRING,
CODE_REFERENCES,
DI_PROVIDES_AND_INJECTS -> {
false
}
}
}
.associateWith { statMetadata ->
val statKey = statMetadata.key
allProjectsStatsData.statsByModule.values.sumOf {
Expand Down

0 comments on commit 7cc0f66

Please sign in to comment.