func checkExitCode()

in internal/cmd/scan.go [184:211]


func checkExitCode(exitCode int, c corescan.Context) {
	if exitCode == utils.QodanaEapLicenseExpiredExitCode && msg.IsInteractive() {
		msg.EmptyMessage()
		msg.ErrorMessage(
			"Your license expired: update your license or token. If you are using EAP, make sure you are using the latest CLI version and update to the latest linter by running %s ",
			msg.PrimaryBold("qodana init"),
		)
		os.Exit(exitCode)
	} else if exitCode == utils.QodanaTimeoutExitCodePlaceholder {
		msg.ErrorMessage("Qodana analysis reached timeout %s", c.GetAnalysisTimeout())
		os.Exit(c.AnalysisTimeoutExitCode())
	} else if exitCode == utils.QodanaEmptyChangesetExitCodePlaceholder {
		msg.ErrorMessage("Nothing to analyse. Exiting with %s", utils.QodanaSuccessExitCode)
		os.Exit(utils.QodanaSuccessExitCode)
	} else if exitCode != utils.QodanaSuccessExitCode && exitCode != utils.QodanaFailThresholdExitCode {
		msg.ErrorMessage("Qodana exited with code %d", exitCode)
		msg.WarningMessage("Check ./logs/ in the results directory for more information")
		if exitCode == utils.QodanaOutOfMemoryExitCode {
			msg.ErrorMessage("Qodana was terminated after running out of memory.")
		} else if msg.AskUserConfirm(fmt.Sprintf("Do you want to open %s", c.ResultsDir())) {
			err := core.OpenDir(c.ResultsDir())
			if err != nil {
				log.Fatalf("Error while opening directory: %s", err)
			}
		}
		os.Exit(exitCode)
	}
}