Metadata-Version: 2.4
Name: mehen
Version: 0.0.2
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Rust
Classifier: Topic :: Software Development :: Quality Assurance
Classifier: Topic :: Software Development :: Testing
License-File: LICENSE
Summary: Tool to compute and export code metrics
Keywords: metrics,code-analysis,complexity,cyclomatic,halstead
Author-email: Konstantin Vyatkin <tino@vtkn.io>
Requires-Python: >=3.8
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
Project-URL: Documentation, https://github.com/ophidiarium/mehen#readme
Project-URL: Homepage, https://github.com/ophidiarium/mehen
Project-URL: Issues, https://github.com/ophidiarium/mehen/issues
Project-URL: Repository, https://github.com/ophidiarium/mehen

# mehen

**mehen** is a Rust library to analyze and extract information
from source code written in many different programming languages.
It is based on a parser generator tool and an incremental parsing library
called
<a href="https://tree-sitter.github.io/tree-sitter/" target="_blank">Tree Sitter</a>.


A command line tool called **mehen** is provided to interact with the API of the library.

This tool can be used to:

- Print nodes and metrics information
- Export metrics in different formats
- Analyze code complexity and maintainability


# Usage

**mehen** computes a variety of software metrics for Go, Python, Rust, and TypeScript/TSX code.

Run `mehen --help` to see all available commands and options.

## Building

To build the `mehen` library, you need to run the following
command:

```console
cargo build
```

If you want to build the `cli`:

```console
cargo build -p mehen-cli
```

To build everything:

```console
cargo build --workspace
```

## Testing

To verify whether all tests pass, run the `cargo test` command.

```console
cargo test --workspace --all-features --verbose
```

### Updating insta tests
We use [insta](https://insta.rs), to update the snapshot tests you should install [cargo insta](https://crates.io/crates/cargo-insta)

``` console
cargo insta test --review
```

Will run the tests, generate the new snapshot references and let you review them.

### Updating grammars

See `mehen-book/src/developers/update-grammars.md` to learn how to update language grammars.

# Contributing

If you want to contribute to the development of this software, please open an issue or pull request on our
[GitHub repository](https://github.com/ophidiarium/mehen). See `mehen-book/src/developers/` for developer documentation.


# License

**mehen** and **mehen-cli** (binary: `mehen`) are released under the
<a href="https://www.mozilla.org/MPL/2.0/" target="_blank">Mozilla Public License v2.0</a>.

# Credits

Mehen is based on the excellent [rust-code-analysis](https://github.com/mozilla/rust-code-analysis) project by Mozilla. While mehen has taken a different direction by focusing on a streamlined set of languages (Go, Python, Rust, and TypeScript/TSX), the core architecture and metric implementations are built upon that foundation.

If you use this software in academic work, please cite the original rust-code-analysis paper:

```bibtex
@article{ARDITO2020100635,
    title = {rust-code-analysis: A Rust library to analyze and extract maintainability information from source codes},
    journal = {SoftwareX},
    volume = {12},
    pages = {100635},
    year = {2020},
    issn = {2352-7110},
    doi = {https://doi.org/10.1016/j.softx.2020.100635},
    url = {https://www.sciencedirect.com/science/article/pii/S2352711020303484},
    author = {Luca Ardito and Luca Barbato and Marco Castelluccio and Riccardo Coppola and Calixte Denizet and Sylvestre Ledru and Michele Valsesia},
    keywords = {Algorithm, Software metrics, Software maintainability, Software quality}
}
```

We thank the Mozilla team and all contributors to rust-code-analysis for their foundational work.

