From 6b86d1af0745fa71cdce9e1a27fb404ef1377d56 Mon Sep 17 00:00:00 2001 From: Sam Tholiya Date: Sat, 28 Dec 2024 22:23:44 +0100 Subject: [PATCH] Removed editor config checker version info --- cmd/editor_config.go | 26 ++++---------------------- examples/quick-start-simple/atmos.yaml | 1 - tests/test_cases.yaml | 1 - 3 files changed, 4 insertions(+), 24 deletions(-) diff --git a/cmd/editor_config.go b/cmd/editor_config.go index a0eedb881..aa07bb185 100644 --- a/cmd/editor_config.go +++ b/cmd/editor_config.go @@ -6,6 +6,7 @@ import ( "github.com/cloudposse/atmos/pkg/schema" u "github.com/cloudposse/atmos/pkg/utils" + "github.com/cloudposse/atmos/pkg/version" "github.com/editorconfig-checker/editorconfig-checker/v3/pkg/config" er "github.com/editorconfig-checker/editorconfig-checker/v3/pkg/error" @@ -16,7 +17,6 @@ import ( ) var ( - editorConfigVersion = "v3.0.3" defaultConfigFilePath = ".editorconfig" initEditorConfig bool currentConfig *config.Config @@ -45,7 +45,6 @@ var editorConfigCmd *cobra.Command = &cobra.Command{ func initializeConfig() { replaceAtmosConfigInConfig(atmosConfig) - u.LogInfo(atmosConfig, fmt.Sprintf("EditorConfig Checker CLI Version: %s", editorConfigVersion)) if configFilePath == "" { configFilePath = defaultConfigFilePath } @@ -57,7 +56,7 @@ func initializeConfig() { } if initEditorConfig { - err := currentConfig.Save(editorConfigVersion) + err := currentConfig.Save(version.Version) if err != nil { u.LogErrorAndExit(atmosConfig, err) } @@ -127,10 +126,6 @@ func runMainLogic() { u.LogErrorAndExit(atmosConfig, err) } - if handleReturnableFlags(config) { - return - } - filePaths, err := files.GetFiles(config) if err != nil { u.LogErrorAndExit(atmosConfig, err) @@ -159,27 +154,14 @@ func checkVersion(config config.Config) error { if !utils.FileExists(config.Path) || config.Version == "" { return nil } - if config.Version != editorConfigVersion { + if config.Version != version.Version { return fmt.Errorf("version mismatch: binary=%s, config=%s", - editorConfigVersion, config.Version) + version.Version, config.Version) } return nil } -// handleReturnableFlags handles early termination flags -func handleReturnableFlags(config config.Config) bool { - if config.ShowVersion { - config.Logger.Output(editorConfigVersion) - return true - } - if config.Help { - config.Logger.Output("USAGE:") - return true - } - return false -} - // addPersistentFlags adds flags to the root command func addPersistentFlags(cmd *cobra.Command) { cmd.PersistentFlags().StringVar(&configFilePath, "config", "", "Path to the configuration file") diff --git a/examples/quick-start-simple/atmos.yaml b/examples/quick-start-simple/atmos.yaml index 555d07515..37ec5031e 100644 --- a/examples/quick-start-simple/atmos.yaml +++ b/examples/quick-start-simple/atmos.yaml @@ -17,5 +17,4 @@ stacks: name_pattern: "{stage}" logs: - file: "/dev/stderr" level: Info diff --git a/tests/test_cases.yaml b/tests/test_cases.yaml index a37d5f0e7..cda0c0004 100644 --- a/tests/test_cases.yaml +++ b/tests/test_cases.yaml @@ -146,7 +146,6 @@ tests: - "editorconfig" expect: stdout: - - "EditorConfig Checker CLI Version: v3.0.3" - "No errors found" stderr: - "^$"