Skip to content

Commit a6a6368

Browse files
authored
Merge pull request #80 from codacy/check-for-yml-config
feature: Adds support for codacy.yml
2 parents aa75670 + b1dd0e7 commit a6a6368

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

config/config.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,15 @@ func NewConfigType(repositoryDirectory string, repositoryCache string, globalCac
110110
c.toolsDirectory = filepath.Join(c.globalCacheDirectory, "tools")
111111
c.toolsConfigDirectory = filepath.Join(c.localCodacyDirectory, "tools-configs")
112112

113-
c.projectConfigFile = filepath.Join(c.localCodacyDirectory, "codacy.yaml")
113+
// If codacy.yml exists, we should rely on it
114+
ymlPath := filepath.Join(c.localCodacyDirectory, "codacy.yml")
115+
if _, err := os.Stat(ymlPath); err == nil {
116+
c.projectConfigFile = ymlPath
117+
} else {
118+
// Otherwise default to codacy.yaml
119+
c.projectConfigFile = filepath.Join(c.localCodacyDirectory, "codacy.yaml")
120+
}
121+
114122
c.cliConfigFile = filepath.Join(c.localCodacyDirectory, "cli-config.yaml")
115123

116124
c.runtimes = make(map[string]*plugins.RuntimeInfo)

0 commit comments

Comments
 (0)