@eagleoutice/flowr 2.10.9 → 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.
Files changed (417) hide show
  1. package/README.md +116 -38
  2. package/abstract-interpretation/absint-visitor.js +6 -3
  3. package/abstract-interpretation/domains/abstract-domain.d.ts +1 -1
  4. package/abstract-interpretation/domains/bounded-set-domain.d.ts +1 -1
  5. package/abstract-interpretation/domains/bounded-set-domain.js +1 -1
  6. package/abstract-interpretation/domains/interval-domain.d.ts +1 -1
  7. package/abstract-interpretation/domains/interval-domain.js +1 -1
  8. package/abstract-interpretation/domains/lattice.d.ts +1 -1
  9. package/abstract-interpretation/domains/partial-product-domain.d.ts +1 -1
  10. package/abstract-interpretation/domains/partial-product-domain.js +2 -2
  11. package/abstract-interpretation/domains/set-range-domain.d.ts +1 -1
  12. package/abstract-interpretation/domains/set-range-domain.js +1 -1
  13. package/abstract-interpretation/domains/set-upper-bound-domain.d.ts +1 -1
  14. package/abstract-interpretation/domains/set-upper-bound-domain.js +1 -1
  15. package/abstract-interpretation/domains/singleton-domain.d.ts +1 -1
  16. package/abstract-interpretation/domains/singleton-domain.js +1 -1
  17. package/abstract-interpretation/domains/state-abstract-domain.d.ts +1 -1
  18. package/abstract-interpretation/domains/state-abstract-domain.js +2 -2
  19. package/abstract-interpretation/unsupported-functions.d.ts +3 -2
  20. package/abstract-interpretation/unsupported-functions.js +38 -28
  21. package/cli/benchmark-app.js +2 -1
  22. package/cli/common/options.d.ts +2 -108
  23. package/cli/common/options.js +3 -27
  24. package/cli/common/script.js +3 -2
  25. package/cli/common/scripts-info.d.ts +2 -123
  26. package/cli/common/scripts-info.js +0 -17
  27. package/cli/flowr-main-options.d.ts +5 -0
  28. package/cli/flowr-main-options.js +10 -0
  29. package/cli/flowr.js +48 -11
  30. package/cli/repl/commands/repl-cfg.js +9 -9
  31. package/cli/repl/commands/repl-commands.js +5 -0
  32. package/cli/repl/commands/repl-dataflow.js +31 -24
  33. package/cli/repl/commands/repl-main.d.ts +6 -0
  34. package/cli/repl/commands/repl-normalize.js +15 -12
  35. package/cli/repl/commands/repl-parse.js +1 -1
  36. package/cli/repl/commands/repl-query.js +4 -5
  37. package/cli/repl/commands/repl-quit.js +2 -1
  38. package/cli/repl/core.d.ts +11 -0
  39. package/cli/repl/core.js +101 -3
  40. package/cli/repl/execute.js +3 -2
  41. package/cli/repl/parser/slice-query-parser.d.ts +16 -0
  42. package/cli/repl/parser/slice-query-parser.js +52 -0
  43. package/cli/repl/print-version.d.ts +3 -1
  44. package/cli/repl/print-version.js +21 -2
  45. package/cli/repl/server/connection.d.ts +3 -0
  46. package/cli/repl/server/connection.js +65 -31
  47. package/cli/repl/server/messages/message-analysis.d.ts +10 -0
  48. package/cli/repl/server/messages/message-analysis.js +6 -2
  49. package/cli/repl/server/messages/message-slice.d.ts +1 -1
  50. package/cli/script-core/summarizer-core.js +13 -32
  51. package/cli/wiki.d.ts +3 -1
  52. package/cli/wiki.js +6 -1
  53. package/config.d.ts +22 -10
  54. package/config.js +33 -7
  55. package/control-flow/diff-cfg.d.ts +1 -1
  56. package/control-flow/diff-cfg.js +1 -1
  57. package/control-flow/semantic-cfg-guided-visitor.js +2 -0
  58. package/control-flow/simple-visitor.js +6 -5
  59. package/control-flow/useless-loop.js +2 -2
  60. package/core/print/dataflow-printer.d.ts +2 -2
  61. package/core/print/dataflow-printer.js +2 -2
  62. package/core/steps/all/static-slicing/00-slice.js +1 -1
  63. package/data/pkgdb/pkgdb-latest.json.br +0 -0
  64. package/data/pkgdb/pkgdb-tiny.json.br +0 -0
  65. package/dataflow/environments/append.d.ts +2 -2
  66. package/dataflow/environments/append.js +4 -10
  67. package/dataflow/environments/apply-kill.d.ts +21 -0
  68. package/dataflow/environments/apply-kill.js +155 -0
  69. package/dataflow/environments/built-in-proc-name.d.ts +4 -0
  70. package/dataflow/environments/built-in-proc-name.js +4 -0
  71. package/dataflow/environments/built-in.d.ts +4 -0
  72. package/dataflow/environments/built-in.js +4 -0
  73. package/dataflow/environments/default-builtin-config.d.ts +183 -67
  74. package/dataflow/environments/default-builtin-config.js +358 -147
  75. package/dataflow/environments/environment.d.ts +49 -31
  76. package/dataflow/environments/environment.js +144 -25
  77. package/dataflow/environments/identifier.d.ts +65 -2
  78. package/dataflow/environments/identifier.js +37 -2
  79. package/dataflow/environments/overwrite.js +2 -10
  80. package/dataflow/environments/reference-to-maybe.d.ts +2 -0
  81. package/dataflow/environments/reference-to-maybe.js +56 -11
  82. package/dataflow/environments/resolve-by-name.d.ts +1 -1
  83. package/dataflow/environments/resolve-by-name.js +23 -9
  84. package/dataflow/environments/scoping.d.ts +9 -2
  85. package/dataflow/environments/scoping.js +15 -2
  86. package/dataflow/eval/values/general.js +4 -0
  87. package/dataflow/extractor.js +35 -4
  88. package/dataflow/graph/df-helper.d.ts +14 -0
  89. package/dataflow/graph/df-helper.js +41 -0
  90. package/dataflow/graph/graph.d.ts +4 -1
  91. package/dataflow/graph/graph.js +6 -2
  92. package/dataflow/info.d.ts +27 -1
  93. package/dataflow/internal/linker.d.ts +5 -1
  94. package/dataflow/internal/linker.js +34 -9
  95. package/dataflow/internal/process/functions/call/built-in/built-in-access.js +7 -5
  96. package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +19 -0
  97. package/dataflow/internal/process/functions/call/built-in/built-in-attach.d.ts +1 -8
  98. package/dataflow/internal/process/functions/call/built-in/built-in-attach.js +7 -13
  99. package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.d.ts +9 -48
  100. package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.js +30 -47
  101. package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +17 -0
  102. package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +7 -2
  103. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.d.ts +2 -2
  104. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +61 -1
  105. package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.js +9 -0
  106. package/dataflow/internal/process/functions/call/built-in/built-in-library.d.ts +37 -3
  107. package/dataflow/internal/process/functions/call/built-in/built-in-library.js +391 -21
  108. package/dataflow/internal/process/functions/call/built-in/built-in-namespace-access.d.ts +13 -0
  109. package/dataflow/internal/process/functions/call/built-in/built-in-namespace-access.js +58 -0
  110. package/dataflow/internal/process/functions/call/built-in/built-in-repeat-loop.js +1 -1
  111. package/dataflow/internal/process/functions/call/built-in/built-in-rm.d.ts +3 -2
  112. package/dataflow/internal/process/functions/call/built-in/built-in-rm.js +132 -25
  113. package/dataflow/internal/process/functions/call/built-in/built-in-source.js +9 -10
  114. package/dataflow/internal/process/functions/call/built-in/built-in-stack-env.d.ts +25 -0
  115. package/dataflow/internal/process/functions/call/built-in/built-in-stack-env.js +94 -0
  116. package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.js +11 -4
  117. package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.d.ts +30 -0
  118. package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.js +279 -0
  119. package/dataflow/internal/process/functions/call/known-call-handling.js +4 -3
  120. package/dataflow/internal/process/functions/call/named-call-handling.d.ts +1 -1
  121. package/dataflow/internal/process/functions/call/named-call-handling.js +23 -0
  122. package/dataflow/origin/dfg-get-origin.d.ts +1 -1
  123. package/dataflow/origin/dfg-get-origin.js +1 -1
  124. package/dataflow/processor.d.ts +6 -0
  125. package/documentation/data/faq/faqs.d.ts +2 -1
  126. package/documentation/data/faq/faqs.js +78 -57
  127. package/documentation/data/interface/doc-writing-code.js +4 -80
  128. package/documentation/data/server/doc-data-server-messages.d.ts +2 -1
  129. package/documentation/data/server/doc-data-server-messages.js +15 -7
  130. package/documentation/doc-readme.js +15 -15
  131. package/documentation/doc-util/doc-cfg.d.ts +3 -1
  132. package/documentation/doc-util/doc-cfg.js +3 -3
  133. package/documentation/doc-util/doc-dfg.d.ts +3 -1
  134. package/documentation/doc-util/doc-dfg.js +3 -3
  135. package/documentation/doc-util/doc-files.d.ts +3 -1
  136. package/documentation/doc-util/doc-files.js +9 -6
  137. package/documentation/doc-util/doc-normalized-ast.d.ts +3 -1
  138. package/documentation/doc-util/doc-normalized-ast.js +2 -2
  139. package/documentation/doc-util/doc-query.d.ts +2 -1
  140. package/documentation/doc-util/doc-query.js +2 -2
  141. package/documentation/doc-util/doc-repl.js +1 -0
  142. package/documentation/doc-util/doc-structure.js +1 -2
  143. package/documentation/doc-util/doc-types.d.ts +6 -6
  144. package/documentation/doc-util/doc-types.js +11 -9
  145. package/documentation/issue-linting-rule.js +1 -2
  146. package/documentation/wiki-analyzer.js +9 -9
  147. package/documentation/wiki-cfg.js +40 -41
  148. package/documentation/wiki-core.js +121 -32
  149. package/documentation/wiki-create-linting-rules.d.ts +6 -0
  150. package/documentation/wiki-create-linting-rules.js +95 -0
  151. package/documentation/wiki-dataflow-graph.js +112 -77
  152. package/documentation/wiki-engine.js +1 -2
  153. package/documentation/wiki-faq.d.ts +2 -1
  154. package/documentation/wiki-faq.js +4 -4
  155. package/documentation/wiki-interface.js +22 -8
  156. package/documentation/wiki-linter.d.ts +1 -1
  157. package/documentation/wiki-linter.js +16 -6
  158. package/documentation/wiki-linting-and-testing.js +2 -2
  159. package/documentation/wiki-mk/doc-context.d.ts +3 -3
  160. package/documentation/wiki-mk/doc-maker.d.ts +2 -0
  161. package/documentation/wiki-mk/doc-maker.js +7 -1
  162. package/documentation/wiki-normalized-ast.js +5 -5
  163. package/documentation/wiki-onboarding.d.ts +2 -1
  164. package/documentation/wiki-onboarding.js +5 -5
  165. package/documentation/wiki-overview.js +4 -17
  166. package/documentation/wiki-package-database.d.ts +9 -0
  167. package/documentation/wiki-package-database.js +63 -0
  168. package/documentation/wiki-query.js +86 -84
  169. package/documentation/wiki-search.js +4 -5
  170. package/documentation/wiki-setup.js +6 -7
  171. package/gas.d.ts +74 -0
  172. package/gas.js +18 -0
  173. package/linter/linter-executor.js +2 -8
  174. package/linter/linter-format.d.ts +4 -11
  175. package/linter/linter-rules.d.ts +111 -86
  176. package/linter/linter-rules.js +9 -1
  177. package/linter/rules/absolute-path.d.ts +2 -7
  178. package/linter/rules/absolute-path.js +8 -5
  179. package/linter/rules/dataframe-access-validation.d.ts +1 -6
  180. package/linter/rules/dataframe-access-validation.js +8 -6
  181. package/linter/rules/dead-code.d.ts +2 -11
  182. package/linter/rules/dead-code.js +16 -11
  183. package/linter/rules/deprecated-functions.d.ts +3 -3
  184. package/linter/rules/file-path-validity.d.ts +1 -6
  185. package/linter/rules/file-path-validity.js +5 -5
  186. package/linter/rules/function-finder-util.d.ts +7 -11
  187. package/linter/rules/function-finder-util.js +9 -6
  188. package/linter/rules/naming-convention.d.ts +2 -7
  189. package/linter/rules/naming-convention.js +3 -2
  190. package/linter/rules/network-functions.d.ts +2 -7
  191. package/linter/rules/network-functions.js +14 -12
  192. package/linter/rules/no-leaked-credentials.d.ts +36 -0
  193. package/linter/rules/no-leaked-credentials.js +75 -0
  194. package/linter/rules/problematic-inputs.d.ts +1 -8
  195. package/linter/rules/problematic-inputs.js +5 -4
  196. package/linter/rules/roxygen-arguments.d.ts +2 -7
  197. package/linter/rules/roxygen-arguments.js +13 -20
  198. package/linter/rules/seeded-randomness.d.ts +2 -7
  199. package/linter/rules/seeded-randomness.js +7 -4
  200. package/linter/rules/software-has-license.d.ts +31 -0
  201. package/linter/rules/software-has-license.js +46 -0
  202. package/linter/rules/software-has-tests.d.ts +38 -0
  203. package/linter/rules/software-has-tests.js +48 -0
  204. package/linter/rules/stop-with-call-arg.d.ts +2 -7
  205. package/linter/rules/stop-with-call-arg.js +3 -2
  206. package/linter/rules/undefined-symbol.d.ts +39 -0
  207. package/linter/rules/undefined-symbol.js +80 -0
  208. package/linter/rules/unused-definition.d.ts +3 -8
  209. package/linter/rules/unused-definition.js +7 -5
  210. package/linter/rules/useless-loop.d.ts +2 -7
  211. package/linter/rules/useless-loop.js +5 -2
  212. package/package.json +5 -5
  213. package/project/cache/flowr-analyzer-cache.d.ts +2 -0
  214. package/project/cache/flowr-analyzer-cache.js +9 -1
  215. package/project/context/flowr-analyzer-context.d.ts +13 -14
  216. package/project/context/flowr-analyzer-context.js +4 -0
  217. package/project/context/flowr-analyzer-dependencies-context.d.ts +16 -8
  218. package/project/context/flowr-analyzer-dependencies-context.js +36 -4
  219. package/project/context/flowr-analyzer-environment-context.d.ts +2 -4
  220. package/project/context/flowr-analyzer-environment-context.js +3 -4
  221. package/project/context/flowr-analyzer-files-context.d.ts +13 -0
  222. package/project/context/flowr-analyzer-files-context.js +12 -2
  223. package/project/context/flowr-analyzer-gas-context.d.ts +28 -0
  224. package/project/context/flowr-analyzer-gas-context.js +101 -0
  225. package/project/context/flowr-file.d.ts +2 -0
  226. package/project/context/flowr-file.js +2 -0
  227. package/project/flowr-analyzer-builder.js +3 -0
  228. package/project/flowr-analyzer.d.ts +2 -1
  229. package/project/flowr-analyzer.js +3 -1
  230. package/project/plugins/file-plugins/files/flowr-namespace-file.d.ts +13 -15
  231. package/project/plugins/file-plugins/files/flowr-namespace-file.js +36 -13
  232. package/project/plugins/file-plugins/files/flowr-rmarkdown-file.d.ts +13 -7
  233. package/project/plugins/file-plugins/files/flowr-rmarkdown-file.js +56 -11
  234. package/project/plugins/file-plugins/flowr-analyzer-virtualenv-file-plugin.d.ts +27 -0
  235. package/project/plugins/file-plugins/flowr-analyzer-virtualenv-file-plugin.js +41 -0
  236. package/project/plugins/file-plugins/notebooks/flowr-analyzer-qmd-file-plugin.d.ts +1 -1
  237. package/project/plugins/file-plugins/notebooks/flowr-analyzer-qmd-file-plugin.js +2 -2
  238. package/project/plugins/file-plugins/notebooks/flowr-analyzer-rmd-file-plugin.d.ts +2 -1
  239. package/project/plugins/file-plugins/notebooks/flowr-analyzer-rmd-file-plugin.js +5 -5
  240. package/project/plugins/flowr-analyzer-plugin.d.ts +15 -8
  241. package/project/plugins/flowr-analyzer-plugin.js +14 -7
  242. package/project/plugins/gas-plugins/flowr-analyzer-gas-plugin.d.ts +19 -0
  243. package/project/plugins/gas-plugins/flowr-analyzer-gas-plugin.js +35 -0
  244. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-lockfile-plugin.d.ts +18 -0
  245. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-lockfile-plugin.js +62 -0
  246. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-pkgdb-plugin.d.ts +63 -0
  247. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-pkgdb-plugin.js +174 -0
  248. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-plugin.d.ts +10 -0
  249. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-plugin.js +6 -0
  250. package/project/plugins/package-version-plugins/package.d.ts +3 -0
  251. package/project/plugins/package-version-plugins/package.js +12 -0
  252. package/project/plugins/package-version-plugins/pkgdb.d.ts +133 -0
  253. package/project/plugins/package-version-plugins/pkgdb.js +370 -0
  254. package/project/plugins/plugin-registry.d.ts +5 -1
  255. package/project/plugins/plugin-registry.js +10 -1
  256. package/project/plugins/project-discovery/flowr-analyzer-gitignore-project-discovery-plugin.d.ts +22 -0
  257. package/project/plugins/project-discovery/flowr-analyzer-gitignore-project-discovery-plugin.js +47 -0
  258. package/project/plugins/project-discovery/flowr-analyzer-project-discovery-plugin.js +1 -1
  259. package/queries/catalog/call-context-query/call-context-query-executor.js +62 -8
  260. package/queries/catalog/call-context-query/call-context-query-format.d.ts +4 -2
  261. package/queries/catalog/call-context-query/call-context-query-format.js +1 -0
  262. package/queries/catalog/call-context-query/identify-link-to-last-call-relation.js +8 -0
  263. package/queries/catalog/dependencies-query/dependencies-query-executor.js +31 -3
  264. package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +3 -1
  265. package/queries/catalog/dependencies-query/dependencies-query-format.js +3 -2
  266. package/queries/catalog/dependencies-query/function-info/function-info.d.ts +1 -1
  267. package/queries/catalog/dependencies-query/function-info/other-path-functions.d.ts +2 -0
  268. package/queries/catalog/dependencies-query/function-info/other-path-functions.js +27 -0
  269. package/queries/catalog/dependencies-query/function-info/read-functions.js +5 -4
  270. package/queries/catalog/dependencies-query/function-info/test-functions.d.ts +2 -0
  271. package/queries/catalog/dependencies-query/function-info/test-functions.js +18 -177
  272. package/queries/catalog/dependencies-query/function-info/visualize-functions.js +3 -1
  273. package/queries/catalog/df-shape-query/df-shape-query-format.js +1 -1
  274. package/queries/catalog/dice-query/dice-query-executor.d.ts +8 -0
  275. package/queries/catalog/dice-query/dice-query-executor.js +52 -0
  276. package/queries/catalog/dice-query/dice-query-format.d.ts +53 -0
  277. package/queries/catalog/dice-query/dice-query-format.js +102 -0
  278. package/queries/catalog/happens-before-query/happens-before-query-executor.js +2 -2
  279. package/queries/catalog/input-sources-query/input-sources-query-format.d.ts +2 -0
  280. package/queries/catalog/input-sources-query/input-sources-query-format.js +1 -0
  281. package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.d.ts +2 -0
  282. package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.js +1 -0
  283. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.d.ts +2 -0
  284. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.js +1 -0
  285. package/queries/catalog/linter-query/linter-query-executor.js +8 -0
  286. package/queries/catalog/location-map-query/location-map-query-format.d.ts +2 -0
  287. package/queries/catalog/location-map-query/location-map-query-format.js +1 -0
  288. package/queries/catalog/origin-query/origin-query-format.d.ts +2 -0
  289. package/queries/catalog/origin-query/origin-query-format.js +1 -0
  290. package/queries/catalog/provenance-query/provenance-query-format.d.ts +2 -0
  291. package/queries/catalog/provenance-query/provenance-query-format.js +1 -0
  292. package/queries/catalog/resolve-value-query/resolve-value-query-format.d.ts +2 -0
  293. package/queries/catalog/resolve-value-query/resolve-value-query-format.js +1 -0
  294. package/queries/catalog/static-slice-query/static-slice-query-executor.js +1 -1
  295. package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +2 -0
  296. package/queries/catalog/static-slice-query/static-slice-query-format.js +1 -0
  297. package/queries/query.d.ts +18 -1
  298. package/queries/query.js +3 -1
  299. package/r-bridge/data/data.d.ts +7 -2
  300. package/r-bridge/data/data.js +8 -2
  301. package/r-bridge/lang-4.x/ast/model/nodes/r-string.d.ts +0 -1
  302. package/r-bridge/lang-4.x/ast/parser/main/internal/values/normalize-number.d.ts +1 -1
  303. package/r-bridge/lang-4.x/ast/parser/main/internal/values/normalize-number.js +1 -1
  304. package/r-bridge/lang-4.x/ast/parser/main/internal/values/normalize-string.d.ts +1 -1
  305. package/r-bridge/lang-4.x/ast/parser/main/internal/values/normalize-string.js +1 -1
  306. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-executor.js +13 -4
  307. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +55 -44
  308. package/r-bridge/parser.js +2 -9
  309. package/r-bridge/shell.d.ts +8 -1
  310. package/r-bridge/shell.js +26 -7
  311. package/search/flowr-search-builder.d.ts +2 -2
  312. package/search/flowr-search-builder.js +1 -1
  313. package/search/flowr-search-filters.d.ts +30 -9
  314. package/search/flowr-search-filters.js +26 -21
  315. package/search/search-executor/search-enrichers.d.ts +601 -1
  316. package/search/search-executor/search-enrichers.js +30 -6
  317. package/slicing/static/static-slicer.d.ts +39 -11
  318. package/slicing/static/static-slicer.js +44 -14
  319. package/util/collections/queue.d.ts +16 -0
  320. package/util/collections/queue.js +38 -0
  321. package/util/log.d.ts +1 -1
  322. package/util/log.js +1 -1
  323. package/util/mermaid/dfg.d.ts +2 -2
  324. package/util/mermaid/dfg.js +2 -2
  325. package/util/mermaid/mermaid.d.ts +4 -0
  326. package/util/mermaid/mermaid.js +8 -1
  327. package/util/objects.d.ts +9 -0
  328. package/util/objects.js +54 -0
  329. package/util/proc.d.ts +6 -0
  330. package/util/proc.js +20 -0
  331. package/util/version.js +10 -2
  332. package/cli/common/features.d.ts +0 -9
  333. package/cli/common/features.js +0 -35
  334. package/cli/script-core/statistics-core.d.ts +0 -6
  335. package/cli/script-core/statistics-core.js +0 -103
  336. package/cli/script-core/statistics-helper-core.d.ts +0 -6
  337. package/cli/script-core/statistics-helper-core.js +0 -85
  338. package/cli/statistics-app.d.ts +0 -11
  339. package/cli/statistics-app.js +0 -16
  340. package/cli/statistics-helper-app.d.ts +0 -11
  341. package/cli/statistics-helper-app.js +0 -14
  342. package/statistics/features/common-syntax-probability.d.ts +0 -38
  343. package/statistics/features/common-syntax-probability.js +0 -169
  344. package/statistics/features/feature.d.ts +0 -179
  345. package/statistics/features/feature.js +0 -38
  346. package/statistics/features/post-processing.d.ts +0 -18
  347. package/statistics/features/post-processing.js +0 -26
  348. package/statistics/features/supported/assignments/assignments.d.ts +0 -12
  349. package/statistics/features/supported/assignments/assignments.js +0 -56
  350. package/statistics/features/supported/assignments/post-process.d.ts +0 -6
  351. package/statistics/features/supported/assignments/post-process.js +0 -126
  352. package/statistics/features/supported/comments/comments.d.ts +0 -18
  353. package/statistics/features/supported/comments/comments.js +0 -143
  354. package/statistics/features/supported/comments/post-process.d.ts +0 -6
  355. package/statistics/features/supported/comments/post-process.js +0 -51
  356. package/statistics/features/supported/control-flow/control-flow.d.ts +0 -17
  357. package/statistics/features/supported/control-flow/control-flow.js +0 -69
  358. package/statistics/features/supported/control-flow/post-process.d.ts +0 -6
  359. package/statistics/features/supported/control-flow/post-process.js +0 -66
  360. package/statistics/features/supported/data-access/data-access.d.ts +0 -15
  361. package/statistics/features/supported/data-access/data-access.js +0 -122
  362. package/statistics/features/supported/data-access/post-process.d.ts +0 -6
  363. package/statistics/features/supported/data-access/post-process.js +0 -108
  364. package/statistics/features/supported/defined-functions/defined-functions.d.ts +0 -34
  365. package/statistics/features/supported/defined-functions/defined-functions.js +0 -145
  366. package/statistics/features/supported/defined-functions/post-process.d.ts +0 -6
  367. package/statistics/features/supported/defined-functions/post-process.js +0 -168
  368. package/statistics/features/supported/expression-list/post-process.d.ts +0 -6
  369. package/statistics/features/supported/expression-list/post-process.js +0 -45
  370. package/statistics/features/supported/expression-list/statistics-expression-list.d.ts +0 -9
  371. package/statistics/features/supported/expression-list/statistics-expression-list.js +0 -37
  372. package/statistics/features/supported/loops/loops.d.ts +0 -20
  373. package/statistics/features/supported/loops/loops.js +0 -81
  374. package/statistics/features/supported/loops/post-process.d.ts +0 -6
  375. package/statistics/features/supported/loops/post-process.js +0 -73
  376. package/statistics/features/supported/used-functions/post-process.d.ts +0 -6
  377. package/statistics/features/supported/used-functions/post-process.js +0 -176
  378. package/statistics/features/supported/used-functions/used-functions.d.ts +0 -24
  379. package/statistics/features/supported/used-functions/used-functions.js +0 -99
  380. package/statistics/features/supported/used-packages/post-process.d.ts +0 -6
  381. package/statistics/features/supported/used-packages/post-process.js +0 -122
  382. package/statistics/features/supported/used-packages/used-packages.d.ts +0 -16
  383. package/statistics/features/supported/used-packages/used-packages.js +0 -140
  384. package/statistics/features/supported/values/post-process.d.ts +0 -6
  385. package/statistics/features/supported/values/post-process.js +0 -73
  386. package/statistics/features/supported/values/values.d.ts +0 -14
  387. package/statistics/features/supported/values/values.js +0 -111
  388. package/statistics/features/supported/variables/post-process.d.ts +0 -15
  389. package/statistics/features/supported/variables/post-process.js +0 -126
  390. package/statistics/features/supported/variables/variables.d.ts +0 -15
  391. package/statistics/features/supported/variables/variables.js +0 -62
  392. package/statistics/meta-statistics.d.ts +0 -32
  393. package/statistics/meta-statistics.js +0 -16
  394. package/statistics/output/file-provider.d.ts +0 -36
  395. package/statistics/output/file-provider.js +0 -96
  396. package/statistics/output/print-stats.d.ts +0 -29
  397. package/statistics/output/print-stats.js +0 -81
  398. package/statistics/output/statistics-file.d.ts +0 -36
  399. package/statistics/output/statistics-file.js +0 -68
  400. package/statistics/statistics.d.ts +0 -29
  401. package/statistics/statistics.js +0 -108
  402. package/statistics/summarizer/auto-detect.d.ts +0 -5
  403. package/statistics/summarizer/auto-detect.js +0 -34
  404. package/statistics/summarizer/first-phase/process.d.ts +0 -6
  405. package/statistics/summarizer/first-phase/process.js +0 -81
  406. package/statistics/summarizer/post-process/clusterer.d.ts +0 -25
  407. package/statistics/summarizer/post-process/clusterer.js +0 -40
  408. package/statistics/summarizer/post-process/file-based-count.d.ts +0 -16
  409. package/statistics/summarizer/post-process/file-based-count.js +0 -47
  410. package/statistics/summarizer/post-process/histogram.d.ts +0 -57
  411. package/statistics/summarizer/post-process/histogram.js +0 -126
  412. package/statistics/summarizer/post-process/post-process-output.d.ts +0 -14
  413. package/statistics/summarizer/post-process/post-process-output.js +0 -102
  414. package/statistics/summarizer/second-phase/process.d.ts +0 -15
  415. package/statistics/summarizer/second-phase/process.js +0 -118
  416. package/statistics/summarizer/summarizer.d.ts +0 -34
  417. package/statistics/summarizer/summarizer.js +0 -141
