Skip to content

Commit

Permalink
🚸 Improve user messaging about token and options
Browse files Browse the repository at this point in the history
  • Loading branch information
tiulpin committed Sep 18, 2023
1 parent 6a68d9d commit 3a1393f
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion cmd/scan.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ But you can always override qodana.yaml options with the following command-line
}
if exitCode == core.QodanaFailThresholdExitCode {
core.EmptyMessage()
core.ErrorMessage("The number of problems exceeds the failThreshold")
core.ErrorMessage("The number of problems exceeds the fail threshold")
os.Exit(exitCode)
}
},
Expand Down
4 changes: 4 additions & 0 deletions core/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,3 +211,7 @@ func (o *QodanaOptions) properties() (map[string]string, []string) {
}
return props, flagsArr
}

func (o *QodanaOptions) requiresToken() bool {
return (o.Linter != Image(QDPYC) && o.Linter != Image(QDJVMC)) || o.Ide != ""
}
10 changes: 6 additions & 4 deletions core/sarif.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,12 @@ func ReadSarif(sarifPath string, printProblems bool) {
}
}
}
if newProblems == 0 {
SuccessMessage("It seems all right 👌 No new problems found according to the checks applied")
} else {
ErrorMessage("Found %d new problems according to the checks applied", newProblems)
if !IsContainer() {
if newProblems == 0 {
SuccessMessage("It seems all right 👌 No new problems found according to the checks applied")
} else {
ErrorMessage("Found %d new problems according to the checks applied", newProblems)
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion core/token.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ func (o *QodanaOptions) getTokenFromKeychain(refresh bool) string {
}

func (o *QodanaOptions) getTokenFromUserInput() string {
if IsInteractive() {
if IsInteractive() && o.requiresToken() {
WarningMessage(cloud.EmptyTokenMessage)
var token string
for {
Expand Down

0 comments on commit 3a1393f

Please sign in to comment.