Skip to content

Commit 4430856

Browse files
committed
docs: mozilla#377 update mdbook metrics info
- updated metrics information - made easier to understand how to use the `cli` for metrics
1 parent f43652b commit 4430856

File tree

1 file changed

+24
-33
lines changed

1 file changed

+24
-33
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,45 @@
11
# Metrics
22

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**.
54

6-
## Print metrics
5+
## Display Metrics
76

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:
128

13-
```console
9+
```bash
1410
rust-code-analysis-cli -m -p /path/to/your/file/or/directory
1511
```
1612

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.
2014

21-
## Export formats
15+
## Exporting Metrics
2216

23-
Different output formats can be used to export metrics:
17+
The **rust-code-analysis-cli** supports multiple output formats for exporting metrics, including:
2418

25-
- Cbor
26-
- Json
27-
- Toml
28-
- Yaml
19+
- CBOR
20+
- JSON
21+
- TOML
22+
- YAML
2923

30-
`Json` and `Toml` can also be exported pretty-printed.
24+
Both `Json` and `Toml` can be exported as pretty-printed.
3125

32-
### Export command
26+
### Export Command
3327

34-
For example, if you want to export metrics as a `json` file, run:
28+
To export metrics as a JSON file:
3529

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
3832
```
3933

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.
4236

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
4738

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:
5140

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
5443
```
44+
45+
This command prints the formatted metrics to the console or the specified output path.

0 commit comments

Comments
 (0)