@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
@@ -35,6 +35,10 @@ const static_slicer_1 = require("../slicing/static/static-slicer");
35
35
  const flowr_analyzer_builder_1 = require("../project/flowr-analyzer-builder");
36
36
  const flowr_analyzer_1 = require("../project/flowr-analyzer");
37
37
  const flowr_analyzer_context_1 = require("../project/context/flowr-analyzer-context");
38
+ const flowr_analyzer_gas_context_1 = require("../project/context/flowr-analyzer-gas-context");
39
+ const flowr_analyzer_gas_plugin_1 = require("../project/plugins/gas-plugins/flowr-analyzer-gas-plugin");
40
+ const gas_1 = require("../gas");
41
+ const semver_1 = require("semver");
38
42
  const doc_maker_1 = require("./wiki-mk/doc-maker");
39
43
  const process_value_1 = require("../dataflow/internal/process/process-value");
40
44
  const graph_1 = require("../dataflow/graph/graph");
@@ -78,6 +82,29 @@ function inspectContextExample(analyzer) {
78
82
  console.log('dplyr version', ctx.deps.getDependency('dplyr'));
79
83
  console.log('loading order', ctx.files.loadingOrder.getLoadingOrder());
80
84
  }
85
+ async function gasPluginExample() {
86
+ class MyGasPlugin extends flowr_analyzer_gas_plugin_1.FlowrAnalyzerGasPlugin {
87
+ name = 'my-gas-plugin';
88
+ description = 'Returns Critical for source when RSS exceeds 1 GB.';
89
+ version = new semver_1.SemVer('1.0.0');
90
+ process(_ctx, key) {
91
+ if (key === gas_1.GasFeatureKey.Source) {
92
+ const { rss } = process.memoryUsage();
93
+ if (rss > 1024 * 1024 * 1024) {
94
+ return 2 /* GasLevel.Critical */;
95
+ }
96
+ if (rss > 512 * 1024 * 1024) {
97
+ return 1 /* GasLevel.Problematic */;
98
+ }
99
+ }
100
+ return undefined;
101
+ }
102
+ }
103
+ return await new flowr_analyzer_builder_1.FlowrAnalyzerBuilder()
104
+ .registerPlugins(new MyGasPlugin())
105
+ .setEngine('tree-sitter')
106
+ .build();
107
+ }
81
108
  /**
82
109
  * https://github.com/flowr-analysis/flowr/wiki/Core
83
110
  */
@@ -92,13 +119,13 @@ This wiki page provides an overview of the inner workings of _flowR_.
92
119
  It is mostly intended for developers that want to extend the capabilities of _flowR_
