@@ -352,26 +352,32 @@ func runToolByName(toolName string, workDirectory string, pathsToCheck []string,
352352 return err
353353 }
354354
355- // Get the tool name with the right version e.g. ESLint9, PMD7, etc.
356- toolRightVersion := getToolName (toolName , tool .Version )
357- fmt .Printf (toolName )
355+ var t * domain.Tool
356+ var usesConfigurationFile = false
358357
359- // Get the repository tools to access tool settings
360- repositoryTools , _ := codacyclient .GetRepositoryTools (initFlags )
358+ // If the user doesn't provide init flags, we skip fetching repository tools
359+ if initFlags != (domain.InitFlags {}) {
360+ // Get the tool name with the right version e.g. ESLint9, PMD7, etc.
361+ toolRightVersion := getToolName (toolName , tool .Version )
361362
362- // Find the matching tool in repositoryTools
363- var t * domain.Tool
364- for i , tool := range repositoryTools {
365- if tool .Name == toolRightVersion {
366- t = & repositoryTools [i ]
367- break
363+ // Get the repository tools to access tool settings
364+ repositoryTools , _ := codacyclient .GetRepositoryTools (initFlags )
365+
366+ // Find the matching tool in repositoryTools
367+
368+ for i , tool := range repositoryTools {
369+ if tool .Name == toolRightVersion {
370+ t = & repositoryTools [i ]
371+ usesConfigurationFile = t .Settings .UsesConfigurationFile
372+ break
373+ }
368374 }
369375 }
370376
371377 switch toolName {
372378 case "eslint" :
373379 binaryPath := runtime .Binaries [tool .Runtime ]
374- return tools .RunEslint (workDirectory , tool .InstallDir , binaryPath , pathsToCheck , autoFix , outputFile , outputFormat , t . Settings . UsesConfigurationFile )
380+ return tools .RunEslint (workDirectory , tool .InstallDir , binaryPath , pathsToCheck , autoFix , outputFile , outputFormat , usesConfigurationFile )
375381 case "trivy" :
376382 binaryPath := tool .Binaries [toolName ]
377383 return tools .RunTrivy (workDirectory , binaryPath , pathsToCheck , outputFile , outputFormat )
0 commit comments