@@ -1,168 +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 path_1 = __importDefault(require("path"));
8
- const fs_1 = __importDefault(require("fs"));
9
- const defined_functions_1 = require("./defined-functions");
10
- const post_processing_1 = require("../../post-processing");
11
- const summarizer_1 = require("../../../../util/summarizer");
12
- const files_1 = require("../../../../util/files");
13
- const time_1 = require("../../../../util/text/time");
14
- const arrays_1 = require("../../../../util/collections/arrays");
15
- function getFnDefCsv(idx, info) {
16
- return `${JSON.stringify(idx)},${(0, summarizer_1.summarizedMeasurement2Csv)((0, summarizer_1.summarizeMeasurement)(info.total.flat()))}`
17
- + `,${(0, summarizer_1.summarizedMeasurement2Csv)((0, summarizer_1.summarizeMeasurement)(info.parameters.flat()))}`
18
- + `,${(0, summarizer_1.summarizedMeasurement2Csv)((0, summarizer_1.summarizeMeasurement)(info.length.lines.flat()))}`
19
- + `,${(0, summarizer_1.summarizedMeasurement2Csv)((0, summarizer_1.summarizeMeasurement)(info.length.chars.flat()))}`
20
- + `,${(0, summarizer_1.summarizedMeasurement2Csv)((0, summarizer_1.summarizeMeasurement)(info.length.nonWhitespaceChars.flat()))}`
21
- + `,${(0, summarizer_1.summarizedMeasurement2Csv)((0, summarizer_1.summarizeMeasurement)([0]))}` /* this has to be changed once we have explicit returns again */
22
- + `,${(0, summarizer_1.summarizedMeasurement2Csv)((0, summarizer_1.summarizeMeasurement)([0]))}`
23
- + `,${(0, summarizer_1.summarizedMeasurement2Csv)((0, summarizer_1.summarizeMeasurement)(info.returns.onlyExplicit.flat()))}`
24
- + `,${(0, summarizer_1.summarizedMeasurement2Csv)((0, summarizer_1.summarizeMeasurement)(info.returns.onlyImplicit.flat()))}`
25
- + `,${(0, summarizer_1.summarizedMeasurement2Csv)((0, summarizer_1.summarizeMeasurement)(info.exitPointsLinePercentageInDef.flat(2)))}`
26
- + `,${(0, summarizer_1.summarizedMeasurement2Csv)((0, summarizer_1.summarizeMeasurement)(info.linePercentageInFile.flat()))}\n`;
27
- }
28
- function addToList(data, count, filepath, config) {
29
- data.count.push(count);
30
- if (count > 0) {
31
- (0, post_processing_1.recordFilePath)(data, filepath, config);
32
- }
33
- }
34
- function retrievePerFileDefinitionInformation(featureRoot, info, config, outputPath) {
35
- /**
36
- * maps fn-name (including namespace) to several definition information
37
- * we use tuples to reduce the memory!
38
- */
39
- const definitionsPerFile = [];
40
- const mergedSuperDefinitions = emptyFunctionDefinitionSummary();
41
- // we collect only `all-calls`
42
- (0, files_1.readLineByLineSync)(path_1.default.join(featureRoot, `${defined_functions_1.AllDefinitionsFileBase}.txt`), (line, lineNumber) => processNextLine(definitionsPerFile, lineNumber, info, JSON.parse(String(line))));
43
- console.log(` [${(0, time_1.date2string)(new Date())}] Defined functions process completed, start to write out function info`);
44
- const fnOutStream = fs_1.default.createWriteStream(path_1.default.join(outputPath, 'function-definitions.csv'));
45
- const prefixes = ['total', 'params', 'length-lines', 'length-chars', 'length-non-ws-chars', 'return-explicit', 'return-implicit', 'return-only-explicit', 'return-only-implicit', 'exit-points-line-crac', 'def-line-frac'];
46
- const others = prefixes.flatMap(summarizer_1.summarizedMeasurement2CsvHeader).join(',');
47
- fnOutStream.write(`counter,${others}\n`);
48
- for (const [idx, info] of definitionsPerFile.entries()) {
49
- fnOutStream.write(getFnDefCsv(idx, info));
50
- mergedSuperDefinitions.total.push(...info.total);
51
- mergedSuperDefinitions.parameters.push(...info.parameters);
52
- mergedSuperDefinitions.length.lines.push(...info.length.lines);
53
- mergedSuperDefinitions.length.chars.push(...info.length.chars);
54
- mergedSuperDefinitions.length.nonWhitespaceChars.push(...info.length.nonWhitespaceChars);
55
- mergedSuperDefinitions.returns.onlyExplicit.push(...info.returns.onlyExplicit);
56
- mergedSuperDefinitions.returns.onlyImplicit.push(...info.returns.onlyImplicit);
57
- mergedSuperDefinitions.exitPointsLinePercentageInDef.push(...info.exitPointsLinePercentageInDef);
58
- mergedSuperDefinitions.linePercentageInFile.push(...info.linePercentageInFile);
59
- mergedSuperDefinitions.callsites.push(...info.callsites);
60
- }
61
- // now, write the ultimate summary at the end of the file
62
- fnOutStream.write(getFnDefCsv('all', mergedSuperDefinitions));
63
- fnOutStream.close();
64
- }
65
- function retrieveMetaInformation(info, config, outputPath) {
66
- const data = {
67
- total: (0, post_processing_1.emptySummarizedWithProject)(),
68
- lambdasOnly: (0, post_processing_1.emptySummarizedWithProject)(),
69
- assignedFunctions: (0, post_processing_1.emptySummarizedWithProject)(),
70
- nestedFunctions: (0, post_processing_1.emptySummarizedWithProject)(),
71
- recursive: (0, post_processing_1.emptySummarizedWithProject)(),
72
- deepestNesting: (0, post_processing_1.emptySummarizedWithProject)()
73
- };
74
- for (const [filepath, meta] of info.entries()) {
75
- const us = meta.definedFunctions;
76
- addToList(data.total, us.total, filepath, config);
77
- addToList(data.lambdasOnly, us.lambdasOnly, filepath, config);
78
- addToList(data.assignedFunctions, us.assignedFunctions, filepath, config);
79
- addToList(data.nestedFunctions, us.nestedFunctions, filepath, config);
80
- addToList(data.recursive, us.recursive, filepath, config);
81
- addToList(data.deepestNesting, us.deepestNesting, filepath, config);
82
- }
83
- console.log(` [${(0, time_1.date2string)(new Date())}] Defined functions metadata reading completed, summarizing and writing to file`);
84
- const out = fs_1.default.createWriteStream(path_1.default.join(outputPath, 'function-definitions-meta.csv'));
85
- out.write(`kind,unique-projects,unique-files,${(0, summarizer_1.summarizedMeasurement2CsvHeader)()}\n`);
86
- for (const [key, val] of Object.entries(data)) {
87
- const data = val;
88
- out.write(`${JSON.stringify(key)},${data.uniqueProjects.size},${data.uniqueFiles.size},${(0, summarizer_1.summarizedMeasurement2Csv)((0, summarizer_1.summarizeMeasurement)(data.count))}\n`);
89
- }
90
- out.close();
91
- }
92
- function retrieveAssignedFunctionNames(featureRoot, config, outputPath) {
93
- const varNames = new Map();
94
- (0, files_1.readLineByLineSync)(path_1.default.join(featureRoot, 'assignedFunctions.txt'), line => {
95
- const parsed = JSON.parse(String(line));
96
- const [hits, context] = parsed;
97
- const countsForFile = (0, arrays_1.array2bag)(hits);
98
- for (const [name, count] of countsForFile.entries()) {
99
- let get = varNames.get(name);
100
- if (!get) {
101
- get = (0, post_processing_1.emptySummarizedWithProject)();
102
- varNames.set(name, get);
103
- }
104
- addToList(get, count, context ?? '', config);
105
- }
106
- });
107
- const varNamesOut = fs_1.default.createWriteStream(path_1.default.join(outputPath, 'function-definitions-var-names.csv'));
108
- varNamesOut.write(`name,unique-projects,unique-files,${(0, summarizer_1.summarizedMeasurement2CsvHeader)()}\n`);
109
- for (const [key, val] of varNames.entries()) {
110
- varNamesOut.write(`${JSON.stringify(key)},${val.uniqueProjects.size},${val.uniqueFiles.size},${(0, summarizer_1.summarizedMeasurement2Csv)((0, summarizer_1.summarizeMeasurement)(val.count))}\n`);
111
- }
112
- varNamesOut.close();
113
- }
114
- /**
115
- * 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)
116
- */
117
- function postProcess(featureRoot, info, outputPath, config) {
118
- // each number[][] contains a 'number[]' per file
119
- retrievePerFileDefinitionInformation(featureRoot, info, config, outputPath);
120
- console.log(` [${(0, time_1.date2string)(new Date())}] Defined functions reading completed, summarizing info...`);
121
- retrieveMetaInformation(info, config, outputPath);
122
- retrieveAssignedFunctionNames(featureRoot, config, outputPath);
123
- }
124
- function emptyFunctionDefinitionSummary() {
125
- return {
126
- total: [],
127
- parameters: [],
128
- length: {
129
- lines: [],
130
- chars: [],
131
- nonWhitespaceChars: []
132
- },
133
- returns: {
134
- explicit: [],
135
- implicit: [],
136
- onlyExplicit: [],
137
- onlyImplicit: []
138
- },
139
- exitPointsLinePercentageInDef: [],
140
- linePercentageInFile: [],
141
- callsites: []
142
- };
143
- }
144
- function processNextLine(data, lineNumber, info, line) {
145
- if (lineNumber % 2_500 === 0) {
146
- console.log(` [${(0, time_1.date2string)(new Date())}] Defined functions processed ${lineNumber} lines`);
147
- }
148
- const [hits, context] = line;
149
- const forFile = emptyFunctionDefinitionSummary();
150
- for (const { location, length, returns, numberOfParameters, callsites } of hits) {
151
- const stats = info.get(context ?? '')?.stats.lines[0].length;
152
- // we retrieve the first component fo the path
153
- forFile.total.push(1);
154
- forFile.parameters.push(numberOfParameters);
155
- forFile.length.lines.push(length.lines);
156
- forFile.length.chars.push(length.characters);
157
- forFile.length.nonWhitespaceChars.push(length.nonWhitespaceCharacters);
158
- forFile.exitPointsLinePercentageInDef.push(returns.map(r => r.location[0]).map(l => l / length.lines));
159
- forFile.callsites.push(callsites.length);
160
- if (stats) {
161
- forFile.linePercentageInFile.push(location[0] / stats);
162
- }
163
- }
164
- // push all of that to main :D
165
- forFile.total = [forFile.total.length];
166
- data.push(forFile);
167
- }
168
- //# sourceMappingURL=post-process.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,45 +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 fs_1 = __importDefault(require("fs"));
9
- const path_1 = __importDefault(require("path"));
10
- const summarizer_1 = require("../../../../util/summarizer");
11
- /**
12
- *
13
- */
14
- function postProcess(featureRoot, info, outputPath, config) {
15
- const collected = {};
16
- const deepestNestingOut = fs_1.default.createWriteStream(path_1.default.join(outputPath, 'deepest-nesting-per-file.csv'));
17
- deepestNestingOut.write('file,deepest-nesting\n');
18
- for (const [filepath, data] of info.entries()) {
19
- const value = data.expressionList;
20
- for (const [key, val] of Object.entries(value)) {
21
- let get = collected[key];
22
- if (!get) {
23
- get = (0, post_processing_1.emptySummarizedWithProject)();
24
- collected[key] = get;
25
- }
26
- if (key === 'deepestNesting') {
27
- deepestNestingOut.write(`${JSON.stringify(filepath)},${val}\n`);
28
- }
29
- get.count.push(val);
30
- if (val > 0) {
31
- (0, post_processing_1.recordFilePath)(get, filepath, config);
32
- }
33
- }
34
- }
35
- deepestNestingOut.close();
36
- const variablesOutStream = fs_1.default.createWriteStream(path_1.default.join(outputPath, 'used-expression-lists.csv'));
37
- variablesOutStream.write(`kind,unique-projects,unique-files,${(0, summarizer_1.summarizedMeasurement2CsvHeader)()}\n`);
38
- for (const [key, val] of Object.entries(collected)) {
39
- const data = val;
40
- const sum = (0, summarizer_1.summarizeMeasurement)(data.count);
41
- variablesOutStream.write(`${JSON.stringify(key)},${data.uniqueProjects.size},${data.uniqueFiles.size},${(0, summarizer_1.summarizedMeasurement2Csv)(sum)}\n`);
42
- }
43
- variablesOutStream.close();
44
- }
45
- //# sourceMappingURL=post-process.js.map
@@ -1,9 +0,0 @@
1
- import type { Writable } from 'ts-essentials';
2
- import type { Feature } from '../../feature';
3
- declare const initialExpressionListInfo: {
4
- allExpressionLists: number;
5
- deepestNesting: number;
6
- };
7
- export type ExpressionListInfo = Writable<typeof initialExpressionListInfo>;
8
- export declare const expressionList: Feature<ExpressionListInfo>;
9
- export {};
@@ -1,37 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.expressionList = void 0;
4
- const post_process_1 = require("./post-process");
5
- const type_1 = require("../../../../r-bridge/lang-4.x/ast/model/type");
6
- const r_project_1 = require("../../../../r-bridge/lang-4.x/ast/model/nodes/r-project");
7
- const initialExpressionListInfo = {
8
- allExpressionLists: 0,
9
- deepestNesting: 0
10
- };
11
- function visitLists(info, input) {
12
- let nest = -1; // we start with nesting 0
13
- let total = 0;
14
- r_project_1.RProject.visitAst(input.normalizedRAst.ast, node => {
15
- if (node.type === type_1.RType.ExpressionList) {
16
- nest++;
17
- total++;
18
- info.deepestNesting = Math.max(info.deepestNesting, nest);
19
- }
20
- }, node => {
21
- if (node.type === type_1.RType.ExpressionList) {
22
- nest--;
23
- }
24
- });
25
- info.allExpressionLists += total;
26
- }
27
- exports.expressionList = {
28
- name: 'Expression Lists',
29
- description: 'Counts expression list nestings',
30
- process(existing, input) {
31
- visitLists(existing, input);
32
- return existing;
33
- },
34
- initialValue: initialExpressionListInfo,
35
- postProcess: post_process_1.postProcess
36
- };
37
- //# sourceMappingURL=statistics-expression-list.js.map
@@ -1,20 +0,0 @@
1
- import type { Feature } from '../../feature';
2
- import type { Writable } from 'ts-essentials';
3
- declare const initialLoopInfo: {
4
- forLoops: import("../../common-syntax-probability").CommonSyntaxTypeCounts<bigint>;
5
- forLoopVar: import("../../common-syntax-probability").CommonSyntaxTypeCounts<bigint>;
6
- forBody: import("../../common-syntax-probability").CommonSyntaxTypeCounts<bigint>;
7
- whileLoops: import("../../common-syntax-probability").CommonSyntaxTypeCounts<bigint>;
8
- whileBody: import("../../common-syntax-probability").CommonSyntaxTypeCounts<bigint>;
9
- repeatLoops: bigint;
10
- repeatBody: import("../../common-syntax-probability").CommonSyntaxTypeCounts<bigint>;
11
- breakStatements: number;
12
- nextStatements: number;
13
- /** apply, tapply, lapply, ...*/
14
- implicitLoops: number;
15
- nestedExplicitLoops: number;
16
- deepestExplicitNesting: number;
17
- };
18
- export type LoopInfo = Writable<typeof initialLoopInfo>;
19
- export declare const loops: Feature<LoopInfo>;
20
- export {};
@@ -1,81 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.loops = void 0;
4
- const common_syntax_probability_1 = require("../../common-syntax-probability");
5
- const post_process_1 = require("./post-process");
6
- const type_1 = require("../../../../r-bridge/lang-4.x/ast/model/type");
7
- const statistics_file_1 = require("../../../output/statistics-file");
8
- const r_project_1 = require("../../../../r-bridge/lang-4.x/ast/model/nodes/r-project");
9
- const model_1 = require("../../../../r-bridge/lang-4.x/ast/model/model");
10
- const initialLoopInfo = {
11
- forLoops: (0, common_syntax_probability_1.emptyCommonSyntaxTypeCounts)(),
12
- forLoopVar: (0, common_syntax_probability_1.emptyCommonSyntaxTypeCounts)(),
13
- forBody: (0, common_syntax_probability_1.emptyCommonSyntaxTypeCounts)(),
14
- whileLoops: (0, common_syntax_probability_1.emptyCommonSyntaxTypeCounts)(),
15
- whileBody: (0, common_syntax_probability_1.emptyCommonSyntaxTypeCounts)(),
16
- repeatLoops: 0n,
17
- repeatBody: (0, common_syntax_probability_1.emptyCommonSyntaxTypeCounts)(),
18
- breakStatements: 0,
19
- nextStatements: 0,
20
- /** apply, tapply, lapply, ...*/
21
- implicitLoops: 0,
22
- nestedExplicitLoops: 0,
23
- deepestExplicitNesting: 0
24
- };
25
- const isImplicitLoop = /[lsvmt]?apply/;
26
- function visitLoops(info, input) {
27
- // holds number of loops and their nesting depths
28
- const loopStack = [];
29
- r_project_1.RProject.visitAst(input.normalizedRAst.ast, node => {
30
- switch (node.type) {
31
- case type_1.RType.Next:
32
- info.nextStatements++;
33
- return;
34
- case type_1.RType.Break:
35
- info.breakStatements++;
36
- return;
37
- case type_1.RType.FunctionCall:
38
- if (node.named && isImplicitLoop.test(node.functionName.lexeme)) {
39
- info.implicitLoops++;
40
- (0, statistics_file_1.appendStatisticsFile)(exports.loops.name, 'implicit-loop', [model_1.RNode.lexeme(node.functionName)], input.filepath);
41
- }
42
- return;
43
- case type_1.RType.ForLoop:
44
- (0, common_syntax_probability_1.updateCommonSyntaxTypeCounts)(info.forLoops, node.vector);
45
- (0, common_syntax_probability_1.updateCommonSyntaxTypeCounts)(info.forLoopVar, node.variable);
46
- (0, common_syntax_probability_1.updateCommonSyntaxTypeCounts)(info.forBody, ...node.body.children);
47
- break;
48
- case type_1.RType.WhileLoop:
49
- (0, common_syntax_probability_1.updateCommonSyntaxTypeCounts)(info.whileLoops, node.condition);
50
- (0, common_syntax_probability_1.updateCommonSyntaxTypeCounts)(info.whileBody, ...node.body.children);
51
- break;
52
- case type_1.RType.RepeatLoop:
53
- info.repeatLoops++;
54
- (0, common_syntax_probability_1.updateCommonSyntaxTypeCounts)(info.repeatBody, ...node.body.children);
55
- break;
56
- default: return;
57
- }
58
- (0, statistics_file_1.appendStatisticsFile)(exports.loops.name, 'all-loops', [model_1.RNode.lexeme(node)], input.filepath);
59
- if (loopStack.length > 0) {
60
- info.nestedExplicitLoops++;
61
- info.deepestExplicitNesting = Math.max(info.deepestExplicitNesting, loopStack.length);
62
- }
63
- loopStack.push(node);
64
- }, node => {
65
- // drop again :D
66
- if (model_1.RLoopConstructs.is(node)) {
67
- loopStack.pop();
68
- }
69
- });
70
- }
71
- exports.loops = {
72
- name: 'Loops',
73
- description: 'All looping structures in the document',
74
- process(existing, input) {
75
- visitLoops(existing, input);
76
- return existing;
77
- },
78
- initialValue: initialLoopInfo,
79
- postProcess: post_process_1.postProcess
80
- };
81
- //# sourceMappingURL=loops.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 post_processing_1 = require("../../post-processing");
8
- const common_syntax_probability_1 = require("../../common-syntax-probability");
9
- const path_1 = __importDefault(require("path"));
10
- const fs_1 = __importDefault(require("fs"));
11
- const numbers_1 = require("../../../../util/numbers");
12
- const summarizer_1 = require("../../../../util/summarizer");
13
- /**
14
- *
15
- */
16
- function postProcess(featureRoot, info, outputPath, config) {
17
- const collected = {
18
- forLoops: (0, common_syntax_probability_1.emptyCommonSyntaxTypeCounts)(() => []),
19
- forLoopVar: (0, common_syntax_probability_1.emptyCommonSyntaxTypeCounts)(() => []),
20
- forBody: (0, common_syntax_probability_1.emptyCommonSyntaxTypeCounts)(() => []),
21
- whileLoops: (0, common_syntax_probability_1.emptyCommonSyntaxTypeCounts)(() => []),
22
- whileBody: (0, common_syntax_probability_1.emptyCommonSyntaxTypeCounts)(() => []),
23
- repeatLoops: (0, post_processing_1.emptySummarizedWithProject)(),
24
- repeatBody: (0, common_syntax_probability_1.emptyCommonSyntaxTypeCounts)(() => []),
25
- breakStatements: (0, post_processing_1.emptySummarizedWithProject)(),
26
- nextStatements: (0, post_processing_1.emptySummarizedWithProject)(),
27
- implicitLoops: (0, post_processing_1.emptySummarizedWithProject)(),
28
- nestedExplicitLoops: (0, post_processing_1.emptySummarizedWithProject)(),
29
- deepestExplicitNesting: (0, post_processing_1.emptySummarizedWithProject)()
30
- };
31
- for (const [filepath, data] of info.entries()) {
32
- const value = data.loops;
33
- for (const [key, val] of Object.entries(value)) {
34
- if (typeof val !== 'object') {
35
- const get = collected[key];
36
- get.count.push(typeof val === 'number' ? Number(val) : (0, numbers_1.bigint2number)(val));
37
- if (val > 0) {
38
- (0, post_processing_1.recordFilePath)(get, filepath, config);
39
- }
40
- }
41
- else {
42
- (0, common_syntax_probability_1.appendCommonSyntaxTypeCounter)(collected[key], val);
43
- }
44
- }
45
- }
46
- const metaOut = fs_1.default.createWriteStream(path_1.default.join(outputPath, 'loops-meta.csv'));
47
- metaOut.write(`kind,unique-projects,unique-files,${(0, summarizer_1.summarizedMeasurement2CsvHeader)()}\n`);
48
- for (const [key, val] of Object.entries(collected)) {
49
- const data = val;
50
- if ('uniqueProjects' in data) {
51
- metaOut.write(`${JSON.stringify(key)},${data.uniqueProjects.size},${data.uniqueFiles.size},${(0, summarizer_1.summarizedMeasurement2Csv)((0, summarizer_1.summarizeMeasurement)(data.count))}\n`);
52
- }
53
- else {
54
- // new file for each :D
55
- const out = fs_1.default.createWriteStream(path_1.default.join(outputPath, `loops-type-${key}.csv`));
56
- // name is for fields like number etc to allow to group multiple entries
57
- out.write(`kind,name,${(0, summarizer_1.summarizedMeasurement2CsvHeader)()}\n`);
58
- for (const [name, vals] of Object.entries(data)) {
59
- if (Array.isArray(vals)) {
60
- out.write(`${JSON.stringify(name)},"",${(0, summarizer_1.summarizedMeasurement2Csv)((0, summarizer_1.summarizeMeasurement)(vals.flat()))}\n`);
61
- }
62
- else {
63
- for (const [keyName, keyValue] of Object.entries(vals)) {
64
- out.write(`${JSON.stringify(name)},${JSON.stringify(keyName)},${(0, summarizer_1.summarizedMeasurement2Csv)((0, summarizer_1.summarizeMeasurement)(keyValue.flat()))}\n`);
65
- }
66
- }
67
- }
68
- out.close();
69
- }
70
- }
71
- metaOut.close();
72
- }
73
- //# sourceMappingURL=post-process.js.map
@@ -1,6 +0,0 @@
1
- import type { FeatureStatisticsWithMeta } from '../../feature';
2
- import type { StatisticsSummarizerConfiguration } from '../../../summarizer/summarizer';
3
- /**
4
- * 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)
5
- */
6
- export declare function postProcess(featureRoot: string, info: Map<string, FeatureStatisticsWithMeta>, outputPath: string, config: StatisticsSummarizerConfiguration): void;
@@ -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