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, pulldown-cmark for Markdown, tree-sitter for Go, C, Kotlin, 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.0.2.tar.gz (549.4 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.0.2-py3-none-win_arm64.whl (5.1 MB view details)

Uploaded Python 3Windows ARM64

mehen-1.0.2-py3-none-win_amd64.whl (5.4 MB view details)

Uploaded Python 3Windows x86-64

mehen-1.0.2-py3-none-manylinux_2_28_x86_64.whl (5.6 MB view details)

Uploaded Python 3manylinux: glibc 2.28+ x86-64

mehen-1.0.2-py3-none-manylinux_2_28_aarch64.whl (5.2 MB view details)

Uploaded Python 3manylinux: glibc 2.28+ ARM64

mehen-1.0.2-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (5.2 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ ARM64

mehen-1.0.2-py3-none-manylinux_2_5_x86_64.manylinux1_x86_64.whl (5.7 MB view details)

Uploaded Python 3manylinux: glibc 2.5+ x86-64

mehen-1.0.2-py3-none-macosx_11_0_arm64.whl (5.2 MB view details)

Uploaded Python 3macOS 11.0+ ARM64

mehen-1.0.2-py3-none-macosx_10_12_x86_64.whl (5.4 MB view details)

Uploaded Python 3macOS 10.12+ x86-64

File details

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

File metadata

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

File hashes

Hashes for mehen-1.0.2.tar.gz
Algorithm Hash digest
SHA256 115ff6635f16f8213866432afedd9de2b47ef964b134494e9f9760559c7c56cc
MD5 c69f51a1756a501550200058b51ff322
BLAKE2b-256 7403666514b70fd99f5b54ad658b7fb02a611e96a4d638605be58e8353053d81

See more details on using hashes here.

Provenance

The following attestation bundles were made for mehen-1.0.2.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.0.2-py3-none-win_arm64.whl.

File metadata

  • Download URL: mehen-1.0.2-py3-none-win_arm64.whl
  • Upload date:
  • Size: 5.1 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.0.2-py3-none-win_arm64.whl
Algorithm Hash digest
SHA256 eeef3df5e97b7b18f2d4628cd3103ca4d2bb9eb9e6de7ac21692254cccc6913e
MD5 e7ed77ac8adc979cfac5a4827c25b9a9
BLAKE2b-256 768d1bd347cc565c3a190596135cdfd46fe750f4f936ddeb997df50988556361

See more details on using hashes here.

Provenance

The following attestation bundles were made for mehen-1.0.2-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.0.2-py3-none-win_amd64.whl.

File metadata

  • Download URL: mehen-1.0.2-py3-none-win_amd64.whl
  • Upload date:
  • Size: 5.4 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.0.2-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 c182ca677a626e5fe9ea4377aa74ff61c2e2f9ba61ceb194af5010b77f59568f
MD5 ca20b8d2c29dd488a10b63ff4f7c45f8
BLAKE2b-256 9ff4d1dc052ea23a9b1e89dfec7d0e054986d8296fc8c80b2181bca423be1821

See more details on using hashes here.

Provenance

The following attestation bundles were made for mehen-1.0.2-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.0.2-py3-none-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for mehen-1.0.2-py3-none-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 103af8a4d4684cefc4b5143b589cd709a5094e5d0948fce981bb54b37c1c281e
MD5 fad8b08b41e63204edf4e944294b727d
BLAKE2b-256 dd763c2406276561077123089bb05703e7f3d4d3c0f0f022c67b8dc05c971604

See more details on using hashes here.

Provenance

The following attestation bundles were made for mehen-1.0.2-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.0.2-py3-none-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for mehen-1.0.2-py3-none-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 85302d06dfac447b6d5bb00fa529643715ee115af0ac5661436d62064729876d
MD5 5ad82b5edfcabc9a1aa03bc108885773
BLAKE2b-256 4e7db1b7d224f986266a66bd5be72c3f524c6d621b9716632797b4a105c26f29

See more details on using hashes here.

Provenance

The following attestation bundles were made for mehen-1.0.2-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.0.2-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for mehen-1.0.2-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 7e7d22f168786c9065d4c652b54db89150329c88bf8640a7e81e8f0fb91dbb53
MD5 b2b78db69ac33e4a9ccb86ac19b9536d
BLAKE2b-256 a0877818f226c264f85639092933d7c0d9616371e8f9227c124deb841b3798d9

See more details on using hashes here.

Provenance

The following attestation bundles were made for mehen-1.0.2-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.0.2-py3-none-manylinux_2_5_x86_64.manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for mehen-1.0.2-py3-none-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 53588bc71ee95c758d0962e25e42739a4f8c6f69c6756f773f78e68766115aaf
MD5 8f54a42fa0f4140e985171c61af82490
BLAKE2b-256 0e6b75b8aa9f398b9dbf0bcff5500cf6eaeaff6f73798a0d885424f654b8dcb6

See more details on using hashes here.

Provenance

The following attestation bundles were made for mehen-1.0.2-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.0.2-py3-none-macosx_11_0_arm64.whl.

File metadata

  • Download URL: mehen-1.0.2-py3-none-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 5.2 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.0.2-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 615ee23c7135b4844ab7d56acee3cf7a4042b79170e70324187842c6302c437e
MD5 9d19447ffdc4bbc36d7c6a0ed8281ff7
BLAKE2b-256 1cce969911ec02f846d478675a758205777b9808b59f3754527fd870db32e9f3

See more details on using hashes here.

Provenance

The following attestation bundles were made for mehen-1.0.2-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.0.2-py3-none-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for mehen-1.0.2-py3-none-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 8c9290d6cfed6aad84e5d26544de0566d8734202d31e2567e536a015ba82efb3
MD5 03cb1d9d6627eb01f4a646ad1492f178
BLAKE2b-256 8a7205fbb5ff14ebaaed072c63d62b2c7db04379f82f3ba48a088ea1aa7d18d2

See more details on using hashes here.

Provenance

The following attestation bundles were made for mehen-1.0.2-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