Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion scan.go
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ func (c *codeScanner) recordBundleDeduplication(missingFiles int, totalFiles int
return
}

ratio := missingFiles * 100 / totalFiles
ratio := (totalFiles - missingFiles) * 100 / totalFiles
c.analytics.AddExtensionIntegerValue("bundle_dedup_ratio_percent", ratio)

c.logger.Info().
Expand Down
4 changes: 2 additions & 2 deletions scan_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ func Test_UploadAndAnalyzeWithOptions_recordsUploadMetrics(t *testing.T) {
t.Run("records the bundle deduplication ratio", func(t *testing.T) {
requestId := uuid.NewString()
// One of the two files in the bundle is missing on the backend.
missingFiles := []string{firstDocPath}
missingFiles := []string{firstDocPath, secondDocPath}
mockBundle := bundle.NewBundle(deepcodeMocks.NewMockDeepcodeClient(ctrl), mockInstrumentor, mockErrorReporter, &logger, "testRootPath", uuid.NewString(), files, []string{}, missingFiles)
mockBundleManager := bundleMocks.NewMockBundleManager(ctrl)
mockBundleManager.EXPECT().CreateEmpty(gomock.Any(), baseDir, gomock.Any(), map[string]bool{}).Return(mockBundle, nil)
Expand All @@ -306,7 +306,7 @@ func Test_UploadAndAnalyzeWithOptions_recordsUploadMetrics(t *testing.T) {
require.NoError(t, err)

extensions := uploadExtensions(t, analyticsClient)
assert.Equal(t, float64(50), extensions["bundle_dedup_ratio_percent"])
assert.Equal(t, float64(0), extensions["bundle_dedup_ratio_percent"])
})

t.Run("records no deduplication ratio for an empty bundle", func(t *testing.T) {
Expand Down
Loading