semantic-complexity 0.0.1-cedf2072
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/LICENSE +21 -0
- package/dist/ast/index.d.ts +2 -0
- package/dist/ast/index.d.ts.map +1 -0
- package/dist/ast/index.js +2 -0
- package/dist/ast/index.js.map +1 -0
- package/dist/ast/parser.d.ts +27 -0
- package/dist/ast/parser.d.ts.map +1 -0
- package/dist/ast/parser.js +273 -0
- package/dist/ast/parser.js.map +1 -0
- package/dist/compare.d.ts +31 -0
- package/dist/compare.d.ts.map +1 -0
- package/dist/compare.js +354 -0
- package/dist/compare.js.map +1 -0
- package/dist/context/index.d.ts +41 -0
- package/dist/context/index.d.ts.map +1 -0
- package/dist/context/index.js +253 -0
- package/dist/context/index.js.map +1 -0
- package/dist/graph/call.d.ts +63 -0
- package/dist/graph/call.d.ts.map +1 -0
- package/dist/graph/call.js +240 -0
- package/dist/graph/call.js.map +1 -0
- package/dist/graph/dependency.d.ts +52 -0
- package/dist/graph/dependency.d.ts.map +1 -0
- package/dist/graph/dependency.js +296 -0
- package/dist/graph/dependency.js.map +1 -0
- package/dist/graph/index.d.ts +3 -0
- package/dist/graph/index.d.ts.map +1 -0
- package/dist/graph/index.js +3 -0
- package/dist/graph/index.js.map +1 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +34 -0
- package/dist/index.js.map +1 -0
- package/dist/metrics/cognitive.d.ts +42 -0
- package/dist/metrics/cognitive.d.ts.map +1 -0
- package/dist/metrics/cognitive.js +204 -0
- package/dist/metrics/cognitive.js.map +1 -0
- package/dist/metrics/cyclomatic.d.ts +31 -0
- package/dist/metrics/cyclomatic.d.ts.map +1 -0
- package/dist/metrics/cyclomatic.js +121 -0
- package/dist/metrics/cyclomatic.js.map +1 -0
- package/dist/metrics/dimensional.d.ts +32 -0
- package/dist/metrics/dimensional.d.ts.map +1 -0
- package/dist/metrics/dimensional.js +560 -0
- package/dist/metrics/dimensional.js.map +1 -0
- package/dist/metrics/index.d.ts +26 -0
- package/dist/metrics/index.d.ts.map +1 -0
- package/dist/metrics/index.js +120 -0
- package/dist/metrics/index.js.map +1 -0
- package/dist/types.d.ts +341 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +22 -0
- package/dist/types.js.map +1 -0
- package/package.json +71 -0
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
import * as path from 'node:path';
|
|
2
|
+
import * as fs from 'node:fs';
|
|
3
|
+
import { parseSourceFile, extractImports } from '../ast/parser.js';
|
|
4
|
+
/**
|
|
5
|
+
* 의존성 그래프 빌더
|
|
6
|
+
*/
|
|
7
|
+
export class DependencyGraph {
|
|
8
|
+
nodes = new Map();
|
|
9
|
+
projectRoot;
|
|
10
|
+
constructor(projectRoot) {
|
|
11
|
+
this.projectRoot = path.resolve(projectRoot);
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* 프로젝트 루트 경로 반환
|
|
15
|
+
*/
|
|
16
|
+
getProjectRoot() {
|
|
17
|
+
return this.projectRoot;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* 파일의 의존성 분석
|
|
21
|
+
*/
|
|
22
|
+
analyzeFile(filePath, content) {
|
|
23
|
+
const absPath = path.resolve(filePath);
|
|
24
|
+
const normalizedPath = this.normalizePath(absPath);
|
|
25
|
+
// 이미 분석된 경우 캐시된 결과 반환
|
|
26
|
+
const existing = this.nodes.get(normalizedPath);
|
|
27
|
+
if (existing)
|
|
28
|
+
return existing;
|
|
29
|
+
// 파일 내용 읽기
|
|
30
|
+
const fileContent = content ?? this.readFile(absPath);
|
|
31
|
+
if (!fileContent) {
|
|
32
|
+
const node = {
|
|
33
|
+
filePath: normalizedPath,
|
|
34
|
+
imports: [],
|
|
35
|
+
importedBy: [],
|
|
36
|
+
depth: -1,
|
|
37
|
+
};
|
|
38
|
+
this.nodes.set(normalizedPath, node);
|
|
39
|
+
return node;
|
|
40
|
+
}
|
|
41
|
+
// 파싱 및 import 추출
|
|
42
|
+
const sourceFile = parseSourceFile(absPath, fileContent);
|
|
43
|
+
const imports = extractImports(sourceFile);
|
|
44
|
+
// import 경로 해석
|
|
45
|
+
const resolvedImports = imports
|
|
46
|
+
.map((imp) => this.resolveImportPath(absPath, imp.source))
|
|
47
|
+
.filter((p) => p !== null);
|
|
48
|
+
// 노드 생성
|
|
49
|
+
const node = {
|
|
50
|
+
filePath: normalizedPath,
|
|
51
|
+
imports: resolvedImports,
|
|
52
|
+
importedBy: [],
|
|
53
|
+
depth: 0,
|
|
54
|
+
};
|
|
55
|
+
this.nodes.set(normalizedPath, node);
|
|
56
|
+
// 역방향 참조 업데이트
|
|
57
|
+
for (const importPath of resolvedImports) {
|
|
58
|
+
const importNode = this.nodes.get(importPath);
|
|
59
|
+
if (importNode && !importNode.importedBy.includes(normalizedPath)) {
|
|
60
|
+
importNode.importedBy.push(normalizedPath);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return node;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* 디렉토리 내 모든 파일 분석
|
|
67
|
+
*/
|
|
68
|
+
analyzeDirectory(dirPath, extensions = ['.ts', '.tsx', '.js', '.jsx']) {
|
|
69
|
+
const files = this.findFiles(dirPath, extensions);
|
|
70
|
+
for (const file of files) {
|
|
71
|
+
this.analyzeFile(file);
|
|
72
|
+
}
|
|
73
|
+
// 모든 파일 분석 후 역방향 참조 재구성
|
|
74
|
+
this.rebuildReverseReferences();
|
|
75
|
+
// 깊이 계산
|
|
76
|
+
this.calculateDepths();
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* 특정 파일에서 시작하는 의존성 트리 구축
|
|
80
|
+
*/
|
|
81
|
+
buildDependencyTree(filePath, maxDepth = 5) {
|
|
82
|
+
const absPath = path.resolve(filePath);
|
|
83
|
+
const normalizedPath = this.normalizePath(absPath);
|
|
84
|
+
const visited = new Set();
|
|
85
|
+
const result = [];
|
|
86
|
+
const traverse = (nodePath, depth) => {
|
|
87
|
+
if (depth > maxDepth || visited.has(nodePath))
|
|
88
|
+
return;
|
|
89
|
+
visited.add(nodePath);
|
|
90
|
+
let node = this.nodes.get(nodePath);
|
|
91
|
+
if (!node) {
|
|
92
|
+
node = this.analyzeFile(nodePath);
|
|
93
|
+
}
|
|
94
|
+
const nodeWithDepth = { ...node, depth };
|
|
95
|
+
result.push(nodeWithDepth);
|
|
96
|
+
for (const importPath of node.imports) {
|
|
97
|
+
traverse(importPath, depth + 1);
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
traverse(normalizedPath, 0);
|
|
101
|
+
return result;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* 특정 파일을 참조하는 파일들 찾기
|
|
105
|
+
*/
|
|
106
|
+
findDependents(filePath, maxDepth = 5) {
|
|
107
|
+
const absPath = path.resolve(filePath);
|
|
108
|
+
const normalizedPath = this.normalizePath(absPath);
|
|
109
|
+
const visited = new Set();
|
|
110
|
+
const result = [];
|
|
111
|
+
const traverse = (nodePath, depth) => {
|
|
112
|
+
if (depth > maxDepth || visited.has(nodePath))
|
|
113
|
+
return;
|
|
114
|
+
visited.add(nodePath);
|
|
115
|
+
const node = this.nodes.get(nodePath);
|
|
116
|
+
if (!node)
|
|
117
|
+
return;
|
|
118
|
+
const nodeWithDepth = { ...node, depth };
|
|
119
|
+
result.push(nodeWithDepth);
|
|
120
|
+
for (const dependentPath of node.importedBy) {
|
|
121
|
+
traverse(dependentPath, depth + 1);
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
traverse(normalizedPath, 0);
|
|
125
|
+
return result;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* 노드 조회
|
|
129
|
+
*/
|
|
130
|
+
getNode(filePath) {
|
|
131
|
+
const normalizedPath = this.normalizePath(path.resolve(filePath));
|
|
132
|
+
return this.nodes.get(normalizedPath);
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* 모든 노드 반환
|
|
136
|
+
*/
|
|
137
|
+
getAllNodes() {
|
|
138
|
+
return Array.from(this.nodes.values());
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* 순환 의존성 탐지
|
|
142
|
+
*/
|
|
143
|
+
findCircularDependencies() {
|
|
144
|
+
const cycles = [];
|
|
145
|
+
const visited = new Set();
|
|
146
|
+
const recursionStack = new Set();
|
|
147
|
+
const dfs = (nodePath, path) => {
|
|
148
|
+
visited.add(nodePath);
|
|
149
|
+
recursionStack.add(nodePath);
|
|
150
|
+
const node = this.nodes.get(nodePath);
|
|
151
|
+
if (!node)
|
|
152
|
+
return false;
|
|
153
|
+
for (const importPath of node.imports) {
|
|
154
|
+
if (!visited.has(importPath)) {
|
|
155
|
+
if (dfs(importPath, [...path, importPath])) {
|
|
156
|
+
return true;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
else if (recursionStack.has(importPath)) {
|
|
160
|
+
// 순환 발견
|
|
161
|
+
const cycleStart = path.indexOf(importPath);
|
|
162
|
+
if (cycleStart >= 0) {
|
|
163
|
+
cycles.push([...path.slice(cycleStart), importPath]);
|
|
164
|
+
}
|
|
165
|
+
else {
|
|
166
|
+
cycles.push([...path, importPath]);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
recursionStack.delete(nodePath);
|
|
171
|
+
return false;
|
|
172
|
+
};
|
|
173
|
+
for (const nodePath of this.nodes.keys()) {
|
|
174
|
+
if (!visited.has(nodePath)) {
|
|
175
|
+
dfs(nodePath, [nodePath]);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
return cycles;
|
|
179
|
+
}
|
|
180
|
+
// ─── Private Methods ───────────────────────────────────────────
|
|
181
|
+
normalizePath(filePath) {
|
|
182
|
+
return filePath.replace(/\\/g, '/');
|
|
183
|
+
}
|
|
184
|
+
readFile(filePath) {
|
|
185
|
+
try {
|
|
186
|
+
return fs.readFileSync(filePath, 'utf-8');
|
|
187
|
+
}
|
|
188
|
+
catch {
|
|
189
|
+
return null;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
resolveImportPath(fromFile, importSource) {
|
|
193
|
+
// 상대 경로만 처리 (node_modules 제외)
|
|
194
|
+
if (!importSource.startsWith('.')) {
|
|
195
|
+
return null;
|
|
196
|
+
}
|
|
197
|
+
const fromDir = path.dirname(fromFile);
|
|
198
|
+
const resolved = path.resolve(fromDir, importSource);
|
|
199
|
+
// 확장자가 없으면 추가
|
|
200
|
+
const extensions = ['.ts', '.tsx', '.js', '.jsx', '/index.ts', '/index.tsx', '/index.js', '/index.jsx'];
|
|
201
|
+
for (const ext of extensions) {
|
|
202
|
+
const candidate = resolved + ext;
|
|
203
|
+
if (fs.existsSync(candidate)) {
|
|
204
|
+
return this.normalizePath(candidate);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
// 이미 확장자가 있는 경우
|
|
208
|
+
if (fs.existsSync(resolved)) {
|
|
209
|
+
return this.normalizePath(resolved);
|
|
210
|
+
}
|
|
211
|
+
return null;
|
|
212
|
+
}
|
|
213
|
+
findFiles(dirPath, extensions) {
|
|
214
|
+
const files = [];
|
|
215
|
+
const traverse = (dir) => {
|
|
216
|
+
try {
|
|
217
|
+
const entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
218
|
+
for (const entry of entries) {
|
|
219
|
+
const fullPath = path.join(dir, entry.name);
|
|
220
|
+
// node_modules 등 제외
|
|
221
|
+
if (entry.name.startsWith('.') || entry.name === 'node_modules' || entry.name === 'dist') {
|
|
222
|
+
continue;
|
|
223
|
+
}
|
|
224
|
+
if (entry.isDirectory()) {
|
|
225
|
+
traverse(fullPath);
|
|
226
|
+
}
|
|
227
|
+
else if (extensions.some((ext) => entry.name.endsWith(ext))) {
|
|
228
|
+
files.push(fullPath);
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
catch {
|
|
233
|
+
// 접근 불가 디렉토리 무시
|
|
234
|
+
}
|
|
235
|
+
};
|
|
236
|
+
traverse(dirPath);
|
|
237
|
+
return files;
|
|
238
|
+
}
|
|
239
|
+
rebuildReverseReferences() {
|
|
240
|
+
// 기존 역참조 초기화
|
|
241
|
+
for (const node of this.nodes.values()) {
|
|
242
|
+
node.importedBy = [];
|
|
243
|
+
}
|
|
244
|
+
// 역참조 재구성
|
|
245
|
+
for (const node of this.nodes.values()) {
|
|
246
|
+
for (const importPath of node.imports) {
|
|
247
|
+
const importNode = this.nodes.get(importPath);
|
|
248
|
+
if (importNode && !importNode.importedBy.includes(node.filePath)) {
|
|
249
|
+
importNode.importedBy.push(node.filePath);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
calculateDepths() {
|
|
255
|
+
// 루트 노드 찾기 (참조되지 않는 노드)
|
|
256
|
+
const roots = Array.from(this.nodes.values()).filter((node) => node.importedBy.length === 0);
|
|
257
|
+
// BFS로 깊이 계산
|
|
258
|
+
const visited = new Set();
|
|
259
|
+
const queue = roots.map((r) => ({
|
|
260
|
+
path: r.filePath,
|
|
261
|
+
depth: 0,
|
|
262
|
+
}));
|
|
263
|
+
while (queue.length > 0) {
|
|
264
|
+
const { path: nodePath, depth } = queue.shift();
|
|
265
|
+
if (visited.has(nodePath))
|
|
266
|
+
continue;
|
|
267
|
+
visited.add(nodePath);
|
|
268
|
+
const node = this.nodes.get(nodePath);
|
|
269
|
+
if (!node)
|
|
270
|
+
continue;
|
|
271
|
+
node.depth = depth;
|
|
272
|
+
for (const importPath of node.imports) {
|
|
273
|
+
if (!visited.has(importPath)) {
|
|
274
|
+
queue.push({ path: importPath, depth: depth + 1 });
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* 의존성 그래프를 DOT 형식으로 출력 (시각화용)
|
|
282
|
+
*/
|
|
283
|
+
export function exportToDot(graph) {
|
|
284
|
+
const lines = ['digraph DependencyGraph {', ' rankdir=TB;'];
|
|
285
|
+
for (const node of graph.getAllNodes()) {
|
|
286
|
+
const shortName = path.basename(node.filePath);
|
|
287
|
+
lines.push(` "${shortName}" [label="${shortName}"];`);
|
|
288
|
+
for (const importPath of node.imports) {
|
|
289
|
+
const importName = path.basename(importPath);
|
|
290
|
+
lines.push(` "${shortName}" -> "${importName}";`);
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
lines.push('}');
|
|
294
|
+
return lines.join('\n');
|
|
295
|
+
}
|
|
296
|
+
//# sourceMappingURL=dependency.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dependency.js","sourceRoot":"","sources":["../../src/graph/dependency.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAE9B,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEnE;;GAEG;AACH,MAAM,OAAO,eAAe;IAClB,KAAK,GAAgC,IAAI,GAAG,EAAE,CAAC;IAC/C,WAAW,CAAS;IAE5B,YAAY,WAAmB;QAC7B,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;IAC/C,CAAC;IAED;;OAEG;IACH,cAAc;QACZ,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;IAED;;OAEG;IACH,WAAW,CAAC,QAAgB,EAAE,OAAgB;QAC5C,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;QACvC,MAAM,cAAc,GAAG,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;QAEnD,sBAAsB;QACtB,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;QAChD,IAAI,QAAQ;YAAE,OAAO,QAAQ,CAAC;QAE9B,WAAW;QACX,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,MAAM,UAAU,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YACtC,MAAM,UAAU,GAAG,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;YAC7C,KAAK,CAAC,IAAI,CAAC,MAAM,SAAS,SAAS,UAAU,IAAI,CAAC,CAAC;QACrD,CAAC;IACH,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAChB,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/graph/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC/D,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/graph/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC/D,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @nxt/complexity - AI-powered cognitive complexity analysis
|
|
3
|
+
*
|
|
4
|
+
* Core 엔진 모듈
|
|
5
|
+
*/
|
|
6
|
+
export type { SourceLocation, FunctionInfo, ParameterInfo, ComplexityResult, ComplexityDetail, ComplexityContributor, FileAnalysisResult, ImportInfo, ImportSpecifier, ExportInfo, DependencyNode, CallNode, CallEdge, AnalysisContext, ProjectInfo, AnalysisOptions, DimensionalComplexity, DimensionalWeights, ExtendedComplexityResult, } from './types.js';
|
|
7
|
+
export { DEFAULT_OPTIONS } from './types.js';
|
|
8
|
+
export { parseSourceFile, getSourceLocation, extractFunctionInfo, extractAllFunctions, extractImports, extractExports, } from './ast/index.js';
|
|
9
|
+
export { calculateCyclomaticComplexity, calculateCognitiveComplexity, analyzeFunction, analyzeFunctionExtended, analyzeFile, getComplexityGrade, generateComplexitySummary, } from './metrics/index.js';
|
|
10
|
+
export { DependencyGraph, CallGraph, exportToDot, exportToMermaid, } from './graph/index.js';
|
|
11
|
+
export { ContextCollector, quickAnalyze } from './context/index.js';
|
|
12
|
+
import type { FileAnalysisResult } from './types.js';
|
|
13
|
+
/**
|
|
14
|
+
* 파일 경로로 복잡도 분석
|
|
15
|
+
*/
|
|
16
|
+
export declare function analyzeFilePath(filePath: string): FileAnalysisResult;
|
|
17
|
+
/**
|
|
18
|
+
* 소스 코드 문자열로 복잡도 분석
|
|
19
|
+
*/
|
|
20
|
+
export declare function analyzeSource(source: string, fileName?: string): FileAnalysisResult;
|
|
21
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,YAAY,EACV,cAAc,EACd,YAAY,EACZ,aAAa,EACb,gBAAgB,EAChB,gBAAgB,EAChB,qBAAqB,EACrB,kBAAkB,EAClB,UAAU,EACV,eAAe,EACf,UAAU,EACV,cAAc,EACd,QAAQ,EACR,QAAQ,EACR,eAAe,EACf,WAAW,EACX,eAAe,EAEf,qBAAqB,EACrB,kBAAkB,EAClB,wBAAwB,GACzB,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAG7C,OAAO,EACL,eAAe,EACf,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,EACnB,cAAc,EACd,cAAc,GACf,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EACL,6BAA6B,EAC7B,4BAA4B,EAC5B,eAAe,EACf,uBAAuB,EACvB,WAAW,EACX,kBAAkB,EAClB,yBAAyB,GAC1B,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EACL,eAAe,EACf,SAAS,EACT,WAAW,EACX,eAAe,GAChB,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAOpE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAErD;;GAEG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,kBAAkB,CAIpE;AAED;;GAEG;AACH,wBAAgB,aAAa,CAC3B,MAAM,EAAE,MAAM,EACd,QAAQ,SAAa,GACpB,kBAAkB,CAGpB"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @nxt/complexity - AI-powered cognitive complexity analysis
|
|
3
|
+
*
|
|
4
|
+
* Core 엔진 모듈
|
|
5
|
+
*/
|
|
6
|
+
export { DEFAULT_OPTIONS } from './types.js';
|
|
7
|
+
// AST
|
|
8
|
+
export { parseSourceFile, getSourceLocation, extractFunctionInfo, extractAllFunctions, extractImports, extractExports, } from './ast/index.js';
|
|
9
|
+
// Metrics
|
|
10
|
+
export { calculateCyclomaticComplexity, calculateCognitiveComplexity, analyzeFunction, analyzeFunctionExtended, analyzeFile, getComplexityGrade, generateComplexitySummary, } from './metrics/index.js';
|
|
11
|
+
// Graph
|
|
12
|
+
export { DependencyGraph, CallGraph, exportToDot, exportToMermaid, } from './graph/index.js';
|
|
13
|
+
// Context
|
|
14
|
+
export { ContextCollector, quickAnalyze } from './context/index.js';
|
|
15
|
+
// ─── Convenience Functions ───────────────────────────────────────
|
|
16
|
+
import * as fs from 'node:fs';
|
|
17
|
+
import { parseSourceFile } from './ast/index.js';
|
|
18
|
+
import { analyzeFile } from './metrics/index.js';
|
|
19
|
+
/**
|
|
20
|
+
* 파일 경로로 복잡도 분석
|
|
21
|
+
*/
|
|
22
|
+
export function analyzeFilePath(filePath) {
|
|
23
|
+
const content = fs.readFileSync(filePath, 'utf-8');
|
|
24
|
+
const sourceFile = parseSourceFile(filePath, content);
|
|
25
|
+
return analyzeFile(sourceFile);
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* 소스 코드 문자열로 복잡도 분석
|
|
29
|
+
*/
|
|
30
|
+
export function analyzeSource(source, fileName = 'input.ts') {
|
|
31
|
+
const sourceFile = parseSourceFile(fileName, source);
|
|
32
|
+
return analyzeFile(sourceFile);
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AA0BH,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAE7C,MAAM;AACN,OAAO,EACL,eAAe,EACf,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,EACnB,cAAc,EACd,cAAc,GACf,MAAM,gBAAgB,CAAC;AAExB,UAAU;AACV,OAAO,EACL,6BAA6B,EAC7B,4BAA4B,EAC5B,eAAe,EACf,uBAAuB,EACvB,WAAW,EACX,kBAAkB,EAClB,yBAAyB,GAC1B,MAAM,oBAAoB,CAAC;AAE5B,QAAQ;AACR,OAAO,EACL,eAAe,EACf,SAAS,EACT,WAAW,EACX,eAAe,GAChB,MAAM,kBAAkB,CAAC;AAE1B,UAAU;AACV,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEpE,oEAAoE;AAEpE,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAGjD;;GAEG;AACH,MAAM,UAAU,eAAe,CAAC,QAAgB;IAC9C,MAAM,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IACnD,MAAM,UAAU,GAAG,eAAe,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IACtD,OAAO,WAAW,CAAC,UAAU,CAAC,CAAC;AACjC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,aAAa,CAC3B,MAAc,EACd,QAAQ,GAAG,UAAU;IAErB,MAAM,UAAU,GAAG,eAAe,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IACrD,OAAO,WAAW,CAAC,UAAU,CAAC,CAAC;AACjC,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import ts from 'typescript';
|
|
2
|
+
import type { ComplexityResult, ComplexityDetail, FunctionInfo } from '../types.js';
|
|
3
|
+
/**
|
|
4
|
+
* SonarSource 인지복잡도 계산
|
|
5
|
+
*
|
|
6
|
+
* 기본 원칙:
|
|
7
|
+
* 1. 중첩은 복잡성을 증가시킨다 (nesting penalty)
|
|
8
|
+
* 2. 선형 흐름 중단은 복잡성을 증가시킨다 (structural increment)
|
|
9
|
+
* 3. 일부 구조는 "하이브리드" (둘 다 적용)
|
|
10
|
+
*
|
|
11
|
+
* Structural Increment (+1):
|
|
12
|
+
* - if, else if, else
|
|
13
|
+
* - switch
|
|
14
|
+
* - for, for-in, for-of, while, do-while
|
|
15
|
+
* - catch
|
|
16
|
+
* - goto (JS/TS에서는 labeled break/continue)
|
|
17
|
+
* - 재귀 호출
|
|
18
|
+
* - 중첩 함수
|
|
19
|
+
*
|
|
20
|
+
* Nesting Penalty (+nesting level):
|
|
21
|
+
* - if, else if, else (중첩 시)
|
|
22
|
+
* - switch (중첩 시)
|
|
23
|
+
* - for, for-in, for-of, while, do-while (중첩 시)
|
|
24
|
+
* - catch (중첩 시)
|
|
25
|
+
* - 삼항 연산자 (중첩 시)
|
|
26
|
+
* - 중첩 함수
|
|
27
|
+
*
|
|
28
|
+
* 참고: 순환복잡도와 달리 &&, ||, ??는 시퀀스가 아닌 경우에만 카운트
|
|
29
|
+
*/
|
|
30
|
+
export declare function calculateCognitiveComplexity(node: ts.Node, sourceFile: ts.SourceFile, currentFunctionName?: string): {
|
|
31
|
+
complexity: number;
|
|
32
|
+
details: ComplexityDetail[];
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* 함수 노드에서 인지복잡도 계산
|
|
36
|
+
*/
|
|
37
|
+
export declare function analyzeFunctionCognitive(functionNode: ts.Node, sourceFile: ts.SourceFile, functionInfo: FunctionInfo): ComplexityResult;
|
|
38
|
+
/**
|
|
39
|
+
* 소스 파일의 모든 함수에 대한 인지복잡도 계산
|
|
40
|
+
*/
|
|
41
|
+
export declare function analyzeFileCognitive(sourceFile: ts.SourceFile): ComplexityResult[];
|
|
42
|
+
//# sourceMappingURL=cognitive.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cognitive.d.ts","sourceRoot":"","sources":["../../src/metrics/cognitive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,KAAK,EACV,gBAAgB,EAChB,gBAAgB,EAEhB,YAAY,EACb,MAAM,aAAa,CAAC;AAGrB;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,4BAA4B,CAC1C,IAAI,EAAE,EAAE,CAAC,IAAI,EACb,UAAU,EAAE,EAAE,CAAC,UAAU,EACzB,mBAAmB,CAAC,EAAE,MAAM,GAC3B;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,gBAAgB,EAAE,CAAA;CAAE,CA6KrD;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CACtC,YAAY,EAAE,EAAE,CAAC,IAAI,EACrB,UAAU,EAAE,EAAE,CAAC,UAAU,EACzB,YAAY,EAAE,YAAY,GACzB,gBAAgB,CAalB;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,UAAU,EAAE,EAAE,CAAC,UAAU,GACxB,gBAAgB,EAAE,CAwBpB"}
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
import ts from 'typescript';
|
|
2
|
+
import { getSourceLocation, extractFunctionInfo } from '../ast/parser.js';
|
|
3
|
+
/**
|
|
4
|
+
* SonarSource 인지복잡도 계산
|
|
5
|
+
*
|
|
6
|
+
* 기본 원칙:
|
|
7
|
+
* 1. 중첩은 복잡성을 증가시킨다 (nesting penalty)
|
|
8
|
+
* 2. 선형 흐름 중단은 복잡성을 증가시킨다 (structural increment)
|
|
9
|
+
* 3. 일부 구조는 "하이브리드" (둘 다 적용)
|
|
10
|
+
*
|
|
11
|
+
* Structural Increment (+1):
|
|
12
|
+
* - if, else if, else
|
|
13
|
+
* - switch
|
|
14
|
+
* - for, for-in, for-of, while, do-while
|
|
15
|
+
* - catch
|
|
16
|
+
* - goto (JS/TS에서는 labeled break/continue)
|
|
17
|
+
* - 재귀 호출
|
|
18
|
+
* - 중첩 함수
|
|
19
|
+
*
|
|
20
|
+
* Nesting Penalty (+nesting level):
|
|
21
|
+
* - if, else if, else (중첩 시)
|
|
22
|
+
* - switch (중첩 시)
|
|
23
|
+
* - for, for-in, for-of, while, do-while (중첩 시)
|
|
24
|
+
* - catch (중첩 시)
|
|
25
|
+
* - 삼항 연산자 (중첩 시)
|
|
26
|
+
* - 중첩 함수
|
|
27
|
+
*
|
|
28
|
+
* 참고: 순환복잡도와 달리 &&, ||, ??는 시퀀스가 아닌 경우에만 카운트
|
|
29
|
+
*/
|
|
30
|
+
export function calculateCognitiveComplexity(node, sourceFile, currentFunctionName) {
|
|
31
|
+
let complexity = 0;
|
|
32
|
+
const details = [];
|
|
33
|
+
function addDetail(node, type, increment, nestingLevel, description) {
|
|
34
|
+
const totalIncrement = increment + nestingLevel;
|
|
35
|
+
details.push({
|
|
36
|
+
type,
|
|
37
|
+
location: getSourceLocation(node, sourceFile),
|
|
38
|
+
increment: totalIncrement,
|
|
39
|
+
nestingLevel,
|
|
40
|
+
description: `${description} (+${increment}${nestingLevel > 0 ? ` +${nestingLevel} nesting` : ''})`,
|
|
41
|
+
});
|
|
42
|
+
complexity += totalIncrement;
|
|
43
|
+
}
|
|
44
|
+
function visit(node, nestingLevel, inLogicalSequence) {
|
|
45
|
+
switch (node.kind) {
|
|
46
|
+
case ts.SyntaxKind.IfStatement: {
|
|
47
|
+
const ifStmt = node;
|
|
48
|
+
// if 또는 else if
|
|
49
|
+
const parent = node.parent;
|
|
50
|
+
const isElseIf = parent &&
|
|
51
|
+
ts.isIfStatement(parent) &&
|
|
52
|
+
parent.elseStatement === node;
|
|
53
|
+
if (isElseIf) {
|
|
54
|
+
addDetail(node, 'else-if', 1, 0, 'else if'); // else if는 nesting penalty 없음
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
addDetail(node, 'if', 1, nestingLevel, 'if 조건문');
|
|
58
|
+
}
|
|
59
|
+
// then 브랜치
|
|
60
|
+
visit(ifStmt.thenStatement, nestingLevel + 1, false);
|
|
61
|
+
// else 브랜치
|
|
62
|
+
if (ifStmt.elseStatement) {
|
|
63
|
+
if (ts.isIfStatement(ifStmt.elseStatement)) {
|
|
64
|
+
// else if는 nesting 증가 없이 순회
|
|
65
|
+
visit(ifStmt.elseStatement, nestingLevel, false);
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
addDetail(ifStmt.elseStatement, 'else', 1, 0, 'else');
|
|
69
|
+
visit(ifStmt.elseStatement, nestingLevel + 1, false);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return; // 자식 노드 이미 처리함
|
|
73
|
+
}
|
|
74
|
+
case ts.SyntaxKind.SwitchStatement:
|
|
75
|
+
addDetail(node, 'switch', 1, nestingLevel, 'switch 문');
|
|
76
|
+
ts.forEachChild(node, (child) => visit(child, nestingLevel + 1, false));
|
|
77
|
+
return;
|
|
78
|
+
case ts.SyntaxKind.ForStatement:
|
|
79
|
+
addDetail(node, 'for', 1, nestingLevel, 'for 반복문');
|
|
80
|
+
ts.forEachChild(node, (child) => visit(child, nestingLevel + 1, false));
|
|
81
|
+
return;
|
|
82
|
+
case ts.SyntaxKind.ForInStatement:
|
|
83
|
+
addDetail(node, 'for-in', 1, nestingLevel, 'for-in 반복문');
|
|
84
|
+
ts.forEachChild(node, (child) => visit(child, nestingLevel + 1, false));
|
|
85
|
+
return;
|
|
86
|
+
case ts.SyntaxKind.ForOfStatement:
|
|
87
|
+
addDetail(node, 'for-of', 1, nestingLevel, 'for-of 반복문');
|
|
88
|
+
ts.forEachChild(node, (child) => visit(child, nestingLevel + 1, false));
|
|
89
|
+
return;
|
|
90
|
+
case ts.SyntaxKind.WhileStatement:
|
|
91
|
+
addDetail(node, 'while', 1, nestingLevel, 'while 반복문');
|
|
92
|
+
ts.forEachChild(node, (child) => visit(child, nestingLevel + 1, false));
|
|
93
|
+
return;
|
|
94
|
+
case ts.SyntaxKind.DoStatement:
|
|
95
|
+
addDetail(node, 'do-while', 1, nestingLevel, 'do-while 반복문');
|
|
96
|
+
ts.forEachChild(node, (child) => visit(child, nestingLevel + 1, false));
|
|
97
|
+
return;
|
|
98
|
+
case ts.SyntaxKind.CatchClause:
|
|
99
|
+
addDetail(node, 'catch', 1, nestingLevel, 'catch 예외 처리');
|
|
100
|
+
ts.forEachChild(node, (child) => visit(child, nestingLevel + 1, false));
|
|
101
|
+
return;
|
|
102
|
+
case ts.SyntaxKind.ConditionalExpression:
|
|
103
|
+
addDetail(node, 'conditional', 1, nestingLevel, '삼항 연산자');
|
|
104
|
+
ts.forEachChild(node, (child) => visit(child, nestingLevel + 1, false));
|
|
105
|
+
return;
|
|
106
|
+
case ts.SyntaxKind.BinaryExpression: {
|
|
107
|
+
const binary = node;
|
|
108
|
+
const op = binary.operatorToken.kind;
|
|
109
|
+
// 논리 연산자 시퀀스 처리
|
|
110
|
+
// a && b && c 는 +1 (시퀀스)
|
|
111
|
+
// a && b || c 는 +2 (다른 연산자)
|
|
112
|
+
const isLogical = op === ts.SyntaxKind.AmpersandAmpersandToken ||
|
|
113
|
+
op === ts.SyntaxKind.BarBarToken ||
|
|
114
|
+
op === ts.SyntaxKind.QuestionQuestionToken;
|
|
115
|
+
if (isLogical) {
|
|
116
|
+
const parentBinary = node.parent;
|
|
117
|
+
const isContinuingSequence = inLogicalSequence &&
|
|
118
|
+
ts.isBinaryExpression(parentBinary) &&
|
|
119
|
+
parentBinary.operatorToken.kind === op;
|
|
120
|
+
if (!isContinuingSequence) {
|
|
121
|
+
const type = op === ts.SyntaxKind.AmpersandAmpersandToken
|
|
122
|
+
? 'logical-and'
|
|
123
|
+
: op === ts.SyntaxKind.BarBarToken
|
|
124
|
+
? 'logical-or'
|
|
125
|
+
: 'nullish-coalescing';
|
|
126
|
+
const desc = op === ts.SyntaxKind.AmpersandAmpersandToken
|
|
127
|
+
? '논리 AND 시퀀스'
|
|
128
|
+
: op === ts.SyntaxKind.BarBarToken
|
|
129
|
+
? '논리 OR 시퀀스'
|
|
130
|
+
: 'Nullish coalescing 시퀀스';
|
|
131
|
+
addDetail(node, type, 1, 0, desc);
|
|
132
|
+
}
|
|
133
|
+
visit(binary.left, nestingLevel, true);
|
|
134
|
+
visit(binary.right, nestingLevel, true);
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
break;
|
|
138
|
+
}
|
|
139
|
+
case ts.SyntaxKind.FunctionDeclaration:
|
|
140
|
+
case ts.SyntaxKind.FunctionExpression:
|
|
141
|
+
case ts.SyntaxKind.ArrowFunction: {
|
|
142
|
+
// 중첩 함수 (콜백)
|
|
143
|
+
if (nestingLevel > 0) {
|
|
144
|
+
addDetail(node, 'nested-function', 1, nestingLevel, '중첩 함수/콜백');
|
|
145
|
+
}
|
|
146
|
+
// 중첩 함수 내부는 새로운 nesting 시작
|
|
147
|
+
ts.forEachChild(node, (child) => visit(child, nestingLevel + 1, false));
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
case ts.SyntaxKind.CallExpression: {
|
|
151
|
+
// 재귀 호출 감지
|
|
152
|
+
const call = node;
|
|
153
|
+
if (currentFunctionName &&
|
|
154
|
+
ts.isIdentifier(call.expression) &&
|
|
155
|
+
call.expression.text === currentFunctionName) {
|
|
156
|
+
addDetail(node, 'recursion', 1, 0, '재귀 호출');
|
|
157
|
+
}
|
|
158
|
+
break;
|
|
159
|
+
}
|
|
160
|
+
default:
|
|
161
|
+
break;
|
|
162
|
+
}
|
|
163
|
+
ts.forEachChild(node, (child) => visit(child, nestingLevel, inLogicalSequence));
|
|
164
|
+
}
|
|
165
|
+
visit(node, 0, false);
|
|
166
|
+
return { complexity, details };
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* 함수 노드에서 인지복잡도 계산
|
|
170
|
+
*/
|
|
171
|
+
export function analyzeFunctionCognitive(functionNode, sourceFile, functionInfo) {
|
|
172
|
+
const { complexity, details } = calculateCognitiveComplexity(functionNode, sourceFile, functionInfo.name !== '<anonymous>' ? functionInfo.name : undefined);
|
|
173
|
+
return {
|
|
174
|
+
function: functionInfo,
|
|
175
|
+
cyclomatic: 0, // cyclomatic.ts에서 별도 계산
|
|
176
|
+
cognitive: complexity,
|
|
177
|
+
details,
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* 소스 파일의 모든 함수에 대한 인지복잡도 계산
|
|
182
|
+
*/
|
|
183
|
+
export function analyzeFileCognitive(sourceFile) {
|
|
184
|
+
const results = [];
|
|
185
|
+
function visit(node, className) {
|
|
186
|
+
// 클래스 처리
|
|
187
|
+
if (ts.isClassDeclaration(node) || ts.isClassExpression(node)) {
|
|
188
|
+
const name = node.name?.getText(sourceFile) ?? '<anonymous>';
|
|
189
|
+
node.members.forEach((member) => visit(member, name));
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
// 함수 노드 확인
|
|
193
|
+
const functionInfo = extractFunctionInfo(node, sourceFile, className);
|
|
194
|
+
if (functionInfo) {
|
|
195
|
+
const result = analyzeFunctionCognitive(node, sourceFile, functionInfo);
|
|
196
|
+
results.push(result);
|
|
197
|
+
}
|
|
198
|
+
// 자식 노드 순회 - 중첩 함수는 별도로 분석하지 않음 (상위 함수에 포함)
|
|
199
|
+
// 최상위 레벨 함수만 독립적으로 분석
|
|
200
|
+
}
|
|
201
|
+
ts.forEachChild(sourceFile, (node) => visit(node));
|
|
202
|
+
return results;
|
|
203
|
+
}
|
|
204
|
+
//# sourceMappingURL=cognitive.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cognitive.js","sourceRoot":"","sources":["../../src/metrics/cognitive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAO5B,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAE1E;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,UAAU,4BAA4B,CAC1C,IAAa,EACb,UAAyB,EACzB,mBAA4B;IAE5B,IAAI,UAAU,GAAG,CAAC,CAAC;IACnB,MAAM,OAAO,GAAuB,EAAE,CAAC;IAEvC,SAAS,SAAS,CAChB,IAAa,EACb,IAA2B,EAC3B,SAAiB,EACjB,YAAoB,EACpB,WAAmB;QAEnB,MAAM,cAAc,GAAG,SAAS,GAAG,YAAY,CAAC;QAChD,OAAO,CAAC,IAAI,CAAC;YACX,IAAI;YACJ,QAAQ,EAAE,iBAAiB,CAAC,IAAI,EAAE,UAAU,CAAC;YAC7C,SAAS,EAAE,cAAc;YACzB,YAAY;YACZ,WAAW,EAAE,GAAG,WAAW,MAAM,SAAS,GAAG,YAAY,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,YAAY,UAAU,CAAC,CAAC,CAAC,EAAE,GAAG;SACpG,CAAC,CAAC;QACH,UAAU,IAAI,cAAc,CAAC;IAC/B,CAAC;IAED,SAAS,KAAK,CAAC,IAAa,EAAE,YAAoB,EAAE,iBAA0B;QAC5E,QAAQ,IAAI,CAAC,IAAI,EAAE,CAAC;YAClB,KAAK,EAAE,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,CAAC;gBAC/B,MAAM,MAAM,GAAG,IAAsB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