Skip to content

Commit

Permalink
Removed editor config checker version info
Browse files Browse the repository at this point in the history
  • Loading branch information
samtholiya committed Dec 28, 2024
1 parent 97028ef commit 6b86d1a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 24 deletions.
26 changes: 4 additions & 22 deletions cmd/editor_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -16,7 +17,6 @@ import (
)

var (
editorConfigVersion = "v3.0.3"
defaultConfigFilePath = ".editorconfig"
initEditorConfig bool
currentConfig *config.Config
Expand Down Expand Up @@ -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
}
Expand All @@ -57,7 +56,7 @@ func initializeConfig() {
}

if initEditorConfig {
err := currentConfig.Save(editorConfigVersion)
err := currentConfig.Save(version.Version)
if err != nil {
u.LogErrorAndExit(atmosConfig, err)
}
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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")
Expand Down
1 change: 0 additions & 1 deletion examples/quick-start-simple/atmos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,4 @@ stacks:
name_pattern: "{stage}"

logs:
file: "/dev/stderr"
level: Info
1 change: 0 additions & 1 deletion tests/test_cases.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,6 @@ tests:
- "editorconfig"
expect:
stdout:
- "EditorConfig Checker CLI Version: v3.0.3"
- "No errors found"
stderr:
- "^$"
Expand Down

0 comments on commit 6b86d1a

Please sign in to comment.