Skip to content

Commit

Permalink
support yml extension on the config file
Browse files Browse the repository at this point in the history
  • Loading branch information
hjrocha committed Nov 26, 2024
1 parent de26f61 commit 9aa8fa4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ The `codacy-cli-v2` is a command-line tool for Codacy that supports analyzing co

### Important Concepts

- **`.codacy/.codacy.yaml`**: Configuration file to specify `node` and `eslint` versions for the CLI.
- **`.codacy/codacy.yaml`**: Configuration file to specify `node` and `eslint` versions for the CLI.
```yaml
runtimes:
- [email protected]
Expand Down Expand Up @@ -66,29 +66,29 @@ alias codacy-cli-v2="bash <(curl -Ls https://raw.githubusercontent.com/codacy/co
Before running the analysis, install the specified tools:

```bash
codacy-cli-v2 install
codacy-cli install
```

### Run Analysis

To run ESLint and output the results to the terminal:

```bash
codacy-cli-v2 analyze --tool eslint
codacy-cli analyze --tool eslint
```

To store the results as SARIF in a file:

```bash
codacy-cli-v2 analyze -t eslint -o eslint.sarif
codacy-cli analyze -t eslint -o eslint.sarif
```

## Upload Results

To upload a SARIF file to Codacy:

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

### Example Repository
Expand Down
10 changes: 9 additions & 1 deletion config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,15 @@ func (c *ConfigType) initCodacyDirs() {
if err != nil {
log.Fatal(err)
}
c.projectConfigFile = filepath.Join(c.localCodacyDirectory, "codacy.yaml")

yamlPath := filepath.Join(c.localCodacyDirectory, "codacy.yaml")
ymlPath := filepath.Join(c.localCodacyDirectory, "codacy.yml")

if _, err := os.Stat(ymlPath); err == nil {
c.projectConfigFile = ymlPath
} else {
c.projectConfigFile = yamlPath
}
}

func Init() {
Expand Down

0 comments on commit 9aa8fa4

Please sign in to comment.