Static analysis tool designed to calculate code metrics for Java and Python projects.
Currently supported code metrics and their descriptions
| Metric | Description | Java | Python |
|---|---|---|---|
| is_broken | If it has any error or missing node | ✓ | ✓ |
| aloc | Actual lines of code | ✓ | ✓ |
| eloc | Empty lines of code | ✓ | ✓ |
| cloc | Comments lines of code | ✓ | ✓ |
| dcloc | Document comments lines of code | ✓ | ✓ |
| noi | number of imports | ✓ | ✓ |
| noc | number of classes | ✓ | ✓ |
| nom | number of methods | ✓ | ✓ |
| cc | Cyclomatic complexity | ✓ | ✓ |
| pc | Parameter count | ✓ | ✓ |
| language | Language of the code block | ✓ | ✓ |
| file_path | Path of the file | ✓ | ✓ |
| start_row | Start row of the code block | ✓ | ✓ |
| start_col | Start column of the code block | ✓ | ✓ |
| end_row | End row of the code block | ✓ | ✓ |
| end_col | End column of the code block | ✓ | ✓ |
| node_name | Name of the node | ✓ | ✓ |
| node_type | Type of the node | ✓ | ✓ |
Note: If the node is broken, the rest of the metrics might not be accurate
- Java:
.java - Python:
.py
You can download the latest release artifacts from the releases page.
To analyze repositories using xStats, run the following command:
xStats --target <TARGET> --output <OUTPUT>-t, --target <TARGET>: Specify the target file or directory.-o, --output <OUTPUT>: Specify the output file.-a, --all-commits: Analyze all commits.--format <FORMAT>: Specify the output format (default: json).-h, --help: Print help information.-V, --version: Print version information.
- Ensure you have Rust installed on your machine. If not, you can install it from here
- Clone the repository
git clone https://github.com/gautam-shetty/xStats.git
cd xStats- Build the project
cargo build --release