|
1 | 1 | # Metrics
|
2 | 2 |
|
3 |
| -Metrics can be printed on screen or exported as different output formats |
4 |
| -through **rust-code-analysis-cli**. |
| 3 | +Metrics can be displayed or exported in various formats using the **rust-code-analysis-cli**. |
5 | 4 |
|
6 |
| -## Print metrics |
| 5 | +## Display Metrics |
7 | 6 |
|
8 |
| -For each function space, **rust-code-analysis** computes the list of metrics |
9 |
| -described above. At the end of this process, **rust-code-analysis-cli** |
10 |
| -dumps the result formatted in a certain way on the screen. |
11 |
| -The command used to print the metrics is the following one: |
| 7 | +To compute and display metrics for a given file or directory, run: |
12 | 8 |
|
13 |
| -```console |
| 9 | +```bash |
14 | 10 | rust-code-analysis-cli -m -p /path/to/your/file/or/directory
|
15 | 11 | ```
|
16 | 12 |
|
17 |
| -The `-p` option represents the path to a file or a directory. If a directory is |
18 |
| -passed as input, **rust-code-analysis-cli** computes the metrics for each file |
19 |
| -contained in it. |
| 13 | +- `-p`: Path to the file or directory to analyze. If a directory is passed, metrics will be computed for all supported files within. |
20 | 14 |
|
21 |
| -## Export formats |
| 15 | +## Exporting Metrics |
22 | 16 |
|
23 |
| -Different output formats can be used to export metrics: |
| 17 | +The **rust-code-analysis-cli** supports multiple output formats for exporting metrics, including: |
24 | 18 |
|
25 |
| -- Cbor |
26 |
| -- Json |
27 |
| -- Toml |
28 |
| -- Yaml |
| 19 | +- CBOR |
| 20 | +- JSON |
| 21 | +- TOML |
| 22 | +- YAML |
29 | 23 |
|
30 |
| -`Json` and `Toml` can also be exported pretty-printed. |
| 24 | +Both `Json` and `Toml` can be exported as pretty-printed. |
31 | 25 |
|
32 |
| -### Export command |
| 26 | +### Export Command |
33 | 27 |
|
34 |
| -For example, if you want to export metrics as a `json` file, run: |
| 28 | +To export metrics as a JSON file: |
35 | 29 |
|
36 |
| -```console |
37 |
| -rust-code-analysis-cli -m -O json -o /output/path -p /path/to/your/file/or/directory |
| 30 | +```bash |
| 31 | +rust-code-analysis-cli -m -p /path/to/your/file/or/directory -O json -o /path/to/output/directory |
38 | 32 | ```
|
39 | 33 |
|
40 |
| -The `-O` option allows you to choose the output format. It supports |
41 |
| -**only** these values: *cbor*, *json*, *toml*, *yaml*. |
| 34 | +- `-O`: Specifies the output format (e.g., json, toml, yaml, cbor). |
| 35 | +- `-o`: Path to save the output file. If not specified, the result will be printed in the shell. |
42 | 36 |
|
43 |
| -The `-o` option is used to specify the path where your file will be saved. |
44 |
| -It accepts **only** paths. The filename of your output file is the same as |
45 |
| -your input file plus the extension associated to the format. When this option |
46 |
| -is not given, the output is printed on shell. |
| 37 | +## Pretty Print |
47 | 38 |
|
48 |
| -As we said before, `Json` and `Toml` can be exported as pretty-printed. To do |
49 |
| -so, the `--pr` option is used. |
50 |
| -In the case below, the pretty-printed `json` output will be printed on shell: |
| 39 | +To output pretty-printed JSON metrics: |
51 | 40 |
|
52 |
| -```console |
53 |
| -rust-code-analysis-cli -m -O json --pr -p /path/to/your/file/or/directory |
| 41 | +```bash |
| 42 | +rust-code-analysis-cli -m -p /path/to/your/file/or/directory --pr -O json |
54 | 43 | ```
|
| 44 | + |
| 45 | +This command prints the formatted metrics to the console or the specified output path. |
0 commit comments