Skip to content

Commit c70faa5

Browse files
authored
Merge 4ce6e15 into c0b977b
2 parents c0b977b + 4ce6e15 commit c70faa5

File tree

1 file changed

+66
-0
lines changed

1 file changed

+66
-0
lines changed

cmd/README.md

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# codacy-cli-v2
2+
3+
This is a POC for what could a new CLI for us. The idea is to rely on the native tools and SARIF format instead of relying on docker.
4+
5+
## Download
6+
7+
### MacOS brew
8+
9+
```bash
10+
brew install codacy/codacy-cli-v2/codacy-cli-v2
11+
```
12+
13+
### Linux
14+
15+
For linux we rely on `codacy-cli.sh` script on the root, to download the CLI you can:
16+
17+
```bash
18+
bash <(curl -Ls https://raw.githubusercontent.com/codacy/codacy-cli-v2/main/codacy-cli.sh)
19+
```
20+
21+
You can either put the downloaded script on a specific file, or an alias that will download the script and look for changes:
22+
```bash
23+
alias codacy-cli-v2="bash <(curl -Ls https://raw.githubusercontent.com/codacy/codacy-cli-v2/main/codacy-cli.sh)"
24+
```
25+
26+
## Important concepts
27+
28+
### `.codacy/.codacy.yaml`
29+
30+
Our CLI relies on the `.codacy/.codacy.yaml` to install and run the specified `node` and `eslint` versions.
31+
32+
Meaning that on the root of the repository that you want to analyse, you should create a `.codacy/.codacy.yaml` such as:
33+
34+
```yaml
35+
runtimes:
36+
37+
tools:
38+
39+
```
40+
41+
### `codacy-cli-v2 install`
42+
43+
Before running, you need to do an install command, so it downloads the specified `node` and `eslint` versions.
44+
To install the tools specified on your `.codacy/.codacy.yaml` you should:
45+
46+
```bash
47+
codacy-cli-v2 install
48+
```
49+
50+
## Run
51+
52+
For now, we only support ESLint, to run and output the results to the terminal:
53+
54+
```bash
55+
codacy-cli-v2 analyze eslint
56+
```
57+
58+
Alternatively, you can store the results as SARIF to a file:
59+
60+
```bash
61+
codacy-cli-v2 analyze eslint -o eslint.sarif
62+
```
63+
64+
## Example repo
65+
66+
As an example, that as an action that relies on this CLI, you can check <https://github.com/troubleshoot-codacy/eslint-test-examples>

0 commit comments

Comments
 (0)