@eagleoutice/flowr 2.10.10 → 2.11.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 +37 -29
- package/cli/common/options.d.ts +2 -108
- package/cli/common/options.js +3 -27
- package/cli/common/scripts-info.d.ts +2 -123
- package/cli/common/scripts-info.js +0 -17
- package/cli/flowr-main-options.d.ts +5 -0
- package/cli/flowr-main-options.js +10 -0
- package/cli/flowr.js +1 -1
- package/cli/repl/print-version.d.ts +3 -1
- package/cli/repl/print-version.js +21 -2
- package/cli/repl/server/connection.d.ts +2 -0
- package/cli/repl/server/connection.js +40 -31
- package/cli/script-core/summarizer-core.js +13 -32
- package/cli/wiki.d.ts +2 -1
- package/cli/wiki.js +2 -0
- package/config.d.ts +13 -0
- package/config.js +8 -0
- package/control-flow/semantic-cfg-guided-visitor.js +1 -0
- package/core/steps/pipeline/default-pipelines.d.ts +146 -146
- package/data/pkgdb/pkgdb-latest.json.br +0 -0
- package/data/pkgdb/pkgdb-tiny.json.br +0 -0
- package/dataflow/environments/append.d.ts +1 -2
- package/dataflow/environments/append.js +3 -10
- package/dataflow/environments/apply-kill.d.ts +21 -0
- package/dataflow/environments/apply-kill.js +155 -0
- package/dataflow/environments/built-in-proc-name.d.ts +2 -0
- package/dataflow/environments/built-in-proc-name.js +2 -0
- package/dataflow/environments/built-in.d.ts +2 -0
- package/dataflow/environments/built-in.js +2 -0
- package/dataflow/environments/default-builtin-config.d.ts +63 -3
- package/dataflow/environments/default-builtin-config.js +40 -8
- package/dataflow/environments/environment.d.ts +49 -32
- package/dataflow/environments/environment.js +133 -18
- package/dataflow/environments/identifier.d.ts +10 -0
- package/dataflow/environments/identifier.js +23 -0
- package/dataflow/environments/overwrite.js +2 -10
- package/dataflow/environments/resolve-by-name.d.ts +1 -1
- package/dataflow/environments/resolve-by-name.js +10 -2
- package/dataflow/environments/scoping.d.ts +9 -2
- package/dataflow/environments/scoping.js +15 -2
- package/dataflow/extractor.js +23 -2
- package/dataflow/graph/df-helper.d.ts +8 -0
- package/dataflow/graph/df-helper.js +8 -0
- package/dataflow/graph/graph.d.ts +4 -1
- package/dataflow/graph/graph.js +5 -1
- package/dataflow/info.d.ts +26 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-access.js +7 -5
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +19 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-attach.d.ts +1 -8
- package/dataflow/internal/process/functions/call/built-in/built-in-attach.js +7 -13
- package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.d.ts +9 -48
- package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.js +30 -47
- package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +17 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +6 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +8 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.js +9 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-library.d.ts +37 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-library.js +391 -21
- package/dataflow/internal/process/functions/call/built-in/built-in-rm.d.ts +2 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-rm.js +131 -48
- package/dataflow/internal/process/functions/call/built-in/built-in-stack-env.d.ts +25 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-stack-env.js +94 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.js +10 -3
- package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.d.ts +30 -0
- package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.js +279 -0
- package/dataflow/internal/process/functions/call/named-call-handling.d.ts +1 -1
- package/dataflow/internal/process/functions/call/named-call-handling.js +17 -0
- package/documentation/data/faq/faqs.js +3 -0
- package/documentation/data/interface/doc-writing-code.js +4 -80
- package/documentation/doc-util/doc-structure.js +1 -2
- package/documentation/wiki-core.js +2 -1
- package/documentation/wiki-dataflow-graph.js +35 -1
- package/documentation/wiki-interface.js +3 -2
- package/documentation/wiki-linter.js +2 -0
- package/documentation/wiki-overview.js +1 -14
- package/documentation/wiki-package-database.d.ts +9 -0
- package/documentation/wiki-package-database.js +63 -0
- package/documentation/wiki-query.js +1 -0
- package/linter/linter-rules.d.ts +23 -0
- package/linter/linter-rules.js +3 -1
- package/linter/rules/absolute-path.js +2 -1
- package/linter/rules/undefined-symbol.d.ts +39 -0
- package/linter/rules/undefined-symbol.js +80 -0
- package/package.json +3 -4
- package/project/cache/flowr-analyzer-cache.d.ts +2 -0
- package/project/cache/flowr-analyzer-cache.js +9 -1
- package/project/context/flowr-analyzer-dependencies-context.d.ts +16 -8
- package/project/context/flowr-analyzer-dependencies-context.js +36 -4
- package/project/context/flowr-analyzer-environment-context.d.ts +2 -4
- package/project/context/flowr-analyzer-environment-context.js +3 -4
- package/project/context/flowr-analyzer-files-context.d.ts +1 -0
- package/project/context/flowr-file.d.ts +2 -0
- package/project/context/flowr-file.js +2 -0
- package/project/flowr-analyzer-builder.js +3 -0
- package/project/flowr-analyzer.d.ts +2 -1
- package/project/flowr-analyzer.js +3 -1
- package/project/plugins/file-plugins/files/flowr-namespace-file.d.ts +13 -15
- package/project/plugins/file-plugins/files/flowr-namespace-file.js +36 -13
- package/project/plugins/file-plugins/flowr-analyzer-virtualenv-file-plugin.d.ts +27 -0
- package/project/plugins/file-plugins/flowr-analyzer-virtualenv-file-plugin.js +41 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-lockfile-plugin.d.ts +18 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-lockfile-plugin.js +62 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-pkgdb-plugin.d.ts +63 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-pkgdb-plugin.js +174 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-plugin.d.ts +10 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-plugin.js +6 -0
- package/project/plugins/package-version-plugins/package.d.ts +3 -0
- package/project/plugins/package-version-plugins/package.js +12 -0
- package/project/plugins/package-version-plugins/pkgdb.d.ts +133 -0
- package/project/plugins/package-version-plugins/pkgdb.js +370 -0
- package/project/plugins/plugin-registry.d.ts +4 -1
- package/project/plugins/plugin-registry.js +7 -0
- package/queries/catalog/call-context-query/call-context-query-executor.js +8 -0
- package/queries/catalog/call-context-query/call-context-query-format.d.ts +2 -0
- package/queries/catalog/call-context-query/call-context-query-format.js +1 -0
- package/queries/catalog/call-context-query/identify-link-to-last-call-relation.js +8 -0
- package/queries/catalog/dependencies-query/dependencies-query-executor.js +31 -3
- package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +3 -1
- package/queries/catalog/dependencies-query/dependencies-query-format.js +3 -2
- package/queries/catalog/dependencies-query/function-info/function-info.d.ts +1 -1
- package/queries/catalog/dependencies-query/function-info/other-path-functions.d.ts +2 -0
- package/queries/catalog/dependencies-query/function-info/other-path-functions.js +27 -0
- package/queries/catalog/dependencies-query/function-info/read-functions.js +5 -4
- package/queries/catalog/dependencies-query/function-info/visualize-functions.js +3 -1
- package/queries/catalog/linter-query/linter-query-executor.js +1 -0
- package/r-bridge/data/data.d.ts +2 -2
- package/r-bridge/data/data.js +2 -2
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-executor.js +13 -4
- package/search/search-executor/search-enrichers.d.ts +1 -1
- package/search/search-executor/search-enrichers.js +7 -4
- package/util/mermaid/mermaid.d.ts +4 -0
- package/util/mermaid/mermaid.js +8 -1
- package/util/version.js +10 -2
- package/cli/common/features.d.ts +0 -9
- package/cli/common/features.js +0 -35
- package/cli/script-core/statistics-core.d.ts +0 -6
- package/cli/script-core/statistics-core.js +0 -104
- package/cli/script-core/statistics-helper-core.d.ts +0 -6
- package/cli/script-core/statistics-helper-core.js +0 -86
- package/cli/statistics-app.d.ts +0 -11
- package/cli/statistics-app.js +0 -16
- package/cli/statistics-helper-app.d.ts +0 -11
- package/cli/statistics-helper-app.js +0 -14
- package/statistics/features/common-syntax-probability.d.ts +0 -38
- package/statistics/features/common-syntax-probability.js +0 -169
- package/statistics/features/feature.d.ts +0 -179
- package/statistics/features/feature.js +0 -38
- package/statistics/features/post-processing.d.ts +0 -18
- package/statistics/features/post-processing.js +0 -26
- package/statistics/features/supported/assignments/assignments.d.ts +0 -12
- package/statistics/features/supported/assignments/assignments.js +0 -56
- package/statistics/features/supported/assignments/post-process.d.ts +0 -6
- package/statistics/features/supported/assignments/post-process.js +0 -126
- package/statistics/features/supported/comments/comments.d.ts +0 -18
- package/statistics/features/supported/comments/comments.js +0 -143
- package/statistics/features/supported/comments/post-process.d.ts +0 -6
- package/statistics/features/supported/comments/post-process.js +0 -51
- package/statistics/features/supported/control-flow/control-flow.d.ts +0 -17
- package/statistics/features/supported/control-flow/control-flow.js +0 -69
- package/statistics/features/supported/control-flow/post-process.d.ts +0 -6
- package/statistics/features/supported/control-flow/post-process.js +0 -66
- package/statistics/features/supported/data-access/data-access.d.ts +0 -15
- package/statistics/features/supported/data-access/data-access.js +0 -122
- package/statistics/features/supported/data-access/post-process.d.ts +0 -6
- package/statistics/features/supported/data-access/post-process.js +0 -108
- package/statistics/features/supported/defined-functions/defined-functions.d.ts +0 -34
- package/statistics/features/supported/defined-functions/defined-functions.js +0 -145
- package/statistics/features/supported/defined-functions/post-process.d.ts +0 -6
- package/statistics/features/supported/defined-functions/post-process.js +0 -168
- package/statistics/features/supported/expression-list/post-process.d.ts +0 -6
- package/statistics/features/supported/expression-list/post-process.js +0 -45
- package/statistics/features/supported/expression-list/statistics-expression-list.d.ts +0 -9
- package/statistics/features/supported/expression-list/statistics-expression-list.js +0 -37
- package/statistics/features/supported/loops/loops.d.ts +0 -20
- package/statistics/features/supported/loops/loops.js +0 -81
- package/statistics/features/supported/loops/post-process.d.ts +0 -6
- package/statistics/features/supported/loops/post-process.js +0 -73
- package/statistics/features/supported/used-functions/post-process.d.ts +0 -6
- package/statistics/features/supported/used-functions/post-process.js +0 -176
- package/statistics/features/supported/used-functions/used-functions.d.ts +0 -24
- package/statistics/features/supported/used-functions/used-functions.js +0 -99
- package/statistics/features/supported/used-packages/post-process.d.ts +0 -6
- package/statistics/features/supported/used-packages/post-process.js +0 -122
- package/statistics/features/supported/used-packages/used-packages.d.ts +0 -16
- package/statistics/features/supported/used-packages/used-packages.js +0 -140
- package/statistics/features/supported/values/post-process.d.ts +0 -6
- package/statistics/features/supported/values/post-process.js +0 -73
- package/statistics/features/supported/values/values.d.ts +0 -14
- package/statistics/features/supported/values/values.js +0 -111
- package/statistics/features/supported/variables/post-process.d.ts +0 -15
- package/statistics/features/supported/variables/post-process.js +0 -126
- package/statistics/features/supported/variables/variables.d.ts +0 -15
- package/statistics/features/supported/variables/variables.js +0 -62
- package/statistics/meta-statistics.d.ts +0 -32
- package/statistics/meta-statistics.js +0 -16
- package/statistics/output/file-provider.d.ts +0 -36
- package/statistics/output/file-provider.js +0 -96
- package/statistics/output/print-stats.d.ts +0 -29
- package/statistics/output/print-stats.js +0 -81
- package/statistics/output/statistics-file.d.ts +0 -36
- package/statistics/output/statistics-file.js +0 -68
- package/statistics/statistics.d.ts +0 -29
- package/statistics/statistics.js +0 -108
- package/statistics/summarizer/auto-detect.d.ts +0 -5
- package/statistics/summarizer/auto-detect.js +0 -34
- package/statistics/summarizer/first-phase/process.d.ts +0 -6
- package/statistics/summarizer/first-phase/process.js +0 -81
- package/statistics/summarizer/post-process/clusterer.d.ts +0 -25
- package/statistics/summarizer/post-process/clusterer.js +0 -40
- package/statistics/summarizer/post-process/file-based-count.d.ts +0 -16
- package/statistics/summarizer/post-process/file-based-count.js +0 -47
- package/statistics/summarizer/post-process/histogram.d.ts +0 -57
- package/statistics/summarizer/post-process/histogram.js +0 -126
- package/statistics/summarizer/post-process/post-process-output.d.ts +0 -14
- package/statistics/summarizer/post-process/post-process-output.js +0 -102
- package/statistics/summarizer/second-phase/process.d.ts +0 -15
- package/statistics/summarizer/second-phase/process.js +0 -118
- package/statistics/summarizer/summarizer.d.ts +0 -34
- package/statistics/summarizer/summarizer.js +0 -141
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.comments = exports.initialCommentInfo = void 0;
|
|
37
|
-
const xpath = __importStar(require("xpath-ts2"));
|
|
38
|
-
const post_process_1 = require("./post-process");
|
|
39
|
-
const assert_1 = require("../../../../util/assert");
|
|
40
|
-
const statistics_file_1 = require("../../../output/statistics-file");
|
|
41
|
-
exports.initialCommentInfo = {
|
|
42
|
-
totalAmount: 0,
|
|
43
|
-
roxygenComments: 0,
|
|
44
|
-
import: 0,
|
|
45
|
-
importFrom: 0,
|
|
46
|
-
importMethodsFrom: 0,
|
|
47
|
-
importClassesFrom: 0,
|
|
48
|
-
useDynLib: 0,
|
|
49
|
-
export: 0,
|
|
50
|
-
exportClass: 0,
|
|
51
|
-
exportMethod: 0,
|
|
52
|
-
exportS3Method: 0,
|
|
53
|
-
exportPattern: 0
|
|
54
|
-
};
|
|
55
|
-
const commentQuery = xpath.parse('//COMMENT');
|
|
56
|
-
const importRegex = /^'\s*@import\s+(?<package>\S+)/;
|
|
57
|
-
const importFromRegex = /^'\s*@importFrom\s+(?<package>\S+)(?<fn>( +\S+)+)$/;
|
|
58
|
-
const useDynLibRegex = /^'\s*@useDynLib\s+(?<package>\S+)(?<fn>( +\S+)+)?$/;
|
|
59
|
-
/** we still name the classes fn, so we can reuse processing code */
|
|
60
|
-
const importClassesFromRegex = /^'\s*@importClassesFrom\s+(?<package>\S+)(?<fn>( +\S+)+)$/;
|
|
61
|
-
const importMethodsFrom = /^'\s*@importMethodsFrom\s+(?<package>\S+)(?<fn>( +\S+)+)$/;
|
|
62
|
-
/** deliberately includes the others to get a "total" overview */
|
|
63
|
-
const exportRegex = /^'\s*@export/;
|
|
64
|
-
const exportS3MethodRegex = /^'\s*@exportS3Method/;
|
|
65
|
-
const exportClassRegex = /^'\s*@exportClass/;
|
|
66
|
-
const exportMethodRegex = /^'\s*@exportMethod/;
|
|
67
|
-
const exportPatternRegex = /^'\s*@exportPattern/;
|
|
68
|
-
function processRoxygenImport(existing, commentsText, filepath) {
|
|
69
|
-
const packages = commentsText.map(text => importRegex.exec(text)?.groups?.package).filter(assert_1.isNotUndefined);
|
|
70
|
-
existing.import += packages.length;
|
|
71
|
-
(0, statistics_file_1.appendStatisticsFile)(exports.comments.name, 'import', packages, filepath, true);
|
|
72
|
-
}
|
|
73
|
-
function processWithRegex(commentsText, existing, regex) {
|
|
74
|
-
return commentsText.map(text => regex.exec(text)).filter(assert_1.isNotNull)
|
|
75
|
-
.flatMap(match => {
|
|
76
|
-
const packageName = match.groups?.package ?? '<unknown>';
|
|
77
|
-
return (match.groups?.fn.trim().split(/\s+/) ?? []).map(fn => `${JSON.stringify(packageName)},${fn}`);
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
function processRoxygenImportFrom(existing, commentsText, filepath) {
|
|
81
|
-
const result = processWithRegex(commentsText, existing, importFromRegex);
|
|
82
|
-
existing.importFrom += result.length;
|
|
83
|
-
(0, statistics_file_1.appendStatisticsFile)(exports.comments.name, 'importFrom', result, filepath, true);
|
|
84
|
-
}
|
|
85
|
-
function processRoxygenImportClassesFrom(existing, commentsText, filepath) {
|
|
86
|
-
const result = processWithRegex(commentsText, existing, importClassesFromRegex);
|
|
87
|
-
existing.importClassesFrom += result.length;
|
|
88
|
-
(0, statistics_file_1.appendStatisticsFile)(exports.comments.name, 'importClassesFrom', result, filepath, true);
|
|
89
|
-
}
|
|
90
|
-
function processRoxygenImportMethodsFrom(existing, commentsText, filepath) {
|
|
91
|
-
const result = processWithRegex(commentsText, existing, importMethodsFrom);
|
|
92
|
-
existing.importMethodsFrom += result.length;
|
|
93
|
-
(0, statistics_file_1.appendStatisticsFile)(exports.comments.name, 'importMethodsFrom', result, filepath, true);
|
|
94
|
-
}
|
|
95
|
-
function processExports(existing, comments) {
|
|
96
|
-
existing.export += comments.filter(text => exportRegex.test(text)).length;
|
|
97
|
-
existing.exportClass += comments.filter(text => exportClassRegex.test(text)).length;
|
|
98
|
-
existing.exportMethod += comments.filter(text => exportMethodRegex.test(text)).length;
|
|
99
|
-
existing.exportS3Method += comments.filter(text => exportS3MethodRegex.test(text)).length;
|
|
100
|
-
existing.exportPattern += comments.filter(text => exportPatternRegex.test(text)).length;
|
|
101
|
-
}
|
|
102
|
-
function processMatchForDynLib(match) {
|
|
103
|
-
const packageName = match.groups?.package ?? '<unknown>';
|
|
104
|
-
const functions = match.groups?.fn?.trim().split(/\s+/) ?? [];
|
|
105
|
-
if (functions.length === 0) {
|
|
106
|
-
return [packageName];
|
|
107
|
-
}
|
|
108
|
-
else {
|
|
109
|
-
return functions.map(fn => `${JSON.stringify(packageName)},${fn}`);
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
function processRoxygenUseDynLib(existing, commentsText, filepath) {
|
|
113
|
-
const result = commentsText.map(text => useDynLibRegex.exec(text))
|
|
114
|
-
.filter(assert_1.isNotNull)
|
|
115
|
-
.flatMap(processMatchForDynLib);
|
|
116
|
-
existing.useDynLib += result.length;
|
|
117
|
-
(0, statistics_file_1.appendStatisticsFile)(exports.comments.name, 'useDynLib', result, filepath, true);
|
|
118
|
-
}
|
|
119
|
-
exports.comments = {
|
|
120
|
-
name: 'Comments',
|
|
121
|
-
description: 'All comments that appear within the document',
|
|
122
|
-
process(existing, input) {
|
|
123
|
-
const comments = commentQuery.select({ node: input.parsedRAst }).map(node => node.textContent ?? '#')
|
|
124
|
-
.map(text => {
|
|
125
|
-
(0, assert_1.guard)(text.startsWith('#'), `unexpected comment ${text}`);
|
|
126
|
-
return text.slice(1);
|
|
127
|
-
})
|
|
128
|
-
.map(text => text.trim());
|
|
129
|
-
existing.totalAmount += comments.length;
|
|
130
|
-
const roxygenComments = comments.filter(text => text.startsWith("'"));
|
|
131
|
-
existing.roxygenComments += roxygenComments.length;
|
|
132
|
-
processRoxygenImport(existing, roxygenComments, input.filepath);
|
|
133
|
-
processRoxygenImportFrom(existing, roxygenComments, input.filepath);
|
|
134
|
-
processRoxygenUseDynLib(existing, roxygenComments, input.filepath);
|
|
135
|
-
processRoxygenImportClassesFrom(existing, roxygenComments, input.filepath);
|
|
136
|
-
processRoxygenImportMethodsFrom(existing, roxygenComments, input.filepath);
|
|
137
|
-
processExports(existing, roxygenComments);
|
|
138
|
-
return existing;
|
|
139
|
-
},
|
|
140
|
-
initialValue: exports.initialCommentInfo,
|
|
141
|
-
postProcess: post_process_1.postProcess
|
|
142
|
-
};
|
|
143
|
-
//# sourceMappingURL=comments.js.map
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { FeatureStatisticsWithMeta } from '../../feature';
|
|
2
|
-
import type { StatisticsSummarizerConfiguration } from '../../../summarizer/summarizer';
|
|
3
|
-
/**
|
|
4
|
-
*
|
|
5
|
-
*/
|
|
6
|
-
export declare function postProcess(featureRoot: string, info: Map<string, FeatureStatisticsWithMeta>, outputPath: string, config: StatisticsSummarizerConfiguration): void;
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.postProcess = postProcess;
|
|
7
|
-
const comments_1 = require("./comments");
|
|
8
|
-
const fs_1 = __importDefault(require("fs"));
|
|
9
|
-
const path_1 = __importDefault(require("path"));
|
|
10
|
-
const summarizer_1 = require("../../../../util/summarizer");
|
|
11
|
-
const assert_1 = require("../../../../util/assert");
|
|
12
|
-
// monoids would be helpful :c
|
|
13
|
-
function appendCommentsPostProcessing(a, b, numberOfLines, filepath, skipForProjects) {
|
|
14
|
-
for (const [key, val] of Object.entries(b)) {
|
|
15
|
-
const get = a[key];
|
|
16
|
-
(0, assert_1.guard)(get !== undefined, `key ${key} is not present in the comments post processing`);
|
|
17
|
-
get.count.push(val);
|
|
18
|
-
get.fracOfLines.push(val / numberOfLines);
|
|
19
|
-
if (val > 0) {
|
|
20
|
-
get.uniqueFiles.add(filepath);
|
|
21
|
-
get.uniqueProjects.add(filepath.split(path_1.default.sep)[skipForProjects] ?? '');
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
const initialCommentsMeta = () => ({ count: [], uniqueProjects: new Set(), uniqueFiles: new Set(), fracOfLines: [] });
|
|
26
|
-
function mapComments(data, fn) {
|
|
27
|
-
const collected = {};
|
|
28
|
-
for (const [key, value] of Object.entries(data)) {
|
|
29
|
-
collected[key] = fn(value);
|
|
30
|
-
}
|
|
31
|
-
return collected;
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
*
|
|
35
|
-
*/
|
|
36
|
-
function postProcess(featureRoot, info, outputPath, config) {
|
|
37
|
-
// for each we collect the count and the number of files that contain them
|
|
38
|
-
const collected = mapComments(comments_1.initialCommentInfo, initialCommentsMeta);
|
|
39
|
-
for (const [filepath, feature] of info.entries()) {
|
|
40
|
-
appendCommentsPostProcessing(collected, feature.comments, feature.stats.lines[0].length, filepath, config.projectSkip);
|
|
41
|
-
}
|
|
42
|
-
const fnOutStream = fs_1.default.createWriteStream(path_1.default.join(outputPath, 'comments.csv'));
|
|
43
|
-
fnOutStream.write(`kind,unique-projects,unique-files,${(0, summarizer_1.summarizedMeasurement2CsvHeader)('count')},${(0, summarizer_1.summarizedMeasurement2CsvHeader)('frac-of-lines')}\n`);
|
|
44
|
-
for (const [key, val] of Object.entries(collected)) {
|
|
45
|
-
const { count, uniqueProjects, uniqueFiles, fracOfLines } = val;
|
|
46
|
-
const counts = (0, summarizer_1.summarizeMeasurement)(count);
|
|
47
|
-
const lineFrac = (0, summarizer_1.summarizeMeasurement)(fracOfLines);
|
|
48
|
-
fnOutStream.write(`${JSON.stringify(key)},${uniqueProjects.size},${uniqueFiles.size},${(0, summarizer_1.summarizedMeasurement2Csv)(counts)},${(0, summarizer_1.summarizedMeasurement2Csv)(lineFrac)}\n`);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
//# sourceMappingURL=post-process.js.map
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { Feature } from '../../feature';
|
|
2
|
-
import type { Writable } from 'ts-essentials';
|
|
3
|
-
declare const initialControlflowInfo: {
|
|
4
|
-
ifThen: import("../../common-syntax-probability").CommonSyntaxTypeCounts<bigint>;
|
|
5
|
-
thenBody: import("../../common-syntax-probability").CommonSyntaxTypeCounts<bigint>;
|
|
6
|
-
ifThenElse: import("../../common-syntax-probability").CommonSyntaxTypeCounts<bigint>;
|
|
7
|
-
elseBody: import("../../common-syntax-probability").CommonSyntaxTypeCounts<bigint>;
|
|
8
|
-
/** can be nested with if-s or if-then-else's */
|
|
9
|
-
nestedIfThen: number;
|
|
10
|
-
nestedIfThenElse: number;
|
|
11
|
-
deepestNesting: number;
|
|
12
|
-
/** switch(...) */
|
|
13
|
-
switchCase: import("../../common-syntax-probability").CommonSyntaxTypeCounts<bigint>;
|
|
14
|
-
};
|
|
15
|
-
export type ControlflowInfo = Writable<typeof initialControlflowInfo>;
|
|
16
|
-
export declare const controlflow: Feature<ControlflowInfo>;
|
|
17
|
-
export {};
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.controlflow = void 0;
|
|
4
|
-
const common_syntax_probability_1 = require("../../common-syntax-probability");
|
|
5
|
-
const post_process_1 = require("./post-process");
|
|
6
|
-
const unpack_argument_1 = require("../../../../dataflow/internal/process/functions/call/argument/unpack-argument");
|
|
7
|
-
const type_1 = require("../../../../r-bridge/lang-4.x/ast/model/type");
|
|
8
|
-
const r_project_1 = require("../../../../r-bridge/lang-4.x/ast/model/nodes/r-project");
|
|
9
|
-
const initialControlflowInfo = {
|
|
10
|
-
ifThen: (0, common_syntax_probability_1.emptyCommonSyntaxTypeCounts)(),
|
|
11
|
-
thenBody: (0, common_syntax_probability_1.emptyCommonSyntaxTypeCounts)(),
|
|
12
|
-
ifThenElse: (0, common_syntax_probability_1.emptyCommonSyntaxTypeCounts)(),
|
|
13
|
-
elseBody: (0, common_syntax_probability_1.emptyCommonSyntaxTypeCounts)(),
|
|
14
|
-
/** can be nested with if-s or if-then-else's */
|
|
15
|
-
nestedIfThen: 0,
|
|
16
|
-
nestedIfThenElse: 0,
|
|
17
|
-
deepestNesting: 0,
|
|
18
|
-
/** switch(...) */
|
|
19
|
-
switchCase: (0, common_syntax_probability_1.emptyCommonSyntaxTypeCounts)()
|
|
20
|
-
};
|
|
21
|
-
function visitIfThenElse(info, input) {
|
|
22
|
-
const ifThenElseStack = [];
|
|
23
|
-
r_project_1.RProject.visitAst(input.normalizedRAst.ast, node => {
|
|
24
|
-
if (node.type !== type_1.RType.IfThenElse) {
|
|
25
|
-
if (node.type === type_1.RType.FunctionCall && node.named && node.functionName.content === 'switch') {
|
|
26
|
-
const initialArg = (0, unpack_argument_1.unpackNonameArg)(node.arguments[0]);
|
|
27
|
-
if (initialArg) {
|
|
28
|
-
info.switchCase = (0, common_syntax_probability_1.updateCommonSyntaxTypeCounts)(info.switchCase, initialArg);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
const ifThenElse = node.otherwise !== undefined;
|
|
34
|
-
if (ifThenElseStack.length > 0) {
|
|
35
|
-
if (ifThenElse) {
|
|
36
|
-
info.nestedIfThenElse++;
|
|
37
|
-
}
|
|
38
|
-
else {
|
|
39
|
-
info.nestedIfThen++;
|
|
40
|
-
}
|
|
41
|
-
info.deepestNesting = Math.max(info.deepestNesting, ifThenElseStack.length);
|
|
42
|
-
}
|
|
43
|
-
ifThenElseStack.push(node);
|
|
44
|
-
info.thenBody = (0, common_syntax_probability_1.updateCommonSyntaxTypeCounts)(info.thenBody, ...node.then.children);
|
|
45
|
-
if (ifThenElse) {
|
|
46
|
-
info.ifThenElse = (0, common_syntax_probability_1.updateCommonSyntaxTypeCounts)(info.ifThenElse, node.condition);
|
|
47
|
-
info.elseBody = (0, common_syntax_probability_1.updateCommonSyntaxTypeCounts)(info.elseBody, ...node.otherwise.children);
|
|
48
|
-
}
|
|
49
|
-
else {
|
|
50
|
-
info.ifThen = (0, common_syntax_probability_1.updateCommonSyntaxTypeCounts)(info.ifThen, node.condition);
|
|
51
|
-
}
|
|
52
|
-
}, node => {
|
|
53
|
-
// drop again :D
|
|
54
|
-
if (node.type === type_1.RType.IfThenElse) {
|
|
55
|
-
ifThenElseStack.pop();
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
exports.controlflow = {
|
|
60
|
-
name: 'Controlflow',
|
|
61
|
-
description: 'Deals with if-then-else and switch-case',
|
|
62
|
-
process(existing, input) {
|
|
63
|
-
visitIfThenElse(existing, input);
|
|
64
|
-
return existing;
|
|
65
|
-
},
|
|
66
|
-
initialValue: initialControlflowInfo,
|
|
67
|
-
postProcess: post_process_1.postProcess
|
|
68
|
-
};
|
|
69
|
-
//# sourceMappingURL=control-flow.js.map
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { FeatureStatisticsWithMeta } from '../../feature';
|
|
2
|
-
import type { StatisticsSummarizerConfiguration } from '../../../summarizer/summarizer';
|
|
3
|
-
/**
|
|
4
|
-
*
|
|
5
|
-
*/
|
|
6
|
-
export declare function postProcess(featureRoot: string, info: Map<string, FeatureStatisticsWithMeta>, outputPath: string, config: StatisticsSummarizerConfiguration): void;
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.postProcess = postProcess;
|
|
7
|
-
const common_syntax_probability_1 = require("../../common-syntax-probability");
|
|
8
|
-
const post_processing_1 = require("../../post-processing");
|
|
9
|
-
const fs_1 = __importDefault(require("fs"));
|
|
10
|
-
const path_1 = __importDefault(require("path"));
|
|
11
|
-
const summarizer_1 = require("../../../../util/summarizer");
|
|
12
|
-
/**
|
|
13
|
-
*
|
|
14
|
-
*/
|
|
15
|
-
function postProcess(featureRoot, info, outputPath, config) {
|
|
16
|
-
const collected = {
|
|
17
|
-
ifThen: (0, common_syntax_probability_1.emptyCommonSyntaxTypeCounts)(() => []),
|
|
18
|
-
thenBody: (0, common_syntax_probability_1.emptyCommonSyntaxTypeCounts)(() => []),
|
|
19
|
-
ifThenElse: (0, common_syntax_probability_1.emptyCommonSyntaxTypeCounts)(() => []),
|
|
20
|
-
elseBody: (0, common_syntax_probability_1.emptyCommonSyntaxTypeCounts)(() => []),
|
|
21
|
-
nestedIfThen: (0, post_processing_1.emptySummarizedWithProject)(),
|
|
22
|
-
nestedIfThenElse: (0, post_processing_1.emptySummarizedWithProject)(),
|
|
23
|
-
deepestNesting: (0, post_processing_1.emptySummarizedWithProject)(),
|
|
24
|
-
switchCase: (0, common_syntax_probability_1.emptyCommonSyntaxTypeCounts)(() => [])
|
|
25
|
-
};
|
|
26
|
-
for (const [filepath, data] of info.entries()) {
|
|
27
|
-
const value = data.controlflow;
|
|
28
|
-
for (const [key, val] of Object.entries(value)) {
|
|
29
|
-
if (typeof val === 'object') {
|
|
30
|
-
(0, common_syntax_probability_1.appendCommonSyntaxTypeCounter)(collected[key], val);
|
|
31
|
-
}
|
|
32
|
-
else {
|
|
33
|
-
const get = collected[key];
|
|
34
|
-
get.count.push(val);
|
|
35
|
-
if (val > 0) {
|
|
36
|
-
(0, post_processing_1.recordFilePath)(get, filepath, config);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
const metaOut = fs_1.default.createWriteStream(path_1.default.join(outputPath, 'control-flow-meta.csv'));
|
|
42
|
-
metaOut.write(`kind,unique-projects,unique-files,${(0, summarizer_1.summarizedMeasurement2CsvHeader)()}\n`);
|
|
43
|
-
for (const [key, val] of Object.entries(collected)) {
|
|
44
|
-
const data = val;
|
|
45
|
-
if ('uniqueProjects' in data) {
|
|
46
|
-
metaOut.write(`${JSON.stringify(key)},${data.uniqueProjects.size},${data.uniqueFiles.size},${(0, summarizer_1.summarizedMeasurement2Csv)((0, summarizer_1.summarizeMeasurement)(data.count))}\n`);
|
|
47
|
-
}
|
|
48
|
-
else {
|
|
49
|
-
const out = fs_1.default.createWriteStream(path_1.default.join(outputPath, `control-flow-type-${key}.csv`));
|
|
50
|
-
// name is for fields like number etc. to allow to group multiple entries
|
|
51
|
-
out.write(`kind,name,${(0, summarizer_1.summarizedMeasurement2CsvHeader)()}\n`);
|
|
52
|
-
for (const [name, vals] of Object.entries(data)) {
|
|
53
|
-
if (Array.isArray(vals)) {
|
|
54
|
-
out.write(`${JSON.stringify(name)},"",${(0, summarizer_1.summarizedMeasurement2Csv)((0, summarizer_1.summarizeMeasurement)(vals.flat()))}\n`);
|
|
55
|
-
}
|
|
56
|
-
else {
|
|
57
|
-
for (const [keyName, keyValue] of Object.entries(vals)) {
|
|
58
|
-
out.write(`${JSON.stringify(name)},${JSON.stringify(keyName)},${(0, summarizer_1.summarizedMeasurement2Csv)((0, summarizer_1.summarizeMeasurement)(keyValue.flat()))}\n`);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
out.close();
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
//# sourceMappingURL=post-process.js.map
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { Feature } from '../../feature';
|
|
2
|
-
import type { Writable } from 'ts-essentials';
|
|
3
|
-
import { type CommonSyntaxTypeCounts } from '../../common-syntax-probability';
|
|
4
|
-
declare const initialDataAccessInfo: {
|
|
5
|
-
singleBracket: Record<number, bigint | CommonSyntaxTypeCounts>;
|
|
6
|
-
doubleBracket: Record<number, bigint | CommonSyntaxTypeCounts>;
|
|
7
|
-
chainedOrNestedAccess: number;
|
|
8
|
-
longestChain: number;
|
|
9
|
-
deepestNesting: number;
|
|
10
|
-
byName: number;
|
|
11
|
-
bySlot: number;
|
|
12
|
-
};
|
|
13
|
-
export type DataAccessInfo = Writable<typeof initialDataAccessInfo>;
|
|
14
|
-
export declare const dataAccess: Feature<DataAccessInfo>;
|
|
15
|
-
export {};
|
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.dataAccess = void 0;
|
|
4
|
-
const common_syntax_probability_1 = require("../../common-syntax-probability");
|
|
5
|
-
const post_process_1 = require("./post-process");
|
|
6
|
-
const assert_1 = require("../../../../util/assert");
|
|
7
|
-
const type_1 = require("../../../../r-bridge/lang-4.x/ast/model/type");
|
|
8
|
-
const role_1 = require("../../../../r-bridge/lang-4.x/ast/model/processing/role");
|
|
9
|
-
const statistics_file_1 = require("../../../output/statistics-file");
|
|
10
|
-
const r_function_call_1 = require("../../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
|
|
11
|
-
const r_project_1 = require("../../../../r-bridge/lang-4.x/ast/model/nodes/r-project");
|
|
12
|
-
const model_1 = require("../../../../r-bridge/lang-4.x/ast/model/model");
|
|
13
|
-
const initialDataAccessInfo = {
|
|
14
|
-
// for the nth argument, how many of them are constant, etc.
|
|
15
|
-
singleBracket: {
|
|
16
|
-
// only counts if empty
|
|
17
|
-
0: 0n,
|
|
18
|
-
1: (0, common_syntax_probability_1.emptyCommonSyntaxTypeCounts)()
|
|
19
|
-
},
|
|
20
|
-
doubleBracket: {
|
|
21
|
-
// similar to single bracket
|
|
22
|
-
0: 0n,
|
|
23
|
-
1: (0, common_syntax_probability_1.emptyCommonSyntaxTypeCounts)()
|
|
24
|
-
},
|
|
25
|
-
chainedOrNestedAccess: 0,
|
|
26
|
-
longestChain: 0,
|
|
27
|
-
deepestNesting: 0,
|
|
28
|
-
byName: 0,
|
|
29
|
-
bySlot: 0,
|
|
30
|
-
};
|
|
31
|
-
function classifyArguments(args, existing) {
|
|
32
|
-
if (args.length === 0) {
|
|
33
|
-
existing[0]++;
|
|
34
|
-
return;
|
|
35
|
-
}
|
|
36
|
-
let i = 1;
|
|
37
|
-
for (const arg of args) {
|
|
38
|
-
if (arg === null || arg === undefined || arg === r_function_call_1.EmptyArgument) {
|
|
39
|
-
existing[0]++;
|
|
40
|
-
continue;
|
|
41
|
-
}
|
|
42
|
-
existing[i] = (0, common_syntax_probability_1.updateCommonSyntaxTypeCounts)(existing[i] ?? (0, common_syntax_probability_1.emptyCommonSyntaxTypeCounts)(), arg);
|
|
43
|
-
i++;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
function visitAccess(info, input) {
|
|
47
|
-
const accessNest = [];
|
|
48
|
-
const accessChain = [];
|
|
49
|
-
const parentRoleCache = new Map();
|
|
50
|
-
r_project_1.RProject.visitAst(input.normalizedRAst.ast, node => {
|
|
51
|
-
if (node.type !== type_1.RType.Access) {
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
const roles = (0, role_1.rolesOfParents)(node, input.normalizedRAst.idMap);
|
|
55
|
-
let acc = false;
|
|
56
|
-
let idxAcc = false;
|
|
57
|
-
for (const role of roles) {
|
|
58
|
-
if (role === "acc" /* RoleInParent.Accessed */) {
|
|
59
|
-
acc = true;
|
|
60
|
-
break; // we only account for the first one
|
|
61
|
-
}
|
|
62
|
-
else if (role === "idx-acc" /* RoleInParent.IndexAccess */) {
|
|
63
|
-
idxAcc = true;
|
|
64
|
-
break;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
// here we have to check after the addition as we can only check the parental context
|
|
68
|
-
if (acc) {
|
|
69
|
-
accessChain.push(node);
|
|
70
|
-
info.chainedOrNestedAccess++;
|
|
71
|
-
info.longestChain = Math.max(info.longestChain, accessChain.length);
|
|
72
|
-
}
|
|
73
|
-
else if (idxAcc) {
|
|
74
|
-
accessNest.push(node);
|
|
75
|
-
info.chainedOrNestedAccess++;
|
|
76
|
-
info.deepestNesting = Math.max(info.deepestNesting, accessNest.length);
|
|
77
|
-
}
|
|
78
|
-
parentRoleCache.set(node.info.id, { acc, idxAcc });
|
|
79
|
-
if (accessNest.length === 0 && accessChain.length === 0) { // store topmost, after add as it must not be a child to do that
|
|
80
|
-
(0, statistics_file_1.appendStatisticsFile)(exports.dataAccess.name, 'dataAccess', [model_1.RNode.lexeme(node)], input.filepath);
|
|
81
|
-
}
|
|
82
|
-
const op = node.operator;
|
|
83
|
-
switch (op) {
|
|
84
|
-
case '@':
|
|
85
|
-
info.bySlot++;
|
|
86
|
-
return;
|
|
87
|
-
case '$':
|
|
88
|
-
info.byName++;
|
|
89
|
-
return;
|
|
90
|
-
case '[':
|
|
91
|
-
classifyArguments(node.access, info.singleBracket);
|
|
92
|
-
break;
|
|
93
|
-
case '[[':
|
|
94
|
-
classifyArguments(node.access, info.doubleBracket);
|
|
95
|
-
break;
|
|
96
|
-
default: (0, assert_1.assertUnreachable)(op);
|
|
97
|
-
}
|
|
98
|
-
(0, assert_1.guard)(Array.isArray(node.access), '[ and [[ must provide access as array');
|
|
99
|
-
}, node => {
|
|
100
|
-
// drop again :D
|
|
101
|
-
if (node.type === type_1.RType.Access) {
|
|
102
|
-
const ctx = parentRoleCache.get(node.info.id);
|
|
103
|
-
if (ctx?.acc) {
|
|
104
|
-
accessChain.pop();
|
|
105
|
-
}
|
|
106
|
-
else if (ctx?.idxAcc) {
|
|
107
|
-
accessNest.pop();
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
exports.dataAccess = {
|
|
113
|
-
name: 'Data Access',
|
|
114
|
-
description: 'Ways of accessing data structures in R',
|
|
115
|
-
process(existing, input) {
|
|
116
|
-
visitAccess(existing, input);
|
|
117
|
-
return existing;
|
|
118
|
-
},
|
|
119
|
-
initialValue: initialDataAccessInfo,
|
|
120
|
-
postProcess: post_process_1.postProcess
|
|
121
|
-
};
|
|
122
|
-
//# sourceMappingURL=data-access.js.map
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { FeatureStatisticsWithMeta } from '../../feature';
|
|
2
|
-
import type { StatisticsSummarizerConfiguration } from '../../../summarizer/summarizer';
|
|
3
|
-
/**
|
|
4
|
-
*
|
|
5
|
-
*/
|
|
6
|
-
export declare function postProcess(featureRoot: string, info: Map<string, FeatureStatisticsWithMeta>, outputPath: string, config: StatisticsSummarizerConfiguration): void;
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.postProcess = postProcess;
|
|
7
|
-
const common_syntax_probability_1 = require("../../common-syntax-probability");
|
|
8
|
-
const post_processing_1 = require("../../post-processing");
|
|
9
|
-
const fs_1 = __importDefault(require("fs"));
|
|
10
|
-
const path_1 = __importDefault(require("path"));
|
|
11
|
-
const numbers_1 = require("../../../../util/numbers");
|
|
12
|
-
const summarizer_1 = require("../../../../util/summarizer");
|
|
13
|
-
function addToList(data, dataAccess, filepath, config) {
|
|
14
|
-
data.count.push(dataAccess);
|
|
15
|
-
if (dataAccess > 0) {
|
|
16
|
-
(0, post_processing_1.recordFilePath)(data, filepath, config);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
function summarizeForBracket(dataAccess, data, filepath, config) {
|
|
20
|
-
for (const [key, val] of Object.entries(dataAccess)) {
|
|
21
|
-
const numericKey = Number(key);
|
|
22
|
-
const get = data.get(numericKey) ?? (0, common_syntax_probability_1.emptyCommonSyntaxTypeCounts)(() => []);
|
|
23
|
-
if (typeof val === 'bigint' || typeof val === 'string') {
|
|
24
|
-
// it is for argument 0
|
|
25
|
-
const sumGet = get;
|
|
26
|
-
const numericVal = (0, numbers_1.bigint2number)(val);
|
|
27
|
-
sumGet.count.push(numericVal);
|
|
28
|
-
if (numericVal > 0) {
|
|
29
|
-
(0, post_processing_1.recordFilePath)(sumGet, filepath, config);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
else {
|
|
33
|
-
(0, common_syntax_probability_1.appendCommonSyntaxTypeCounter)(get, val);
|
|
34
|
-
}
|
|
35
|
-
data.set(numericKey, get);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
function writeSingleOrDoubleEmpty(outputPath, key, name, vals) {
|
|
39
|
-
const out = fs_1.default.createWriteStream(path_1.default.join(outputPath, `data-access-type-${key}-${name}.csv`));
|
|
40
|
-
// name is for fields like number etc. to allow to group multiple entries
|
|
41
|
-
out.write(`kind,unique-projects,unique-files,${(0, summarizer_1.summarizedMeasurement2CsvHeader)()}\n`);
|
|
42
|
-
out.write(`"0",${vals.uniqueProjects.size},${vals.uniqueFiles.size},${(0, summarizer_1.summarizedMeasurement2Csv)((0, summarizer_1.summarizeMeasurement)(vals.count))}\n`);
|
|
43
|
-
out.close();
|
|
44
|
-
}
|
|
45
|
-
function writeSingleOrDoubleBrackets(data, outputPath, key) {
|
|
46
|
-
for (const [name, vals] of data.entries()) {
|
|
47
|
-
// the 0 column
|
|
48
|
-
if ('uniqueProjects' in vals) {
|
|
49
|
-
writeSingleOrDoubleEmpty(outputPath, key, name, vals);
|
|
50
|
-
}
|
|
51
|
-
else {
|
|
52
|
-
// non-0-column
|
|
53
|
-
const out = fs_1.default.createWriteStream(path_1.default.join(outputPath, `data-access-type-${key}-${name}.csv`));
|
|
54
|
-
// name is for fields like number etc. to allow to group multiple entries
|
|
55
|
-
out.write(`kind,name,${(0, summarizer_1.summarizedMeasurement2CsvHeader)()}\n`);
|
|
56
|
-
for (const [entryName, values] of Object.entries(vals)) {
|
|
57
|
-
if (Array.isArray(values)) {
|
|
58
|
-
out.write(`${JSON.stringify(entryName)},"",${(0, summarizer_1.summarizedMeasurement2Csv)((0, summarizer_1.summarizeMeasurement)(values.flat()))}\n`);
|
|
59
|
-
}
|
|
60
|
-
else {
|
|
61
|
-
for (const [keyName, keyValue] of Object.entries(values)) {
|
|
62
|
-
out.write(`${JSON.stringify(entryName)},${JSON.stringify(keyName)},${(0, summarizer_1.summarizedMeasurement2Csv)((0, summarizer_1.summarizeMeasurement)(keyValue.flat()))}\n`);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
out.close();
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
*
|
|
72
|
-
*/
|
|
73
|
-
function postProcess(featureRoot, info, outputPath, config) {
|
|
74
|
-
const summarize = {
|
|
75
|
-
singleBracket: new Map(),
|
|
76
|
-
doubleBracket: new Map(),
|
|
77
|
-
chainedOrNestedAccess: (0, post_processing_1.emptySummarizedWithProject)(),
|
|
78
|
-
longestChain: (0, post_processing_1.emptySummarizedWithProject)(),
|
|
79
|
-
deepestNesting: (0, post_processing_1.emptySummarizedWithProject)(),
|
|
80
|
-
byName: (0, post_processing_1.emptySummarizedWithProject)(),
|
|
81
|
-
bySlot: (0, post_processing_1.emptySummarizedWithProject)()
|
|
82
|
-
};
|
|
83
|
-
// initialize the special 0
|
|
84
|
-
summarize.singleBracket.set(0, (0, post_processing_1.emptySummarizedWithProject)());
|
|
85
|
-
summarize.doubleBracket.set(0, (0, post_processing_1.emptySummarizedWithProject)());
|
|
86
|
-
for (const [filepath, value] of info.entries()) {
|
|
87
|
-
const dataAccess = value.dataAccess;
|
|
88
|
-
addToList(summarize.chainedOrNestedAccess, dataAccess.chainedOrNestedAccess, filepath, config);
|
|
89
|
-
addToList(summarize.longestChain, dataAccess.longestChain, filepath, config);
|
|
90
|
-
addToList(summarize.deepestNesting, dataAccess.deepestNesting, filepath, config);
|
|
91
|
-
addToList(summarize.byName, dataAccess.byName, filepath, config);
|
|
92
|
-
addToList(summarize.bySlot, dataAccess.bySlot, filepath, config);
|
|
93
|
-
summarizeForBracket(dataAccess.singleBracket, summarize.singleBracket, filepath, config);
|
|
94
|
-
summarizeForBracket(dataAccess.doubleBracket, summarize.doubleBracket, filepath, config);
|
|
95
|
-
}
|
|
96
|
-
const metaOut = fs_1.default.createWriteStream(path_1.default.join(outputPath, 'data-access-meta.csv'));
|
|
97
|
-
metaOut.write(`kind,unique-projects,unique-files,${(0, summarizer_1.summarizedMeasurement2CsvHeader)()}\n`);
|
|
98
|
-
for (const [key, value] of Object.entries(summarize)) {
|
|
99
|
-
const data = value;
|
|
100
|
-
if ('uniqueProjects' in data) {
|
|
101
|
-
metaOut.write(`${JSON.stringify(key)},${data.uniqueProjects.size},${data.uniqueFiles.size},${(0, summarizer_1.summarizedMeasurement2Csv)((0, summarizer_1.summarizeMeasurement)(data.count))}\n`);
|
|
102
|
-
continue;
|
|
103
|
-
}
|
|
104
|
-
writeSingleOrDoubleBrackets(data, outputPath, key);
|
|
105
|
-
}
|
|
106
|
-
metaOut.close();
|
|
107
|
-
}
|
|
108
|
-
//# sourceMappingURL=post-process.js.map
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import type { Feature } from '../../feature';
|
|
2
|
-
import type { Writable } from 'ts-essentials';
|
|
3
|
-
import type { MergeableRecord } from '../../../../util/objects';
|
|
4
|
-
import { SourcePosition } from '../../../../util/range';
|
|
5
|
-
declare const initialFunctionDefinitionInfo: {
|
|
6
|
-
/** all, anonymous, assigned, non-assigned, ... */
|
|
7
|
-
total: number;
|
|
8
|
-
/** how many are really using OP-Lambda? */
|
|
9
|
-
lambdasOnly: number;
|
|
10
|
-
/** using `<<-`, `<-`, `=`, `->` `->>` */
|
|
11
|
-
assignedFunctions: number;
|
|
12
|
-
nestedFunctions: number;
|
|
13
|
-
/** functions that in some easily detectable way call themselves */
|
|
14
|
-
recursive: number;
|
|
15
|
-
deepestNesting: number;
|
|
16
|
-
};
|
|
17
|
-
export type FunctionDefinitionInfo = Writable<typeof initialFunctionDefinitionInfo>;
|
|
18
|
-
export declare const AllDefinitionsFileBase = "all-definitions";
|
|
19
|
-
export interface SingleFunctionDefinitionInformation extends MergeableRecord {
|
|
20
|
-
location: SourcePosition;
|
|
21
|
-
/** locations of all direct call sites */
|
|
22
|
-
callsites: SourcePosition[];
|
|
23
|
-
numberOfParameters: number;
|
|
24
|
-
returns: {
|
|
25
|
-
location: SourcePosition;
|
|
26
|
-
}[];
|
|
27
|
-
length: {
|
|
28
|
-
lines: number;
|
|
29
|
-
characters: number;
|
|
30
|
-
nonWhitespaceCharacters: number;
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
export declare const definedFunctions: Feature<FunctionDefinitionInfo>;
|
|
34
|
-
export {};
|