mehen 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +116 -0
- package/package.json +9 -9
package/README.md
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
# mehen
|
|
2
|
+
|
|
3
|
+
Rust-powered CLI for detecting heuristic source code metrics at scale: complexity, maintainability, lines of code, and more.
|
|
4
|
+
|
|
5
|
+
Designed for fast, deterministic analysis over large codebases, helping both human and AI engineers track how complexity evolves over time.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install mehen
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Or run without installing:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npx -y mehen --help
|
|
17
|
+
bunx mehen --help
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Also available on [PyPI](https://pypi.org/project/mehen/):
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
uvx mehen --help
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Supported Languages
|
|
27
|
+
|
|
28
|
+
- Python (.py)
|
|
29
|
+
- TypeScript (.ts)
|
|
30
|
+
- TSX (.tsx)
|
|
31
|
+
- Rust (.rs)
|
|
32
|
+
- Go (.go)
|
|
33
|
+
|
|
34
|
+
## Usage
|
|
35
|
+
|
|
36
|
+
Analyze metrics for a directory:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
npx -y mehen -m -p src
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Export metrics as JSON:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
npx -y mehen -m -p src -O json -o ./metrics
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Other supported output formats: YAML, TOML, CBOR.
|
|
49
|
+
|
|
50
|
+
## What Mehen Computes
|
|
51
|
+
|
|
52
|
+
- **Cyclomatic complexity** -- control flow complexity
|
|
53
|
+
- **Cognitive complexity** -- human-perceived complexity with nesting
|
|
54
|
+
- **Maintainability Index** -- overall maintainability score
|
|
55
|
+
- **Halstead metrics** -- volume, difficulty, effort, bugs prediction
|
|
56
|
+
- **ABC metric** -- assignments, branches, conditionals
|
|
57
|
+
- **LOC family** -- SLOC, PLOC, LLOC, CLOC, blanks
|
|
58
|
+
- **NArgs / NOM / NExit** -- arguments, methods, exit points
|
|
59
|
+
- **NPA / NPM / WMC** -- public attributes, public methods, weighted methods per class
|
|
60
|
+
|
|
61
|
+
## CI Integration
|
|
62
|
+
|
|
63
|
+
`mehen` works well in CI pipelines. Here is a real-world example from a GitHub Actions workflow that computes metrics on pull requests, compares against the `main` branch, and posts a summary comment:
|
|
64
|
+
|
|
65
|
+
```yaml
|
|
66
|
+
steps:
|
|
67
|
+
- uses: actions/checkout@v5
|
|
68
|
+
with:
|
|
69
|
+
fetch-depth: 0
|
|
70
|
+
|
|
71
|
+
- name: Set up Node.js
|
|
72
|
+
uses: actions/setup-node@v5
|
|
73
|
+
with:
|
|
74
|
+
node-version: '22'
|
|
75
|
+
|
|
76
|
+
# Run mehen on the PR branch
|
|
77
|
+
- run: mkdir -p $HOME/mehen-json
|
|
78
|
+
- run: npx -y mehen -m -O json -o "$HOME/mehen-json" -p src
|
|
79
|
+
|
|
80
|
+
# Run mehen on main for baseline comparison
|
|
81
|
+
- uses: actions/checkout@v5
|
|
82
|
+
with:
|
|
83
|
+
ref: main
|
|
84
|
+
path: main
|
|
85
|
+
- run: mkdir -p $HOME/mehen-json-base
|
|
86
|
+
- run: npx -y mehen -m -O json -o "$HOME/mehen-json-base" -p main/src
|
|
87
|
+
|
|
88
|
+
# Compare and comment on PR (using actions/github-script or similar)
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
The JSON output per file contains structured metric data that can be diffed across branches to surface regressions.
|
|
92
|
+
|
|
93
|
+
## Platforms
|
|
94
|
+
|
|
95
|
+
Native binaries are provided for:
|
|
96
|
+
|
|
97
|
+
| OS | x64 | arm64 |
|
|
98
|
+
|---|---|---|
|
|
99
|
+
| Linux (glibc) | `@mehen/linux-x64-gnu` | `@mehen/linux-arm64-gnu` |
|
|
100
|
+
| Linux (musl) | `@mehen/linux-x64-musl` | `@mehen/linux-arm64-musl` |
|
|
101
|
+
| macOS | `@mehen/darwin-x64` | `@mehen/darwin-arm64` |
|
|
102
|
+
| Windows | `@mehen/win32-x64` | `@mehen/win32-arm64` |
|
|
103
|
+
|
|
104
|
+
The correct binary is selected automatically at runtime.
|
|
105
|
+
|
|
106
|
+
Requires Node.js >= 18.
|
|
107
|
+
|
|
108
|
+
## Links
|
|
109
|
+
|
|
110
|
+
- [GitHub](https://github.com/ophidiarium/mehen)
|
|
111
|
+
- [Issues](https://github.com/ophidiarium/mehen/issues)
|
|
112
|
+
- [PyPI package](https://pypi.org/project/mehen/)
|
|
113
|
+
|
|
114
|
+
## License
|
|
115
|
+
|
|
116
|
+
[MPL-2.0](https://www.mozilla.org/MPL/2.0/)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mehen",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"description": "Tool to compute and export code metrics",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"metrics",
|
|
@@ -37,14 +37,14 @@
|
|
|
37
37
|
"node": ">=18.0.0"
|
|
38
38
|
},
|
|
39
39
|
"optionalDependencies": {
|
|
40
|
-
"@mehen/linux-x64-gnu": "0.0.
|
|
41
|
-
"@mehen/linux-x64-musl": "0.0.
|
|
42
|
-
"@mehen/linux-arm64-gnu": "0.0.
|
|
43
|
-
"@mehen/linux-arm64-musl": "0.0.
|
|
44
|
-
"@mehen/darwin-x64": "0.0.
|
|
45
|
-
"@mehen/darwin-arm64": "0.0.
|
|
46
|
-
"@mehen/win32-x64": "0.0.
|
|
47
|
-
"@mehen/win32-arm64": "0.0.
|
|
40
|
+
"@mehen/linux-x64-gnu": "0.0.4",
|
|
41
|
+
"@mehen/linux-x64-musl": "0.0.4",
|
|
42
|
+
"@mehen/linux-arm64-gnu": "0.0.4",
|
|
43
|
+
"@mehen/linux-arm64-musl": "0.0.4",
|
|
44
|
+
"@mehen/darwin-x64": "0.0.4",
|
|
45
|
+
"@mehen/darwin-arm64": "0.0.4",
|
|
46
|
+
"@mehen/win32-x64": "0.0.4",
|
|
47
|
+
"@mehen/win32-arm64": "0.0.4"
|
|
48
48
|
},
|
|
49
49
|
"publishConfig": {
|
|
50
50
|
"access": "public"
|