societe-generale/github-crawler

refactor maps merging in RepositoryEnricher

vincent-fuchs opened this issue · 0 comments

Summary

we can do better than

//TODO rewrite this in a functional Kotlin way, to reduce maps
miscRepositoryTasks.forEach{
val miscRepoTaskResult=it.perform(repo)
for ((branch, value) in miscRepoTaskResult) {
if(resultsCollector[branch]==null){
resultsCollector[branch]=value
}
else{
val existingValuesForBranch=resultsCollector[branch]!!.toMutableMap()
existingValuesForBranch.putAll(value)
resultsCollector[branch]=existingValuesForBranch
}
}
}

--> let's refactor it, leveraging on Kotlin features. Unit test is already in place to validate we don't break anything

Type of Issue

It is a :

  • request