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, documentation health, and more.

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

📚 Documentation: https://mehen.ophi.dev

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

  • Polyglot by design — per-file language detection across nine source languages plus Markdown. Useful for monorepos.
  • Real language parsers — Ruff for Python, Oxc for TS/JS/JSX/TSX, Mago for PHP, Prism for Ruby, ra_ap_syntax for Rust, the official Kotlin spec ANTLR grammar for Kotlin, pulldown-cmark for Markdown, tree-sitter for Go, C, PowerShell.
  • Code and documentation in one tool — source-code complexity and Markdown documentation health.
  • Deterministic, no network — pure static analysis. Same input → same output. Safe for air-gapped CI.
  • Pull-request native — built-in mehen diff plus a sticky comment GitHub Action.

Install

# npm
npm install -g mehen

# PyPI / uv
uv tool install mehen
# or: pip install mehen

# cargo binstall
cargo binstall --git https://github.com/ophi-dev/mehen mehen

Full installation guide: https://mehen.ophi.dev/installation.

Quick start

# Analyze a single file
mehen metrics src/main.py --pretty

# Rank the worst offenders in a tree
mehen top-offenders src --metric cognitive

# Diff metrics against main
mehen diff --from main --to HEAD --paths src --output-format markdown

Quickstart: https://mehen.ophi.dev/quickstart.

GitHub Action

Drop the action into a workflow to publish per-PR metric trends:

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

steps:
  - uses: actions/checkout@v6
    with:
      fetch-depth: 0
  - uses: ophi-dev/mehen@v0
    with:
      paths: src

Full reference: https://mehen.ophi.dev/guides/github-action.

Documentation

Everything else lives in the docs site:

Contributing

Issues and pull requests welcome at https://github.com/ophi-dev/mehen/issues.

License

mehen is released under the GNU Affero General Public License v3.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-1.1.0.tar.gz (735.9 kB view details)

Uploaded Source

Built Distributions

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

mehen-1.1.0-py3-none-win_arm64.whl (5.9 MB view details)

Uploaded Python 3Windows ARM64

mehen-1.1.0-py3-none-win_amd64.whl (6.3 MB view details)

Uploaded Python 3Windows x86-64

mehen-1.1.0-py3-none-manylinux_2_28_x86_64.whl (6.3 MB view details)

Uploaded Python 3manylinux: glibc 2.28+ x86-64

mehen-1.1.0-py3-none-manylinux_2_28_aarch64.whl (5.8 MB view details)

Uploaded Python 3manylinux: glibc 2.28+ ARM64

