@pythonidaer/complexity-report 1.0.5 → 1.0.6

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/CHANGELOG.md CHANGED
@@ -5,6 +5,16 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [1.0.6] - 2026-02-08
9
+
10
+ ### Fixed
11
+ - **Threshold detection:** Regex now accepts single or double quotes around severity (e.g. `'warn'` or `"warn"`) in eslint.config.js.
12
+ - **Report hang:** Built-in ESLint ignore patterns for `complexity/**`, `dist/**`, `build/**`, `.angular/**`, `**/coverage/**`, `node_modules/**` so the run does not hang on report output or build/cache dirs.
13
+
14
+ ### Added
15
+ - README: Angular 21 / ESLint 10 note at Installation (legacy-peer-deps); Troubleshooting for peer dependency errors and slow runs.
16
+ - README: Performance note updated to describe built-in ignores.
17
+
8
18
  ## [1.0.5] - 2026-02-08
9
19
 
10
20
  ### Fixed
package/README.md CHANGED
@@ -21,6 +21,8 @@
21
21
  npm install -D @pythonidaer/complexity-report
22
22
  ```
23
23
 
24
+ On **Angular 21** or other projects using **ESLint 10**, install may fail with peer dependency conflicts; use `npm install --legacy-peer-deps` or set `legacy-peer-deps=true` in `.npmrc`. See [Troubleshooting](#npm-install-fails-with-peer-dependency-errors-eg-angular-21-eslint-10).
25
+
24
26
  ## Requirements
25
27
 
26
28
  - **Node.js**: >=18 (to run the CLI)
@@ -28,16 +30,20 @@ npm install -D @pythonidaer/complexity-report
28
30
 
29
31
  The package bundles ESLint and uses your project's config to run complexity analysis. You do not need to install ESLint or TypeScript in your project for the tool to work.
30
32
 
33
+ **Performance:** The tool runs ESLint with `lintFiles(['.'])` and applies built-in ignores for `complexity/**`, `dist/**`, `build/**`, `.angular/**`, `**/coverage/**`, and `node_modules/**` so the run does not hang on report output or build dirs. Your ESLint config's own ignores also apply; add any other large or generated dirs there if needed.
34
+
31
35
  ## Quick Start
32
36
 
33
37
  ### CLI Usage
34
38
 
35
- Run from your project root:
39
+ Run from your project root (after installing above):
36
40
 
37
41
  ```bash
38
42
  npx complexity-report
39
43
  ```
40
44
 
45
+ Use the hyphen: `complexity-report` (not `complexity report`). To run without adding to `package.json`: `npx @pythonidaer/complexity-report`
46
+
41
47
  This generates an interactive HTML report at `complexity/index.html`.
42
48
 
43
49
  ### With npm Scripts
@@ -98,6 +104,22 @@ console.log(`Total functions: ${result.stats.allFunctionsCount}`);
98
104
  - [Changelog](./CHANGELOG.md) — version history and migration from scripts
99
105
  - [Publishing to npm](./PUBLISH.md) — for maintainers
100
106
 
107
+ ## Troubleshooting
108
+
109
+ ### Report seems to hang on "Running ESLint to collect complexity..."
110
+
111
+ The tool already ignores `complexity/**`, `dist/**`, `build/**`, `.angular/**`, `**/coverage/**`, and `node_modules/**`. If it still hangs, add other large or generated directories to your ESLint config's `ignore` (e.g. `.next/**`, `out/**`, `*.min.js`).
112
+
113
+ ### npm install fails with peer dependency errors (e.g. Angular 21, ESLint 10)
114
+
115
+ Some setups (e.g. Angular 21 with ESLint 10) can trigger peer dependency conflicts. Install with:
116
+
117
+ ```bash
118
+ npm install --legacy-peer-deps
119
+ ```
120
+
121
+ Or add to your project's `.npmrc`: `legacy-peer-deps=true`. The report runs correctly with ESLint 10 once installed.
122
+
101
123
  ## License
102
124
 
103
125
  MIT © Johnny Hammond
@@ -73,6 +73,13 @@ export async function runESLintComplexityCheck(projectRoot) {
73
73
  '**/__tests__/**',
74
74
  '**/*.test.{js,ts,tsx}',
75
75
  '**/*.spec.{js,ts,tsx}',
76
+ // Avoid linting report output and common build/cache dirs (prevents apparent hang)
77
+ 'complexity/**',
78
+ 'dist/**',
79
+ 'build/**',
80
+ '.angular/**',
81
+ '**/coverage/**',
82
+ 'node_modules/**',
76
83
  ],
77
84
  overrideConfig: {
78
85
  rules: {
@@ -15,8 +15,8 @@ export function getComplexityThreshold(projectRoot) {
15
15
  const configContent = readFileSync(configPath, 'utf-8');
16
16
 
17
17
  // Extract all complexity max values using regex
18
- // Pattern: complexity: ["warn", { max: <number>, variant: "classic" }]
19
- const complexityMatches = configContent.match(/complexity:\s*\["warn",\s*\{\s*max:\s*(\d+)/g);
18
+ // Pattern: complexity: ["warn" | 'warn', { max: <number>, ... }] — accept single or double quotes
19
+ const complexityMatches = configContent.match(/complexity:\s*\[["'](?:warn|error)["'],\s*\{\s*max:\s*(\d+)/g);
20
20
 
21
21
  if (!complexityMatches || complexityMatches.length === 0) {
22
22
  // Default to 10 if not found
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pythonidaer/complexity-report",
3
- "version": "1.0.5",
3
+ "version": "1.0.6",
4
4
  "description": "AST-based cyclomatic complexity analyzer with interactive HTML reports and detailed function breakdowns",
5
5
  "type": "module",
6
6
  "main": "index.js",