Metrics can be printed on screen or exported as different output formats through rust-code-analysis-cli.
For each function space, rust-code-analysis computes the list of metrics described above. At the end of this process, rust-code-analysis-cli dumps the result formatted in a certain way on the screen. The command used to print the metrics is the following one:
rust-code-analysis-cli -m -p /path/to/your/file/or/directory
-p option represents the path to a file or a directory. If a directory is
passed as input, rust-code-analysis-cli computes the metrics for each file
contained in it.
Different output formats can be used to export metrics:
Toml can also be exported pretty-printed.
For example, if you want to export metrics as a
json file, run:
rust-code-analysis-cli -m -O json -o /output/path -p /path/to/your/file/or/directory
-O option allows you to choose the output format. It supports
only these values: cbor, json, toml, yaml.
-o option is used to specify the path where your file will be saved.
It accepts only paths. The filename of your output file is the same as
your input file plus the extension associated to the format. When this option
is not given, the output is printed on shell.
As we said before,
Toml can be exported as pretty-printed. To do
--pr option is used.
In the case below, the pretty-printed
json output will be printed on shell:
rust-code-analysis-cli -m -O json --pr -p /path/to/your/file/or/directory