Initial support for virtual dependencies.

Well, they will probably not work anyway, because they don't have hashes. But at this point, at least the parser does not crash at isVirtual="false"
This commit is contained in:
Šesták Vít
2017-12-08 11:20:57 +01:00
parent 39ba123efc
commit 9343619ca9
3 changed files with 20 additions and 6 deletions

View File

@@ -401,13 +401,15 @@ class Statistics @Inject()(
val (lastRefreshTime, resultsFuture) = projectReportsProvider.resultsForVersions(versions)
resultsFuture flatMap { allResults =>
select(allResults, Some("project:"+req.body.plan)).fold(Future.successful(NotFound(Json.obj("error"->"not found")))) { selection =>
if(selection.result.failedProjects.nonEmpty){
throw new RuntimeException("Cannot compare, because the previous analysis has failed")
}
reportMapFuture.map {reportMap =>
def extractVulnerabilities(r: Result) = {
r.vulnerableDependencies.flatMap(_.vulnerabilities.map(_.name)).toSet
}
val adHocReports = DependencyCheckReportsParser.forAdHocScans(reportMap)
def compare[T](f: Result => Set[T]) = new SetDiff(f(selection.result), f(adHocReports))
//adHocReports.dep
Ok(Json.obj(
"vulnerabilities"->showDiff(compare(extractVulnerabilities)),
"dependencies"->showDiff(compare(_.groupedDependencies.map(GroupedDependencyIdentifier.fromGroupedDependency).toSet))