@@ -15,6 +15,7 @@ import (
1515 "codacy/cli-v2/tools"
1616 "codacy/cli-v2/tools/lizard"
1717 "codacy/cli-v2/tools/pylint"
18+ reviveTool "codacy/cli-v2/tools/revive"
1819 "codacy/cli-v2/utils"
1920)
2021
@@ -374,6 +375,11 @@ func createToolFileConfigurations(tool domain.Tool, patternConfiguration []domai
374375 return fmt .Errorf ("failed to create Lizard config: %v" , err )
375376 }
376377 fmt .Println ("Lizard configuration created based on Codacy settings" )
378+ case domain .Revive :
379+ if err := createReviveConfigFile (patternConfiguration , toolsConfigDir ); err != nil {
380+ return fmt .Errorf ("failed to write revive config: %v" , err )
381+ }
382+ fmt .Println ("Revive configuration created based on Codacy settings" )
377383 }
378384 return nil
379385}
@@ -466,6 +472,11 @@ func createLizardConfigFile(toolsConfigDir string, patternConfiguration []domain
466472 return nil
467473}
468474
475+ func createReviveConfigFile (config []domain.PatternConfiguration , toolsConfigDir string ) error {
476+ reviveConfigurationString := reviveTool .GenerateReviveConfig (config )
477+ return os .WriteFile (filepath .Join (toolsConfigDir , "revive.toml" ), []byte (reviveConfigurationString ), utils .DefaultFilePerms )
478+ }
479+
469480// buildDefaultConfigurationFiles creates default configuration files for all tools
470481func BuildDefaultConfigurationFiles (toolsConfigDir string , flags domain.InitFlags ) error {
471482 for uuid := range domain .SupportedToolsMetadata {
@@ -502,6 +513,10 @@ func BuildDefaultConfigurationFiles(toolsConfigDir string, flags domain.InitFlag
502513 if err := createLizardConfigFile (toolsConfigDir , patternsConfig ); err != nil {
503514 return fmt .Errorf ("failed to create default Lizard configuration: %w" , err )
504515 }
516+ case domain .Revive :
517+ if err := createReviveConfigFile (patternsConfig , toolsConfigDir ); err != nil {
518+ return fmt .Errorf ("failed to create default Revive configuration: %w" , err )
519+ }
505520 case domain .PMD7 , domain .ESLint9 :
506521 continue
507522 }
0 commit comments