complexity-guard 0.2.0 → 0.2.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 +19 -11
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -22,29 +22,33 @@ complexity-guard src/
|
|
|
22
22
|
|
|
23
23
|
```
|
|
24
24
|
src/auth/login.ts
|
|
25
|
-
42:0 ✓ ok Function 'validateCredentials'
|
|
26
|
-
67:0 ⚠ warning Function 'processLoginFlow'
|
|
27
|
-
89:2 ✗ error
|
|
25
|
+
42:0 ✓ ok Function 'validateCredentials' cyclomatic 3 cognitive 2
|
|
26
|
+
67:0 ⚠ warning Function 'processLoginFlow' cyclomatic 12 cognitive 18
|
|
27
|
+
89:2 ✗ error Method 'handleComplexAuthFlow' cyclomatic 25 cognitive 32
|
|
28
28
|
|
|
29
29
|
Analyzed 12 files, 47 functions
|
|
30
30
|
Found 3 warnings, 1 errors
|
|
31
31
|
|
|
32
|
-
Top
|
|
32
|
+
Top cyclomatic hotspots:
|
|
33
33
|
1. handleComplexAuthFlow (src/auth/login.ts:89) complexity 25
|
|
34
34
|
2. processPayment (src/checkout/payment.ts:156) complexity 18
|
|
35
|
-
|
|
35
|
+
|
|
36
|
+
Top cognitive hotspots:
|
|
37
|
+
1. handleComplexAuthFlow (src/auth/login.ts:89) complexity 32
|
|
38
|
+
2. processLoginFlow (src/auth/login.ts:67) complexity 18
|
|
36
39
|
|
|
37
40
|
✗ 4 problems (1 errors, 3 warnings)
|
|
38
41
|
```
|
|
39
42
|
|
|
40
43
|
## Features
|
|
41
44
|
|
|
42
|
-
- **
|
|
43
|
-
- **
|
|
44
|
-
- **
|
|
45
|
-
- **
|
|
46
|
-
- **
|
|
47
|
-
- **
|
|
45
|
+
- **Cognitive Complexity**: SonarSource-based metric measuring code *understandability* with nesting depth penalties
|
|
46
|
+
- **Cyclomatic Complexity**: McCabe metric with ESLint-aligned counting rules, complementary to cognitive complexity
|
|
47
|
+
- **Console + JSON Output**: Human-readable terminal display and machine-readable JSON for CI integration
|
|
48
|
+
- **Configurable Thresholds**: Warning and error levels for both metrics, customizable per project via config file
|
|
49
|
+
- **Zero Config**: Works out of the box with sensible defaults, optional `.complexityguard.json` for customization
|
|
50
|
+
- **Single Binary**: No runtime dependencies, runs offline, fast startup
|
|
51
|
+
- **Error-Tolerant Parsing**: Tree-sitter based parser handles syntax errors gracefully, continues analysis on remaining files
|
|
48
52
|
|
|
49
53
|
## Configuration
|
|
50
54
|
|
|
@@ -60,6 +64,10 @@ Create a `.complexityguard.json` file in your project root to customize behavior
|
|
|
60
64
|
"cyclomatic": {
|
|
61
65
|
"warning": 10,
|
|
62
66
|
"error": 20
|
|
67
|
+
},
|
|
68
|
+
"cognitive": {
|
|
69
|
+
"warning": 15,
|
|
70
|
+
"error": 25
|
|
63
71
|
}
|
|
64
72
|
},
|
|
65
73
|
"counting_rules": {
|
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.2.
|
|
7
|
+
"version": "0.2.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.2.
|
|
17
|
-
"@complexity-guard/darwin-x64": "0.2.
|
|
18
|
-
"@complexity-guard/linux-arm64": "0.2.
|
|
19
|
-
"@complexity-guard/linux-x64": "0.2.
|
|
20
|
-
"@complexity-guard/windows-x64": "0.2.
|
|
16
|
+
"@complexity-guard/darwin-arm64": "0.2.1",
|
|
17
|
+
"@complexity-guard/darwin-x64": "0.2.1",
|
|
18
|
+
"@complexity-guard/linux-arm64": "0.2.1",
|
|
19
|
+
"@complexity-guard/linux-x64": "0.2.1",
|
|
20
|
+
"@complexity-guard/windows-x64": "0.2.1"
|
|
21
21
|
},
|
|
22
22
|
"license": "MIT",
|
|
23
23
|
"repository": {
|