Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: #377 create documentation #1117

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 59 additions & 0 deletions rust-code-analysis-cli/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# rust-code-analysis-cli

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

## Features

- Analyze source code for different programming languages.
- Export results in different formats (CBOR, JSON, TOML, YAML).
- Perform various operations on source code (e.g., dumping abstract syntax tree to stdout, counting nodes, computing code metrics).

## Installation

Clone the repository and build the project:

```sh
cd rust-code-analysis-cli/
cargo build
```

## Usage

Run the tool by specifying the input file and the desired operation:

```sh
rust-code-analysis-cli [OPTIONS]
```

## Available Options

- `-p, --paths <FILE>...`: Input files to analyze.
- `-d, --dump`: Dump the abstract syntax tree to stdout.
- `-c, --comments`: Remove comments from specified files.
- `-f, --find <NODE_TYPE>`: Find nodes of the given type.
- `-F, --function`: Get functions and their spans.
- `-C, --count <NODE_TYPE>`: Count nodes of the given type.
- `-m, --metrics`: Compute code metrics.
- `--ops`: Retrieve all operands and operators in the code.
- `-i, --in-place`: Perform actions in place.
- `-I, --include [<INCLUDE>...]`: Include files matching the given pattern.
- `-X, --exclude [<EXCLUDE>...]`: Exclude files matching the given pattern.
- `-j, --num-jobs <NUM_JOBS>`: Number of threads to use.
- `-l, --language-type <LANGUAGE>`: Language of the input files.
- `-O, --output-format <FORMAT>`: Output format for the results (CBOR, JSON, TOML, YAML).
- `--pr`: Dump a pretty JSON output file.
- `-o, --output <OUTPUT>`: Output directory for the results.
- `--preproc <PREPROCESSOR>`: Get preprocessor directives for C/C++ files.
- `--ls <LINE_START>`: Start line for the analysis.
- `--le <LINE_END>`: End line for the analysis.
- `-w, --warning`: Show warnings.
- `-v, --version`: Show version information.
- `-h, --help`: Show help information.

## Examples

To analyze the code in a file and export the metrics in JSON format:

```sh
rust-code-analysis-cli --metrics --output-format json --output . --paths path/to/file.rs
```
44 changes: 44 additions & 0 deletions rust-code-analysis-web/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# rust-code-analysis-web

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

## Features

- **Comment Removal**: Removes comments from source code to provide a cleaner version of the code.
- **Function Spans**: Retrieves the start and end lines of functions in the given source code.
- **Metrics Calculation**: Computes static analysis metrics for the source code.

miguelcsx marked this conversation as resolved.
Show resolved Hide resolved
Refer to the REST API documentation for detailed information about the available endpoints and parameters.

## Installation

Clone the repository and build the project:

```sh
cd rust-code-analysis-web/
cargo build
```

## Usage

Run the server by specifying the host and port:

```sh
rust-code-analysis-web [OPTIONS]
```

### Available Options

- `-j, --num-jobs <NUM_JOBS>`: Number of parallel jobs to run (optional).
- `--host <HOST>`: IP address where the server should run (default is 127.0.0.1).
- `--port <PORT>`: Port to be used by the server (default is 8080).
- `-h, --help`: Show help information.
- `-v, --version`: Show version information.

## Examples

To start the server on a specific host and port:

```sh
rust-code-analysis-web --host <HOST> --port <PORT> -j <NUM_JOBS>
```