@eagleoutice/flowr 2.10.10 → 2.11.1

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.
Files changed (223) hide show
  1. package/README.md +35 -27
  2. package/cli/common/options.d.ts +2 -108
  3. package/cli/common/options.js +3 -27
  4. package/cli/common/scripts-info.d.ts +2 -123
  5. package/cli/common/scripts-info.js +0 -17
  6. package/cli/flowr-main-options.d.ts +5 -0
  7. package/cli/flowr-main-options.js +10 -0
  8. package/cli/flowr.js +2 -2
  9. package/cli/repl/commands/repl-commands.js +7 -6
  10. package/cli/repl/print-version.d.ts +3 -1
  11. package/cli/repl/print-version.js +21 -2
  12. package/cli/repl/server/connection.d.ts +2 -0
  13. package/cli/repl/server/connection.js +40 -31
  14. package/cli/script-core/summarizer-core.js +13 -32
  15. package/cli/wiki.d.ts +2 -1
  16. package/cli/wiki.js +2 -0
  17. package/config.d.ts +9 -0
  18. package/config.js +10 -0
  19. package/control-flow/semantic-cfg-guided-visitor.js +1 -0
  20. package/core/steps/pipeline/default-pipelines.d.ts +146 -146
  21. package/data/pkgdb/pkgdb-latest.json.br +0 -0
  22. package/data/pkgdb/pkgdb-tiny.json.br +0 -0
  23. package/dataflow/environments/append.d.ts +1 -2
  24. package/dataflow/environments/append.js +3 -10
  25. package/dataflow/environments/apply-kill.d.ts +21 -0
  26. package/dataflow/environments/apply-kill.js +155 -0
  27. package/dataflow/environments/built-in-proc-name.d.ts +2 -0
  28. package/dataflow/environments/built-in-proc-name.js +2 -0
  29. package/dataflow/environments/built-in.d.ts +2 -0
  30. package/dataflow/environments/built-in.js +2 -0
  31. package/dataflow/environments/default-builtin-config.d.ts +63 -3
  32. package/dataflow/environments/default-builtin-config.js +40 -8
  33. package/dataflow/environments/environment.d.ts +49 -32
  34. package/dataflow/environments/environment.js +133 -18
  35. package/dataflow/environments/identifier.d.ts +10 -0
  36. package/dataflow/environments/identifier.js +23 -0
  37. package/dataflow/environments/overwrite.js +2 -10
  38. package/dataflow/environments/resolve-by-name.d.ts +1 -1
  39. package/dataflow/environments/resolve-by-name.js +10 -2
  40. package/dataflow/environments/scoping.d.ts +9 -2
  41. package/dataflow/environments/scoping.js +15 -2
  42. package/dataflow/extractor.js +23 -2
  43. package/dataflow/graph/df-helper.d.ts +8 -0
  44. package/dataflow/graph/df-helper.js +8 -0
  45. package/dataflow/graph/graph.d.ts +4 -1
  46. package/dataflow/graph/graph.js +5 -1
  47. package/dataflow/info.d.ts +26 -0
  48. package/dataflow/internal/process/functions/call/built-in/built-in-access.js +7 -5
  49. package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +19 -0
  50. package/dataflow/internal/process/functions/call/built-in/built-in-attach.d.ts +1 -8
  51. package/dataflow/internal/process/functions/call/built-in/built-in-attach.js +7 -13
  52. package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.d.ts +9 -48
  53. package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.js +30 -47
  54. package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +17 -0
  55. package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +6 -1
  56. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.d.ts +2 -2
  57. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +8 -1
  58. package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.js +9 -0
  59. package/dataflow/internal/process/functions/call/built-in/built-in-library.d.ts +37 -3
  60. package/dataflow/internal/process/functions/call/built-in/built-in-library.js +391 -21
  61. package/dataflow/internal/process/functions/call/built-in/built-in-rm.d.ts +2 -1
  62. package/dataflow/internal/process/functions/call/built-in/built-in-rm.js +131 -48
  63. package/dataflow/internal/process/functions/call/built-in/built-in-stack-env.d.ts +25 -0
  64. package/dataflow/internal/process/functions/call/built-in/built-in-stack-env.js +94 -0
  65. package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.js +10 -3
  66. package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.d.ts +30 -0
  67. package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.js +279 -0
  68. package/dataflow/internal/process/functions/call/named-call-handling.d.ts +1 -1
  69. package/dataflow/internal/process/functions/call/named-call-handling.js +17 -0
  70. package/documentation/data/faq/faqs.js +3 -0
  71. package/documentation/data/interface/doc-writing-code.js +4 -80
  72. package/documentation/doc-util/doc-structure.js +1 -2
  73. package/documentation/wiki-core.js +2 -1
  74. package/documentation/wiki-dataflow-graph.js +35 -1
  75. package/documentation/wiki-interface.js +2 -2
  76. package/documentation/wiki-linter.js +2 -0
  77. package/documentation/wiki-overview.js +1 -14
  78. package/documentation/wiki-package-database.d.ts +9 -0
  79. package/documentation/wiki-package-database.js +63 -0
  80. package/documentation/wiki-query.js +1 -0
  81. package/linter/linter-rules.d.ts +23 -0
  82. package/linter/linter-rules.js +3 -1
  83. package/linter/rules/absolute-path.js +2 -1
  84. package/linter/rules/undefined-symbol.d.ts +39 -0
  85. package/linter/rules/undefined-symbol.js +80 -0
  86. package/package.json +4 -4
  87. package/project/cache/flowr-analyzer-cache.d.ts +2 -0
  88. package/project/cache/flowr-analyzer-cache.js +9 -1
  89. package/project/context/flowr-analyzer-dependencies-context.d.ts +16 -8
  90. package/project/context/flowr-analyzer-dependencies-context.js +39 -4
  91. package/project/context/flowr-analyzer-environment-context.d.ts +2 -4
  92. package/project/context/flowr-analyzer-environment-context.js +3 -4
  93. package/project/context/flowr-analyzer-files-context.d.ts +1 -0
  94. package/project/context/flowr-file.d.ts +2 -0
  95. package/project/context/flowr-file.js +2 -0
  96. package/project/flowr-analyzer-builder.js +3 -0
  97. package/project/flowr-analyzer.d.ts +2 -1
  98. package/project/flowr-analyzer.js +3 -1
  99. package/project/plugins/file-plugins/files/flowr-namespace-file.d.ts +13 -15
  100. package/project/plugins/file-plugins/files/flowr-namespace-file.js +36 -13
  101. package/project/plugins/file-plugins/flowr-analyzer-virtualenv-file-plugin.d.ts +27 -0
  102. package/project/plugins/file-plugins/flowr-analyzer-virtualenv-file-plugin.js +41 -0
  103. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-lockfile-plugin.d.ts +18 -0
  104. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-lockfile-plugin.js +62 -0
  105. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-pkgdb-plugin.d.ts +63 -0
  106. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-pkgdb-plugin.js +176 -0
  107. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-plugin.d.ts +10 -0
  108. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-plugin.js +6 -0
  109. package/project/plugins/package-version-plugins/package.d.ts +3 -0
  110. package/project/plugins/package-version-plugins/package.js +12 -0
  111. package/project/plugins/package-version-plugins/pkgdb.d.ts +133 -0
  112. package/project/plugins/package-version-plugins/pkgdb.js +370 -0
  113. package/project/plugins/plugin-registry.d.ts +4 -1
  114. package/project/plugins/plugin-registry.js +7 -0
  115. package/queries/catalog/call-context-query/call-context-query-executor.js +8 -0
  116. package/queries/catalog/call-context-query/call-context-query-format.d.ts +2 -0
  117. package/queries/catalog/call-context-query/call-context-query-format.js +1 -0
  118. package/queries/catalog/call-context-query/identify-link-to-last-call-relation.js +8 -0
  119. package/queries/catalog/dependencies-query/dependencies-query-executor.js +31 -3
  120. package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +3 -1
  121. package/queries/catalog/dependencies-query/dependencies-query-format.js +3 -2
  122. package/queries/catalog/dependencies-query/function-info/function-info.d.ts +1 -1
  123. package/queries/catalog/dependencies-query/function-info/other-path-functions.d.ts +2 -0
  124. package/queries/catalog/dependencies-query/function-info/other-path-functions.js +27 -0
  125. package/queries/catalog/dependencies-query/function-info/read-functions.js +5 -4
  126. package/queries/catalog/dependencies-query/function-info/visualize-functions.js +3 -1
  127. package/queries/catalog/linter-query/linter-query-executor.js +1 -0
  128. package/r-bridge/data/data.d.ts +2 -2
  129. package/r-bridge/data/data.js +2 -2
  130. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-executor.js +13 -4
  131. package/search/search-executor/search-enrichers.d.ts +1 -1
  132. package/search/search-executor/search-enrichers.js +7 -4
  133. package/util/mermaid/mermaid.d.ts +4 -0
  134. package/util/mermaid/mermaid.js +8 -1
  135. package/util/text/ansi.d.ts +10 -1
  136. package/util/text/ansi.js +17 -4
  137. package/util/version.js +10 -2
  138. package/cli/common/features.d.ts +0 -9
  139. package/cli/common/features.js +0 -35
  140. package/cli/script-core/statistics-core.d.ts +0 -6
  141. package/cli/script-core/statistics-core.js +0 -104
  142. package/cli/script-core/statistics-helper-core.d.ts +0 -6
  143. package/cli/script-core/statistics-helper-core.js +0 -86
  144. package/cli/statistics-app.d.ts +0 -11
  145. package/cli/statistics-app.js +0 -16
  146. package/cli/statistics-helper-app.d.ts +0 -11
  147. package/cli/statistics-helper-app.js +0 -14
  148. package/statistics/features/common-syntax-probability.d.ts +0 -38
  149. package/statistics/features/common-syntax-probability.js +0 -169
  150. package/statistics/features/feature.d.ts +0 -179
  151. package/statistics/features/feature.js +0 -38
  152. package/statistics/features/post-processing.d.ts +0 -18
  153. package/statistics/features/post-processing.js +0 -26
  154. package/statistics/features/supported/assignments/assignments.d.ts +0 -12
  155. package/statistics/features/supported/assignments/assignments.js +0 -56
  156. package/statistics/features/supported/assignments/post-process.d.ts +0 -6
  157. package/statistics/features/supported/assignments/post-process.js +0 -126
  158. package/statistics/features/supported/comments/comments.d.ts +0 -18
  159. package/statistics/features/supported/comments/comments.js +0 -143
  160. package/statistics/features/supported/comments/post-process.d.ts +0 -6
  161. package/statistics/features/supported/comments/post-process.js +0 -51
  162. package/statistics/features/supported/control-flow/control-flow.d.ts +0 -17
  163. package/statistics/features/supported/control-flow/control-flow.js +0 -69
  164. package/statistics/features/supported/control-flow/post-process.d.ts +0 -6
  165. package/statistics/features/supported/control-flow/post-process.js +0 -66
  166. package/statistics/features/supported/data-access/data-access.d.ts +0 -15
  167. package/statistics/features/supported/data-access/data-access.js +0 -122
  168. package/statistics/features/supported/data-access/post-process.d.ts +0 -6
  169. package/statistics/features/supported/data-access/post-process.js +0 -108
  170. package/statistics/features/supported/defined-functions/defined-functions.d.ts +0 -34
  171. package/statistics/features/supported/defined-functions/defined-functions.js +0 -145
  172. package/statistics/features/supported/defined-functions/post-process.d.ts +0 -6
  173. package/statistics/features/supported/defined-functions/post-process.js +0 -168
  174. package/statistics/features/supported/expression-list/post-process.d.ts +0 -6
  175. package/statistics/features/supported/expression-list/post-process.js +0 -45
  176. package/statistics/features/supported/expression-list/statistics-expression-list.d.ts +0 -9
  177. package/statistics/features/supported/expression-list/statistics-expression-list.js +0 -37
  178. package/statistics/features/supported/loops/loops.d.ts +0 -20
  179. package/statistics/features/supported/loops/loops.js +0 -81
  180. package/statistics/features/supported/loops/post-process.d.ts +0 -6
  181. package/statistics/features/supported/loops/post-process.js +0 -73
  182. package/statistics/features/supported/used-functions/post-process.d.ts +0 -6
  183. package/statistics/features/supported/used-functions/post-process.js +0 -176
  184. package/statistics/features/supported/used-functions/used-functions.d.ts +0 -24
  185. package/statistics/features/supported/used-functions/used-functions.js +0 -99
  186. package/statistics/features/supported/used-packages/post-process.d.ts +0 -6
  187. package/statistics/features/supported/used-packages/post-process.js +0 -122
  188. package/statistics/features/supported/used-packages/used-packages.d.ts +0 -16
  189. package/statistics/features/supported/used-packages/used-packages.js +0 -140
  190. package/statistics/features/supported/values/post-process.d.ts +0 -6
  191. package/statistics/features/supported/values/post-process.js +0 -73
  192. package/statistics/features/supported/values/values.d.ts +0 -14
  193. package/statistics/features/supported/values/values.js +0 -111
  194. package/statistics/features/supported/variables/post-process.d.ts +0 -15
  195. package/statistics/features/supported/variables/post-process.js +0 -126
  196. package/statistics/features/supported/variables/variables.d.ts +0 -15
  197. package/statistics/features/supported/variables/variables.js +0 -62
  198. package/statistics/meta-statistics.d.ts +0 -32
  199. package/statistics/meta-statistics.js +0 -16
  200. package/statistics/output/file-provider.d.ts +0 -36
  201. package/statistics/output/file-provider.js +0 -96
  202. package/statistics/output/print-stats.d.ts +0 -29
  203. package/statistics/output/print-stats.js +0 -81
  204. package/statistics/output/statistics-file.d.ts +0 -36
  205. package/statistics/output/statistics-file.js +0 -68
  206. package/statistics/statistics.d.ts +0 -29
  207. package/statistics/statistics.js +0 -108
  208. package/statistics/summarizer/auto-detect.d.ts +0 -5
  209. package/statistics/summarizer/auto-detect.js +0 -34
  210. package/statistics/summarizer/first-phase/process.d.ts +0 -6
  211. package/statistics/summarizer/first-phase/process.js +0 -81
  212. package/statistics/summarizer/post-process/clusterer.d.ts +0 -25
  213. package/statistics/summarizer/post-process/clusterer.js +0 -40
  214. package/statistics/summarizer/post-process/file-based-count.d.ts +0 -16
  215. package/statistics/summarizer/post-process/file-based-count.js +0 -47
  216. package/statistics/summarizer/post-process/histogram.d.ts +0 -57
  217. package/statistics/summarizer/post-process/histogram.js +0 -126
  218. package/statistics/summarizer/post-process/post-process-output.d.ts +0 -14
  219. package/statistics/summarizer/post-process/post-process-output.js +0 -102
  220. package/statistics/summarizer/second-phase/process.d.ts +0 -15
  221. package/statistics/summarizer/second-phase/process.js +0 -118
  222. package/statistics/summarizer/summarizer.d.ts +0 -34
  223. package/statistics/summarizer/summarizer.js +0 -141
