diff --git a/rust-code-analysis-cli/README.md b/rust-code-analysis-cli/README.md new file mode 100644 index 000000000..4b3de51d0 --- /dev/null +++ b/rust-code-analysis-cli/README.md @@ -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 ...`: Input files to analyze. +- `-d, --dump`: Dump the abstract syntax tree to stdout. +- `-c, --comments`: Remove comments from specified files. +- `-f, --find `: Find nodes of the given type. +- `-F, --function`: Get functions and their spans. +- `-C, --count `: 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 files matching the given pattern. +- `-X, --exclude [...]`: Exclude files matching the given pattern. +- `-j, --num-jobs `: Number of threads to use. +- `-l, --language-type `: Language of the input files. +- `-O, --output-format `: Output format for the results (CBOR, JSON, TOML, YAML). +- `--pr`: Dump a pretty JSON output file. +- `-o, --output `: Output directory for the results. +- `--preproc `: Get preprocessor directives for C/C++ files. +- `--ls `: Start line for the analysis. +- `--le `: 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 +``` diff --git a/rust-code-analysis-web/README.md b/rust-code-analysis-web/README.md new file mode 100644 index 000000000..a0b9dc56a --- /dev/null +++ b/rust-code-analysis-web/README.md @@ -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. + +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 `: Number of parallel jobs to run (optional). +- `--host `: IP address where the server should run (default is 127.0.0.1). +- `--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 --port -j +```