Skip to content

Commit 162a669

Browse files
authored
Misc improvements to README (#111)
1 parent baeeda1 commit 162a669

1 file changed

Lines changed: 59 additions & 8 deletions

File tree

README.md

Lines changed: 59 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44

55
This project is a Rust crate (library) to analyse source code. This software is based on [Tree Sitter](https://github.com/tree-sitter/tree-sitter).
66

7-
It supports several languages:
7+
## Supported Languages
8+
89
* C++
910
* C#
1011
* CSS
@@ -17,17 +18,67 @@ It supports several languages:
1718
* Rust
1819
* Typescript
1920

20-
## How to build it
21+
## Supported Metrics
22+
23+
- CC: it calculates the code complexity examining the
24+
control flow of a program.
25+
- SLOC: it counts the number of lines in a source file.
26+
- LLOC: it counts the number of logical lines (instructions) contained in a source file.
27+
- HALSTEAD: it is a suite that provides a series of information, such as the effort required to maintain the analyzed code, the size in bits to store the program, the difficulty to understand the code, an estimate of the number of bugs present in the codebase, and an estimate of the time needed to implement the software.
28+
- NEXITS: it counts the number of possible exit points from a method/function.
29+
- NARGS: it counts the number of arguments of a function/method.
30+
31+
## How to get metrics
32+
33+
You can get metrics in your shell in this way
34+
35+
```
36+
rust-code-analysis --metrics --paths /your/path/to/a/file
37+
```
38+
39+
or as a `json` file
40+
41+
```
42+
rust-code-analysis --metrics --output your/path/to/the/output/directory --paths /your/path/to/a/file
43+
```
44+
45+
or you can run it as a `HTTP` service and use its `REST API`
46+
47+
48+
```
49+
rust-code-analysis --serve --port 9090
50+
```
2151

22-
```console
23-
# Fetch the tree-sitter dependencies
24-
git submodule init
25-
git submodule update --recursive
2652

27-
# Now build with cargo
53+
## How to build the software
54+
55+
Clone the repository and its submodules through HTTPS
56+
57+
```
58+
git clone --recurse-submodules -j8 https://github.com/mozilla/rust-code-analysis.git
59+
```
60+
61+
or through SSH
62+
63+
```
64+
git clone --recurse-submodules -j8 git@github.com:mozilla/rust-code-analysis.git
65+
```
66+
67+
Build and run `rust-code-analysis`
68+
69+
```console
70+
# Build with cargo
2871
cargo build
2972

30-
# It should be available through cargo now
73+
# Run through cargo
3174
cargo run -- -h
3275
cargo run -- --serve --port 8000
3376
```
77+
78+
## How to run tests
79+
80+
After the build step, run the following command in order to verify if all tests pass
81+
82+
```
83+
cargo test --verbose
84+
```

0 commit comments

Comments
 (0)