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 eleven source languages plus Markdown and SQL. Useful for monorepos.
- Real language parsers — Ruff for Python, Oxc for TS/JS/JSX/TSX, Mago for PHP, Prism for Ruby,
ra_ap_syntaxfor Rust, ANTLR (Kotlin spec grammar for Kotlin, grammars-v4 for Java), pulldown-cmark for Markdown, sqruff for SQL, tree-sitter for Go, C, PowerShell. - Code, documentation, and SQL in one tool — source-code complexity, Markdown documentation
health, and a dedicated relational metric family for
.sqlfiles. - Deterministic, no network — pure static analysis. Same input → same output. Safe for air-gapped CI.
- Pull-request native — built-in
mehen diffplus 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@v1
with:
paths: src
Full reference: https://mehen.ophi.dev/guides/github-action.
Documentation
Everything else lives in the docs site:
- Code metrics — cyclomatic, cognitive, Halstead, MI, ABC, LOC family, NOM, NPA, NPM, WMC.
- Markdown metrics — DMI, MRPC, MCC, link debt, filler/lazy risk, English/Japanese prose layer.
- SQL metrics — CTE graphs, join/subquery structure,
object-touch risk, SQL Halstead, and composite scores via
mehen-sql(sqruff-backed). - Commands —
mehen metrics,mehen diff,mehen top-offenders. - Developers guide — build, test, contribute, add a language.
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mehen-1.6.0.tar.gz.
File metadata
- Download URL: mehen-1.6.0.tar.gz
- Upload date:
- Size: 1.0 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b3d0bad33261c9023ba659564c4f9e2aba40cff341e672b6e7cb6b52ed90bdcd
|
|
| MD5 |
369a390f0a18345a1b7c58f303075df4
|
|
| BLAKE2b-256 |
49bb3f9f9670c11d82d9179eeef28e8df441f88e25b62ab0f1e44828f190f84c
|
Provenance
The following attestation bundles were made for mehen-1.6.0.tar.gz:
Publisher:
release.yml on ophi-dev/mehen
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mehen-1.6.0.tar.gz -
Subject digest:
b3d0bad33261c9023ba659564c4f9e2aba40cff341e672b6e7cb6b52ed90bdcd - Sigstore transparency entry: 2211617304
- Sigstore integration time:
-
Permalink:
ophi-dev/mehen@b41332ba76c3a38bfca0d933d8f70986c4a99c06 -
Branch / Tag:
refs/tags/v1.6.0 - Owner: https://github.com/ophi-dev
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@b41332ba76c3a38bfca0d933d8f70986c4a99c06 -
Trigger Event:
push
-
Statement type:
File details
Details for the file mehen-1.6.0-py3-none-win_arm64.whl.
File metadata
- Download URL: mehen-1.6.0-py3-none-win_arm64.whl
- Upload date:
- Size: 9.6 MB
- Tags: Python 3, Windows ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f5a56640b2fd23e9553ba5e717931d08004ae193d68f5f4754b000280ef322f0
|
|
| MD5 |
46cfe99294239d3a4289925b6282bd7b
|
|
| BLAKE2b-256 |
2e632d9d31c280c650c9e76e935a6584ae326b7987a1b1e61615d0e331e4b1fa
|
Provenance
The following attestation bundles were made for mehen-1.6.0-py3-none-win_arm64.whl:
Publisher:
release.yml on ophi-dev/mehen
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mehen-1.6.0-py3-none-win_arm64.whl -
Subject digest:
f5a56640b2fd23e9553ba5e717931d08004ae193d68f5f4754b000280ef322f0 - Sigstore transparency entry: 2211617582
- Sigstore integration time:
-
Permalink:
ophi-dev/mehen@b41332ba76c3a38bfca0d933d8f70986c4a99c06 -
Branch / Tag:
refs/tags/v1.6.0 - Owner: https://github.com/ophi-dev
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@b41332ba76c3a38bfca0d933d8f70986c4a99c06 -
Trigger Event:
push
-
Statement type:
File details
Details for the file mehen-1.6.0-py3-none-win_amd64.whl.
File metadata
- Download URL: mehen-1.6.0-py3-none-win_amd64.whl
- Upload date:
- Size: 10.7 MB
- Tags: Python 3, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
496e06e5ada362fe30aa933de378de8704b04c433ca70ea9e10c2ab0763900b0
|
|
| MD5 |
7e664e7e34c0e4e786950a49de5f294a
|
|
| BLAKE2b-256 |
279b2ca90f9fbd53ab6c6ed8b23a3254578cc948fd6c5a335515d652a9f0c6bc
|
Provenance
The following attestation bundles were made for mehen-1.6.0-py3-none-win_amd64.whl:
Publisher:
release.yml on ophi-dev/mehen
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mehen-1.6.0-py3-none-win_amd64.whl -
Subject digest:
496e06e5ada362fe30aa933de378de8704b04c433ca70ea9e10c2ab0763900b0 - Sigstore transparency entry: 2211617477
- Sigstore integration time:
-
Permalink:
ophi-dev/mehen@b41332ba76c3a38bfca0d933d8f70986c4a99c06 -
Branch / Tag:
refs/tags/v1.6.0 - Owner: https://github.com/ophi-dev
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@b41332ba76c3a38bfca0d933d8f70986c4a99c06 -
Trigger Event:
push
-
Statement type:
File details
Details for the file mehen-1.6.0-py3-none-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: mehen-1.6.0-py3-none-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 10.3 MB
- Tags: Python 3, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e9138056a5bea84d95b8fa60debe8b27eaeaa82e4ed5653131d1eecd43ff6e6a
|
|
| MD5 |
dbbc1390a951ace8611816b218bd26c3
|
|
| BLAKE2b-256 |
e72a7225792f790e197711af8e21a2a1d326111fcfa8eb18f2bb56013a7d1844
|
Provenance
The following attestation bundles were made for mehen-1.6.0-py3-none-manylinux_2_28_x86_64.whl:
Publisher:
release.yml on ophi-dev/mehen
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mehen-1.6.0-py3-none-manylinux_2_28_x86_64.whl -
Subject digest:
e9138056a5bea84d95b8fa60debe8b27eaeaa82e4ed5653131d1eecd43ff6e6a - Sigstore transparency entry: 2211617510
- Sigstore integration time:
-
Permalink:
ophi-dev/mehen@b41332ba76c3a38bfca0d933d8f70986c4a99c06 -
Branch / Tag:
refs/tags/v1.6.0 - Owner: https://github.com/ophi-dev
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@b41332ba76c3a38bfca0d933d8f70986c4a99c06 -
Trigger Event:
push
-
Statement type:
File details
Details for the file mehen-1.6.0-py3-none-manylinux_2_28_aarch64.whl.
File metadata
- Download URL: mehen-1.6.0-py3-none-manylinux_2_28_aarch64.whl
- Upload date:
- Size: 9.6 MB
- Tags: Python 3, manylinux: glibc 2.28+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6b889d564ad49cfe5cce9741b4ccbe00ab5323ca881d4de087c77e8216922799
|
|
| MD5 |
c74a71a38854a5e6b98af378b81dfa0f
|
|
| BLAKE2b-256 |
b5b3ee41493b0a7fb50a1801933748986d6f741c8ef9dea79dabf641c84cda51
|
Provenance
The following attestation bundles were made for mehen-1.6.0-py3-none-manylinux_2_28_aarch64.whl:
Publisher:
release.yml on ophi-dev/mehen
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mehen-1.6.0-py3-none-manylinux_2_28_aarch64.whl -
Subject digest:
6b889d564ad49cfe5cce9741b4ccbe00ab5323ca881d4de087c77e8216922799 - Sigstore transparency entry: 2211617385
- Sigstore integration time:
-
Permalink:
ophi-dev/mehen@b41332ba76c3a38bfca0d933d8f70986c4a99c06 -
Branch / Tag:
refs/tags/v1.6.0 - Owner: https://github.com/ophi-dev
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@b41332ba76c3a38bfca0d933d8f70986c4a99c06 -
Trigger Event:
push
-
Statement type:
File details
Details for the file mehen-1.6.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: mehen-1.6.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 9.5 MB
- Tags: Python 3, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
22040f147cfc997540fadd38f063098970917732798e810003fcd0ea32152fa5
|
|
| MD5 |
7e7f81ac28a0680bdef05dab18453ef4
|
|
| BLAKE2b-256 |
860587a03a12bed319b5539cd6f1c5ac5bd1bdfe50a129f1c7f48a5932078492
|
Provenance
The following attestation bundles were made for mehen-1.6.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:
Publisher:
release.yml on ophi-dev/mehen
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mehen-1.6.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl -
Subject digest:
22040f147cfc997540fadd38f063098970917732798e810003fcd0ea32152fa5 - Sigstore transparency entry: 2211617544
- Sigstore integration time:
-
Permalink:
ophi-dev/mehen@b41332ba76c3a38bfca0d933d8f70986c4a99c06 -
Branch / Tag:
refs/tags/v1.6.0 - Owner: https://github.com/ophi-dev
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@b41332ba76c3a38bfca0d933d8f70986c4a99c06 -
Trigger Event:
push
-
Statement type:
File details
Details for the file mehen-1.6.0-py3-none-manylinux_2_5_x86_64.manylinux1_x86_64.whl.
File metadata
- Download URL: mehen-1.6.0-py3-none-manylinux_2_5_x86_64.manylinux1_x86_64.whl
- Upload date:
- Size: 10.4 MB
- Tags: Python 3, manylinux: glibc 2.5+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6cdc6dc9b7e4556d9e890187e2f2285f7914c6aeed93755f3256ad4cd2e2a272
|
|
| MD5 |
4426718a2dec7de274aee05414a89ee3
|
|
| BLAKE2b-256 |
a8205319360238f7786c55e70013bf68e78b9606277639f9ce4f33b6afba34da
|
Provenance
The following attestation bundles were made for mehen-1.6.0-py3-none-manylinux_2_5_x86_64.manylinux1_x86_64.whl:
Publisher:
release.yml on ophi-dev/mehen
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mehen-1.6.0-py3-none-manylinux_2_5_x86_64.manylinux1_x86_64.whl -
Subject digest:
6cdc6dc9b7e4556d9e890187e2f2285f7914c6aeed93755f3256ad4cd2e2a272 - Sigstore transparency entry: 2211617415
- Sigstore integration time:
-
Permalink:
ophi-dev/mehen@b41332ba76c3a38bfca0d933d8f70986c4a99c06 -
Branch / Tag:
refs/tags/v1.6.0 - Owner: https://github.com/ophi-dev
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@b41332ba76c3a38bfca0d933d8f70986c4a99c06 -
Trigger Event:
push
-
Statement type:
File details
Details for the file mehen-1.6.0-py3-none-macosx_11_0_arm64.whl.
File metadata
- Download URL: mehen-1.6.0-py3-none-macosx_11_0_arm64.whl
- Upload date:
- Size: 9.4 MB
- Tags: Python 3, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b8c9cbadafd68ceb0bceeeb7b817214eedd731d0fe8b6b880d6c5111f7dd8b8c
|
|
| MD5 |
ec7dc7eea2be0e9f1ccd83c64b02e12c
|
|
| BLAKE2b-256 |
c75744c1edb9b5c864d07cbfefaa1c1dcee7d9a94fd134bdc6f12177dd357af8
|
Provenance
The following attestation bundles were made for mehen-1.6.0-py3-none-macosx_11_0_arm64.whl:
Publisher:
release.yml on ophi-dev/mehen
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mehen-1.6.0-py3-none-macosx_11_0_arm64.whl -
Subject digest:
b8c9cbadafd68ceb0bceeeb7b817214eedd731d0fe8b6b880d6c5111f7dd8b8c - Sigstore transparency entry: 2211617445
- Sigstore integration time:
-
Permalink:
ophi-dev/mehen@b41332ba76c3a38bfca0d933d8f70986c4a99c06 -
Branch / Tag:
refs/tags/v1.6.0 - Owner: https://github.com/ophi-dev
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@b41332ba76c3a38bfca0d933d8f70986c4a99c06 -
Trigger Event:
push
-
Statement type:
File details
Details for the file mehen-1.6.0-py3-none-macosx_10_12_x86_64.whl.
File metadata
- Download URL: mehen-1.6.0-py3-none-macosx_10_12_x86_64.whl
- Upload date:
- Size: 10.1 MB
- Tags: Python 3, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8dbdb7c7a1eb127a210c5f069ae3b9a1489d317ba1bd5131f72d4205a810cfe4
|
|
| MD5 |
ff7e1b0a5dc1983d90bbcede62635653
|
|
| BLAKE2b-256 |
930cd0641970c73c2e679eaf3d7f4bc787ce2c96063586aa752dfa8722bd3a56
|
Provenance
The following attestation bundles were made for mehen-1.6.0-py3-none-macosx_10_12_x86_64.whl:
Publisher:
release.yml on ophi-dev/mehen
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mehen-1.6.0-py3-none-macosx_10_12_x86_64.whl -
Subject digest:
8dbdb7c7a1eb127a210c5f069ae3b9a1489d317ba1bd5131f72d4205a810cfe4 - Sigstore transparency entry: 2211617341
- Sigstore integration time:
-
Permalink:
ophi-dev/mehen@b41332ba76c3a38bfca0d933d8f70986c4a99c06 -
Branch / Tag:
refs/tags/v1.6.0 - Owner: https://github.com/ophi-dev
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@b41332ba76c3a38bfca0d933d8f70986c4a99c06 -
Trigger Event:
push
-
Statement type: