Skip to content

Commit 99aaba4

Browse files
code review changes
1 parent b43c19d commit 99aaba4

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

config/config.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ func (c *ConfigType) Runtimes() map[string]*plugins.RuntimeInfo {
6969
return c.runtimes
7070
}
7171

72-
// readOrCreateConfig reads the existing YAML config or creates a new one
73-
func (c *ConfigType) readOrCreateConfig(codacyPath string) (map[string]interface{}, error) {
72+
// loadConfigOrInitializeEmpty reads the existing YAML config or returns an empty configuration if the file doesn't exist
73+
func (c *ConfigType) loadConfigOrInitializeEmpty(codacyPath string) (map[string]interface{}, error) {
7474
content, err := os.ReadFile(codacyPath)
7575
if err != nil && !os.IsNotExist(err) {
7676
return nil, fmt.Errorf("error reading codacy.yaml: %w", err)
@@ -129,7 +129,7 @@ func (c *ConfigType) writeConfig(codacyPath string, config map[string]interface{
129129
func (c *ConfigType) addRuntimeToCodacyYaml(name string, version string) error {
130130
codacyPath := filepath.Join(c.localCodacyDirectory, "codacy.yaml")
131131

132-
config, err := c.readOrCreateConfig(codacyPath)
132+
config, err := c.loadConfigOrInitializeEmpty(codacyPath)
133133
if err != nil {
134134
return err
135135
}

0 commit comments

Comments
 (0)