in internal/core/ide.go [108:252]
func GetIdeArgs(c corescan.Context) []string {
arguments := make([]string, 0)
if c.CustomLocalQodanaYamlPath() != "" {
arguments = append(arguments, "--config", strutil.QuoteForWindows(c.CustomLocalQodanaYamlPath()))
}
if c.Analyser().IsContainer() && c.SaveReport() {
arguments = append(arguments, "--save-report")
}
if c.OnlyDirectory() != "" {
arguments = append(arguments, "--only-directory", strutil.QuoteForWindows(c.OnlyDirectory()))
}
if c.DisableSanity() {
arguments = append(arguments, "--disable-sanity")
}
if c.ProfileName() != "" {
arguments = append(arguments, "--profile-name", strutil.QuoteIfSpace(c.ProfileName()))
}
if c.ProfilePath() != "" {
arguments = append(arguments, "--profile-path", strutil.QuoteForWindows(c.ProfilePath()))
}
if c.RunPromo() != "" {
arguments = append(arguments, "--run-promo", c.RunPromo())
}
if c.Script() != "" && c.Script() != "default" {
arguments = append(arguments, "--script", c.Script())
}
if c.Baseline() != "" {
arguments = append(arguments, "--baseline", strutil.QuoteForWindows(c.Baseline()))
}
if c.BaselineIncludeAbsent() {
arguments = append(arguments, "--baseline-include-absent")
}
if c.FailThreshold() != "" {
arguments = append(arguments, "--fail-threshold", c.FailThreshold())
}
if rel := c.ProjectDirPathRelativeToRepositoryRoot(); rel != "" && rel != "." {
if c.Analyser().IsContainer() {
// it is safe to use / here because it's a path inside the container
arguments = append(arguments, "--project-dir", qdcontainer.MountDir+"/"+rel)
arguments = append(arguments, "--repository-root", qdcontainer.MountDir)
}
}
linter := c.Analyser().GetLinter()
if linter.SupportFixes {
applyFixes := c.ApplyFixes()
cleanup := c.Cleanup()
if c.FixesStrategy() != "" {
switch strings.ToLower(c.FixesStrategy()) {
case "apply":
applyFixes = true
case "cleanup":
cleanup = true
default:
break
}
}
if !c.Analyser().IsContainer() && c.Prod().Is233orNewer() {
if applyFixes {
arguments = append(arguments, "--apply-fixes")
} else if cleanup {
arguments = append(arguments, "--cleanup")
}
} else { // remove this block in 2023.3 or later
if applyFixes {
arguments = append(arguments, "--fixes-strategy", "apply")
} else if cleanup {
arguments = append(arguments, "--fixes-strategy", "cleanup")
}
}
}
// TODO : think how it could be better handled in presence of random 3rd party linters
if linter == product.DotNetCommunityLinter || linter == product.ClangLinter {
// third party common options
if c.NoStatistics() {
arguments = append(arguments, "--no-statistics")
}
if linter == product.DotNetCommunityLinter {
// cdnet options
if c.CdnetSolution() != "" {
arguments = append(arguments, "--solution", strutil.QuoteForWindows(c.CdnetSolution()))
}
if c.CdnetProject() != "" {
arguments = append(arguments, "--project", strutil.QuoteForWindows(c.CdnetProject()))
}
if c.CdnetConfiguration() != "" {
arguments = append(arguments, "--configuration", c.CdnetConfiguration())
}
if c.CdnetPlatform() != "" {
arguments = append(arguments, "--platform", c.CdnetPlatform())
}
if c.CdnetNoBuild() {
arguments = append(arguments, "--no-build")
}
} else {
// clang options
if c.ClangCompileCommands() != "" {
arguments = append(arguments, "--compile-commands", strutil.QuoteForWindows(c.ClangCompileCommands()))
}
if c.ClangArgs() != "" {
arguments = append(arguments, "--clang-args", c.ClangArgs())
}
}
}
if c.Analyser().IsContainer() {
if startHash, err := c.StartHash(); startHash != "" && err == nil && c.Script() == "default" {
arguments = append(arguments, "--diff-start", startHash)
}
if c.DiffEnd() != "" && c.Script() == "default" {
arguments = append(arguments, "--diff-end", c.DiffEnd())
}
if c.ForceLocalChangesScript() && c.Script() == "default" {
arguments = append(arguments, "--force-local-changes-script")
}
if c.AnalysisId() != "" {
arguments = append(arguments, "--analysis-id", c.AnalysisId())
}
if c.CoverageDir() != "" {
arguments = append(arguments, "--coverage-dir", c.CoverageDir())
}
if c.JvmDebugPort() > 0 {
arguments = append(arguments, "--jvm-debug-port", strconv.Itoa(c.JvmDebugPort()))
}
if c.GlobalConfigurationsDir() != "" {
arguments = append(arguments, "--global-config-dir", qdcontainer.DataGlobalConfigDir)
}
if c.GlobalConfigurationId() != "" {
arguments = append(arguments, "--global-config-id", c.GlobalConfigurationId())
}
if c.GenerateCodeClimateReport() {
arguments = append(arguments, "--code-climate")
}
for _, property := range c.Property() {
arguments = append(arguments, "--property="+property)
}
} else if c.Prod().Is251orNewer() {
arguments = append(arguments, "--config-dir", strutil.QuoteForWindows(c.EffectiveConfigurationDir()))
}
return arguments
}