Skip to content

Commit 9aa8fa4

Browse files
committed
support yml extension on the config file
1 parent de26f61 commit 9aa8fa4

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ The `codacy-cli-v2` is a command-line tool for Codacy that supports analyzing co
2929

3030
### Important Concepts
3131

32-
- **`.codacy/.codacy.yaml`**: Configuration file to specify `node` and `eslint` versions for the CLI.
32+
- **`.codacy/codacy.yaml`**: Configuration file to specify `node` and `eslint` versions for the CLI.
3333
```yaml
3434
runtimes:
3535
@@ -66,29 +66,29 @@ alias codacy-cli-v2="bash <(curl -Ls https://raw.githubusercontent.com/codacy/co
6666
Before running the analysis, install the specified tools:
6767

6868
```bash
69-
codacy-cli-v2 install
69+
codacy-cli install
7070
```
7171

7272
### Run Analysis
7373

7474
To run ESLint and output the results to the terminal:
7575

7676
```bash
77-
codacy-cli-v2 analyze --tool eslint
77+
codacy-cli analyze --tool eslint
7878
```
7979

8080
To store the results as SARIF in a file:
8181

8282
```bash
83-
codacy-cli-v2 analyze -t eslint -o eslint.sarif
83+
codacy-cli analyze -t eslint -o eslint.sarif
8484
```
8585

8686
## Upload Results
8787

8888
To upload a SARIF file to Codacy:
8989

9090
```bash
91-
codacy-cli-v2 upload -s path/to/your.sarif -c your-commit-uuid -t your-project-token
91+
codacy-cli upload -s path/to/your.sarif -c your-commit-uuid -t your-project-token
9292
```
9393

9494
### Example Repository

config/config.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,15 @@ func (c *ConfigType) initCodacyDirs() {
8383
if err != nil {
8484
log.Fatal(err)
8585
}
86-
c.projectConfigFile = filepath.Join(c.localCodacyDirectory, "codacy.yaml")
86+
87+
yamlPath := filepath.Join(c.localCodacyDirectory, "codacy.yaml")
88+
ymlPath := filepath.Join(c.localCodacyDirectory, "codacy.yml")
89+
90+
if _, err := os.Stat(ymlPath); err == nil {
91+
c.projectConfigFile = ymlPath
92+
} else {
93+
c.projectConfigFile = yamlPath
94+
}
8795
}
8896

8997
func Init() {

0 commit comments

Comments
 (0)