Skip to content

Commit b2daee1

Browse files
authored
docs: More documentation (#1117)
1 parent 4611945 commit b2daee1

File tree

2 files changed

+103
-0
lines changed

2 files changed

+103
-0
lines changed

rust-code-analysis-cli/README.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# rust-code-analysis-cli
2+
3+
`rust-code-analysis-cli` is a tool designed to compute and export code metrics, analyze source code, and perform various operations such as removing comments, counting nodes, retrieving functions, and computing code metrics in different formats.
4+
5+
## Features
6+
7+
- Analyze source code for different programming languages.
8+
- Export results in different formats (CBOR, JSON, TOML, YAML).
9+
- Perform various operations on source code (e.g., dumping abstract syntax tree to stdout, counting nodes, computing code metrics).
10+
11+
## Installation
12+
13+
Clone the repository and build the project:
14+
15+
```sh
16+
cd rust-code-analysis-cli/
17+
cargo build
18+
```
19+
20+
## Usage
21+
22+
Run the tool by specifying the input file and the desired operation:
23+
24+
```sh
25+
rust-code-analysis-cli [OPTIONS]
26+
```
27+
28+
## Available Options
29+
30+
- `-p, --paths <FILE>...`: Input files to analyze.
31+
- `-d, --dump`: Dump the abstract syntax tree to stdout.
32+
- `-c, --comments`: Remove comments from specified files.
33+
- `-f, --find <NODE_TYPE>`: Find nodes of the given type.
34+
- `-F, --function`: Get functions and their spans.
35+
- `-C, --count <NODE_TYPE>`: Count nodes of the given type.
36+
- `-m, --metrics`: Compute code metrics.
37+
- `--ops`: Retrieve all operands and operators in the code.
38+
- `-i, --in-place`: Perform actions in place.
39+
- `-I, --include [<INCLUDE>...]`: Include files matching the given pattern.
40+
- `-X, --exclude [<EXCLUDE>...]`: Exclude files matching the given pattern.
41+
- `-j, --num-jobs <NUM_JOBS>`: Number of threads to use.
42+
- `-l, --language-type <LANGUAGE>`: Language of the input files.
43+
- `-O, --output-format <FORMAT>`: Output format for the results (CBOR, JSON, TOML, YAML).
44+
- `--pr`: Dump a pretty JSON output file.
45+
- `-o, --output <OUTPUT>`: Output directory for the results.
46+
- `--preproc <PREPROCESSOR>`: Get preprocessor directives for C/C++ files.
47+
- `--ls <LINE_START>`: Start line for the analysis.
48+
- `--le <LINE_END>`: End line for the analysis.
49+
- `-w, --warning`: Show warnings.
50+
- `-v, --version`: Show version information.
51+
- `-h, --help`: Show help information.
52+
53+
## Examples
54+
55+
To analyze the code in a file and export the metrics in JSON format:
56+
57+
```sh
58+
rust-code-analysis-cli --metrics --output-format json --output . --paths path/to/file.rs
59+
```

rust-code-analysis-web/README.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# rust-code-analysis-web
2+
3+
`rust-code-analysis-web` is a web server that provides source code analysis capabilities via a RESTful API. It enables developers to interact with the code analysis functionality from the rust-code-analysis suite through HTTP requests.
4+
5+
## Features
6+
7+
- **Comment Removal**: Removes comments from source code to provide a cleaner version of the code.
8+
- **Function Spans**: Retrieves the start and end lines of functions in the given source code.
9+
- **Metrics Calculation**: Computes static analysis metrics for the source code.
10+
11+
Refer to the REST API documentation for detailed information about the available endpoints and parameters.
12+
13+
## Installation
14+
15+
Clone the repository and build the project:
16+
17+
```sh
18+
cd rust-code-analysis-web/
19+
cargo build
20+
```
21+
22+
## Usage
23+
24+
Run the server by specifying the host and port:
25+
26+
```sh
27+
rust-code-analysis-web [OPTIONS]
28+
```
29+
30+
### Available Options
31+
32+
- `-j, --num-jobs <NUM_JOBS>`: Number of parallel jobs to run (optional).
33+
- `--host <HOST>`: IP address where the server should run (default is 127.0.0.1).
34+
- `--port <PORT>`: Port to be used by the server (default is 8080).
35+
- `-h, --help`: Show help information.
36+
- `-v, --version`: Show version information.
37+
38+
## Examples
39+
40+
To start the server on a specific host and port:
41+
42+
```sh
43+
rust-code-analysis-web --host <HOST> --port <PORT> -j <NUM_JOBS>
44+
```

0 commit comments

Comments
 (0)