@mycodemap/mycodemap 0.1.0
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 +17 -0
- package/LICENSE +21 -0
- package/README.md +559 -0
- package/dist/ai/claude.d.ts +38 -0
- package/dist/ai/claude.d.ts.map +1 -0
- package/dist/ai/claude.js +169 -0
- package/dist/ai/claude.js.map +1 -0
- package/dist/ai/codex.d.ts +38 -0
- package/dist/ai/codex.d.ts.map +1 -0
- package/dist/ai/codex.js +169 -0
- package/dist/ai/codex.js.map +1 -0
- package/dist/ai/factory.d.ts +48 -0
- package/dist/ai/factory.d.ts.map +1 -0
- package/dist/ai/factory.js +95 -0
- package/dist/ai/factory.js.map +1 -0
- package/dist/ai/index.d.ts +12 -0
- package/dist/ai/index.d.ts.map +1 -0
- package/dist/ai/index.js +29 -0
- package/dist/ai/index.js.map +1 -0
- package/dist/ai/provider.d.ts +70 -0
- package/dist/ai/provider.d.ts.map +1 -0
- package/dist/ai/provider.js +31 -0
- package/dist/ai/provider.js.map +1 -0
- package/dist/ai/subagent-caller.d.ts +90 -0
- package/dist/ai/subagent-caller.d.ts.map +1 -0
- package/dist/ai/subagent-caller.js +280 -0
- package/dist/ai/subagent-caller.js.map +1 -0
- package/dist/ai/types.d.ts +70 -0
- package/dist/ai/types.d.ts.map +1 -0
- package/dist/ai/types.js +5 -0
- package/dist/ai/types.js.map +1 -0
- package/dist/cache/file-hash-cache.d.ts +76 -0
- package/dist/cache/file-hash-cache.d.ts.map +1 -0
- package/dist/cache/file-hash-cache.js +159 -0
- package/dist/cache/file-hash-cache.js.map +1 -0
- package/dist/cache/index.d.ts +151 -0
- package/dist/cache/index.d.ts.map +1 -0
- package/dist/cache/index.js +303 -0
- package/dist/cache/index.js.map +1 -0
- package/dist/cache/lru-cache.d.ts +93 -0
- package/dist/cache/lru-cache.d.ts.map +1 -0
- package/dist/cache/lru-cache.js +194 -0
- package/dist/cache/lru-cache.js.map +1 -0
- package/dist/cache/parse-cache.d.ts +68 -0
- package/dist/cache/parse-cache.d.ts.map +1 -0
- package/dist/cache/parse-cache.js +173 -0
- package/dist/cache/parse-cache.js.map +1 -0
- package/dist/cli/commands/analyze.d.ts +96 -0
- package/dist/cli/commands/analyze.d.ts.map +1 -0
- package/dist/cli/commands/analyze.js +567 -0
- package/dist/cli/commands/analyze.js.map +1 -0
- package/dist/cli/commands/ci.d.ts +25 -0
- package/dist/cli/commands/ci.d.ts.map +1 -0
- package/dist/cli/commands/ci.js +481 -0
- package/dist/cli/commands/ci.js.map +1 -0
- package/dist/cli/commands/complexity.d.ts +70 -0
- package/dist/cli/commands/complexity.d.ts.map +1 -0
- package/dist/cli/commands/complexity.js +479 -0
- package/dist/cli/commands/complexity.js.map +1 -0
- package/dist/cli/commands/cycles.d.ts +10 -0
- package/dist/cli/commands/cycles.d.ts.map +1 -0
- package/dist/cli/commands/cycles.js +202 -0
- package/dist/cli/commands/cycles.js.map +1 -0
- package/dist/cli/commands/deps.d.ts +61 -0
- package/dist/cli/commands/deps.d.ts.map +1 -0
- package/dist/cli/commands/deps.js +340 -0
- package/dist/cli/commands/deps.js.map +1 -0
- package/dist/cli/commands/generate.d.ts +8 -0
- package/dist/cli/commands/generate.d.ts.map +1 -0
- package/dist/cli/commands/generate.js +61 -0
- package/dist/cli/commands/generate.js.map +1 -0
- package/dist/cli/commands/impact.d.ts +55 -0
- package/dist/cli/commands/impact.d.ts.map +1 -0
- package/dist/cli/commands/impact.js +455 -0
- package/dist/cli/commands/impact.js.map +1 -0
- package/dist/cli/commands/init.d.ts +4 -0
- package/dist/cli/commands/init.d.ts.map +1 -0
- package/dist/cli/commands/init.js +50 -0
- package/dist/cli/commands/init.js.map +1 -0
- package/dist/cli/commands/query.d.ts +22 -0
- package/dist/cli/commands/query.d.ts.map +1 -0
- package/dist/cli/commands/query.js +718 -0
- package/dist/cli/commands/query.js.map +1 -0
- package/dist/cli/commands/watch-foreground.d.ts +9 -0
- package/dist/cli/commands/watch-foreground.d.ts.map +1 -0
- package/dist/cli/commands/watch-foreground.js +67 -0
- package/dist/cli/commands/watch-foreground.js.map +1 -0
- package/dist/cli/commands/watch.d.ts +12 -0
- package/dist/cli/commands/watch.d.ts.map +1 -0
- package/dist/cli/commands/watch.js +114 -0
- package/dist/cli/commands/watch.js.map +1 -0
- package/dist/cli/commands/workflow.d.ts +25 -0
- package/dist/cli/commands/workflow.d.ts.map +1 -0
- package/dist/cli/commands/workflow.js +488 -0
- package/dist/cli/commands/workflow.js.map +1 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +115 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/paths.d.ts +90 -0
- package/dist/cli/paths.d.ts.map +1 -0
- package/dist/cli/paths.js +136 -0
- package/dist/cli/paths.js.map +1 -0
- package/dist/cli/runtime-logger.d.ts +13 -0
- package/dist/cli/runtime-logger.d.ts.map +1 -0
- package/dist/cli/runtime-logger.js +213 -0
- package/dist/cli/runtime-logger.js.map +1 -0
- package/dist/core/analyzer.d.ts +3 -0
- package/dist/core/analyzer.d.ts.map +1 -0
- package/dist/core/analyzer.js +359 -0
- package/dist/core/analyzer.js.map +1 -0
- package/dist/core/ast-complexity-analyzer.d.ts +40 -0
- package/dist/core/ast-complexity-analyzer.d.ts.map +1 -0
- package/dist/core/ast-complexity-analyzer.js +279 -0
- package/dist/core/ast-complexity-analyzer.js.map +1 -0
- package/dist/core/global-index.d.ts +69 -0
- package/dist/core/global-index.d.ts.map +1 -0
- package/dist/core/global-index.js +388 -0
- package/dist/core/global-index.js.map +1 -0
- package/dist/generator/ai-overview.d.ts +51 -0
- package/dist/generator/ai-overview.d.ts.map +1 -0
- package/dist/generator/ai-overview.js +160 -0
- package/dist/generator/ai-overview.js.map +1 -0
- package/dist/generator/context.d.ts +5 -0
- package/dist/generator/context.d.ts.map +1 -0
- package/dist/generator/context.js +514 -0
- package/dist/generator/context.js.map +1 -0
- package/dist/generator/file-describer.d.ts +93 -0
- package/dist/generator/file-describer.d.ts.map +1 -0
- package/dist/generator/file-describer.js +375 -0
- package/dist/generator/file-describer.js.map +1 -0
- package/dist/generator/index.d.ts +8 -0
- package/dist/generator/index.d.ts.map +1 -0
- package/dist/generator/index.js +259 -0
- package/dist/generator/index.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -0
- package/dist/orchestrator/adapters/ast-grep-adapter.d.ts +75 -0
- package/dist/orchestrator/adapters/ast-grep-adapter.d.ts.map +1 -0
- package/dist/orchestrator/adapters/ast-grep-adapter.js +242 -0
- package/dist/orchestrator/adapters/ast-grep-adapter.js.map +1 -0
- package/dist/orchestrator/adapters/base-adapter.d.ts +24 -0
- package/dist/orchestrator/adapters/base-adapter.d.ts.map +1 -0
- package/dist/orchestrator/adapters/base-adapter.js +2 -0
- package/dist/orchestrator/adapters/base-adapter.js.map +1 -0
- package/dist/orchestrator/adapters/codemap-adapter.d.ts +56 -0
- package/dist/orchestrator/adapters/codemap-adapter.d.ts.map +1 -0
- package/dist/orchestrator/adapters/codemap-adapter.js +163 -0
- package/dist/orchestrator/adapters/codemap-adapter.js.map +1 -0
- package/dist/orchestrator/adapters/index.d.ts +10 -0
- package/dist/orchestrator/adapters/index.d.ts.map +1 -0
- package/dist/orchestrator/adapters/index.js +3 -0
- package/dist/orchestrator/adapters/index.js.map +1 -0
- package/dist/orchestrator/ai-feed-generator.d.ts +210 -0
- package/dist/orchestrator/ai-feed-generator.d.ts.map +1 -0
- package/dist/orchestrator/ai-feed-generator.js +377 -0
- package/dist/orchestrator/ai-feed-generator.js.map +1 -0
- package/dist/orchestrator/commit-validator.d.ts +30 -0
- package/dist/orchestrator/commit-validator.d.ts.map +1 -0
- package/dist/orchestrator/commit-validator.js +87 -0
- package/dist/orchestrator/commit-validator.js.map +1 -0
- package/dist/orchestrator/confidence.d.ts +25 -0
- package/dist/orchestrator/confidence.d.ts.map +1 -0
- package/dist/orchestrator/confidence.js +138 -0
- package/dist/orchestrator/confidence.js.map +1 -0
- package/dist/orchestrator/file-header-scanner.d.ts +48 -0
- package/dist/orchestrator/file-header-scanner.d.ts.map +1 -0
- package/dist/orchestrator/file-header-scanner.js +158 -0
- package/dist/orchestrator/file-header-scanner.js.map +1 -0
- package/dist/orchestrator/git-analyzer.d.ts +192 -0
- package/dist/orchestrator/git-analyzer.d.ts.map +1 -0
- package/dist/orchestrator/git-analyzer.js +539 -0
- package/dist/orchestrator/git-analyzer.js.map +1 -0
- package/dist/orchestrator/index.d.ts +20 -0
- package/dist/orchestrator/index.d.ts.map +1 -0
- package/dist/orchestrator/index.js +16 -0
- package/dist/orchestrator/index.js.map +1 -0
- package/dist/orchestrator/intent-router.d.ts +41 -0
- package/dist/orchestrator/intent-router.d.ts.map +1 -0
- package/dist/orchestrator/intent-router.js +98 -0
- package/dist/orchestrator/intent-router.js.map +1 -0
- package/dist/orchestrator/result-fusion.d.ts +114 -0
- package/dist/orchestrator/result-fusion.d.ts.map +1 -0
- package/dist/orchestrator/result-fusion.js +332 -0
- package/dist/orchestrator/result-fusion.js.map +1 -0
- package/dist/orchestrator/test-linker.d.ts +166 -0
- package/dist/orchestrator/test-linker.d.ts.map +1 -0
- package/dist/orchestrator/test-linker.js +570 -0
- package/dist/orchestrator/test-linker.js.map +1 -0
- package/dist/orchestrator/tool-orchestrator.d.ts +108 -0
- package/dist/orchestrator/tool-orchestrator.d.ts.map +1 -0
- package/dist/orchestrator/tool-orchestrator.js +247 -0
- package/dist/orchestrator/tool-orchestrator.js.map +1 -0
- package/dist/orchestrator/types.d.ts +162 -0
- package/dist/orchestrator/types.d.ts.map +1 -0
- package/dist/orchestrator/types.js +39 -0
- package/dist/orchestrator/types.js.map +1 -0
- package/dist/orchestrator/workflow/ci-executor.d.ts +157 -0
- package/dist/orchestrator/workflow/ci-executor.d.ts.map +1 -0
- package/dist/orchestrator/workflow/ci-executor.js +423 -0
- package/dist/orchestrator/workflow/ci-executor.js.map +1 -0
- package/dist/orchestrator/workflow/config.d.ts +97 -0
- package/dist/orchestrator/workflow/config.d.ts.map +1 -0
- package/dist/orchestrator/workflow/config.js +115 -0
- package/dist/orchestrator/workflow/config.js.map +1 -0
- package/dist/orchestrator/workflow/git-analyzer.d.ts +173 -0
- package/dist/orchestrator/workflow/git-analyzer.d.ts.map +1 -0
- package/dist/orchestrator/workflow/git-analyzer.js +473 -0
- package/dist/orchestrator/workflow/git-analyzer.js.map +1 -0
- package/dist/orchestrator/workflow/index.d.ts +21 -0
- package/dist/orchestrator/workflow/index.d.ts.map +1 -0
- package/dist/orchestrator/workflow/index.js +21 -0
- package/dist/orchestrator/workflow/index.js.map +1 -0
- package/dist/orchestrator/workflow/phase-checkpoint.d.ts +38 -0
- package/dist/orchestrator/workflow/phase-checkpoint.d.ts.map +1 -0
- package/dist/orchestrator/workflow/phase-checkpoint.js +75 -0
- package/dist/orchestrator/workflow/phase-checkpoint.js.map +1 -0
- package/dist/orchestrator/workflow/phase-inheritance.d.ts +128 -0
- package/dist/orchestrator/workflow/phase-inheritance.d.ts.map +1 -0
- package/dist/orchestrator/workflow/phase-inheritance.js +266 -0
- package/dist/orchestrator/workflow/phase-inheritance.js.map +1 -0
- package/dist/orchestrator/workflow/result-fusion.d.ts +117 -0
- package/dist/orchestrator/workflow/result-fusion.d.ts.map +1 -0
- package/dist/orchestrator/workflow/result-fusion.js +246 -0
- package/dist/orchestrator/workflow/result-fusion.js.map +1 -0
- package/dist/orchestrator/workflow/templates.d.ts +116 -0
- package/dist/orchestrator/workflow/templates.d.ts.map +1 -0
- package/dist/orchestrator/workflow/templates.js +546 -0
- package/dist/orchestrator/workflow/templates.js.map +1 -0
- package/dist/orchestrator/workflow/test-linker.d.ts +152 -0
- package/dist/orchestrator/workflow/test-linker.d.ts.map +1 -0
- package/dist/orchestrator/workflow/test-linker.js +342 -0
- package/dist/orchestrator/workflow/test-linker.js.map +1 -0
- package/dist/orchestrator/workflow/types.d.ts +202 -0
- package/dist/orchestrator/workflow/types.d.ts.map +1 -0
- package/dist/orchestrator/workflow/types.js +4 -0
- package/dist/orchestrator/workflow/types.js.map +1 -0
- package/dist/orchestrator/workflow/visualizer.d.ts +56 -0
- package/dist/orchestrator/workflow/visualizer.d.ts.map +1 -0
- package/dist/orchestrator/workflow/visualizer.js +300 -0
- package/dist/orchestrator/workflow/visualizer.js.map +1 -0
- package/dist/orchestrator/workflow/workflow-context.d.ts +50 -0
- package/dist/orchestrator/workflow/workflow-context.d.ts.map +1 -0
- package/dist/orchestrator/workflow/workflow-context.js +105 -0
- package/dist/orchestrator/workflow/workflow-context.js.map +1 -0
- package/dist/orchestrator/workflow/workflow-orchestrator.d.ts +126 -0
- package/dist/orchestrator/workflow/workflow-orchestrator.d.ts.map +1 -0
- package/dist/orchestrator/workflow/workflow-orchestrator.js +489 -0
- package/dist/orchestrator/workflow/workflow-orchestrator.js.map +1 -0
- package/dist/orchestrator/workflow/workflow-persistence.d.ts +38 -0
- package/dist/orchestrator/workflow/workflow-persistence.d.ts.map +1 -0
- package/dist/orchestrator/workflow/workflow-persistence.js +166 -0
- package/dist/orchestrator/workflow/workflow-persistence.js.map +1 -0
- package/dist/parser/implementations/fast-parser.d.ts +65 -0
- package/dist/parser/implementations/fast-parser.d.ts.map +1 -0
- package/dist/parser/implementations/fast-parser.js +299 -0
- package/dist/parser/implementations/fast-parser.js.map +1 -0
- package/dist/parser/implementations/smart-parser.d.ts +220 -0
- package/dist/parser/implementations/smart-parser.d.ts.map +1 -0
- package/dist/parser/implementations/smart-parser.js +1536 -0
- package/dist/parser/implementations/smart-parser.js.map +1 -0
- package/dist/parser/implementations/tree-sitter-parser.d.ts +57 -0
- package/dist/parser/implementations/tree-sitter-parser.d.ts.map +1 -0
- package/dist/parser/implementations/tree-sitter-parser.js +375 -0
- package/dist/parser/implementations/tree-sitter-parser.js.map +1 -0
- package/dist/parser/index.d.ts +19 -0
- package/dist/parser/index.d.ts.map +1 -0
- package/dist/parser/index.js +449 -0
- package/dist/parser/index.js.map +1 -0
- package/dist/parser/interfaces/IParser.d.ts +218 -0
- package/dist/parser/interfaces/IParser.d.ts.map +1 -0
- package/dist/parser/interfaces/IParser.js +22 -0
- package/dist/parser/interfaces/IParser.js.map +1 -0
- package/dist/plugins/built-in/call-graph.d.ts +38 -0
- package/dist/plugins/built-in/call-graph.d.ts.map +1 -0
- package/dist/plugins/built-in/call-graph.js +135 -0
- package/dist/plugins/built-in/call-graph.js.map +1 -0
- package/dist/plugins/built-in/complexity-analyzer.d.ts +45 -0
- package/dist/plugins/built-in/complexity-analyzer.d.ts.map +1 -0
- package/dist/plugins/built-in/complexity-analyzer.js +155 -0
- package/dist/plugins/built-in/complexity-analyzer.js.map +1 -0
- package/dist/plugins/index.d.ts +34 -0
- package/dist/plugins/index.d.ts.map +1 -0
- package/dist/plugins/index.js +103 -0
- package/dist/plugins/index.js.map +1 -0
- package/dist/plugins/plugin-loader.d.ts +22 -0
- package/dist/plugins/plugin-loader.d.ts.map +1 -0
- package/dist/plugins/plugin-loader.js +200 -0
- package/dist/plugins/plugin-loader.js.map +1 -0
- package/dist/plugins/plugin-registry.d.ts +20 -0
- package/dist/plugins/plugin-registry.d.ts.map +1 -0
- package/dist/plugins/plugin-registry.js +143 -0
- package/dist/plugins/plugin-registry.js.map +1 -0
- package/dist/plugins/types.d.ts +72 -0
- package/dist/plugins/types.d.ts.map +1 -0
- package/dist/plugins/types.js +5 -0
- package/dist/plugins/types.js.map +1 -0
- package/dist/types/index.d.ts +373 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +7 -0
- package/dist/types/index.js.map +1 -0
- package/dist/watcher/daemon.d.ts +64 -0
- package/dist/watcher/daemon.d.ts.map +1 -0
- package/dist/watcher/daemon.js +189 -0
- package/dist/watcher/daemon.js.map +1 -0
- package/dist/watcher/file-watcher.d.ts +70 -0
- package/dist/watcher/file-watcher.d.ts.map +1 -0
- package/dist/watcher/file-watcher.js +127 -0
- package/dist/watcher/file-watcher.js.map +1 -0
- package/dist/watcher/index.d.ts +5 -0
- package/dist/watcher/index.d.ts.map +1 -0
- package/dist/watcher/index.js +6 -0
- package/dist/watcher/index.js.map +1 -0
- package/dist/watcher/watch-worker.d.ts +2 -0
- package/dist/watcher/watch-worker.d.ts.map +1 -0
- package/dist/watcher/watch-worker.js +57 -0
- package/dist/watcher/watch-worker.js.map +1 -0
- package/dist/worker/index.d.ts +76 -0
- package/dist/worker/index.d.ts.map +1 -0
- package/dist/worker/index.js +155 -0
- package/dist/worker/index.js.map +1 -0
- package/dist/worker/parse-worker.d.ts +2 -0
- package/dist/worker/parse-worker.d.ts.map +1 -0
- package/dist/worker/parse-worker.js +202 -0
- package/dist/worker/parse-worker.js.map +1 -0
- package/mycodemap.config.schema.json +42 -0
- package/package.json +69 -0
|
@@ -0,0 +1,479 @@
|
|
|
1
|
+
// [META] since:2026-03-03 | owner:orchestrator-team | stable:true
|
|
2
|
+
// [WHY] 提供代码复杂度分析命令,支持文件级和函数级复杂度详情
|
|
3
|
+
import chalk from 'chalk';
|
|
4
|
+
import fs from 'fs';
|
|
5
|
+
import path from 'path';
|
|
6
|
+
import { resolveDataPath } from '../paths.js';
|
|
7
|
+
import { analyzeFileComplexity } from '../../core/ast-complexity-analyzer.js';
|
|
8
|
+
// ===== 纯逻辑函数(从原有函数提取) =====
|
|
9
|
+
/**
|
|
10
|
+
* 加载代码地图数据
|
|
11
|
+
*/
|
|
12
|
+
function loadCodeMap(rootDir) {
|
|
13
|
+
const codemapPath = resolveDataPath(rootDir);
|
|
14
|
+
if (!fs.existsSync(codemapPath)) {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
try {
|
|
18
|
+
const data = fs.readFileSync(codemapPath, 'utf-8');
|
|
19
|
+
return JSON.parse(data);
|
|
20
|
+
}
|
|
21
|
+
catch {
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* 计算可维护性指数
|
|
27
|
+
*
|
|
28
|
+
* 基于微软的可维护性指数公式,进行适应性调整:
|
|
29
|
+
* MI = MAX(0, (171 - 5.2 * ln(Halstead Volume) - 0.23 * Cyclomatic - 16.2 * ln(LOC)) * 100 / 171)
|
|
30
|
+
*
|
|
31
|
+
* 由于我们没有 Halstead Volume,使用简化但合理的公式:
|
|
32
|
+
* - 基于圈复杂度和代码行数计算
|
|
33
|
+
* - 结果范围 0-100
|
|
34
|
+
* - 考虑了文件大小和复杂度的平衡
|
|
35
|
+
*/
|
|
36
|
+
function calculateMaintainabilityIndex(loc, cyclomatic, commentRatio) {
|
|
37
|
+
// 规范化输入
|
|
38
|
+
const normalizedLOC = Math.max(1, loc);
|
|
39
|
+
const normalizedCC = Math.max(1, cyclomatic);
|
|
40
|
+
// 基础分 100
|
|
41
|
+
let mi = 100;
|
|
42
|
+
// 圈复杂度惩罚(每点复杂度减少2分)
|
|
43
|
+
mi -= (normalizedCC - 1) * 2;
|
|
44
|
+
// 代码行数惩罚(对数缩放,避免大文件过度惩罚)
|
|
45
|
+
// 100行: -5分, 500行: -15分, 1000行: -20分
|
|
46
|
+
mi -= Math.log(normalizedLOC / 10 + 1) * 5;
|
|
47
|
+
// 注释奖励(最多+10分)
|
|
48
|
+
mi += commentRatio * 15;
|
|
49
|
+
// 确保结果在 0-100 范围内
|
|
50
|
+
return Math.max(0, Math.min(100, Math.round(mi)));
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* 获取模块复杂度信息
|
|
54
|
+
*/
|
|
55
|
+
function getModuleComplexity(module) {
|
|
56
|
+
// 如果模块已经有复杂度数据(来自解析器)
|
|
57
|
+
if (module.complexity && module.complexity.cyclomatic > 0) {
|
|
58
|
+
const commentRatio = module.stats.commentLines / Math.max(1, module.stats.lines);
|
|
59
|
+
const maintainability = calculateMaintainabilityIndex(module.stats.codeLines, module.complexity.cyclomatic, commentRatio);
|
|
60
|
+
return {
|
|
61
|
+
cyclomatic: module.complexity.cyclomatic,
|
|
62
|
+
cognitive: module.complexity.cognitive || Math.round(module.complexity.cyclomatic * 1.5),
|
|
63
|
+
maintainability,
|
|
64
|
+
functions: module.complexity.details?.functions.length ||
|
|
65
|
+
module.symbols.filter(s => s.kind === 'function' || s.kind === 'method').length,
|
|
66
|
+
classes: module.symbols.filter(s => s.kind === 'class').length,
|
|
67
|
+
lines: module.stats.codeLines,
|
|
68
|
+
functionDetails: module.complexity.details?.functions.map(f => ({
|
|
69
|
+
name: f.name,
|
|
70
|
+
kind: 'function',
|
|
71
|
+
line: 1,
|
|
72
|
+
column: 1,
|
|
73
|
+
cyclomatic: f.cyclomatic,
|
|
74
|
+
cognitive: f.cognitive,
|
|
75
|
+
nestingDepth: 0,
|
|
76
|
+
isHighComplexity: f.cyclomatic >= 10
|
|
77
|
+
}))
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
// 否则基于符号数量估算
|
|
81
|
+
const functions = module.symbols.filter(s => s.kind === 'function' || s.kind === 'method').length;
|
|
82
|
+
const classes = module.symbols.filter(s => s.kind === 'class').length;
|
|
83
|
+
// 更合理的圈复杂度估算:基于函数数量和代码行数
|
|
84
|
+
// 每个函数基础复杂度1,再加上基于行数的估算
|
|
85
|
+
const cyclomatic = Math.max(1, functions + Math.floor(module.stats.codeLines / 50));
|
|
86
|
+
const cognitive = Math.round(cyclomatic * 1.5);
|
|
87
|
+
const commentRatio = module.stats.commentLines / Math.max(1, module.stats.lines);
|
|
88
|
+
const maintainability = calculateMaintainabilityIndex(module.stats.codeLines, cyclomatic, commentRatio);
|
|
89
|
+
return {
|
|
90
|
+
cyclomatic,
|
|
91
|
+
cognitive,
|
|
92
|
+
maintainability,
|
|
93
|
+
functions,
|
|
94
|
+
classes,
|
|
95
|
+
lines: module.stats.codeLines
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* 使用 AST 分析获取精确的模块复杂度信息
|
|
100
|
+
*/
|
|
101
|
+
function getModuleComplexityWithAST(module) {
|
|
102
|
+
try {
|
|
103
|
+
const astResult = analyzeFileComplexity(module.absolutePath);
|
|
104
|
+
return {
|
|
105
|
+
cyclomatic: astResult.cyclomatic,
|
|
106
|
+
cognitive: astResult.cognitive,
|
|
107
|
+
maintainability: astResult.maintainability,
|
|
108
|
+
functions: astResult.functions,
|
|
109
|
+
classes: astResult.classes,
|
|
110
|
+
lines: astResult.lines,
|
|
111
|
+
functionDetails: astResult.functionDetails
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
catch (error) {
|
|
115
|
+
// 如果 AST 分析失败,回退到估算方式
|
|
116
|
+
console.warn(`警告: AST 分析失败,回退到估算方式: ${module.absolutePath}`);
|
|
117
|
+
return getModuleComplexity(module);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* 构建 SourceLocation 对象
|
|
122
|
+
*/
|
|
123
|
+
function buildLocation(filePath, line = 1, column = 1) {
|
|
124
|
+
return {
|
|
125
|
+
file: filePath,
|
|
126
|
+
line,
|
|
127
|
+
column,
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
function analyzeComplexity(codeMap, options = {}) {
|
|
131
|
+
const { filePaths, useAST = false } = options;
|
|
132
|
+
const result = {
|
|
133
|
+
files: []
|
|
134
|
+
};
|
|
135
|
+
// 筛选目标模块
|
|
136
|
+
let modulesToAnalyze = codeMap.modules;
|
|
137
|
+
if (filePaths && filePaths.length > 0) {
|
|
138
|
+
modulesToAnalyze = codeMap.modules.filter(m => filePaths.some(fp => m.absolutePath.includes(fp) ||
|
|
139
|
+
path.relative(codeMap.project.rootDir, m.absolutePath).includes(fp)));
|
|
140
|
+
}
|
|
141
|
+
// 计算每个模块的复杂度
|
|
142
|
+
for (const module of modulesToAnalyze) {
|
|
143
|
+
const complexity = useAST
|
|
144
|
+
? getModuleComplexityWithAST(module)
|
|
145
|
+
: getModuleComplexity(module);
|
|
146
|
+
const relativePath = path.relative(codeMap.project.rootDir, module.absolutePath);
|
|
147
|
+
result.files.push({
|
|
148
|
+
path: module.absolutePath,
|
|
149
|
+
relativePath,
|
|
150
|
+
location: buildLocation(relativePath, 1, 1), // 新增:结构化位置信息
|
|
151
|
+
complexity
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
// 计算汇总统计
|
|
155
|
+
if (result.files.length > 0) {
|
|
156
|
+
result.summary = {
|
|
157
|
+
totalModules: codeMap.modules.length,
|
|
158
|
+
averageCyclomatic: result.files.reduce((sum, f) => sum + f.complexity.cyclomatic, 0) / result.files.length,
|
|
159
|
+
averageCognitive: result.files.reduce((sum, f) => sum + f.complexity.cognitive, 0) / result.files.length,
|
|
160
|
+
averageMaintainability: result.files.reduce((sum, f) => sum + f.complexity.maintainability, 0) / result.files.length
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
return result;
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* 获取复杂度评级(内部使用)
|
|
167
|
+
*/
|
|
168
|
+
function getComplexityRating(value, type) {
|
|
169
|
+
if (type === 'cyclomatic') {
|
|
170
|
+
if (value <= 10)
|
|
171
|
+
return chalk.green('低');
|
|
172
|
+
if (value <= 20)
|
|
173
|
+
return chalk.yellow('中');
|
|
174
|
+
if (value <= 50)
|
|
175
|
+
return chalk.red('高');
|
|
176
|
+
return chalk.magenta('极高');
|
|
177
|
+
}
|
|
178
|
+
else {
|
|
179
|
+
if (value >= 80)
|
|
180
|
+
return chalk.green('高');
|
|
181
|
+
if (value >= 60)
|
|
182
|
+
return chalk.yellow('中');
|
|
183
|
+
if (value >= 40)
|
|
184
|
+
return chalk.red('低');
|
|
185
|
+
return chalk.magenta('极低');
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* 获取风险等级(内部使用)
|
|
190
|
+
*/
|
|
191
|
+
function getRiskLevel(complexity) {
|
|
192
|
+
if (complexity.cyclomatic > 20 || complexity.cognitive > 30 || complexity.maintainability < 40) {
|
|
193
|
+
return 'high';
|
|
194
|
+
}
|
|
195
|
+
if (complexity.cyclomatic > 10 || complexity.cognitive > 15 || complexity.maintainability < 60) {
|
|
196
|
+
return 'medium';
|
|
197
|
+
}
|
|
198
|
+
return 'low';
|
|
199
|
+
}
|
|
200
|
+
// ===== ComplexityCommand 类(供 ToolOrchestrator 调用) =====
|
|
201
|
+
export class ComplexityCommand {
|
|
202
|
+
codeMap = null;
|
|
203
|
+
rootDir;
|
|
204
|
+
constructor(rootDir) {
|
|
205
|
+
this.rootDir = rootDir || process.cwd();
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* 加载代码地图
|
|
209
|
+
*/
|
|
210
|
+
loadCodeMap() {
|
|
211
|
+
if (this.codeMap) {
|
|
212
|
+
return this.codeMap;
|
|
213
|
+
}
|
|
214
|
+
this.codeMap = loadCodeMap(this.rootDir);
|
|
215
|
+
return this.codeMap;
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* 运行复杂度分析,返回结构化结果
|
|
219
|
+
*/
|
|
220
|
+
async run(args) {
|
|
221
|
+
const codeMap = this.loadCodeMap();
|
|
222
|
+
if (!codeMap) {
|
|
223
|
+
throw new Error('代码地图不存在,请先运行 codemap generate');
|
|
224
|
+
}
|
|
225
|
+
return analyzeComplexity(codeMap, {
|
|
226
|
+
filePaths: args.targets,
|
|
227
|
+
useAST: args.useAST ?? false
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* 增强模式,返回 UnifiedResult[]
|
|
232
|
+
*/
|
|
233
|
+
async runEnhanced(args) {
|
|
234
|
+
const result = await this.run(args);
|
|
235
|
+
return this.toUnifiedResults(result);
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* 将 ComplexityResult 转换为 UnifiedResult[]
|
|
239
|
+
*/
|
|
240
|
+
toUnifiedResults(result) {
|
|
241
|
+
return result.files.map(file => {
|
|
242
|
+
const complexity = file.complexity;
|
|
243
|
+
const riskLevel = getRiskLevel(complexity);
|
|
244
|
+
// 基于复杂度计算相关性(复杂度越高相关性越高)
|
|
245
|
+
const relevance = Math.min(1, Math.max(0.3, (complexity.cyclomatic / 50) * 0.4 +
|
|
246
|
+
(complexity.cognitive / 75) * 0.3 +
|
|
247
|
+
(1 - complexity.maintainability / 100) * 0.3));
|
|
248
|
+
// 确定类型:复杂度高则标记为 risk-assessment
|
|
249
|
+
const type = riskLevel === 'high' ? 'risk-assessment' : 'file';
|
|
250
|
+
// 生成人类可读的描述
|
|
251
|
+
const content = `圈复杂度: ${complexity.cyclomatic}, 认知复杂度: ${complexity.cognitive}, 可维护性: ${complexity.maintainability}`;
|
|
252
|
+
// 使用已有的 location
|
|
253
|
+
const location = file.location || {
|
|
254
|
+
file: file.relativePath,
|
|
255
|
+
line: 1,
|
|
256
|
+
column: 1,
|
|
257
|
+
};
|
|
258
|
+
return {
|
|
259
|
+
id: `codemap-${file.path}-0`,
|
|
260
|
+
source: 'codemap',
|
|
261
|
+
toolScore: 0.9,
|
|
262
|
+
type,
|
|
263
|
+
file: file.path,
|
|
264
|
+
line: 1,
|
|
265
|
+
location, // 新增:结构化位置信息
|
|
266
|
+
content,
|
|
267
|
+
relevance,
|
|
268
|
+
keywords: [],
|
|
269
|
+
metadata: {
|
|
270
|
+
symbolType: 'class',
|
|
271
|
+
dependencies: [],
|
|
272
|
+
testFile: '',
|
|
273
|
+
commitCount: 0,
|
|
274
|
+
gravity: 0,
|
|
275
|
+
heatScore: {
|
|
276
|
+
freq30d: 0,
|
|
277
|
+
lastType: '',
|
|
278
|
+
lastDate: null,
|
|
279
|
+
stability: true
|
|
280
|
+
},
|
|
281
|
+
impactCount: 0,
|
|
282
|
+
stability: true,
|
|
283
|
+
riskLevel,
|
|
284
|
+
// 额外添加复杂度详细指标
|
|
285
|
+
complexityMetrics: {
|
|
286
|
+
cyclomatic: complexity.cyclomatic,
|
|
287
|
+
cognitive: complexity.cognitive,
|
|
288
|
+
maintainability: complexity.maintainability,
|
|
289
|
+
functions: complexity.functions,
|
|
290
|
+
classes: complexity.classes,
|
|
291
|
+
lines: complexity.lines
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
};
|
|
295
|
+
});
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
// ===== 原有 CLI 命令(保持兼容,使用控制台输出) =====
|
|
299
|
+
/**
|
|
300
|
+
* 格式化复杂度输出
|
|
301
|
+
*/
|
|
302
|
+
function formatComplexity(codeMap, targetModule, allComplexities, options) {
|
|
303
|
+
// 如果有详细数据,使用已有的复杂度信息
|
|
304
|
+
const activeComplexity = targetModule && allComplexities.length > 0
|
|
305
|
+
? allComplexities[0].complexity
|
|
306
|
+
: (options.file && allComplexities.length > 0 ? allComplexities[0].complexity : undefined);
|
|
307
|
+
if (options.json) {
|
|
308
|
+
const output = {};
|
|
309
|
+
if (options.file && targetModule) {
|
|
310
|
+
const relativePath = path.relative(codeMap.project.rootDir, targetModule.absolutePath);
|
|
311
|
+
output.file = {
|
|
312
|
+
path: targetModule.absolutePath,
|
|
313
|
+
relativePath,
|
|
314
|
+
location: buildLocation(relativePath, 1, 1), // 新增:结构化位置信息
|
|
315
|
+
complexity: activeComplexity || getModuleComplexity(targetModule)
|
|
316
|
+
};
|
|
317
|
+
}
|
|
318
|
+
else {
|
|
319
|
+
output.modules = allComplexities.map(({ module, complexity }) => {
|
|
320
|
+
const relativePath = path.relative(codeMap.project.rootDir, module.absolutePath);
|
|
321
|
+
return {
|
|
322
|
+
path: relativePath,
|
|
323
|
+
location: buildLocation(relativePath, 1, 1), // 新增:结构化位置信息
|
|
324
|
+
...complexity
|
|
325
|
+
};
|
|
326
|
+
});
|
|
327
|
+
output.summary = {
|
|
328
|
+
totalModules: codeMap.modules.length,
|
|
329
|
+
averageCyclomatic: allComplexities.reduce((sum, c) => sum + c.complexity.cyclomatic, 0) / codeMap.modules.length,
|
|
330
|
+
averageCognitive: allComplexities.reduce((sum, c) => sum + c.complexity.cognitive, 0) / codeMap.modules.length,
|
|
331
|
+
averageMaintainability: allComplexities.reduce((sum, c) => sum + c.complexity.maintainability, 0) / codeMap.modules.length
|
|
332
|
+
};
|
|
333
|
+
}
|
|
334
|
+
console.log(JSON.stringify(output, null, 2));
|
|
335
|
+
return;
|
|
336
|
+
}
|
|
337
|
+
// 检查是否需要显示单个文件详情(targetModule 存在 或 allComplexities 只有一个元素且有函数详情)
|
|
338
|
+
const showSingleFile = options.file && (targetModule || (allComplexities.length === 1 && allComplexities[0].complexity.functionDetails));
|
|
339
|
+
if (showSingleFile) {
|
|
340
|
+
// 输出指定文件的复杂度
|
|
341
|
+
// 如果有来自 AST 分析的详细数据则使用它
|
|
342
|
+
const complexity = allComplexities.length > 0 && allComplexities[0].complexity.functionDetails
|
|
343
|
+
? allComplexities[0].complexity
|
|
344
|
+
: (targetModule ? getModuleComplexity(targetModule) : allComplexities[0].complexity);
|
|
345
|
+
const filePath = targetModule
|
|
346
|
+
? path.relative(codeMap.project.rootDir, targetModule.absolutePath)
|
|
347
|
+
: (allComplexities.length > 0 ? allComplexities[0].module.absolutePath : options.file);
|
|
348
|
+
console.log(chalk.cyan(`\n📊 文件复杂度: ${filePath}`));
|
|
349
|
+
console.log(chalk.gray('─'.repeat(50)));
|
|
350
|
+
console.log(chalk.yellow('\n圈复杂度 (Cyclomatic Complexity):'));
|
|
351
|
+
console.log(chalk.green(` ${complexity.cyclomatic}`), getComplexityRating(complexity.cyclomatic, 'cyclomatic'));
|
|
352
|
+
console.log(chalk.gray(` 衡量代码中独立路径的数量`));
|
|
353
|
+
console.log(chalk.yellow('\n认知复杂度 (Cognitive Complexity):'));
|
|
354
|
+
console.log(chalk.green(` ${complexity.cognitive}`), chalk.gray('(越低越好)'));
|
|
355
|
+
console.log(chalk.gray(` 衡量代码的理解难度`));
|
|
356
|
+
console.log(chalk.yellow('\n可维护性指数 (Maintainability):'));
|
|
357
|
+
console.log(chalk.green(` ${complexity.maintainability}`), getComplexityRating(complexity.maintainability, 'maintainability'));
|
|
358
|
+
console.log(chalk.gray(` 0-100,越高越易维护`));
|
|
359
|
+
console.log(chalk.yellow('\n统计信息:'));
|
|
360
|
+
console.log(chalk.gray(` 代码行数: ${complexity.lines}`));
|
|
361
|
+
console.log(chalk.gray(` 函数/方法: ${complexity.functions}`));
|
|
362
|
+
console.log(chalk.gray(` 类: ${complexity.classes}`));
|
|
363
|
+
// 显示函数级详情(当有详细数据时)
|
|
364
|
+
if (options.detail && complexity.functionDetails && complexity.functionDetails.length > 0) {
|
|
365
|
+
console.log(chalk.yellow('\n函数级复杂度详情:'));
|
|
366
|
+
console.log(chalk.gray('─'.repeat(50)));
|
|
367
|
+
// 按圈复杂度排序
|
|
368
|
+
const sortedFunctions = [...complexity.functionDetails].sort((a, b) => b.cyclomatic - a.cyclomatic);
|
|
369
|
+
for (const func of sortedFunctions) {
|
|
370
|
+
const complexityLevel = func.isHighComplexity
|
|
371
|
+
? chalk.red(' ⚠️ 高')
|
|
372
|
+
: chalk.green(' ✓');
|
|
373
|
+
console.log(chalk.cyan(`\n ${func.name} (${func.kind})`));
|
|
374
|
+
console.log(chalk.gray(` 行号: ${func.line}`));
|
|
375
|
+
console.log(chalk.gray(` 圈复杂度: ${func.cyclomatic} ${complexityLevel}`));
|
|
376
|
+
console.log(chalk.gray(` 认知复杂度: ${func.cognitive}`));
|
|
377
|
+
console.log(chalk.gray(` 嵌套深度: ${func.nestingDepth}`));
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
else {
|
|
382
|
+
// 输出所有文件的复杂度
|
|
383
|
+
console.log(chalk.cyan('\n📊 项目复杂度分析'));
|
|
384
|
+
console.log(chalk.gray('─'.repeat(50)));
|
|
385
|
+
// 按圈复杂度排序
|
|
386
|
+
const sorted = allComplexities.sort((a, b) => b.complexity.cyclomatic - a.complexity.cyclomatic);
|
|
387
|
+
console.log(chalk.yellow('\n🔥 复杂度最高的文件 (Top 15):'));
|
|
388
|
+
let rank = 1;
|
|
389
|
+
for (const { module, complexity } of sorted.slice(0, 15)) {
|
|
390
|
+
const relPath = path.relative(codeMap.project.rootDir, module.absolutePath);
|
|
391
|
+
const rating = getComplexityRating(complexity.cyclomatic, 'cyclomatic');
|
|
392
|
+
console.log(chalk.green(`\n ${rank}. ${relPath}`));
|
|
393
|
+
console.log(chalk.gray(` 圈复杂度: ${complexity.cyclomatic} ${rating}`));
|
|
394
|
+
console.log(chalk.gray(` 认知复杂度: ${complexity.cognitive}`));
|
|
395
|
+
console.log(chalk.gray(` 可维护性: ${complexity.maintainability} ${getComplexityRating(complexity.maintainability, 'maintainability')}`));
|
|
396
|
+
rank++;
|
|
397
|
+
}
|
|
398
|
+
// 统计摘要
|
|
399
|
+
const totalCyclomatic = allComplexities.reduce((sum, c) => sum + c.complexity.cyclomatic, 0);
|
|
400
|
+
const totalCognitive = allComplexities.reduce((sum, c) => sum + c.complexity.cognitive, 0);
|
|
401
|
+
const totalMaintainability = allComplexities.reduce((sum, c) => sum + c.complexity.maintainability, 0);
|
|
402
|
+
const avgCyclomatic = totalCyclomatic / codeMap.modules.length;
|
|
403
|
+
const avgCognitive = totalCognitive / codeMap.modules.length;
|
|
404
|
+
const avgMaintainability = totalMaintainability / codeMap.modules.length;
|
|
405
|
+
console.log(chalk.gray('\n─'.repeat(50)));
|
|
406
|
+
console.log(chalk.cyan('\n📈 项目统计:'));
|
|
407
|
+
console.log(chalk.gray(` 总文件数: ${codeMap.modules.length}`));
|
|
408
|
+
console.log(chalk.gray(` 平均圈复杂度: ${avgCyclomatic.toFixed(2)} ${getComplexityRating(avgCyclomatic, 'cyclomatic')}`));
|
|
409
|
+
console.log(chalk.gray(` 平均认知复杂度: ${avgCognitive.toFixed(2)}`));
|
|
410
|
+
console.log(chalk.gray(` 平均可维护性: ${avgMaintainability.toFixed(2)} ${getComplexityRating(avgMaintainability, 'maintainability')}`));
|
|
411
|
+
}
|
|
412
|
+
console.log('');
|
|
413
|
+
}
|
|
414
|
+
/**
|
|
415
|
+
* 加载代码地图数据(兼容旧函数,带控制台输出)
|
|
416
|
+
*/
|
|
417
|
+
function loadCodeMapWithOutput(rootDir) {
|
|
418
|
+
const codemapPath = resolveDataPath(rootDir);
|
|
419
|
+
if (!fs.existsSync(codemapPath)) {
|
|
420
|
+
console.log(chalk.red('❌ 代码地图不存在,请先运行 codemap generate'));
|
|
421
|
+
return null;
|
|
422
|
+
}
|
|
423
|
+
try {
|
|
424
|
+
const data = fs.readFileSync(codemapPath, 'utf-8');
|
|
425
|
+
return JSON.parse(data);
|
|
426
|
+
}
|
|
427
|
+
catch (error) {
|
|
428
|
+
console.log(chalk.red('❌ 读取代码地图失败:', error instanceof Error ? error.message : String(error)));
|
|
429
|
+
return null;
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
/**
|
|
433
|
+
* Complexity 命令实现(原有函数,保持兼容)
|
|
434
|
+
*/
|
|
435
|
+
export async function complexityCommand(options) {
|
|
436
|
+
const rootDir = process.cwd();
|
|
437
|
+
// 加载代码地图
|
|
438
|
+
const codeMap = loadCodeMapWithOutput(rootDir);
|
|
439
|
+
if (!codeMap) {
|
|
440
|
+
process.exit(1);
|
|
441
|
+
}
|
|
442
|
+
// 获取目标模块
|
|
443
|
+
let targetModule;
|
|
444
|
+
const allComplexities = [];
|
|
445
|
+
// 使用 AST 分析时,detail 选项自动启用
|
|
446
|
+
const useAST = options.detail || false;
|
|
447
|
+
if (options.file) {
|
|
448
|
+
targetModule = codeMap.modules.find(m => m.absolutePath.includes(options.file) ||
|
|
449
|
+
path.relative(codeMap.project.rootDir, m.absolutePath).includes(options.file));
|
|
450
|
+
if (!targetModule) {
|
|
451
|
+
console.log(chalk.red(`❌ 未找到文件: ${options.file}`));
|
|
452
|
+
process.exit(1);
|
|
453
|
+
}
|
|
454
|
+
// 如果使用 AST 分析,获取精确的函数级复杂度
|
|
455
|
+
if (useAST) {
|
|
456
|
+
const astComplexity = getModuleComplexityWithAST(targetModule);
|
|
457
|
+
allComplexities.push({
|
|
458
|
+
module: targetModule,
|
|
459
|
+
complexity: astComplexity
|
|
460
|
+
});
|
|
461
|
+
targetModule = undefined; // 使用 allComplexities 输出
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
else {
|
|
465
|
+
// 计算所有模块的复杂度
|
|
466
|
+
for (const module of codeMap.modules) {
|
|
467
|
+
const complexity = useAST
|
|
468
|
+
? getModuleComplexityWithAST(module)
|
|
469
|
+
: getModuleComplexity(module);
|
|
470
|
+
allComplexities.push({
|
|
471
|
+
module,
|
|
472
|
+
complexity
|
|
473
|
+
});
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
// 输出结果
|
|
477
|
+
formatComplexity(codeMap, targetModule, allComplexities, options);
|
|
478
|
+
}
|
|
479
|
+
//# sourceMappingURL=complexity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"complexity.js","sourceRoot":"","sources":["../../../src/cli/commands/complexity.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,mCAAmC;AAEnC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAG9C,OAAO,EAAE,qBAAqB,EAAsE,MAAM,uCAAuC,CAAC;AAyClJ,6BAA6B;AAE7B;;GAEG;AACH,SAAS,WAAW,CAAC,OAAe;IAClC,MAAM,WAAW,GAAG,eAAe,CAAC,OAAO,CAAC,CAAC;IAE7C,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,WAAW,CAAC,EAAE,CAAC;QAChC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,EAAE,CAAC,YAAY,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;QACnD,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAY,CAAC;IACrC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,C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