From ac0abeae790443670a683ba0e27a50a216e0a7f1 Mon Sep 17 00:00:00 2001 From: hybloid <48032702+hybloid@users.noreply.github.com> Date: Mon, 22 Apr 2024 14:38:08 +0200 Subject: [PATCH] :children_crossing: Disable report sending on license only token for 3rd party (#327) --- platform/run.go | 4 ++-- platform/statistics.go | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/platform/run.go b/platform/run.go index f3f9171e..8a1896c9 100644 --- a/platform/run.go +++ b/platform/run.go @@ -156,11 +156,11 @@ func RunAnalysis(options *QodanaOptions) (int, error) { } func sendReportToQodanaServer(options *QodanaOptions, mountInfo *MountInfo) { - if cloud.Token.Token != "" { + if cloud.Token.IsAllowedToSendReports() { fmt.Println("Publishing report ...") SendReport(options, cloud.Token.Token, QuoteForWindows(filepath.Join(options.CacheDir, PublisherJarName)), QuoteForWindows(mountInfo.JavaPath)) } else { - fmt.Println("License token is not set, skipping report publishing") + fmt.Println("Skipping report publishing") } } diff --git a/platform/statistics.go b/platform/statistics.go index fe035dbc..7de4550c 100644 --- a/platform/statistics.go +++ b/platform/statistics.go @@ -19,6 +19,7 @@ package platform import ( "encoding/json" "fmt" + "github.com/JetBrains/qodana-cli/v2024/cloud" "github.com/JetBrains/qodana-cli/v2024/tooling" "github.com/google/uuid" log "github.com/sirupsen/logrus" @@ -51,6 +52,10 @@ func sendFuserEvents(ch chan tooling.FuserEvent, events *[]tooling.FuserEvent, o println("Statistics disabled, skipping FUS") return } + if !cloud.Token.IsAllowedToSendFUS() { + println("You are not allowed to send FUS") + return + } linterOptions := opts.GetLinterSpecificOptions() if linterOptions == nil { log.Error(fmt.Errorf("linter specific options are not set"))