@@ -310,14 +310,16 @@ func checkIfConfigExistsAndIsNeeded(toolName string, cliLocalMode bool) error {
310310 // Only show error if we're in remote mode and need the config file
311311 if ! cliLocalMode && initFlags .ApiToken != "" {
312312 fmt .Printf ("Creating new config file for tool %s\n " , toolName )
313- configsetup .CreateToolConfigurationFile (toolName , initFlags )
313+ if err := configsetup .CreateToolConfigurationFile (toolName , initFlags ); err != nil {
314+ return fmt .Errorf ("failed to create config file for tool %s: %w" , toolName , err )
315+ }
314316 } else if ! cliLocalMode {
315- fmt .Printf ("config file not found for tool %s: %s and no api token provided \n " , toolName , toolConfigPath )
317+ fmt .Printf ("Config file not found for tool %s: %s and no API token provided\n " , toolName , toolConfigPath )
316318 } else {
317- fmt .Printf ("config file not found for tool %s: %s please add a config file to the tools-configs directory\n " , toolName , toolConfigPath )
319+ fmt .Printf ("Config file not found for tool %s: %s. Please add a config file to the tools-configs directory\n " , toolName , toolConfigPath )
318320 }
319321 } else if err != nil {
320- fmt .Printf ( "error checking config file for tool %s: %v \n " , toolName , err )
322+ return fmt .Errorf ( "Error checking config file for tool %s: %w " , toolName , err )
321323 } else {
322324 fmt .Printf ("Config file found for %s: %s\n " , toolName , toolConfigPath )
323325 }
@@ -365,7 +367,7 @@ func runTool(workDirectory string, toolName string, pathsToCheck []string, outpu
365367 return err
366368 }
367369 log .Println ("Running tools for the specified file(s)..." )
368- log .Printf ("Running %s...\n " , toolName )
370+ log .Printf ("Running %s..." , toolName )
369371
370372 tool := config .Config .Tools ()[toolName ]
371373 var isToolInstalled bool
@@ -397,7 +399,7 @@ func runTool(workDirectory string, toolName string, pathsToCheck []string, outpu
397399 runtime = config .Config .Runtimes ()[tool .Runtime ]
398400 isRuntimeInstalled = runtime == nil || config .Config .IsRuntimeInstalled (tool .Runtime , runtime )
399401 if ! isRuntimeInstalled {
400- fmt .Printf ("%s runtime is not installed, installing...\n " , tool .Runtime )
402+ fmt .Printf ("%s runtime is not installed, installing..." , tool .Runtime )
401403 err := config .InstallRuntime (tool .Runtime , runtime )
402404 if err != nil {
403405 return fmt .Errorf ("failed to install %s runtime: %w" , tool .Runtime , err )
@@ -409,7 +411,7 @@ func runTool(workDirectory string, toolName string, pathsToCheck []string, outpu
409411 runtime = config .Config .Runtimes ()[tool .Runtime ]
410412 isRuntimeInstalled = runtime == nil || config .Config .IsRuntimeInstalled (tool .Runtime , runtime )
411413 if ! isRuntimeInstalled {
412- fmt .Printf ("%s runtime is not installed, installing...\n " , tool .Runtime )
414+ fmt .Printf ("%s runtime is not installed, installing..." , tool .Runtime )
413415 err := config .InstallRuntime (tool .Runtime , runtime )
414416 if err != nil {
415417 return fmt .Errorf ("failed to install %s runtime: %w" , tool .Runtime , err )
@@ -443,7 +445,9 @@ func validateCloudMode(cliLocalMode bool) error {
443445var analyzeCmd = & cobra.Command {
444446 Use : "analyze" ,
445447 Short : "Analyze code using configured tools" ,
446- Long : `Analyze code using configured tools and output results in the specified format.` ,
448+ Long : `Analyze code using configured tools and output results in the specified format.
449+
450+ Supports API token, provider, and repository flags to automatically fetch tool configurations from Codacy API if they don't exist locally.` ,
447451 Run : func (cmd * cobra.Command , args []string ) {
448452 // Validate paths before proceeding
449453 if err := validatePaths (args ); err != nil {
0 commit comments