func ComputeContext()

in internal/platform/thirdpartyscan/compute.go [27:74]


func ComputeContext(
	cliOptions platformcmd.CliOptions,
	initArgs commoncontext.Context,
	linterInfo LinterInfo,
	mountInfo MountInfo,
	cloudData ThirdPartyStartupCloudData,
	qodanaYamlConfig QodanaYamlConfig,
) Context {
	projectDir := initArgs.ProjectDir

	clangCompileCommands := cliOptions.ClangCompileCommands
	if strings.HasPrefix(clangCompileCommands, "./") || strings.HasPrefix(clangCompileCommands, "../") {
		clangCompileCommands = filepath.Join(projectDir, clangCompileCommands)
		clangCompileCommands = filepath.Clean(clangCompileCommands)
	}

	clangArgs := cliOptions.ClangArgs
	if clangArgs != "" {
		clangArgs = "-- " + clangArgs
	}

	return ContextBuilder{
		LinterInfo:                linterInfo,
		MountInfo:                 mountInfo,
		CloudData:                 cloudData,
		ProjectDir:                projectDir,
		ResultsDir:                initArgs.ResultsDir,
		ReportDir:                 initArgs.ReportDir,
		LogDir:                    initArgs.LogDir(),
		CacheDir:                  initArgs.CacheDir,
		ClangCompileCommands:      clangCompileCommands,
		ClangArgs:                 clangArgs,
		Property:                  cliOptions.Property,
		CdnetSolution:             cliOptions.CdnetSolution,
		CdnetProject:              cliOptions.CdnetProject,
		CdnetConfiguration:        cliOptions.CdnetConfiguration,
		CdnetPlatform:             cliOptions.CdnetPlatform,
		NoStatistics:              cliOptions.NoStatistics,
		CdnetNoBuild:              cliOptions.CdnetNoBuild,
		AnalysisId:                cliOptions.AnalysisId,
		Baseline:                  cliOptions.Baseline,
		BaselineIncludeAbsent:     cliOptions.BaselineIncludeAbsent,
		FailThreshold:             cliOptions.FailThreshold,
		GenerateCodeClimateReport: cliOptions.GenerateCodeClimateReport,
		SendBitBucketInsights:     cliOptions.SendBitBucketInsights,
		QodanaYamlConfig:          qodanaYamlConfig,
	}.Build()
}