93
120
  and assumes knowledge of [TypeScript](https://www.typescriptlang.org/) and [R](https://www.r-project.org/).
94
121
  If you think parts of the wiki are missing, wrong, or outdated, please do not hesitate to [open a new issue](${doc_issue_1.NewIssueUrl})!
95
- In case you are new and want to develop for flowR, please check out the relevant [Setup](${doc_files_1.FlowrWikiBaseRef}/Setup#-developing-for-flowr) wiki page
122
+ In case you are new and want to develop for flowR, please check out the relevant ${ctx.linkPage('wiki/Setup', 'Setup', '-developing-for-flowr')} wiki page
96
123
  and the [Contributing Guidelines](${doc_files_1.RemoteFlowrFilePathBaseRef}/.github/CONTRIBUTING.md).
97
124
 
98
125
  ${(0, doc_structure_1.block)({
99
126
  type: 'NOTE',
100
127
  content: `
101
- Essentially every step we explain here can be explored directly from flowR's REPL in an interactive fashion (see the [Interface](${doc_files_1.FlowrWikiBaseRef}/Interface#using-the-repl) wiki page).
128
+ Essentially every step we explain here can be explored directly from flowR's REPL in an interactive fashion (see the ${ctx.linkPage('wiki/Interface', 'Interface', 'using-the-repl')} wiki page).
102
129
  We recommend to use commands like ${(0, doc_cli_option_1.getReplCommand)('parse')} or ${(0, doc_cli_option_1.getReplCommand)('dataflow*')} to explore the output of flowR using your own samples.
103
130
  As a quickstart you may use:
104
131
 
@@ -121,6 +148,7 @@ See the [Getting flowR to Talk](#getting-flowr-to-talk) section below for more i
121
148
  * [Dataflow Graph Generation](#dataflow-graph-generation)
122
149
  * [Beyond the Dataflow Graph](#beyond-the-dataflow-graph)
123
150
  * [Static Backward Slicing](#static-backward-slicing)
151
+ * [Gas (Resource Guard)](#gas-resource-guard)
124
152
  * [Getting flowR to Talk](#getting-flowr-to-talk)
125
153
 
126
154
  ## Creating and Using a flowR Analyzer Instance
@@ -130,15 +158,15 @@ It provides a fluent interface for the configuration and creation of a ${ctx.lin
130
158
 
131
159
  ${ctx.code(makeAnalyzerExample, { dropLinesStart: 1, dropLinesEnd: 2, hideDefinedAt: true })}
132
160
 
133
- Have a look at the [Engine](${doc_files_1.FlowrWikiBaseRef}/Engines) wiki page to understand the different engines and parsers you can use.
161
+ Have a look at the ${ctx.linkPage('wiki/Engines', 'Engine')} wiki page to understand the different engines and parsers you can use.
134
162
 
135
- The analyzer instance can then be used to access analysis results like the [normalized AST](${doc_files_1.FlowrWikiBaseRef}/Normalized-AST),
136
- the [dataflow graph](${doc_files_1.FlowrWikiBaseRef}/Dataflow-Graph), and the [controlflow graph](${doc_files_1.FlowrWikiBaseRef}/Control-Flow-Graph):
163
+ The analyzer instance can then be used to access analysis results like the ${ctx.linkPage('wiki/Normalized AST', 'normalized AST')},
164
+ the ${ctx.linkPage('wiki/Dataflow Graph', 'dataflow graph')}, and the ${ctx.linkPage('wiki/Control Flow Graph', 'controlflow graph')}:
137
165
 
138
166
  ${ctx.code(extractStepsExample, { dropLinesStart: 1, dropLinesEnd: 2, hideDefinedAt: true })}
139
167
 
140
168
  The underlying ${ctx.link(flowr_analyzer_1.FlowrAnalyzer.name)} instance will take care of caching, updates, and running the appropriate steps.
141
- It also exposes the [query API](${doc_files_1.FlowrWikiBaseRef}/Query-API):
169
+ It also exposes the ${ctx.linkPage('wiki/Query API', 'query API')}:
142
170
 
143
171
  ${ctx.code(sliceQueryExample, { dropLinesStart: 1, dropLinesEnd: 2, hideDefinedAt: true })}
144
172
 
@@ -151,7 +179,7 @@ ${ctx.code(inspectContextExample, { dropLinesStart: 1, dropLinesEnd: 1, hideDefi
151
179
  At the core of every analysis done via a ${ctx.link(flowr_analyzer_1.FlowrAnalyzer)} is the ${ctx.link(pipeline_executor_1.PipelineExecutor)} class which takes a sequence of analysis steps (in the form of a ${ctx.link('Pipeline')}) and executes it
152
180
  on a given input. In general, these pipeline steps are analysis agnostic and may use arbitrary input and ordering. However, two important and predefined pipelines,
153
181
  the ${ctx.link('DEFAULT_DATAFLOW_PIPELINE')} and the ${ctx.link('TREE_SITTER_DATAFLOW_PIPELINE')} adequately cover the most common analysis steps
154
- (differentiated only by the [Engine](${doc_files_1.FlowrWikiBaseRef}/Engines) used).
182
+ (differentiated only by the ${ctx.linkPage('wiki/Engines', 'Engine')} used).
155
183
 
156
184
  ${(0, doc_structure_1.block)({
157
185
  type: 'TIP',
@@ -161,7 +189,7 @@ ${(0, doc_structure_1.block)({
161
189
  `
162
190
  })}
163
191
 
164
- Using the [\`tree-sitter\` engine](${doc_files_1.FlowrWikiBaseRef}/Engines) you can request a dataflow analysis of a sample piece of R code like the following:
192
+ Using the ${ctx.linkPage('wiki/Engines', '`tree-sitter` engine')} you can request a dataflow analysis of a sample piece of R code like the following:
165
193
 
166
194
  ${(0, doc_code_1.codeBlock)('typescript', `
167
195
  const executor = new PipelineExecutor(TREE_SITTER_DATAFLOW_PIPELINE, {
@@ -171,7 +199,7 @@ const executor = new PipelineExecutor(TREE_SITTER_DATAFLOW_PIPELINE, {
171
199
  const result = await executor.allRemainingSteps();
172
200
  `)}
173
201
 
174
- This is, roughly, what the ${ctx.link('dataflow')} function does when using the [\`tree-sitter\` engine](${doc_files_1.FlowrWikiBaseRef}/Engines).
202
+ This is, roughly, what the ${ctx.link('dataflow')} function does when using the ${ctx.linkPage('wiki/Engines', '`tree-sitter` engine')}.
175
203
  We create a new ${ctx.link(pipeline_executor_1.PipelineExecutor)} with the ${ctx.link('TREE_SITTER_DATAFLOW_PIPELINE')} and then use
176
204
  ${ctx.link(`${pipeline_executor_1.PipelineExecutor.name}::${pipeline_executor_1.PipelineExecutor.prototype.allRemainingSteps.name}`)}
177
205
  to cause the execution of all contained steps (in general, pipelines can be executed step-by-step, but this is usually not required if you just want the result).
@@ -183,8 +211,8 @@ automatically selects the correct pipeline based on the engine used.
183
211
 
184
212
  Everything that complies to the ${ctx.link('IPipelineStep')} interface can be used as a step in a pipeline, with the most important definition being the
185
213
  \`processor\` function, which refers to the actual work performed by the step.
186
- For example, the ${ctx.link('STATIC_DATAFLOW')} step ultimately relies on the ${ctx.link(extractor_1.produceDataFlowGraph)} function to create a [dataflow graph](${doc_files_1.FlowrWikiBaseRef}/Dataflow-Graph)
187
- using the [normalized AST](${doc_files_1.FlowrWikiBaseRef}/Normalized-AST) of the program.
214
+ For example, the ${ctx.link('STATIC_DATAFLOW')} step ultimately relies on the ${ctx.link(extractor_1.produceDataFlowGraph)} function to create a ${ctx.linkPage('wiki/Dataflow Graph', 'dataflow graph')}
215
+ using the ${ctx.linkPage('wiki/Normalized AST', 'normalized AST')} of the program.
188
216
 
189
217
  ### Shape of a Pipeline Step
190
218
 
@@ -208,10 +236,10 @@ However, as such steps are currently not relevant for any of flowR's core analys
208
236
 
209
237
  ## How flowR Produces Dataflow Graphs
210
238
 
211
- This section focuses on the generation of a [dataflow graph](${doc_files_1.FlowrWikiBaseRef}/Dataflow-Graph) from a given R program, using the [RShell Engine](${doc_files_1.FlowrWikiBaseRef}/Engines) and hence the
212
- ${ctx.link('DEFAULT_DATAFLOW_PIPELINE')}. The [\`tree-sitter\` engine](${doc_files_1.FlowrWikiBaseRef}/Engines) uses the ${ctx.link('TREE_SITTER_DATAFLOW_PIPELINE')}),
213
- which replaces the parser with the integrated tree-sitter parser and hence uses a slightly adapted normalization step to produce a similar [normalized AST](${doc_files_1.FlowrWikiBaseRef}/Normalized-AST).
214
- The [dataflow graph](${doc_files_1.FlowrWikiBaseRef}/Dataflow-Graph) should be the same for both engines (although [\`tree-sitter\`](${doc_files_1.FlowrWikiBaseRef}/Engines) is faster and may be able to parse more files).
239
+ This section focuses on the generation of a ${ctx.linkPage('wiki/Dataflow Graph', 'dataflow graph')} from a given R program, using the ${ctx.linkPage('wiki/Engines', 'RShell Engine')} and hence the
240
+ ${ctx.link('DEFAULT_DATAFLOW_PIPELINE')}. The ${ctx.linkPage('wiki/Engines', '`tree-sitter` engine')} uses the ${ctx.link('TREE_SITTER_DATAFLOW_PIPELINE')}),
241
+ which replaces the parser with the integrated tree-sitter parser and hence uses a slightly adapted normalization step to produce a similar ${ctx.linkPage('wiki/Normalized AST', 'normalized AST')}.
242
+ The ${ctx.linkPage('wiki/Dataflow Graph', 'dataflow graph')} should be the same for both engines (although ${ctx.linkPage('wiki/Engines', '`tree-sitter`')} is faster and may be able to parse more files).
215
243
 
216
244
  ### Overview
217
245
 
@@ -223,9 +251,9 @@ We can see that it relies on three steps:
223
251
 
224
252
  1. **${ctx.link('PARSE_WITH_R_SHELL_STEP', { codeFont: false })}** ([parsing](#parsing)): Uses the ${ctx.link(shell_1.RShell)} to parse the input program.\\
225
253
  _Its main function linked as the processor is the ${ctx.link(parser_1.parseRequests, { codeFont: false })} function._
226
- 2. **${ctx.link('NORMALIZE', { codeFont: false })}** ([normalization](#normalization)): Normalizes the AST produced by the parser (to create a [normalized AST](${doc_files_1.FlowrWikiBaseRef}/Normalized-AST)).\\
254
+ 2. **${ctx.link('NORMALIZE', { codeFont: false })}** ([normalization](#normalization)): Normalizes the AST produced by the parser (to create a ${ctx.linkPage('wiki/Normalized AST', 'normalized AST')}).\\
227
255
  _Its main function linked as the processor is the ${ctx.link(parser_2.normalize, { codeFont: false })} function._
228
- 3. **${ctx.link('STATIC_DATAFLOW', { codeFont: false })}** ([dataflow](#dataflow-graph-generation)): Produces the actual [dataflow graph](${doc_files_1.FlowrWikiBaseRef}/Dataflow-Graph) from the normalized AST.\\
256
+ 3. **${ctx.link('STATIC_DATAFLOW', { codeFont: false })}** ([dataflow](#dataflow-graph-generation)): Produces the actual ${ctx.linkPage('wiki/Dataflow Graph', 'dataflow graph')} from the normalized AST.\\
229
257
  _Its main function linked as the processor is the ${ctx.link(extractor_1.produceDataFlowGraph, { codeFont: false })} function._
230
258
 
231
259
  To explore these steps, let's use the REPL with the (very simple and contrived) R code: \`${sampleCode}\`.
@@ -257,13 +285,13 @@ ${(0, doc_structure_1.block)({
257
285
  type: 'NOTE',
258
286
  content: 'Maybe you are left with the question: What is tree-sitter doing differently? Expand the following to get more information!\n\n' + (0, doc_structure_1.details)('And what changes with tree-sitter?', `
259
287
 
260
- Essentially not much (from a user perspective, it does essentially everything and all differently under the hood)! Have a look at the [Engines](${doc_files_1.FlowrWikiBaseRef}/Engines) wiki page for more information on the differences between the engines.
288
+ Essentially not much (from a user perspective, it does essentially everything and all differently under the hood)! Have a look at the ${ctx.linkPage('wiki/Engines', 'Engines')} wiki page for more information on the differences between the engines.
261
289
  Below you can see the Repl commands for the tree-sitter engine (using ${(0, doc_cli_option_1.getCliLongOptionOf)('flowr', 'default-engine')} to set the engine to tree-sitter):
262
290
 
263
291
  ${await (async () => {
264
292
  return await (0, doc_repl_1.documentReplSession)(treeSitter, [{
265
293
  command: `:parse "${sampleCode}"`,
266
- description: `This shows the ASCII-Art representation of the parse-tree of the R code \`${sampleCode}\`, as it is provided by the ${ctx.link(tree_sitter_executor_1.TreeSitterExecutor)}. See the [Engines](${doc_files_1.FlowrWikiBaseRef}/Engines) wiki page for more information on the differences between the engines.`
294
+ description: `This shows the ASCII-Art representation of the parse-tree of the R code \`${sampleCode}\`, as it is provided by the ${ctx.link(tree_sitter_executor_1.TreeSitterExecutor)}. See the ${ctx.linkPage('wiki/Engines', 'Engines')} wiki page for more information on the differences between the engines.`
267
295
  },
268
296
  {
269
297
  command: `:normalize* "${sampleCode}"`,
@@ -279,7 +307,7 @@ ${await (async () => {
279
307
 
280
308
  ### Parsing
281
309
 
282
- The parsing step uses the ${ctx.link(shell_1.RShell)} to parse the input program (or, of course, the ${ctx.link(tree_sitter_executor_1.TreeSitterExecutor)} when using the [\`tree-sitter\` engine](${doc_files_1.FlowrWikiBaseRef}/Engines)).
310
+ The parsing step uses the ${ctx.link(shell_1.RShell)} to parse the input program (or, of course, the ${ctx.link(tree_sitter_executor_1.TreeSitterExecutor)} when using the ${ctx.linkPage('wiki/Engines', '`tree-sitter` engine')}).
283
311
  To speed up the process, we use the ${ctx.link(init_1.initCommand)} function to compile the parsing function and rely on a
284
312
  custom serialization, which outputs the information in a CSV-like format.
285
313
  This means, that the ${(0, doc_cli_option_1.getReplCommand)('parse')} command actually kind-of lies to you, as it does pretty print the serialized version which looks more like the following (this uses the ${ctx.link(retriever_1.retrieveParseDataFromRCode.name)} function with the sample code \`${sampleCode}\`):
@@ -300,7 +328,7 @@ ${await (0, retriever_1.retrieveParseDataFromRCode)((0, retriever_1.requestFromI
300
328
  </details>
301
329
 
302
330
  In fact, this data is merely what R's [\`base::parse\`](https://stat.ethz.ch/R-manual/R-devel/library/base/html/parse.html) and [\`utils::getParseData\`](https://stat.ethz.ch/R-manual/R-devel/library/utils/html/getParseData.html) functions provide.
303
- We then use this data in the [normalization](#normalization) step to create a [normalized AST](${doc_files_1.FlowrWikiBaseRef}/Normalized-AST).
331
+ We then use this data in the [normalization](#normalization) step to create a ${ctx.linkPage('wiki/Normalized AST', 'normalized AST')}.
304
332
 
305
333
  If you are interested in the raw token types that we may encounter, have a look at the ${ctx.link('RawRType')} enum.
306
334
 
@@ -311,12 +339,12 @@ ${ctx.link(format_1.convertPreparedParsedData)} functions to first transform the
311
339
  Next, ${ctx.link(normalize_root_1.normalizeRootObjToAst)} transforms this object to a normalized AST and ${ctx.link(decorate_1.decorateAst)} adds additional information to the AST (like roles, ids, depth, etc.).
312
340
  While looking at the mermaid visualization of such an AST is nice and usually sufficient, looking at the objects themselves shows you the full range of information the AST provides (all encompassed within the ${ctx.link(model_1.RNode)} type).
313
341
 
314
- Let's have a look at the normalized AST for the sample code \`${sampleCode}\` (please refer to the [normalized AST](${doc_files_1.FlowrWikiBaseRef}/Normalized-AST) wiki page for more information):
342
+ Let's have a look at the normalized AST for the sample code \`${sampleCode}\` (please refer to the ${ctx.linkPage('wiki/Normalized AST', 'normalized AST')} wiki page for more information):
315
343
 
316
344
  ${(0, doc_structure_1.details)('Normalized AST for <code>x <- 1; print(x)</code>', (0, doc_code_1.codeBlock)('json', JSON.stringify((await (0, default_pipelines_1.createNormalizePipeline)(shell, { context: (0, flowr_analyzer_context_1.contextFromInput)(sampleCode) }).allRemainingSteps()).normalize.ast, json_1.jsonReplacer, 4)))}
317
345
 
318
346
  This is… a lot! We get the type from the ${ctx.link('RType')} enum, the lexeme, location information, an id, the children of the node, and their parents.
319
- While the [normalized AST](${doc_files_1.FlowrWikiBaseRef}/Normalized-AST) wiki page provides you with information on how to interpret this data, we will focus on how we get it from the
347
+ While the ${ctx.linkPage('wiki/Normalized AST', 'normalized AST')} wiki page provides you with information on how to interpret this data, we will focus on how we get it from the
320
348
  table provided by the [parsing](#parsing) step.
321
349
 
322
350
  There are two important functions: ${ctx.link(normalize_root_1.normalizeRootObjToAst)}, which operates on the parse-output already transformed into a tree-like structure,
@@ -342,11 +370,11 @@ ${(0, doc_structure_1.details)('Ast for <code>x <- 1; print(x)</code> after the
342
370
  The decoration is comparatively trivial. We take the AST throw it into the ${ctx.link(decorate_1.decorateAst.name)} function (which again, handles each normalized node type) and
343
371
  get:
344
372
 
345
- 1. The AST with ids, roles, and depth information (see the [normalized AST](${doc_files_1.FlowrWikiBaseRef}/Normalized-AST) wiki page for more information).
373
+ 1. The AST with ids, roles, and depth information (see the ${ctx.linkPage('wiki/Normalized AST', 'normalized AST')} wiki page for more information).
346
374
  2. A mapping of ids to nodes in the form of a ${ctx.link('AstIdMap')} object. This allows us to quickly access nodes by their id.
347
375
 
348
376
  The ids used for the AST generation are arbitrary (usually created by the ${ctx.link(decorate_1.deterministicCountingIdGenerator.name)}) function) but unique and intentionally
349
- separated from the ids used by the R&nbsp;parser. For one, this detaches us from the [Engine](${doc_files_1.FlowrWikiBaseRef}/Engines) used, and secondly, it allows for much easier
377
+ separated from the ids used by the R&nbsp;parser. For one, this detaches us from the ${ctx.linkPage('wiki/Engines', 'Engine')} used, and secondly, it allows for much easier
350
378
  extension of the AST (e.g., when R&nbsp;files use [\`base::source\`](https://stat.ethz.ch/R-manual/R-devel/library/base/html/source.html) to include other R&nbsp;files).
351
379
  All ids conform to the ${ctx.link('NodeId')} type.
352
380
 
@@ -364,7 +392,7 @@ Looking at the function showcases the general structure of a processor:
364
392
 
365
393
  ${ctx.hierarchy(process_uninteresting_leaf_1.processUninterestingLeaf, { maxDepth: 2, openTop: true })}
366
394
 
367
- Every processor has the same shape. It takes the normalized node (see the [normalized AST](${doc_files_1.FlowrWikiBaseRef}/Normalized-AST) for more information),
395
+ Every processor has the same shape. It takes the normalized node (see the ${ctx.linkPage('wiki/Normalized AST', 'normalized AST')} for more information),
368
396
  and a ${ctx.link('DataflowProcessorInformation')} object which, as some kind of "backpack" carries global information
369
397
  to every handler.
370
398
  This information is to be used to create a ${ctx.link('DataflowInformation')}:
@@ -377,13 +405,14 @@ to produce a new dataflow information to pass upwards in the fold. The ${ctx.lin
377
405
  * the ${ctx.link(graph_1.DataflowGraph)} of the current subtree
378
406
  * the currently active ${ctx.link('REnvironmentInformation')} as an abstraction of all active definitions linking to potential definition locations (see [Advanced R::Environments](https://adv-r.hadley.nz/environments.html))
379
407
  * control flow information in ${ctx.link('DataflowCfgInformation')} which is used to enrich the dataflow information with control flow information
380
- * and sets of currently ingoing (read), outgoing (write) and unknown ${ctx.link('IdentifierReference')}s.
408
+ * sets of currently ingoing (read), outgoing (write) and unknown ${ctx.link('IdentifierReference')}s.
409
+ * and a set of ${ctx.link('KillReference')}s which tracks variables that go out of scope within the current subtree (e.g., due to \`rm\`). Just like the reference sets above, kills are carried upwards in the fold so that the enclosing scope (expression list, branch, loop, or function body) can apply the removal (via ${ctx.link('applyKills')}) at the correct location, even when the \`rm\` happens nested within a branch or block. This also covers clearing the whole environment with \`rm(list=ls())\` and conservatively handling removals whose target cannot be resolved statically.
381
410
 
382
411
  While all of them are essentially empty when processing an “uninteresting leaf”, handling a constant is slightly more interesting with ${ctx.link(process_value_1.processValue)}:
383
412
 
384
413
  ${ctx.hierarchy(process_value_1.processValue, { maxDepth: 2, openTop: true })}
385
414
 
386
- Please note, that we add the [value vertex](${doc_files_1.FlowrWikiBaseRef}/Dataflow-Graph#value-vertex) to the newly created dataflow graph,
415
+ Please note, that we add the ${ctx.linkPage('wiki/Dataflow Graph', 'value vertex', 'value-vertex')} to the newly created dataflow graph,
387
416
  which holds a reference to the constant. If you are confused with the use of the ${ctx.link('ParentInformation')} type,
388
417
  this stems from the [AST decoration](#normalization) and signals that we have a decorated ${ctx.link(model_1.RNode)} (which may have additional information in \`OtherInfo\`).
389
418
 
@@ -394,7 +423,7 @@ We do this, because R does it the same way, and allows to even overwrite these o
394
423
  By treating them like R, as function calls, we get support for these overwrites for free, courtesy of flowR's call resolution.
395
424
 
396
425
  But where are all the interesting things handled then?
397
- For that, we want to have a look at the built-in environment, which can be freely configured using flowR's [configuration system](${doc_files_1.FlowrWikiBaseRef}/Interface#configuring-flowr).
426
+ For that, we want to have a look at the built-in environment, which can be freely configured using flowR's ${ctx.linkPage('wiki/Interface', 'configuration system', 'configuring-flowr')}.
398
427
  FlowR's heart and soul resides in the ${ctx.link('DefaultBuiltinConfig')} object, which is used to configure the built-in environment
399
428
  by mapping function names to ${ctx.link('BuiltInProcessorMapper')} functions.
400
429
  There you can find functions like ${ctx.link(built_in_access_1.processAccess)} which handles the (subset) access to a variable,
@@ -423,9 +452,9 @@ to produce a new dataflow information.
423
452
 
424
453
  ## Beyond the Dataflow Graph
425
454
 
426
- Given the [dataflow graph](${doc_files_1.FlowrWikiBaseRef}/Dataflow-Graph), you can do a lot more!
427
- You can issue [queries](${doc_files_1.FlowrWikiBaseRef}/Query-API) to explore the graph, [search](${doc_files_1.FlowrWikiBaseRef}/Search-API) for specific elements, or, for example, request a [static backward slice](#static-backward-slicing).
428
- Of course, all of these endeavors work not just with the ${ctx.link(shell_1.RShell)} but also with the [\`tree-sitter\` engine](${doc_files_1.FlowrWikiBaseRef}/Engines).
455
+ Given the ${ctx.linkPage('wiki/Dataflow Graph', 'dataflow graph')}, you can do a lot more!
456
+ You can issue ${ctx.linkPage('wiki/Query API', 'queries')} to explore the graph, ${ctx.linkPage('wiki/Search API', 'search')} for specific elements, or, for example, request a [static backward slice](#static-backward-slicing).
457
+ Of course, all of these endeavors work not just with the ${ctx.link(shell_1.RShell)} but also with the ${ctx.linkPage('wiki/Engines', '`tree-sitter` engine')}.
429
458
 
430
459
  ### Static Backward Slicing
431
460
 
@@ -444,6 +473,66 @@ ${await (0, doc_repl_1.documentReplSession)(treeSitter, [{
444
473
  description: 'Slice for the example file for the variable "prod" in line 12.'
445
474
  }], { openOutput: true })}
446
475
 
476
+ ## Gas (Resource Guard)
477
+
478
+ During a large analysis, flowR may run into memory or time pressure.
479
+ The _gas_ system provides per-feature resource guards that check the current heap usage and elapsed analysis time.
480
+
481
+ Any analysis site queries the level with ${ctx.linkM(flowr_analyzer_gas_context_1.FlowrAnalyzerGasContext, 'checkGas')}, where \`key\` is a feature name.
482
+ The call is a no-op when gas is disabled for that key and no gas plugins are registered.
483
+ Heap statistics come from the \`v8\` module (Node.js, Electron, VS Code) or Chromium's \`performance.memory\` in browsers. If neither is available, gas skips the memory check and only the elapsed-time thresholds apply. Programmatic configs can supply a custom source via the \`heapProvider\` of the ${ctx.link('FlowrGasConfig')} (\`config.gas.heapProvider\`), and gas plugins can override levels entirely.
484
+
485
+ | Level | Value | Description |
486
+ |:-------------------------|------:|:------------------------------------|
487
+ | \`GasLevel.Normal\` | 0 | ${ctx.doc('GasLevel::Normal')} |
488
+ | \`GasLevel.Problematic\` | 1 | ${ctx.doc('GasLevel::Problematic')} |
489
+ | \`GasLevel.Critical\` | 2 | ${ctx.doc('GasLevel::Critical')} |
490
+
491
+ ### Enabling Gas for a Feature
492
+
493
+ Gas is **disabled by default** for every feature (see ${ctx.link('GasFeatureKey')} for all recognized keys).
494
+ Enable it by setting a positive factor in \`config.gas.features\`:
495
+
496
+ \`\`\`json
497
+ {
498
+ "gas": {
499
+ "thresholds": {
500
+ "memory": { "problematic": 0.7, "critical": 0.9 },
501
+ "timeMs": { "problematic": 100000, "critical": 120000 }
502
+ },
503
+ "features": {
504
+ "source": 1
505
+ }
506
+ }
507
+ }
508
+ \`\`\`
509
+
510
+ The factor scales both dimensions before comparing against the thresholds:
511
+
512
+ \`\`\`
513
+ scaled_ratio = (used_heap / heap_limit) * factor
514
+ scaled_elapsed = elapsed_ms * factor
515
+ \`\`\`
516
+
517
+ A factor of \`2\` makes the check twice as sensitive: it triggers \`Problematic\` when the heap
518
+ is at 35% (= 0.7 / 2) instead of 70%.
519
+
520
+ ### Known Feature Keys
521
+
522
+ ${ctx.doc('GasFeatureKey')}
523
+
524
+ | Key | Description |
525
+ |:----|:------------|
526
+ ${Object.entries(gas_1.GasFeatureKey).map(([name, key]) => `| \`${key}\` | ${ctx.doc(`GasFeatureKey::${name}`)} |`).join('\n')}
527
+
528
+ You can search for \`ctx.gas.checkGas(\` in the source to locate every active check site.
529
+
530
+ ### Gas Plugins
531
+
532
+ ${ctx.doc(flowr_analyzer_gas_plugin_1.FlowrAnalyzerGasPlugin)}
533
+
534
+ ${ctx.code(gasPluginExample, { dropLinesStart: 1, dropLinesEnd: 1, hideDefinedAt: true })}
535
+
447
536
  ## Helpful Things
448
537
 
449
538
  ### Getting flowR to Talk
@@ -0,0 +1,6 @@
1
+ import type { DocMakerArgs } from './wiki-mk/doc-maker';
2
+ import { DocMaker } from './wiki-mk/doc-maker';
3
+ export declare class WikiCreateLintingRules extends DocMaker<'wiki/Create Linting Rules.md'> {
4
+ constructor();
5
+ protected text({ ctx }: DocMakerArgs): string;
6
+ }
@@ -0,0 +1,95 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WikiCreateLintingRules = void 0;
4
+ const doc_files_1 = require("./doc-util/doc-files");
5
+ const doc_maker_1 = require("./wiki-mk/doc-maker");
6
+ const linter_format_1 = require("../linter/linter-format");
7
+ const flowr_search_builder_1 = require("../search/flowr-search-builder");
8
+ const deprecated_functions_1 = require("../linter/rules/deprecated-functions");
9
+ function lintingRuleFields(ctx) {
10
+ return Object.keys(deprecated_functions_1.DEPRECATED_FUNCTIONS).map(field => {
11
+ return `- ${ctx.link(`LintingRule::${field}`)} ${ctx.doc(`LintingRule::${field}`)}`;
12
+ }).join('\n');
13
+ }
14
+ function lintingRuleInfoFields(ctx) {
15
+ return Object.keys(deprecated_functions_1.DEPRECATED_FUNCTIONS.info).map(field => {
16
+ return ` - ${ctx.link(`LinterRuleInformation::${field}`)} ${ctx.doc(`LinterRuleInformation::${field}`)}`;
17
+ }).join('\n');
18
+ }
19
+ function defineRule() {
20
+ // eslint-disable-next-line @typescript-eslint/naming-convention
21
+ const MY_NEW_RULE = {
22
+ createSearch: (_config) => flowr_search_builder_1.Q.all(),
23
+ processSearchResult: (_elements, _config, _data) => ({
24
+ results: [],
25
+ '.meta': {}
26
+ }),
27
+ prettyPrint: {
28
+ query: (_result, _metadata) => 'my-rule finding',
29
+ full: (_result, _metadata) => 'My Rule reported a finding that should be reviewed.'
30
+ },
31
+ info: {
32
+ name: 'My Rule',
33
+ description: 'Detects something.',
34
+ tags: [],
35
+ certainty: linter_format_1.LintingRuleCertainty.BestEffort,
36
+ defaultConfig: {}
37
+ }
38
+ };
39
+ void MY_NEW_RULE;
40
+ }
41
+ class WikiCreateLintingRules extends doc_maker_1.DocMaker {
42
+ constructor() {
43
+ super('wiki/Create Linting Rules.md', module.filename, 'creating linting rules');
44
+ }
45
+ text({ ctx }) {
46
+ return `
47
+ # Create Linting Rules
48
+
49
+ This page explains how to add a new linting rule to flowR. For an overview of the linter and the existing linting rules, see ${ctx.linkPage('wiki/Linter')}.
50
+
51
+ ## Step 1: Create the new rule file
52
+
53
+ To add a new linting rule, create a dedicated rule file next to the existing rule implementations. The file name should correspond to the exported linting rule object, for example \`my-new-rule.ts\` for a rule object named \`MY_NEW_RULE\`.
54
+ Existing rules such as ${ctx.link('DEPRECATED_FUNCTIONS')} can be used as references.
55
+ Before implementing a new linting rule, open a corresponding [linting rule issue](${doc_files_1.FlowrGithubRef}/issues/new?template=linting-rule.yaml) using the accompanying issue template.
56
+
57
+ ## Step 2: Define the types for the rule
58
+
59
+ For new rules, the central interface is ${ctx.link('LintingRule')}. Its type parameters are documented directly as part of the interface.
60
+
61
+ ## Step 3: Define the rule itself
62
+
63
+ A new linting rule must implement the ${ctx.link('LintingRule')} interface. It consists of the following main parts:
64
+
65
+ ${lintingRuleFields(ctx)}
66
+
67
+ The ${ctx.link('LintingRule::info')} field has type ${ctx.link('LinterRuleInformation')} and contains:
68
+
69
+ ${lintingRuleInfoFields(ctx)}
70
+
71
+ The following example shows the basic structure of a linting rule:
72
+
73
+ ${ctx.code(defineRule, { dropLinesStart: 8, dropLinesEnd: 2 })}
74
+
75
+
76
+ ## Step 4: Register the rule
77
+
78
+ After implementing the rule, register it by adding it to ${ctx.link('LintingRules')}.
79
+
80
+
81
+ ## Step 5: Add the rule to the linter wiki generation
82
+
83
+ After registering the rule, add a corresponding \`rule\` entry to the linter wiki generation in ${ctx.link('WikiLinter')}. These entries are used to generate the linter overview and the individual wiki pages for linting rules, which can then be inspected through ${ctx.linkPage('wiki/Linter')}.
84
+
85
+ ## Step 6: Add tests for the rule
86
+
87
+ New linting rules should be covered by tests following the existing linter test pattern. The test file should be named \`lint-<my-new-rule>.test.ts\`. Existing linter tests can be used as references for the expected structure.
88
+
89
+ The linter wiki automatically extracts additional examples from these tests by reading \`assertLinter\` calls. If a test should not appear as a generated wiki example, add \`/* @ignore-in-wiki */\` to the test.
90
+ For general information on creating and regenerating wiki pages, see ${ctx.linkPage('wiki/FAQ')}, especially the FAQ entry on creating new wiki pages. The linter overview and the generated rule documentation can then be inspected through ${ctx.linkPage('wiki/Linter')}.
91
+ `;
92
+ }
93
+ }
94
+ exports.WikiCreateLintingRules = WikiCreateLintingRules;
95
+ //# sourceMappingURL=wiki-create-linting-rules.js.map