-
Notifications
You must be signed in to change notification settings - Fork 58
docs: #377 create documentation #1117
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
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | ||
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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. | ||
|
|
||
| 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> | ||
| ``` | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.