Skip to content

Commit

Permalink
fix: add edge case
Browse files Browse the repository at this point in the history
  • Loading branch information
bastiandoetsch committed Nov 10, 2023
1 parent 3e6f14d commit 8bf4361
Showing 1 changed file with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,21 @@ class AnalyticsScanListener(val project: Project) {
}

override fun scanningSnykCodeFinished(snykCodeResults: SnykCodeResults?) {
snykCodeResults?.let {
val scanDoneEvent = getScanDoneEvent(
System.currentTimeMillis() - start,
"Snyk Code",
val duration = System.currentTimeMillis() - start
val product = "Snyk Code"
val scanDoneEvent = if (snykCodeResults != null) {
getScanDoneEvent(
duration,
product,
snykCodeResults.totalCriticalCount,
snykCodeResults.totalErrorsCount,
snykCodeResults.totalWarnsCount,
snykCodeResults.totalInfosCount,
)
getSnykTaskQueueService(project)?.ls?.sendReportAnalyticsCommand(scanDoneEvent)
} else {
getScanDoneEvent(duration, product, 0, 0, 0, 0)
}
getSnykTaskQueueService(project)?.ls?.sendReportAnalyticsCommand(scanDoneEvent)
}

override fun scanningIacFinished(iacResult: IacResult) {
Expand Down

0 comments on commit 8bf4361

Please sign in to comment.