From 3260d62f6011064aa49443320ad9549689221b77 Mon Sep 17 00:00:00 2001 From: tiulpin Date: Thu, 10 Feb 2022 17:49:55 +0300 Subject: [PATCH] :bug: Improve linter detection from .idea --- cmd/init.go | 8 +++++++- core/configurator.go | 3 ++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/cmd/init.go b/cmd/init.go index 5517d1da..7f43c776 100644 --- a/cmd/init.go +++ b/cmd/init.go @@ -34,7 +34,13 @@ func NewInitCommand() *cobra.Command { Short: "Configure project for Qodana", Long: `Configure project for Qodana: prepare Qodana configuration file by analyzing the project structure and generating a default configuration qodana.yaml file.`, Run: func(cmd *cobra.Command, args []string) { - core.GetLinter(options.ProjectDir) + qodanaYaml := core.GetQodanaYaml(options.ProjectDir) + if qodanaYaml.Linter == "" { + core.GetLinter(options.ProjectDir) + } else { + core.EmptyMessage() + core.SuccessMessage("The linter was already configured before: %s", core.PrimaryBold(qodanaYaml.Linter)) + } core.WarningMessage("Run %s to analyze the project. The configuration is stored in qodana.yaml and can be changed later", core.PrimaryBold("qodana scan")) }, } diff --git a/core/configurator.go b/core/configurator.go index 997fcf24..b034fa4f 100644 --- a/core/configurator.go +++ b/core/configurator.go @@ -206,7 +206,8 @@ func readIdeaDir(project string) []string { workspace := string(xml) if strings.Contains(workspace, "PhpWorkspaceProjectConfiguration") { languages = Append(languages, "PHP") - } else { + } + if strings.Contains(workspace, "node.js.detected.package.eslint") { languages = Append(languages, "JavaScript") } }