complexity-guard 0.6.0 → 0.9.1
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 +9 -7
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# ComplexityGuard
|
|
2
2
|
|
|
3
|
-
Fast complexity analysis for TypeScript/JavaScript — single static binary, zero dependencies.
|
|
3
|
+
Fast complexity analysis for TypeScript/JavaScript — single static binary built with Rust, zero dependencies.
|
|
4
4
|
|
|
5
5
|
## Install
|
|
6
6
|
|
|
@@ -23,14 +23,12 @@ complexity-guard src/
|
|
|
23
23
|
```
|
|
24
24
|
src/auth/login.ts
|
|
25
25
|
42:0 ✓ ok Function 'validateCredentials' cyclomatic 3 cognitive 2
|
|
26
|
-
67:0 ⚠ warning Function 'processLoginFlow' cyclomatic 12 cognitive 18
|
|
27
|
-
|
|
28
|
-
89:2 ✗ error Method 'handleComplexAuthFlow' cyclomatic 25 cognitive 32
|
|
29
|
-
[halstead vol 1244 diff 18.6 effort 23135 bugs 0.41] [length 62 params 4 depth 6]
|
|
26
|
+
67:0 ⚠ warning Function 'processLoginFlow' cyclomatic 12 cognitive 18 [halstead vol 843] [length 34] [params 3] [depth 4]
|
|
27
|
+
89:2 ✗ error Function 'handleComplexAuthFlow' cyclomatic 25 cognitive 32 [halstead vol 1244] [length 62] [params 4] [depth 6]
|
|
30
28
|
|
|
31
29
|
Analyzed 12 files, 47 functions
|
|
32
|
-
Found 3 warnings, 1 errors
|
|
33
30
|
Health: 73
|
|
31
|
+
Found 3 warnings, 1 errors
|
|
34
32
|
|
|
35
33
|
Top cyclomatic hotspots:
|
|
36
34
|
1. handleComplexAuthFlow (src/auth/login.ts:89) complexity 25
|
|
@@ -53,12 +51,15 @@ Top Halstead volume hotspots:
|
|
|
53
51
|
- **Cognitive Complexity**: SonarSource-based metric with nesting depth penalties — measures understandability
|
|
54
52
|
- **Halstead Metrics**: Information-theoretic vocabulary density, volume, difficulty, effort, and estimated bugs
|
|
55
53
|
- **Structural Metrics**: Function length, parameter count, nesting depth, file length, and export count
|
|
54
|
+
- **Duplication Detection**: Rabin-Karp rolling hash detects Type 1 and Type 2 code clones across files — enable with `--duplication`
|
|
56
55
|
- **Composite Health Score**: Single 0–100 score combining all metric families with configurable weights — enforce in CI with `--fail-health-below`
|
|
57
56
|
- **Console + JSON + SARIF + HTML Output**: Human-readable terminal display, machine-readable JSON, SARIF 2.1.0 for GitHub Code Scanning, and self-contained HTML reports with interactive dashboard, treemap visualization, and sortable metric tables
|
|
58
|
-
- **
|
|
57
|
+
- **Multi-threaded Parallel Analysis**: Analyzes files concurrently across all CPU cores by default — 1.5–3.1x faster than FTA; use `--threads N` to control thread count
|
|
58
|
+
- **Configurable Thresholds**: Warning and error levels for all metric families, customizable per project
|
|
59
59
|
- **Selective Metrics**: Use `--metrics cyclomatic,halstead` to compute only specific families
|
|
60
60
|
- **Zero Config**: Works out of the box with sensible defaults, optional `.complexityguard.json` for customization
|
|
61
61
|
- **Single Binary**: No runtime dependencies, runs offline, fast startup
|
|
62
|
+
- **Low Memory Footprint**: 1.2–2.2x less memory than Node.js-based tools on small and medium projects
|
|
62
63
|
- **Error-Tolerant Parsing**: Tree-sitter based parser handles syntax errors gracefully, continues analysis on remaining files
|
|
63
64
|
|
|
64
65
|
## Configuration
|
|
@@ -95,6 +96,7 @@ Create a `.complexityguard.json` file in your project root to customize behavior
|
|
|
95
96
|
- [Documentation](https://github.com/benvds/complexity-guard#documentation)
|
|
96
97
|
- [SARIF Output / GitHub Code Scanning](https://github.com/benvds/complexity-guard/blob/main/docs/sarif-output.md)
|
|
97
98
|
- [HTML Reports](https://github.com/benvds/complexity-guard/blob/main/docs/examples.md#html-reports)
|
|
99
|
+
- [Performance Benchmarks](https://github.com/benvds/complexity-guard/blob/main/docs/benchmarks.md)
|
|
98
100
|
|
|
99
101
|
## License
|
|
100
102
|
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"name": "Ben van de Sande",
|
|
5
5
|
"email": "info@getlean.digital"
|
|
6
6
|
},
|
|
7
|
-
"version": "0.
|
|
7
|
+
"version": "0.9.1",
|
|
8
8
|
"description": "Fast complexity analysis for TypeScript/JavaScript — single static binary",
|
|
9
9
|
"bin": {
|
|
10
10
|
"complexity-guard": "bin/complexity-guard.js"
|
|
@@ -13,11 +13,11 @@
|
|
|
13
13
|
"bin/"
|
|
14
14
|
],
|
|
15
15
|
"optionalDependencies": {
|
|
16
|
-
"@complexity-guard/darwin-arm64": "0.
|
|
17
|
-
"@complexity-guard/darwin-x64": "0.
|
|
18
|
-
"@complexity-guard/linux-arm64": "0.
|
|
19
|
-
"@complexity-guard/linux-x64": "0.
|
|
20
|
-
"@complexity-guard/windows-x64": "0.
|
|
16
|
+
"@complexity-guard/darwin-arm64": "0.9.1",
|
|
17
|
+
"@complexity-guard/darwin-x64": "0.9.1",
|
|
18
|
+
"@complexity-guard/linux-arm64": "0.9.1",
|
|
19
|
+
"@complexity-guard/linux-x64": "0.9.1",
|
|
20
|
+
"@complexity-guard/windows-x64": "0.9.1"
|
|
21
21
|
},
|
|
22
22
|
"license": "MIT",
|
|
23
23
|
"repository": {
|