mehen-1.1.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (5.8 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ ARM64

mehen-1.1.0-py3-none-manylinux_2_5_x86_64.manylinux1_x86_64.whl (6.4 MB view details)

Uploaded Python 3manylinux: glibc 2.5+ x86-64

mehen-1.1.0-py3-none-macosx_11_0_arm64.whl (5.8 MB view details)

Uploaded Python 3macOS 11.0+ ARM64

mehen-1.1.0-py3-none-macosx_10_12_x86_64.whl (6.1 MB view details)

Uploaded Python 3macOS 10.12+ x86-64

File details

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

File metadata

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

File hashes

Hashes for mehen-1.1.0.tar.gz
Algorithm Hash digest
SHA256 19adc075ee8e4776f6333babb5feede276178d1fe46aa4990b10e6d3c0570822
MD5 f303b75f145d5ab18715ea9f1002f405
BLAKE2b-256 1baf5bb58d8d7478046fa84aa537d10302c9f4a436018c801938162dfd441ad9

See more details on using hashes here.

Provenance

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

Publisher: release.yml on ophi-dev/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-1.1.0-py3-none-win_arm64.whl.

File metadata

  • Download URL: mehen-1.1.0-py3-none-win_arm64.whl
  • Upload date:
  • Size: 5.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-1.1.0-py3-none-win_arm64.whl
Algorithm Hash digest
SHA256 3194b35900355ea83fdc902772800ceb07545177d8860684e3e15655a404dbeb
MD5 0846685c901931b79a9d79db10d30282
BLAKE2b-256 e7e8bc7c8ed7a58830f08bc8142edb1c9c23adf5e4b292f27d1545c26dfee5cf

See more details on using hashes here.

Provenance

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

Publisher: release.yml on ophi-dev/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-1.1.0-py3-none-win_amd64.whl.

File metadata

  • Download URL: mehen-1.1.0-py3-none-win_amd64.whl
  • Upload date:
  • Size: 6.3 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-1.1.0-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 ddfedf572612084f347e0ff83f65c406253a938f0243545f769519d53dbae6b4
MD5 2b53e31a0fc59c805c0f33dd3668c284
BLAKE2b-256 193388c8d6e33d1addbff634a9ceda51635635f0a62a738d08042b3f57f73ef4

See more details on using hashes here.

Provenance

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

Publisher: release.yml on ophi-dev/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-1.1.0-py3-none-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for mehen-1.1.0-py3-none-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 d007c84da76826bf926d0852bc7784e378cffdfb00ecc78a1f78cbe64852dbc3
MD5 99e89e0e7538525586efb0b17bf342e7
BLAKE2b-256 2bc0e503ab91c64080d5b8e52cb849d8a36fdc6ee55d9d8fcb3e0a6f3b30c404

See more details on using hashes here.

Provenance

The following attestation bundles were made for mehen-1.1.0-py3-none-manylinux_2_28_x86_64.whl:

Publisher: release.yml on ophi-dev/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-1.1.0-py3-none-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for mehen-1.1.0-py3-none-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 b3251bc6755349895f9f0583e9559a8503dfa6f050e3d79d5e9f7c04e13737fb
MD5 d9910ab18b827604e2e4cc05da875aec
BLAKE2b-256 e682e7b5d5933786110f63f10c6a23ab924e727beee7407624ec6285e2ea5ee8

See more details on using hashes here.

Provenance

The following attestation bundles were made for mehen-1.1.0-py3-none-manylinux_2_28_aarch64.whl:

Publisher: release.yml on ophi-dev/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-1.1.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for mehen-1.1.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 e42b4b9fa58700d52c7994fa7156df24245a182fd23848aa50e01e336b17c119
MD5 935b79be87d11d4d6fa81072cb4b83b6
BLAKE2b-256 3c1c076fbeadf3acfe419400aad91050e191ea14bfda0c13ac657ba102618da2

See more details on using hashes here.

Provenance

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

Publisher: release.yml on ophi-dev/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-1.1.0-py3-none-manylinux_2_5_x86_64.manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for mehen-1.1.0-py3-none-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 b3bab1e0432c2f29e9ebb2ee3b6fec64c7e7518be337483e7b81922af7cb8257
MD5 310c5078ffee9382982d8f50b56ecf99
BLAKE2b-256 0827e139e10acb4411a9b2dd65028b9cc4af71e6f1ea228e7c392d39e0bd3071

See more details on using hashes here.

Provenance

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

Publisher: release.yml on ophi-dev/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-1.1.0-py3-none-macosx_11_0_arm64.whl.

File metadata

  • Download URL: mehen-1.1.0-py3-none-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 5.8 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-1.1.0-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4dd3c387d53a2ce6fb8031cbf984429403b6c37a86f1024dc769de7bb1fb2fde
MD5 c02dbb8f50f145534227768448bbbbb6
BLAKE2b-256 0cf362d3ae1228785eca3eb5660c5f7efaed96578dff17e8c044b077773b6c23

See more details on using hashes here.

Provenance

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

Publisher: release.yml on ophi-dev/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-1.1.0-py3-none-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for mehen-1.1.0-py3-none-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 045a997e583dd2920a73f1f7034f5c11b00ff2b88d35704d9a3a05e75ee1ad98
MD5 f31bee6975b2cd5926bf96b24eb04e33
BLAKE2b-256 52533ca77739b832bd09d2373c3435d99deb92c709cbb58bfe8eb5e67c166b89

See more details on using hashes here.

Provenance

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

Publisher: release.yml on ophi-dev/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