@@ -1,176 +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 path_1 = __importDefault(require("path"));
9
- const fs_1 = __importDefault(require("fs"));
10
- const used_functions_1 = require("./used-functions");
11
- const summarizer_1 = require("../../../../util/summarizer");
12
- const files_1 = require("../../../../util/files");
13
- const time_1 = require("../../../../util/text/time");
14
- const numbers_1 = require("../../../../util/numbers");
15
- function retrieveFunctionCallInformation(featureRoot, info, config, outputPath) {
16
- // each number[][] contains a 'number[]' per file
17
- /**
18
- * maps fn-name (including namespace) to number of arguments and their location (the number of elements in the array give the number of total call)
19
- * we use tuples to reduce the memory!
20
- * A function that is defined within the file is _always_ decorated with the filename (as second array element)!
21
- */
22
- const functionsPerFile = new Map();
23
- const importantFunctions = new Map(['parse',
24
- 'eval',
25
- 'deparse',
26
- 'quote',
27
- 'body',
28
- 'formals',
29
- 'body',
30
- 'environment',
31
- 'new.env',
32
- 'assign',
33
- 'get',
34
- 'setGeneric',
35
- 'R6Class'].map(name => [name, fs_1.default.createWriteStream(path_1.default.join(outputPath, `${name}.csv`))]));
36
- for (const [, value] of importantFunctions) {
37
- value.write('filepath,location,namespace,inspected by,classification,notes\n');
38
- }
39
- // we collect only `all-calls`
40
- (0, files_1.readLineByLineSync)(path_1.default.join(featureRoot, `${used_functions_1.AllCallsFileBase}.txt`), (line, lineNumber) => processNextLine(functionsPerFile, lineNumber, info, JSON.parse(String(line)), config, importantFunctions));
41
- for (const [, value] of importantFunctions) {
42
- value.close();
43
- }
44
- importantFunctions.clear();
45
- console.log(` [${(0, time_1.date2string)(new Date())}] Used functions process completed, start to write out function info`);
46
- const fnOutStream = fs_1.default.createWriteStream(path_1.default.join(outputPath, 'function-calls.csv'));
47
- const prefixes = ['total', 'args', 'line-frac'];
48
- const others = prefixes.flatMap(summarizer_1.summarizedMeasurement2CsvHeader).join(',');
49
- fnOutStream.write(`function,unique-projects,unique-files,${others}\n`);
50
- for (const [key, [uniqueProjects, uniqueFiles, total, args, lineFrac]] of functionsPerFile.entries()) {
51
- const totalSum = (0, summarizer_1.summarizeMeasurement)(total.flat(), info.size);
52
- const argsSum = (0, summarizer_1.summarizeMeasurement)(args.flat(), info.size);
53
- const lineFracSum = (0, summarizer_1.summarizeMeasurement)(lineFrac.flat());
54
- // we write in csv style :), we escape the key in case it contains commas (with filenames) etc.
55
- fnOutStream.write(`${JSON.stringify(key ?? 'unknown')},${uniqueProjects.size},${uniqueFiles.size},${(0, summarizer_1.summarizedMeasurement2Csv)(totalSum)},${(0, summarizer_1.summarizedMeasurement2Csv)(argsSum)},${(0, summarizer_1.summarizedMeasurement2Csv)(lineFracSum)}\n`);
56
- }
57
- fnOutStream.close();
58
- }
59
- function writeFunctionCallsMetaInformationToCsv(outputPath, data) {
60
- const out = fs_1.default.createWriteStream(path_1.default.join(outputPath, 'function-calls-meta.csv'));
61
- out.write(`kind,unique-projects,unique-files,${(0, summarizer_1.summarizedMeasurement2CsvHeader)()}\n`);
62
- out.write(`average-call,${(0, summarizer_1.summarizedMeasurement2Csv)((0, summarizer_1.summarizeMeasurement)(data.averageCall.flat()))}\n`);
63
- out.write(`nested-calls,${(0, summarizer_1.summarizedMeasurement2Csv)((0, summarizer_1.summarizeMeasurement)(data.nestedCalls.flat()))}\n`);
64
- out.write(`deepest-nesting,${(0, summarizer_1.summarizedMeasurement2Csv)((0, summarizer_1.summarizeMeasurement)(data.deepestNesting.flat()))}\n`);
65
- out.write(`empty-args,${(0, summarizer_1.summarizedMeasurement2Csv)((0, summarizer_1.summarizeMeasurement)(data.emptyArgs.flat()))}\n`);
66
- out.write(`unnamed-calls,${(0, summarizer_1.summarizedMeasurement2Csv)((0, summarizer_1.summarizeMeasurement)(data.unnamedCalls.flat()))}\n`);
67
- out.close();
68
- }
69
- function retrieveFunctionCallMetaInformation(info, outputPath) {
70
- const data = {
71
- averageCall: [],
72
- nestedCalls: [],
73
- deepestNesting: [],
74
- emptyArgs: [],
75
- unnamedCalls: [],
76
- args: []
77
- };
78
- for (const meta of info.values()) {
79
- const us = meta.usedFunctions;
80
- data.averageCall.push([us.allFunctionCalls]);
81
- data.nestedCalls.push([us.nestedFunctionCalls]);
82
- data.deepestNesting.push([us.deepestNesting]);
83
- data.emptyArgs.push([(0, numbers_1.bigint2number)(us.args[0])]);
84
- data.unnamedCalls.push([us.unnamedCalls]);
85
- for (const [i, val] of Object.entries(us.args)) {
86
- if (Number(i) !== 0) {
87
- let get = data.args[Number(i)];
88
- if (!get) {
89
- get = (0, common_syntax_probability_1.emptyCommonSyntaxTypeCounts)(() => []);
90
- data.args[Number(i)] = get;
91
- }
92
- (0, common_syntax_probability_1.appendCommonSyntaxTypeCounter)(get, val);
93
- }
94
- }
95
- }
96
- console.log(` [${(0, time_1.date2string)(new Date())}] Used functions metadata reading completed, summarizing and writing to file`);
97
- writeFunctionCallsMetaInformationToCsv(outputPath, data);
98
- for (const [index, arg] of data.args.entries()) {
99
- if (!arg) {
100
- // we treat the first/0-argument entry separate for legacy reasons
101
- continue;
102
- }
103
- const out = fs_1.default.createWriteStream(path_1.default.join(outputPath, `function-calls-arg-${index}.csv`));
104
- out.write(`kind,name,${(0, summarizer_1.summarizedMeasurement2CsvHeader)()}\n`);
105
- for (const [name, vals] of Object.entries(arg)) {
106
- if (Array.isArray(vals)) {
107
- out.write(`${JSON.stringify(name)},"",${(0, summarizer_1.summarizedMeasurement2Csv)((0, summarizer_1.summarizeMeasurement)(vals.flat()))}\n`);
108
- }
109
- else {
110
- for (const [keyName, keyValue] of Object.entries(vals)) {
111
- out.write(`${JSON.stringify(name)},${JSON.stringify(keyName)},${(0, summarizer_1.summarizedMeasurement2Csv)((0, summarizer_1.summarizeMeasurement)(keyValue.flat()))}\n`);
112
- }
113
- }
114
- }
115
- out.close();
116
- }
117
- }
118
- /**
119
- * Note: the summary does not contain a 0 for each function that is _not_ called by a file. Hence, the minimum can not be 0 (division for mean etc. will still be performed on total file count)
120
- */
121
- function postProcess(featureRoot, info, outputPath, config) {
122
- retrieveFunctionCallInformation(featureRoot, info, config, outputPath);
123
- console.log(` [${(0, time_1.date2string)(new Date())}] Used functions reading completed, summarizing info...`);
124
- retrieveFunctionCallMetaInformation(info, outputPath);
125
- }
126
- function processNextLine(data, lineNumber, info, line, config, importants) {
127
- if (lineNumber % 2_500 === 0) {
128
- console.log(` [${(0, time_1.date2string)(new Date())}] Used functions processed ${lineNumber} lines`);
129
- }
130
- const [hits, context] = line;
131
- // group hits by fullname
132
- const groupedByFunctionName = new Map();
133
- for (const [name, loc, args, ns, known] of hits) {
134
- const importantWrite = name && importants.get(name);
135
- if (importantWrite) {
136
- importantWrite.write(`${JSON.stringify(context)},${loc?.[0] ?? '?'}:${loc?.[1] ?? '?'},${ns ?? '""'},,,\n`);
137
- }
138
- const fullname = ns && ns !== '' ? `${ns}::${name ?? ''}` : name;
139
- const key = (fullname ?? '') + (known === 1 ? '-' + (context ?? '') : '');
140
- const stats = info.get(context ?? '')?.stats.lines[0].length;
141
- let get = groupedByFunctionName.get(key);
142
- if (!get) {
143
- get = [new Set(), new Set(), [], [], []];
144
- groupedByFunctionName.set(key, get);
145
- }
146
- // we retrieve the first component fo the path
147
- const projectName = context?.split(path_1.default.sep)[config.projectSkip];
148
- get[0].add(projectName ?? '');
149
- get[1].add(context ?? '');
150
- get[2].push(1);
151
- get[3].push(args);
152
- if (loc && stats) {
153
- // we reduce by 1 to get flat 0% if it is the first line
154
- get[4].push(stats === 1 ? 1 : (loc[0] - 1) / (stats - 1));
155
- }
156
- }
157
- for (const [key, info] of groupedByFunctionName.entries()) {
158
- let get = data.get(key);
159
- if (!get) {
160
- get = [new Set(), new Set(), [], [], []];
161
- // an amazing empty structure :D
162
- data.set(key, get);
163
- }
164
- // for total, we only need the number of elements as it will always be one :D
165
- for (const context of info[0]) {
166
- get[0].add(context);
167
- }
168
- for (const context of info[1]) {
169
- get[1].add(context);
170
- }
171
- get[2].push([info[2].length]);
172
- get[3].push(info[3]);
173
- get[4].push(info[4]);
174
- }
175
- }
176
- //# sourceMappingURL=post-process.js.map
@@ -1,24 +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 initialFunctionUsageInfo: {
5
- allFunctionCalls: number;
6
- args: Record<number, bigint | CommonSyntaxTypeCounts>;
7
- /** `a(b(), c(3, d()))` has 3 (`b`, `c`, `d`) */
8
- nestedFunctionCalls: number;
9
- deepestNesting: number;
10
- unnamedCalls: number;
11
- };
12
- export type FunctionUsageInfo = Writable<typeof initialFunctionUsageInfo>;
13
- export declare const AllCallsFileBase = "all-calls";
14
- export declare const usedFunctions: Feature<FunctionUsageInfo>;
15
- export type FunctionCallInformation = [
16
- /** the name of the called function, or undefined if this was an unnamed function call */
17
- name: string | undefined,
18
- location: [line: number, character: number] | undefined,
19
- numberOfArguments: number,
20
- /** whether this was called from a namespace, like `a::b()` */
21
- namespace: string | undefined,
22
- knownDefinitionInFile: 0 | 1
23
- ];
24
- export {};
@@ -1,99 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.usedFunctions = exports.AllCallsFileBase = 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 statistics_file_1 = require("../../../output/statistics-file");
9
- const edge_1 = require("../../../../dataflow/graph/edge");
10
- const identifier_1 = require("../../../../dataflow/environments/identifier");
11
- const range_1 = require("../../../../util/range");
12
- const r_project_1 = require("../../../../r-bridge/lang-4.x/ast/model/nodes/r-project");
13
- const initialFunctionUsageInfo = {
14
- allFunctionCalls: 0,
15
- args: {
16
- // only if called without arguments
17
- 0: 0n,
18
- 1: (0, common_syntax_probability_1.emptyCommonSyntaxTypeCounts)()
19
- },
20
- /** `a(b(), c(3, d()))` has 3 (`b`, `c`, `d`) */
21
- nestedFunctionCalls: 0,
22
- deepestNesting: 0,
23
- unnamedCalls: 0
24
- };
25
- exports.AllCallsFileBase = 'all-calls';
26
- exports.usedFunctions = {
27
- name: 'Used Functions',
28
- description: 'All functions called, split into various sub-categories',
29
- process(existing, input) {
30
- visitCalls(existing, input);
31
- return existing;
32
- },
33
- initialValue: initialFunctionUsageInfo,
34
- postProcess: post_process_1.postProcess
35
- };
36
- function classifyArguments(args, existing) {
37
- if (args.length === 0) {
38
- existing[0]++;
39
- return;
40
- }
41
- let i = 1;
42
- for (const arg of args) {
43
- if (arg === undefined) {
44
- existing[0]++;
45
- continue;
46
- }
47
- existing[i] = (0, common_syntax_probability_1.updateCommonSyntaxTypeCounts)(existing[i] ?? (0, common_syntax_probability_1.emptyCommonSyntaxTypeCounts)(), arg);
48
- i++;
49
- }
50
- }
51
- function visitCalls(info, input) {
52
- const calls = [];
53
- const allCalls = [];
54
- r_project_1.RProject.visitAst(input.normalizedRAst.ast, node => {
55
- if (node.type !== type_1.RType.FunctionCall) {
56
- return;
57
- }
58
- if (calls.length > 0) {
59
- info.nestedFunctionCalls++;
60
- (0, statistics_file_1.appendStatisticsFile)(exports.usedFunctions.name, 'nested-calls', [node.lexeme], input.filepath);
61
- info.deepestNesting = Math.max(info.deepestNesting, calls.length);
62
- }
63
- const dataflowNode = input.dataflow.graph.get(node.info.id);
64
- let hasCallsEdge = false;
65
- if (dataflowNode) {
66
- hasCallsEdge = dataflowNode[1].values().some(e => edge_1.DfEdge.includesType(e, edge_1.EdgeType.Calls));
67
- }
68
- if (!node.named) {
69
- info.unnamedCalls++;
70
- (0, statistics_file_1.appendStatisticsFile)(exports.usedFunctions.name, 'unnamed-calls', [node.lexeme], input.filepath);
71
- allCalls.push([
72
- undefined,
73
- range_1.SourceRange.getStart(node.location),
74
- node.arguments.length,
75
- '',
76
- hasCallsEdge ? 1 : 0
77
- ]);
78
- }
79
- else {
80
- allCalls.push([
81
- node.functionName.lexeme,
82
- range_1.SourceRange.getStart(node.location),
83
- node.arguments.length,
84
- identifier_1.Identifier.getNamespace(node.functionName.content) ?? '',
85
- hasCallsEdge ? 1 : 0
86
- ]);
87
- }
88
- classifyArguments(node.arguments.map(e => (0, unpack_argument_1.unpackNonameArg)(e)), info.args);
89
- calls.push(node);
90
- }, node => {
91
- // drop again :D
92
- if (node.type === type_1.RType.FunctionCall) {
93
- calls.pop();
94
- }
95
- });
96
- info.allFunctionCalls += allCalls.length;
97
- (0, statistics_file_1.appendStatisticsFile)(exports.usedFunctions.name, exports.AllCallsFileBase, allCalls, input.filepath);
98
- }
99
- //# sourceMappingURL=used-functions.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,122 +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 post_processing_1 = require("../../post-processing");
8
- const used_packages_1 = require("./used-packages");
9
- const fs_1 = __importDefault(require("fs"));
10
- const path_1 = __importDefault(require("path"));
11
- const summarizer_1 = require("../../../../util/summarizer");
12
- const files_1 = require("../../../../util/files");
13
- const strings_1 = require("../../../../util/text/strings");
14
- const arrays_1 = require("../../../../util/collections/arrays");
15
- /**
16
- *
17
- */
18
- function postProcess(featureRoot, info, outputPath, config) {
19
- const collected = {};
20
- for (const [filepath, data] of info.entries()) {
21
- const value = data.usedPackages;
22
- for (const [key, val] of Object.entries(value)) {
23
- let get = collected[key];
24
- if (!get) {
25
- get = (0, post_processing_1.emptySummarizedWithProject)();
26
- collected[key] = get;
27
- }
28
- get.count.push(val);
29
- if (val > 0) {
30
- (0, post_processing_1.recordFilePath)(get, filepath, config);
31
- }
32
- }
33
- }
34
- const variablesOutStream = fs_1.default.createWriteStream(path_1.default.join(outputPath, 'loading-functions.csv'));
35
- variablesOutStream.write(`kind,unique-projects,unique-files,${(0, summarizer_1.summarizedMeasurement2CsvHeader)()}\n`);
36
- for (const [key, val] of Object.entries(collected)) {
37
- const data = val;
38
- const sum = (0, summarizer_1.summarizeMeasurement)(data.count);
39
- variablesOutStream.write(`${JSON.stringify(key)},${data.uniqueProjects.size},${data.uniqueFiles.size},${(0, summarizer_1.summarizedMeasurement2Csv)(sum)}\n`);
40
- }
41
- variablesOutStream.close();
42
- // now we want to collect the names of the loaded libraries,
43
- // we collect and store them separately (per kind) but also, we want store the summarized results in the end!
44
- const loadedLibraries = new Map();
45
- for (const key of Object.keys(used_packages_1.initialUsedPackageInfos)) {
46
- const data = retrieveDataForLoad(key, featureRoot, outputPath, config);
47
- for (const [name, val] of data.entries()) {
48
- let get = loadedLibraries.get(name);
49
- if (!get) {
50
- get = (0, post_processing_1.emptySummarizedWithProject)();
51
- loadedLibraries.set(name, get);
52
- }
53
- get.count.push(...val.count);
54
- for (const uniqueFile of val.uniqueFiles) {
55
- get.uniqueFiles.add(uniqueFile);
56
- }
57
- for (const uniqueProject of val.uniqueProjects) {
58
- get.uniqueProjects.add(uniqueProject);
59
- }
60
- }
61
- }
62
- const output = path_1.default.join(outputPath, 'all-operators.csv');
63
- const out = fs_1.default.createWriteStream(output);
64
- out.write(`kind,unique-projects,unique-files,${(0, summarizer_1.summarizedMeasurement2CsvHeader)()}\n`);
65
- for (const [key, val] of loadedLibraries.entries()) {
66
- const { count, uniqueProjects, uniqueFiles } = val;
67
- const sum = (0, summarizer_1.summarizeMeasurement)(count);
68
- out.write(`${JSON.stringify(key)},${uniqueProjects.size},${uniqueFiles.size},${(0, summarizer_1.summarizedMeasurement2Csv)(sum)}\n`);
69
- }
70
- out.close();
71
- }
72
- // directly writes the results to the output path
73
- function retrieveDataForLoad(operator, readFromPath, outputPath, config) {
74
- const input = path_1.default.join(readFromPath, `${operator}.txt`);
75
- if (!fs_1.default.existsSync(input)) {
76
- // if there is nothing with this, just return :)
77
- return new Map();
78
- }
79
- const collected = new Map();
80
- (0, files_1.readLineByLineSync)(input, (line, lineNumber) => {
81
- if (line.length === 0) {
82
- return;
83
- }
84
- if (lineNumber % 2_500 === 0) {
85
- console.log(` Processing line ${lineNumber} from ${input}`);
86
- }
87
- const [packages, context] = JSON.parse(line.toString());
88
- // first, we have to collect what this file gives us
89
- // we normalize surrounding quotation marks
90
- const bag = (0, arrays_1.array2bag)(packages.map(p => {
91
- if ((0, strings_1.startAndEndsWith)(p, '"') || (0, strings_1.startAndEndsWith)(p, "'") || (0, strings_1.startAndEndsWith)(p, '`')) {
92
- return p.slice(1, -1);
93
- }
94
- else {
95
- return p;
96
- }
97
- }));
98
- // now we merge it into the global map (oh gosh this is so horrible
99
- for (const [name, count] of bag.entries()) {
100
- let get = collected.get(name);
101
- if (!get) {
102
- get = (0, post_processing_1.emptySummarizedWithProject)();
103
- collected.set(name, get);
104
- }
105
- get.count.push(count);
106
- if (count > 0) {
107
- (0, post_processing_1.recordFilePath)(get, context, config);
108
- }
109
- }
110
- });
111
- const output = path_1.default.join(outputPath, `${operator}.csv`);
112
- const out = fs_1.default.createWriteStream(output);
113
- out.write(`kind,unique-projects,unique-files,${(0, summarizer_1.summarizedMeasurement2CsvHeader)()}\n`);
114
- for (const [key, val] of collected.entries()) {
115
- const { count, uniqueProjects, uniqueFiles } = val;
116
- const sum = (0, summarizer_1.summarizeMeasurement)(count);
117
- out.write(`${JSON.stringify(key)},${uniqueProjects.size},${uniqueFiles.size},${(0, summarizer_1.summarizedMeasurement2Csv)(sum)}\n`);
118
- }
119
- out.close();
120
- return collected;
121
- }
122
- //# sourceMappingURL=post-process.js.map
@@ -1,16 +0,0 @@
1
- import type { Feature } from '../../feature';
2
- import type { Writable } from 'ts-essentials';
3
- export declare const initialUsedPackageInfos: {
4
- library: number;
5
- require: number;
6
- loadNamespace: number;
7
- requireNamespace: number;
8
- attachNamespace: number;
9
- withinApply: number;
10
- '::': number;
11
- ':::': number;
12
- /** just contains all occurrences where it is impossible to statically determine which package is loaded */
13
- '<loadedByVariable>': number;
14
- };
15
- export type UsedPackageInfo = Writable<typeof initialUsedPackageInfos>;
16
- export declare const usedPackages: Feature<UsedPackageInfo>;
@@ -1,140 +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.usedPackages = exports.initialUsedPackageInfos = void 0;
37
- const xpath = __importStar(require("xpath-ts2"));
38
- const post_process_1 = require("./post-process");
39
- const statistics_file_1 = require("../../../output/statistics-file");
40
- exports.initialUsedPackageInfos = {
41
- library: 0,
42
- require: 0,
43
- loadNamespace: 0,
44
- requireNamespace: 0,
45
- attachNamespace: 0,
46
- withinApply: 0,
47
- '::': 0,
48
- ':::': 0,
49
- /** just contains all occurrences where it is impossible to statically determine which package is loaded */
50
- '<loadedByVariable>': 0
51
- };
52
- // based on the extraction routine of lintr search for function calls which are not character-loads (we can not trace those...)
53
- const withinApply = xpath.parse(`
54
- //SYMBOL_FUNCTION_CALL[contains(.,"apply")]/../..
55
- //SYMBOL[text()='require' or text()='library' or text()='loadNamespace' or text()='requireNamespace' or text()='attachNamespace']
56
- /../..
57
- `);
58
- // horrible ways I found exploratively like loading within `sapply`
59
- const libraryOrRequire = xpath.parse(`
60
- //SYMBOL_FUNCTION_CALL[text() = $variable]
61
- /parent::expr
62
- /parent::expr[
63
- expr[2][STR_CONST]
64
- or (
65
- expr[2][SYMBOL]
66
- and not(
67
- SYMBOL_SUB[text() = 'character.only']
68
- /following-sibling::expr[1]
69
- /NUM_CONST[text() = 'TRUE' or text() = 'T']
70
- )
71
- )
72
- ]/OP-LEFT-PAREN[1]/following-sibling::expr[1][SYMBOL | STR_CONST]
73
- `);
74
- // there is no except in xpath 1.0?
75
- const packageLoadedWithVariableLoadRequire = xpath.parse(`
76
- //SYMBOL_FUNCTION_CALL[text() = 'library' or text() = 'require']
77
- /parent::expr
78
- /parent::expr[
79
- expr[2][SYMBOL]
80
- and (
81
- SYMBOL_SUB[text() = 'character.only']
82
- /following-sibling::expr[1]
83
- /NUM_CONST[text() = 'TRUE' or text() = 'T']
84
- )
85
- ]/OP-LEFT-PAREN[1]/following-sibling::expr[1][SYMBOL | STR_CONST]
86
- `);
87
- const packageLoadedWithVariableNamespaces = xpath.parse(`
88
- //SYMBOL_FUNCTION_CALL[text() = 'loadNamespace' or text() = 'requireNamespace' or text() = 'attachNamespace']/../following-sibling::expr[1][SYMBOL]
89
- `);
90
- const queryForFunctionCall = xpath.parse(`
91
- //SYMBOL_FUNCTION_CALL[text() = $variable]/../following-sibling::expr[1][STR_CONST]
92
- `);
93
- // otherwise, the parser seems to fail
94
- const queryForNsAccess = xpath.parse(`
95
- //NS_GET[text() = $variable]/../SYMBOL_PACKAGE[1]
96
- |
97
- //NS_GET_INT[text() = $variable]/../SYMBOL_PACKAGE[1]
98
- `);
99
- const queries = [
100
- {
101
- types: ['library', 'require'],
102
- query: libraryOrRequire
103
- },
104
- {
105
- types: ['loadNamespace', 'requireNamespace', 'attachNamespace'],
106
- query: queryForFunctionCall
107
- },
108
- {
109
- types: ['::', ':::'],
110
- query: queryForNsAccess
111
- }
112
- ];
113
- exports.usedPackages = {
114
- name: 'Used Packages',
115
- description: 'All the packages used in the code',
116
- process(existing, input) {
117
- // we will unify in the end, so we can count, group etc. but we do not re-count multiple packages in the same file
118
- for (const q of queries) {
119
- for (const fn of q.types) {
120
- const nodes = q.query.select({ node: input.parsedRAst, variables: { variable: fn } });
121
- existing[fn] += nodes.length;
122
- (0, statistics_file_1.appendStatisticsFile)(this.name, fn, nodes, input.filepath, true);
123
- }
124
- }
125
- const nodesForVariableLoad = [
126
- ...packageLoadedWithVariableLoadRequire.select({ node: input.parsedRAst }),
127
- ...packageLoadedWithVariableNamespaces.select({ node: input.parsedRAst })
128
- ];
129
- existing['<loadedByVariable>'] += nodesForVariableLoad.length;
130
- // should not be unique as variables may be repeated, and we have no idea
131
- (0, statistics_file_1.appendStatisticsFile)(this.name, '<loadedByVariable>', nodesForVariableLoad, input.filepath);
132
- const withinApplyNodes = withinApply.select({ node: input.parsedRAst });
133
- existing.withinApply += withinApplyNodes.length;
134
- (0, statistics_file_1.appendStatisticsFile)(this.name, 'withinApply', withinApplyNodes, input.filepath);
135
- return existing;
136
- },
137
- initialValue: exports.initialUsedPackageInfos,
138
- postProcess: post_process_1.postProcess
139
- };
140
- //# sourceMappingURL=used-packages.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,73 +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 fs_1 = __importDefault(require("fs"));
8
- const path_1 = __importDefault(require("path"));
9
- const post_processing_1 = require("../../post-processing");
10
- const summarizer_1 = require("../../../../util/summarizer");
11
- const time_1 = require("../../../../util/text/time");
12
- const files_1 = require("../../../../util/files");
13
- const arrays_1 = require("../../../../util/collections/arrays");
14
- /**
15
- *
16
- */
17
- function postProcess(featureRoot, info, outputPath, config) {
18
- const collected = {};
19
- for (const [filepath, data] of info.entries()) {
20
- const value = data.values;
21
- for (const [key, val] of Object.entries(value)) {
22
- let get = collected[key];
23
- if (!get) {
24
- get = (0, post_processing_1.emptySummarizedWithProject)();
25
- collected[key] = get;
26
- }
27
- get.count.push(val);
28
- if (val > 0) {
29
- (0, post_processing_1.recordFilePath)(get, filepath, config);
30
- }
31
- }
32
- }
33
- const valuesOutStream = fs_1.default.createWriteStream(path_1.default.join(outputPath, 'values.csv'));
34
- valuesOutStream.write(`kind,unique-projects,unique-files,${(0, summarizer_1.summarizedMeasurement2CsvHeader)()}\n`);
35
- for (const [key, val] of Object.entries(collected)) {
36
- const data = val;
37
- const sum = (0, summarizer_1.summarizeMeasurement)(data.count);
38
- valuesOutStream.write(`${JSON.stringify(key)},${data.uniqueProjects.size},${data.uniqueFiles.size},${(0, summarizer_1.summarizedMeasurement2Csv)(sum)}\n`);
39
- }
40
- valuesOutStream.close();
41
- // now we read all numeric values to get the top used magic numbers (per file)
42
- const valueMap = new Map();
43
- (0, files_1.readLineByLineSync)(path_1.default.join(featureRoot, 'numeric.txt'), (line, lineNumber) => {
44
- if (line.length === 0) {
45
- return;
46
- }
47
- if (lineNumber % 2_500 === 0) {
48
- console.log(` [${(0, time_1.date2string)(new Date())}] Collecting numeric values ${lineNumber}`);
49
- }
50
- const [values, context] = JSON.parse(String(line));
51
- const bag = (0, arrays_1.array2bag)(values);
52
- for (const [key, val] of bag.entries()) {
53
- let get = valueMap.get(key);
54
- if (!get) {
55
- get = { count: [], uniqueFiles: new Set(), uniqueProjects: new Set() };
56
- valueMap.set(key, get);
57
- }
58
- get.count.push(val);
59
- if (val > 0) {
60
- get.uniqueFiles.add(context ?? '');
61
- get.uniqueProjects.add(context?.split(path_1.default.sep)[config.projectSkip] ?? '');
62
- }
63
- }
64
- });
65
- const magicNumbersOutStream = fs_1.default.createWriteStream(path_1.default.join(outputPath, 'magic-numbers.csv'));
66
- magicNumbersOutStream.write(`num,unique-projects,unique-files,${(0, summarizer_1.summarizedMeasurement2CsvHeader)()}\n`);
67
- for (const [key, val] of valueMap.entries()) {
68
- const sum = (0, summarizer_1.summarizeMeasurement)(val.count);
69
- magicNumbersOutStream.write(`${JSON.stringify(key)},${val.uniqueProjects.size},${val.uniqueFiles.size},${(0, summarizer_1.summarizedMeasurement2Csv)(sum)}\n`);
70
- }
71
- magicNumbersOutStream.close();
72
- }
73
- //# sourceMappingURL=post-process.js.map