Skip to main content

Tool to compute and export code metrics

Project description

mehen

mehen is a Rust-powered CLI for detecting heuristic source code metrics at scale: complexity, maintainability, lines of code, and more.

It is designed for fast, deterministic analysis over large codebases, helping both human and AI engineers track how complexity evolves over time.

What is Mehen?

In Ophidiarium projects, names matter.

Mehen is a mythical ancient Egyptian serpent associated with guarding Ra. In the same spirit, mehen helps guard your codebase from slowly collapsing under complexity.

Why Teams Use Mehen

Most common usage patterns we see:

  • CI jobs that compute metrics for changed files and publish trend reports
  • Pre-PR / pre-CR hooks that provide immediate quality feedback
  • Automation workflows that enrich pull request templates with metric deltas

Current Language Support

Today mehen supports:

  • Python
  • TypeScript
  • TSX
  • Rust
  • Go

Planned next: Ruby and PHP.

What Mehen Computes

mehen provides a broad metric set, including:

  • Cyclomatic complexity
  • Cognitive complexity
  • Maintainability Index
  • Halstead metrics
  • ABC metrics
  • NArgs / NOM / NExit
  • LOC family (SLOC, PLOC, LLOC, CLOC, blanks)
  • NPA / NPM / WMC

Distribution

mehen ships native binaries through both ecosystems:

  • npm (mehen + platform packages)
  • PyPI (mehen via maturin binary packaging)

Quick Start

Run without installation

From npm ecosystem:

bunx mehen --help

From Python/uv ecosystem:

uv tool run mehen --help
# or
uvx mehen --help

Run locally from source

cargo run -- --help

Typical examples

Analyze metrics for a directory:

mehen -m -p src

Export metrics as JSON/TOML/YAML/CBOR:

mehen -m -p src -O json -o ./metrics

GitHub Actions

Use the in-repository action to publish changed-file metric trends on pull requests:

permissions:
  contents: read
  pull-requests: write
  issues: write

steps:
  - uses: actions/checkout@v5
    with:
      fetch-depth: 0

  - uses: ophidiarium/mehen@v1
    with:
      paths: src

For polyglot monorepos, pass each root you want tracked. mehen will analyze only supported languages in changed files under those roots:

- uses: ophidiarium/mehen@v1
  with:
    paths: |
      crates/api/src
      apps/web/src
      tools
    thresholds: |
      cyclomatic=5
      cognitive=4
      loc.lloc=120

Thresholds are optional. When configured, the action fails if an adverse per-file metric delta exceeds the configured limit.

Reporting and Integrations

Current machine-readable outputs:

  • JSON
  • YAML
  • TOML
  • CBOR

Roadmap direction:

  • Native git integration for changed-file detection
  • Rich markdown reports for AI/human review flows
  • More polished console reporting for local developer loops

Implementation Notes

Internally, mehen is built on:

mehen continues in its own CLI-focused direction while preserving and evolving that foundation.

Development

Build and check:

cargo check
cargo build
cargo fmt --all
cargo clippy --all-targets --all-features --locked

Tests:

cargo test --all-targets --locked

Snapshot tests (insta):

cargo insta test --all-features --check --unreferenced reject --test-runner nextest --no-test-runner-fallback --disable-nextest-doctest

See mehen-book/src/developers/ for developer docs, including language and grammar updates.

Contributing

Contributions are welcome via issues and pull requests:

License

