in internal/platform/commoncontext/common.go [182:242]
func SelectAnalyzerForPath(path string, token string) product.Analyzer {
var linters []product.Linter
msg.PrintProcess(
func(_ *pterm.SpinnerPrinter) {
languages := readIdeaDir(path)
if len(languages) == 0 {
languages, _ = recognizeDirLanguages(path)
}
if len(languages) == 0 {
msg.WarningMessage("No technologies detected (no source code files?)\n")
} else {
msg.WarningMessage("Detected technologies: " + strings.Join(languages, ", ") + "\n")
for _, language := range languages {
if i, ok := product.LangsToLinters[language]; ok {
linters = append(linters, i...)
}
}
if len(linters) == 0 {
linters = product.AllLinters
}
}
// breaking change will not be backported to 241
if (slices.Contains(linters, product.AndroidCommunityLinter) ||
slices.Contains(linters, product.AndroidLinter)) &&
isAndroidProject(path) {
filteredLinters := make([]product.Linter, 0, len(linters))
for _, l := range linters {
if l != product.AndroidLinter && l != product.AndroidCommunityLinter {
filteredLinters = append(filteredLinters, l)
}
}
linters = append(
[]product.Linter{product.AndroidLinter, product.AndroidCommunityLinter},
filteredLinters...,
)
}
}, "Scanning project", "",
)
linters = algorithm.Unique(linters)
selector := func(choices []string) string {
choice, err := msg.QodanaInteractiveSelect.WithOptions(choices).Show()
if err != nil {
msg.ErrorMessage("%s", err)
return ""
}
return choice
}
interactive := msg.IsInteractive()
linters = filterByLicensePlan(linters, token)
analyzer := selectAnalyzer(path, linters, interactive, selector)
if analyzer == nil {
msg.ErrorMessage("Could not configure project as it is not supported by Qodana")
msg.WarningMessage("See https://www.jetbrains.com/help/qodana/supported-technologies.html for more details")
os.Exit(1)
}
msg.SuccessMessage("Selected '%s'", analyzer.GetLinter().PresentableName)
return analyzer
}