@@ -272,10 +272,10 @@ var versionedToolNames = map[string]map[int]string{
272272}
273273
274274var simpleToolAliases = map [string ]string {
275- "lizard" : "Lizard" ,
275+ "lizard" : "Lizard" ,
276276 "opengrep" : "Opengrep" ,
277- "pylint" : "pylintpython3" ,
278- "trivy" : "Trivy" ,
277+ "pylint" : "pylintpython3" ,
278+ "trivy" : "Trivy" ,
279279}
280280
281281func getToolName (toolName string , version string ) string {
@@ -328,7 +328,7 @@ func checkIfConfigExistsAndIsNeeded(toolName string, cliLocalMode bool) error {
328328
329329 // Check if the config file exists
330330 if _ , err := os .Stat (toolConfigPath ); os .IsNotExist (err ) {
331- // Config file does not exist - create it if we have the means to do so
331+ repoConfigPath := filepath . Join ( config . Config . RepositoryDirectory (), configFileName )
332332 if (! cliLocalMode && initFlags .ApiToken != "" ) || cliLocalMode {
333333 if err := configsetup .CreateToolConfigurationFile (toolName , initFlags ); err != nil {
334334 return fmt .Errorf ("failed to create config file for tool %s: %w" , toolName , err )
@@ -340,6 +340,13 @@ func checkIfConfigExistsAndIsNeeded(toolName string, cliLocalMode bool) error {
340340 "error" : err ,
341341 })
342342 }
343+ } else if _ , repoErr := os .Stat (repoConfigPath ); repoErr == nil {
344+ // Config not in .codacy/tools-configs/ - check if it exists in the repo root
345+ logger .Info ("Config file found in repository root for tool, skipping config creation" , logrus.Fields {
346+ "tool" : toolName ,
347+ "toolConfigPath" : repoConfigPath ,
348+ })
349+ return nil
343350 } else {
344351 logger .Debug ("Config file not found for tool, using tool defaults" , logrus.Fields {
345352 "tool" : toolName ,
0 commit comments