mehen is released under the Mozilla Public License v2.0.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mehen-0.0.6.tar.gz (3.2 MB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

mehen-0.0.6-py3-none-win_arm64.whl (2.9 MB view details)

Uploaded Python 3Windows ARM64

mehen-0.0.6-py3-none-win_amd64.whl (3.1 MB view details)

Uploaded Python 3Windows x86-64

mehen-0.0.6-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.2 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ x86-64

mehen-0.0.6-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (3.0 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ ARM64

mehen-0.0.6-py3-none-manylinux_2_5_x86_64.manylinux1_x86_64.whl (3.3 MB view details)

Uploaded Python 3manylinux: glibc 2.5+ x86-64

mehen-0.0.6-py3-none-macosx_11_0_arm64.whl (3.0 MB view details)

Uploaded Python 3macOS 11.0+ ARM64

mehen-0.0.6-py3-none-macosx_10_12_x86_64.whl (3.1 MB view details)

Uploaded Python 3macOS 10.12+ x86-64

File details

Details for the file mehen-0.0.6.tar.gz.

File metadata

  • Download URL: mehen-0.0.6.tar.gz
  • Upload date:
  • Size: 3.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for mehen-0.0.6.tar.gz
Algorithm Hash digest
SHA256 84707435f09087d3e14a5f839aed3411f1af6015d109a34929f34375e2fe4471
MD5 c8faebce52fb7ac04a52eb0fa3f1e6dc
BLAKE2b-256 d56905c0164a204b074220436c49aaaa8ea6342a4e2e9db1736b7c9d19578136

See more details on using hashes here.

Provenance

The following attestation bundles were made for mehen-0.0.6.tar.gz:

Publisher: release.yml on ophidiarium/mehen

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mehen-0.0.6-py3-none-win_arm64.whl.

File metadata

  • Download URL: mehen-0.0.6-py3-none-win_arm64.whl
  • Upload date:
  • Size: 2.9 MB
  • Tags: Python 3, Windows ARM64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for mehen-0.0.6-py3-none-win_arm64.whl
Algorithm Hash digest
SHA256 38f9197370bc53c6cc888818d11f64fcc97f5100ab538a6cbd0798dc84294b2b
MD5 7f2c7c4c06df539918a0a3fcdca555e9
BLAKE2b-256 5342e44f877bf2d8d0987ed6a19463484cd0802b51c5bd630d84e7994e7cda02

See more details on using hashes here.

Provenance

The following attestation bundles were made for mehen-0.0.6-py3-none-win_arm64.whl:

Publisher: release.yml on ophidiarium/mehen

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mehen-0.0.6-py3-none-win_amd64.whl.

File metadata

  • Download URL: mehen-0.0.6-py3-none-win_amd64.whl
  • Upload date:
  • Size: 3.1 MB
  • Tags: Python 3, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for mehen-0.0.6-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 4df85788dc1e813fe66fa3fb0179149d20a31814ce28209b552961d857b315e2
MD5 b5f0f20a3cc5e6f0e11ffbb71e6b3cd0
BLAKE2b-256 cf09444a4787b68c40e5dd74f85d1d8383b6190118fe13c215621281e521eabf

See more details on using hashes here.

Provenance

The following attestation bundles were made for mehen-0.0.6-py3-none-win_amd64.whl:

Publisher: release.yml on ophidiarium/mehen

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mehen-0.0.6-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for mehen-0.0.6-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2c6099b876322293b1c91c52364c02537f35f6011f856c28dc17acfea582e2ea
MD5 cdbc08560798b2d91290cb320f9595a6
BLAKE2b-256 7db375c83d84dfe64582ea5159c9dd2993b32b190863d5a4a309b9ba1f5e3040

See more details on using hashes here.

Provenance

The following attestation bundles were made for mehen-0.0.6-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on ophidiarium/mehen

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mehen-0.0.6-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for mehen-0.0.6-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 61ab3f1d5e278eaf82292402a0d4b6d9461900e7f8f856c4685c8e740d76df85
MD5 70cf77cd82b52fb9232cf403e4991b22
BLAKE2b-256 4b037df914c52463be838b355c73307478c145f0a25394d457b343bf159d62db

See more details on using hashes here.

Provenance

The following attestation bundles were made for mehen-0.0.6-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release.yml on ophidiarium/mehen

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mehen-0.0.6-py3-none-manylinux_2_5_x86_64.manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for mehen-0.0.6-py3-none-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 28514d9fc1eed649cf2a34e37fb494c0230178b9d7b5eac7ea0f39c51c21ecda
MD5 f4b0c0ac2962dc3d7d107042e2760038
BLAKE2b-256 c139356d395e6ac732c4eee0581fd23058e1e25a0942d877698e3552fb6d586c

See more details on using hashes here.

Provenance

The following attestation bundles were made for mehen-0.0.6-py3-none-manylinux_2_5_x86_64.manylinux1_x86_64.whl:

Publisher: release.yml on ophidiarium/mehen

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mehen-0.0.6-py3-none-macosx_11_0_arm64.whl.

File metadata

  • Download URL: mehen-0.0.6-py3-none-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 3.0 MB
  • Tags: Python 3, macOS 11.0+ ARM64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for mehen-0.0.6-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e19eededd3007e9bab995b7cc49af5f1a755d7cbffaecfdde1a3eb9993bb9f8b
MD5 2e05f3aeb4c328778a89db2848f6bb77
BLAKE2b-256 c79fa7c1d892ec171adf5eb02891cbd22db8525ce783414a0241a3182a8e3d72

See more details on using hashes here.

Provenance

The following attestation bundles were made for mehen-0.0.6-py3-none-macosx_11_0_arm64.whl:

Publisher: release.yml on ophidiarium/mehen

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mehen-0.0.6-py3-none-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for mehen-0.0.6-py3-none-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 8b61132508c95ede6ce30079112183fc321aa21ae89389770462ca11248a3e54
MD5 619f3472a1c6443e56e39065969947dc
BLAKE2b-256 874049f0e8ccddf96d052239af8927114ee3ca341cdc3044cee9116f52bd38e1

See more details on using hashes here.

Provenance

The following attestation bundles were made for mehen-0.0.6-py3-none-macosx_10_12_x86_64.whl:

Publisher: release.yml on ophidiarium/mehen

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page