@optave/codegraph 2.6.0 → 3.0.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/README.md +109 -52
- package/package.json +5 -5
- package/src/ast.js +392 -0
- package/src/batch.js +93 -3
- package/src/builder.js +314 -95
- package/src/cfg.js +1451 -0
- package/src/change-journal.js +130 -0
- package/src/cli.js +411 -139
- package/src/complexity.js +8 -8
- package/src/dataflow.js +1187 -0
- package/src/db.js +96 -0
- package/src/embedder.js +16 -16
- package/src/export.js +305 -0
- package/src/extractors/csharp.js +64 -1
- package/src/extractors/go.js +66 -1
- package/src/extractors/hcl.js +22 -0
- package/src/extractors/java.js +61 -1
- package/src/extractors/javascript.js +142 -0
- package/src/extractors/php.js +79 -0
- package/src/extractors/python.js +134 -0
- package/src/extractors/ruby.js +89 -0
- package/src/extractors/rust.js +71 -1
- package/src/index.js +51 -3
- package/src/mcp.js +403 -222
- package/src/paginate.js +3 -3
- package/src/parser.js +8 -0
- package/src/queries.js +362 -36
- package/src/structure.js +4 -1
- package/src/viewer.js +948 -0
- package/src/watcher.js +36 -1
package/src/complexity.js
CHANGED
|
@@ -183,7 +183,7 @@ const CSHARP_RULES = {
|
|
|
183
183
|
'if_statement',
|
|
184
184
|
'else_clause',
|
|
185
185
|
'for_statement',
|
|
186
|
-
'
|
|
186
|
+
'foreach_statement',
|
|
187
187
|
'while_statement',
|
|
188
188
|
'do_statement',
|
|
189
189
|
'catch_clause',
|
|
@@ -197,7 +197,7 @@ const CSHARP_RULES = {
|
|
|
197
197
|
nestingNodes: new Set([
|
|
198
198
|
'if_statement',
|
|
199
199
|
'for_statement',
|
|
200
|
-
'
|
|
200
|
+
'foreach_statement',
|
|
201
201
|
'while_statement',
|
|
202
202
|
'do_statement',
|
|
203
203
|
'catch_clause',
|
|
@@ -211,9 +211,9 @@ const CSHARP_RULES = {
|
|
|
211
211
|
'local_function_statement',
|
|
212
212
|
]),
|
|
213
213
|
ifNodeType: 'if_statement',
|
|
214
|
-
elseNodeType:
|
|
214
|
+
elseNodeType: null,
|
|
215
215
|
elifNodeType: null,
|
|
216
|
-
elseViaAlternative:
|
|
216
|
+
elseViaAlternative: true,
|
|
217
217
|
switchLikeNodes: new Set(['switch_statement']),
|
|
218
218
|
};
|
|
219
219
|
|
|
@@ -291,7 +291,7 @@ export const COMPLEXITY_RULES = new Map([
|
|
|
291
291
|
['go', GO_RULES],
|
|
292
292
|
['rust', RUST_RULES],
|
|
293
293
|
['java', JAVA_RULES],
|
|
294
|
-
['
|
|
294
|
+
['csharp', CSHARP_RULES],
|
|
295
295
|
['ruby', RUBY_RULES],
|
|
296
296
|
['php', PHP_RULES],
|
|
297
297
|
]);
|
|
@@ -1026,7 +1026,7 @@ export const HALSTEAD_RULES = new Map([
|
|
|
1026
1026
|
['go', GO_HALSTEAD],
|
|
1027
1027
|
['rust', RUST_HALSTEAD],
|
|
1028
1028
|
['java', JAVA_HALSTEAD],
|
|
1029
|
-
['
|
|
1029
|
+
['csharp', CSHARP_HALSTEAD],
|
|
1030
1030
|
['ruby', RUBY_HALSTEAD],
|
|
1031
1031
|
['php', PHP_HALSTEAD],
|
|
1032
1032
|
]);
|
|
@@ -1116,7 +1116,7 @@ const COMMENT_PREFIXES = new Map([
|
|
|
1116
1116
|
['go', C_STYLE_PREFIXES],
|
|
1117
1117
|
['rust', C_STYLE_PREFIXES],
|
|
1118
1118
|
['java', C_STYLE_PREFIXES],
|
|
1119
|
-
['
|
|
1119
|
+
['csharp', C_STYLE_PREFIXES],
|
|
1120
1120
|
['python', ['#']],
|
|
1121
1121
|
['ruby', ['#']],
|
|
1122
1122
|
['php', ['//', '#', '/*', '*', '*/']],
|
|
@@ -1574,7 +1574,7 @@ export function computeAllMetrics(functionNode, langId) {
|
|
|
1574
1574
|
/**
|
|
1575
1575
|
* Find the function body node in a parse tree that matches a given line range.
|
|
1576
1576
|
*/
|
|
1577
|
-
function findFunctionNode(rootNode, startLine, _endLine, rules) {
|
|
1577
|
+
export function findFunctionNode(rootNode, startLine, _endLine, rules) {
|
|
1578
1578
|
// tree-sitter lines are 0-indexed
|
|
1579
1579
|
const targetStart = startLine - 1;
|
|
1580
1580
|
|