@eagleoutice/flowr 2.12.3 → 2.13.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (321) hide show
  1. package/README.md +42 -95
  2. package/abstract-interpretation/data-frame/dataframe-domain.d.ts +3 -3
  3. package/abstract-interpretation/data-frame/dataframe-domain.js +14 -6
  4. package/abstract-interpretation/data-frame/semantics.js +12 -16
  5. package/abstract-interpretation/domains/abstract-domain.d.ts +46 -44
  6. package/abstract-interpretation/domains/abstract-domain.js +146 -6
  7. package/abstract-interpretation/domains/bounded-set-domain.d.ts +16 -25
  8. package/abstract-interpretation/domains/bounded-set-domain.js +22 -69
  9. package/abstract-interpretation/domains/interval-domain.d.ts +27 -36
  10. package/abstract-interpretation/domains/interval-domain.js +111 -146
  11. package/abstract-interpretation/domains/lattice.d.ts +3 -3
  12. package/abstract-interpretation/domains/multi-value-state-domain.js +3 -3
  13. package/abstract-interpretation/domains/partial-product-domain.d.ts +12 -19
  14. package/abstract-interpretation/domains/partial-product-domain.js +21 -54
  15. package/abstract-interpretation/domains/positive-interval-domain.d.ts +8 -12
  16. package/abstract-interpretation/domains/positive-interval-domain.js +21 -50
  17. package/abstract-interpretation/domains/product-domain.d.ts +1 -1
  18. package/abstract-interpretation/domains/product-domain.js +4 -4
  19. package/abstract-interpretation/domains/set-range-domain.d.ts +60 -56
  20. package/abstract-interpretation/domains/set-range-domain.js +141 -200
  21. package/abstract-interpretation/domains/set-upper-bound-domain.d.ts +17 -23
  22. package/abstract-interpretation/domains/set-upper-bound-domain.js +59 -103
  23. package/abstract-interpretation/domains/singleton-domain.d.ts +15 -18
  24. package/abstract-interpretation/domains/singleton-domain.js +33 -72
  25. package/abstract-interpretation/domains/state-abstract-domain.d.ts +12 -16
  26. package/abstract-interpretation/domains/state-abstract-domain.js +36 -126
  27. package/abstract-interpretation/domains/state-domain-like.d.ts +2 -2
  28. package/abstract-interpretation/domains/value-abstract-domain.d.ts +120 -0
  29. package/abstract-interpretation/domains/{satisfiable-domain.js → value-abstract-domain.js} +14 -2
  30. package/benchmark/slicer.d.ts +2 -2
  31. package/benchmark/slicer.js +6 -5
  32. package/cli/common/options.d.ts +20 -0
  33. package/cli/common/options.js +4 -0
  34. package/cli/common/scripts-info.d.ts +20 -0
  35. package/cli/flowr-main-options.d.ts +4 -0
  36. package/cli/flowr-main-options.js +5 -0
  37. package/cli/flowr.d.ts +5 -0
  38. package/cli/flowr.js +15 -7
  39. package/cli/repl/commands/repl-commands.d.ts +8 -0
  40. package/cli/repl/commands/repl-commands.js +16 -3
  41. package/cli/repl/commands/repl-query.js +50 -20
  42. package/cli/repl/commands/repl-signature.js +2 -2
  43. package/cli/repl/core.d.ts +14 -5
  44. package/cli/repl/core.js +32 -17
  45. package/cli/repl/parser/slice-query-parser.d.ts +69 -8
  46. package/cli/repl/parser/slice-query-parser.js +82 -13
  47. package/cli/repl/path-input.d.ts +6 -0
  48. package/cli/repl/path-input.js +41 -0
  49. package/cli/repl/print-version.js +3 -5
  50. package/cli/slicer-app.d.ts +4 -0
  51. package/cli/slicer-app.js +4 -2
  52. package/config.d.ts +56 -6
  53. package/config.js +134 -12
  54. package/control-flow/control-flow-graph.d.ts +3 -2
  55. package/control-flow/control-flow-graph.js +34 -14
  56. package/control-flow/semantic-cfg-guided-visitor.d.ts +3 -0
  57. package/control-flow/semantic-cfg-guided-visitor.js +3 -0
  58. package/core/steps/all/static-slicing/10-reconstruct.d.ts +6 -0
  59. package/core/steps/all/static-slicing/10-reconstruct.js +3 -1
  60. package/data/r-base-packages.generated.d.ts +1 -1
  61. package/data/r-base-packages.generated.js +3 -3
  62. package/data/sigdb/sigdb.remote.json +53 -53
  63. package/dataflow/environments/built-in-proc-name.d.ts +2 -0
  64. package/dataflow/environments/built-in-proc-name.js +2 -0
  65. package/dataflow/environments/built-in.d.ts +2 -0
  66. package/dataflow/environments/built-in.js +2 -0
  67. package/dataflow/environments/default-builtin-config.d.ts +3 -5
  68. package/dataflow/environments/default-builtin-config.js +2 -2
  69. package/dataflow/environments/environment.d.ts +9 -0
  70. package/dataflow/environments/environment.js +28 -7
  71. package/dataflow/environments/identifier.d.ts +1 -2
  72. package/dataflow/environments/identifier.js +1 -5
  73. package/dataflow/extractor.js +1 -2
  74. package/dataflow/graph/dataflowgraph-builder.js +42 -3
  75. package/dataflow/graph/df-helper.d.ts +15 -0
  76. package/dataflow/graph/df-helper.js +20 -0
  77. package/dataflow/internal/process/functions/call/built-in/built-in-attach.js +4 -4
  78. package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.d.ts +7 -0
  79. package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.js +13 -0
  80. package/dataflow/internal/process/functions/call/built-in/built-in-library.d.ts +4 -0
  81. package/dataflow/internal/process/functions/call/built-in/built-in-library.js +57 -11
  82. package/dataflow/internal/process/functions/call/built-in/built-in-load.d.ts +12 -0
  83. package/dataflow/internal/process/functions/call/built-in/built-in-load.js +233 -0
  84. package/dataflow/internal/process/functions/call/built-in/built-in-source.js +2 -1
  85. package/dataflow/internal/process/functions/call/built-in/built-in-with.js +5 -3
  86. package/documentation/data/faq/faqs.js +12 -1
  87. package/documentation/doc-readme.js +1 -1
  88. package/documentation/doc-util/doc-files.d.ts +2 -2
  89. package/documentation/doc-util/doc-files.js +4 -7
  90. package/documentation/doc-util/doc-query.d.ts +12 -9
  91. package/documentation/doc-util/doc-query.js +63 -28
  92. package/documentation/wiki-absint.js +1 -4
  93. package/documentation/wiki-analyzer.js +8 -3
  94. package/documentation/wiki-cfg.js +3 -2
  95. package/documentation/wiki-dataflow-graph.js +14 -4
  96. package/documentation/wiki-interface.js +30 -16
  97. package/documentation/wiki-mk/doc-maker.js +1 -1
  98. package/documentation/wiki-query.js +190 -30
  99. package/documentation/wiki-signature-database.d.ts +1 -1
  100. package/documentation/wiki-signature-database.js +53 -27
  101. package/linter/linter-output.d.ts +24 -0
  102. package/linter/linter-output.js +117 -0
  103. package/linter/linter-rules.d.ts +2 -4
  104. package/linter/rules/dataframe-access-validation.js +4 -4
  105. package/linter/rules/deprecated-functions.d.ts +2 -4
  106. package/linter/rules/deprecated-functions.js +58 -3
  107. package/linter/rules/undefined-symbol.js +18 -10
  108. package/linter/rules/unused-definition.js +24 -0
  109. package/package.json +5 -2
  110. package/project/context/flowr-analyzer-context.d.ts +61 -1
  111. package/project/context/flowr-analyzer-context.js +124 -3
  112. package/project/context/flowr-analyzer-dependencies-context.d.ts +32 -7
  113. package/project/context/flowr-analyzer-dependencies-context.js +33 -3
  114. package/project/context/flowr-analyzer-files-context.d.ts +40 -0
  115. package/project/context/flowr-analyzer-files-context.js +171 -14
  116. package/project/context/flowr-analyzer-loading-order-context.d.ts +6 -0
  117. package/project/context/flowr-analyzer-loading-order-context.js +20 -0
  118. package/project/context/flowr-analyzer-meta-context.d.ts +92 -10
  119. package/project/context/flowr-analyzer-meta-context.js +64 -23
  120. package/project/context/flowr-file.d.ts +7 -0
  121. package/project/context/flowr-file.js +7 -0
  122. package/project/context/project-kind.d.ts +22 -0
  123. package/project/context/project-kind.js +27 -0
  124. package/project/dependency-version-space.d.ts +168 -0
  125. package/project/dependency-version-space.js +570 -0
  126. package/project/flowr-analyzer-builder.js +1 -1
  127. package/project/flowr-analyzer.d.ts +7 -0
  128. package/project/flowr-analyzer.js +9 -0
  129. package/project/plugins/file-plugins/files/flowr-description-file.d.ts +4 -0
  130. package/project/plugins/file-plugins/files/flowr-description-file.js +7 -0
  131. package/project/plugins/file-plugins/files/flowr-namespace-file.js +5 -1
  132. package/project/plugins/file-plugins/files/flowr-rda-file.d.ts +739 -0
  133. package/project/plugins/file-plugins/files/flowr-rda-file.js +2407 -0
  134. package/project/plugins/file-plugins/files/flowr-rproject-file.d.ts +31 -0
  135. package/project/plugins/file-plugins/files/flowr-rproject-file.js +66 -0
  136. package/project/plugins/file-plugins/files/r-fun-tab.d.ts +828 -0
  137. package/project/plugins/file-plugins/files/r-fun-tab.js +1039 -0
  138. package/project/plugins/file-plugins/flowr-analyzer-description-file-plugin.d.ts +1 -1
  139. package/project/plugins/file-plugins/flowr-analyzer-description-file-plugin.js +1 -1
  140. package/project/plugins/file-plugins/flowr-analyzer-file-plugin.js +1 -1
  141. package/project/plugins/file-plugins/flowr-analyzer-inst-file-plugin.d.ts +1 -1
  142. package/project/plugins/file-plugins/flowr-analyzer-inst-file-plugin.js +1 -1
  143. package/project/plugins/file-plugins/flowr-analyzer-license-file-plugin.d.ts +1 -1
  144. package/project/plugins/file-plugins/flowr-analyzer-license-file-plugin.js +1 -1
  145. package/project/plugins/file-plugins/flowr-analyzer-namespace-files-plugin.d.ts +1 -1
  146. package/project/plugins/file-plugins/flowr-analyzer-namespace-files-plugin.js +1 -1
  147. package/project/plugins/file-plugins/flowr-analyzer-news-file-plugin.d.ts +1 -1
  148. package/project/plugins/file-plugins/flowr-analyzer-news-file-plugin.js +1 -1
  149. package/project/plugins/file-plugins/flowr-analyzer-rda-file-plugin.d.ts +26 -0
  150. package/project/plugins/file-plugins/flowr-analyzer-rda-file-plugin.js +38 -0
  151. package/project/plugins/file-plugins/flowr-analyzer-rprofile-file-plugin.d.ts +17 -0
  152. package/project/plugins/file-plugins/flowr-analyzer-rprofile-file-plugin.js +30 -0
  153. package/project/plugins/file-plugins/flowr-analyzer-rproject-file-plugin.d.ts +22 -0
  154. package/project/plugins/file-plugins/flowr-analyzer-rproject-file-plugin.js +36 -0
  155. package/project/plugins/file-plugins/flowr-analyzer-test-file-plugin.d.ts +1 -1
  156. package/project/plugins/file-plugins/flowr-analyzer-test-file-plugin.js +1 -1
  157. package/project/plugins/file-plugins/flowr-analyzer-vignette-file-plugin.d.ts +1 -1
  158. package/project/plugins/file-plugins/flowr-analyzer-vignette-file-plugin.js +1 -1
  159. package/project/plugins/file-plugins/flowr-analyzer-virtualenv-file-plugin.d.ts +3 -4
  160. package/project/plugins/file-plugins/flowr-analyzer-virtualenv-file-plugin.js +5 -6
  161. package/project/plugins/flowr-analyzer-plugin.js +5 -0
  162. package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-description-file-plugin.d.ts +1 -1
  163. package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-description-file-plugin.js +1 -1
  164. package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-implicit-sources-plugin.d.ts +14 -0
  165. package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-implicit-sources-plugin.js +53 -0
  166. package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-plugin.js +1 -1
  167. package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-rprofile-plugin.d.ts +15 -0
  168. package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-rprofile-plugin.js +33 -0
  169. package/project/plugins/package-version-plugins/flowr-analyzer-meta-description-file-plugin.d.ts +1 -1
  170. package/project/plugins/package-version-plugins/flowr-analyzer-meta-description-file-plugin.js +18 -13
  171. package/project/plugins/package-version-plugins/flowr-analyzer-meta-rproject-file-plugin.d.ts +13 -0
  172. package/project/plugins/package-version-plugins/flowr-analyzer-meta-rproject-file-plugin.js +32 -0
  173. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-description-file-plugin.d.ts +1 -1
  174. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-description-file-plugin.js +1 -1
  175. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-lockfile-plugin.d.ts +8 -1
  176. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-lockfile-plugin.js +70 -7
  177. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-namespace-file-plugin.d.ts +1 -1
  178. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-namespace-file-plugin.js +1 -1
  179. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-plugin.js +1 -1
  180. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-session-info-plugin.d.ts +18 -0
  181. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-session-info-plugin.js +62 -0
  182. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.d.ts +4 -1
  183. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.js +5 -13
  184. package/project/plugins/package-version-plugins/package.d.ts +4 -1
  185. package/project/plugins/package-version-plugins/package.js +8 -5
  186. package/project/plugins/plugin-registry.d.ts +11 -3
  187. package/project/plugins/plugin-registry.js +24 -5
  188. package/project/plugins/project-discovery/flowr-analyzer-ignore-file-project-discovery-plugin.d.ts +51 -0
  189. package/project/plugins/project-discovery/flowr-analyzer-ignore-file-project-discovery-plugin.js +101 -0
  190. package/project/plugins/project-discovery/flowr-analyzer-project-discovery-plugin.js +10 -5
  191. package/project/sigdb/build.js +12 -2
  192. package/project/sigdb/decode.d.ts +7 -0
  193. package/project/sigdb/decode.js +35 -4
  194. package/project/sigdb/decompress.d.ts +2 -0
  195. package/project/sigdb/decompress.js +5 -0
  196. package/project/sigdb/manifest.d.ts +5 -0
  197. package/project/sigdb/manifest.js +37 -6
  198. package/project/sigdb/reader.d.ts +82 -2
  199. package/project/sigdb/reader.js +226 -14
  200. package/project/sigdb/schema.d.ts +31 -5
  201. package/project/sigdb/schema.js +7 -3
  202. package/project/sigdb/{version.d.ts → sigdb-version.d.ts} +21 -1
  203. package/project/sigdb/sigdb-version.js +119 -0
  204. package/queries/catalog/absint-query/absint-query-format.d.ts +2 -0
  205. package/queries/catalog/absint-query/absint-query-format.js +2 -0
  206. package/queries/catalog/call-context-query/call-context-query-executor.js +30 -3
  207. package/queries/catalog/call-context-query/call-context-query-format.d.ts +1 -0
  208. package/queries/catalog/call-context-query/call-context-query-format.js +1 -0
  209. package/queries/catalog/call-graph-query/call-graph-query-executor.js +3 -1
  210. package/queries/catalog/call-graph-query/call-graph-query-format.d.ts +6 -0
  211. package/queries/catalog/call-graph-query/call-graph-query-format.js +2 -0
  212. package/queries/catalog/call-graph-query/expand-library-internals.d.ts +19 -0
  213. package/queries/catalog/call-graph-query/expand-library-internals.js +59 -0
  214. package/queries/catalog/cluster-query/cluster-query-format.d.ts +1 -0
  215. package/queries/catalog/cluster-query/cluster-query-format.js +1 -0
  216. package/queries/catalog/config-query/config-query-executor.js +17 -5
  217. package/queries/catalog/config-query/config-query-format.d.ts +19 -3
  218. package/queries/catalog/config-query/config-query-format.js +258 -98
  219. package/queries/catalog/control-flow-query/control-flow-query-format.d.ts +1 -0
  220. package/queries/catalog/control-flow-query/control-flow-query-format.js +1 -0
  221. package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.d.ts +1 -0
  222. package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.js +1 -0
  223. package/queries/catalog/dataflow-query/dataflow-query-format.d.ts +1 -0
  224. package/queries/catalog/dataflow-query/dataflow-query-format.js +1 -0
  225. package/queries/catalog/dependencies-query/dependencies-query-executor.js +2 -7
  226. package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +13 -1
  227. package/queries/catalog/dependencies-query/dependencies-query-format.js +117 -17
  228. package/queries/catalog/dice-query/dice-query-executor.js +6 -9
  229. package/queries/catalog/dice-query/dice-query-format.d.ts +4 -5
  230. package/queries/catalog/dice-query/dice-query-format.js +10 -6
  231. package/queries/catalog/does-call-query/does-call-query-executor.js +15 -2
  232. package/queries/catalog/does-call-query/does-call-query-format.d.ts +8 -0
  233. package/queries/catalog/does-call-query/does-call-query-format.js +4 -1
  234. package/queries/catalog/files-query/files-query-format.d.ts +2 -0
  235. package/queries/catalog/files-query/files-query-format.js +2 -0
  236. package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-executor.d.ts +6 -0
  237. package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-executor.js +293 -0
  238. package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-format.d.ts +121 -0
  239. package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-format.js +345 -0
  240. package/queries/catalog/happens-before-query/happens-before-query-format.d.ts +1 -0
  241. package/queries/catalog/happens-before-query/happens-before-query-format.js +1 -0
  242. package/queries/catalog/id-map-query/id-map-query-format.d.ts +1 -0
  243. package/queries/catalog/id-map-query/id-map-query-format.js +1 -0
  244. package/queries/catalog/input-sources-query/input-sources-query-format.d.ts +2 -0
  245. package/queries/catalog/input-sources-query/input-sources-query-format.js +2 -0
  246. package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.d.ts +2 -0
  247. package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.js +2 -0
  248. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.d.ts +2 -0
  249. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.js +2 -0
  250. package/queries/catalog/inspect-recursion-query/inspect-recursion-query-format.d.ts +2 -0
  251. package/queries/catalog/inspect-recursion-query/inspect-recursion-query-format.js +2 -0
  252. package/queries/catalog/linter-query/linter-query-executor.js +11 -2
  253. package/queries/catalog/linter-query/linter-query-format.d.ts +9 -4
  254. package/queries/catalog/linter-query/linter-query-format.js +44 -21
  255. package/queries/catalog/location-map-query/location-map-query-format.d.ts +2 -0
  256. package/queries/catalog/location-map-query/location-map-query-format.js +2 -0
  257. package/queries/catalog/normalized-ast-query/normalized-ast-query-format.d.ts +1 -0
  258. package/queries/catalog/normalized-ast-query/normalized-ast-query-format.js +1 -0
  259. package/queries/catalog/origin-query/origin-query-format.d.ts +2 -0
  260. package/queries/catalog/origin-query/origin-query-format.js +2 -0
  261. package/queries/catalog/project-query/project-query-executor.d.ts +0 -15
  262. package/queries/catalog/project-query/project-query-executor.js +19 -62
  263. package/queries/catalog/project-query/project-query-format.d.ts +7 -18
  264. package/queries/catalog/project-query/project-query-format.js +3 -18
  265. package/queries/catalog/provenance-query/provenance-query-format.d.ts +2 -0
  266. package/queries/catalog/provenance-query/provenance-query-format.js +2 -0
  267. package/queries/catalog/resolve-value-query/resolve-value-query-format.d.ts +2 -0
  268. package/queries/catalog/resolve-value-query/resolve-value-query-format.js +2 -0
  269. package/queries/catalog/search-query/search-query-format.d.ts +1 -0
  270. package/queries/catalog/search-query/search-query-format.js +1 -0
  271. package/queries/catalog/signature-query/signature-query-executor.d.ts +5 -0
  272. package/queries/catalog/signature-query/signature-query-executor.js +267 -57
  273. package/queries/catalog/signature-query/signature-query-format.d.ts +37 -6
  274. package/queries/catalog/signature-query/signature-query-format.js +41 -5
  275. package/queries/catalog/signature-query/signature-query-render.js +48 -6
  276. package/queries/catalog/slice-query-options.d.ts +49 -0
  277. package/queries/catalog/slice-query-options.js +50 -0
  278. package/queries/catalog/static-slice-query/static-slice-query-executor.js +4 -12
  279. package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +4 -15
  280. package/queries/catalog/static-slice-query/static-slice-query-format.js +9 -10
  281. package/queries/query-print.js +3 -1
  282. package/queries/query.d.ts +62 -2
  283. package/queries/query.js +9 -2
  284. package/r-bridge/data/data.d.ts +16 -0
  285. package/r-bridge/data/data.js +20 -0
  286. package/r-bridge/lang-4.x/ast/model/model.d.ts +1 -0
  287. package/r-bridge/lang-4.x/ast/model/processing/decorate.js +2 -1
  288. package/r-bridge/lang-4.x/ast/parser/main/internal/normalize-access.js +2 -1
  289. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +19 -16
  290. package/reconstruct/reconstruct.d.ts +18 -1
  291. package/reconstruct/reconstruct.js +42 -19
  292. package/slicing/criterion/parse.d.ts +4 -0
  293. package/slicing/criterion/parse.js +4 -0
  294. package/slicing/static/slice-call.js +17 -9
  295. package/slicing/static/static-slicer.d.ts +1 -1
  296. package/slicing/static/static-slicer.js +5 -4
  297. package/util/files.d.ts +19 -1
  298. package/util/files.js +45 -3
  299. package/util/glob.d.ts +19 -0
  300. package/util/glob.js +67 -0
  301. package/util/log.d.ts +12 -0
  302. package/util/log.js +17 -1
  303. package/util/logic.d.ts +6 -0
  304. package/util/logic.js +31 -1
  305. package/util/mermaid/dfg.js +17 -12
  306. package/util/mermaid/mermaid.js +2 -2
  307. package/util/objects.d.ts +5 -0
  308. package/util/objects.js +8 -0
  309. package/util/r-version.d.ts +9 -1
  310. package/util/r-version.js +27 -2
  311. package/util/schema.d.ts +18 -0
  312. package/util/schema.js +102 -4
  313. package/util/text/ansi.d.ts +4 -0
  314. package/util/text/ansi.js +27 -3
  315. package/util/text/strings.d.ts +9 -0
  316. package/util/text/strings.js +29 -0
  317. package/util/version.js +79 -6
  318. package/abstract-interpretation/domains/satisfiable-domain.d.ts +0 -29
  319. package/project/plugins/project-discovery/flowr-analyzer-gitignore-project-discovery-plugin.d.ts +0 -22
  320. package/project/plugins/project-discovery/flowr-analyzer-gitignore-project-discovery-plugin.js +0 -52
  321. package/project/sigdb/version.js +0 -55
@@ -6,12 +6,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.WikiSignatureDatabase = void 0;
7
7
  const fs_1 = __importDefault(require("fs"));
8
8
  const path_1 = __importDefault(require("path"));
9
- const zlib_1 = __importDefault(require("zlib"));
10
9
  const doc_maker_1 = require("./wiki-mk/doc-maker");
11
10
  const doc_files_1 = require("./doc-util/doc-files");
12
11
  const reader_1 = require("../project/sigdb/reader");
13
12
  const schema_1 = require("../project/sigdb/schema");
14
13
  const manifest_1 = require("../project/sigdb/manifest");
14
+ const codec_1 = require("../project/sigdb/codec");
15
15
  const config_1 = require("../config");
16
16
  const flowr_analyzer_package_versions_sigdb_plugin_1 = require("../project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin");
17
17
  const flowr_analyzer_builder_1 = require("../project/flowr-analyzer-builder");
@@ -23,6 +23,21 @@ function usePackageDatabase(parser) {
23
23
  const sigdb = new flowr_analyzer_package_versions_sigdb_plugin_1.FlowrAnalyzerPackageVersionsSigDbPlugin('/path/to/sigs.manifest.json.br');
24
24
  return new flowr_analyzer_builder_1.FlowrAnalyzerBuilder().setParser(parser).registerPlugins(sigdb).build();
25
25
  }
26
+ function accessTheDatabase(source) {
27
+ const fn = source.functionByName('dplyr', 'lead', '1.1.4');
28
+ return {
29
+ exported: fn?.exported,
30
+ signature: fn?.signature.map(p => p.name),
31
+ localCalls: fn?.callees,
32
+ topic: fn?.topic,
33
+ location: [fn?.file, fn?.line],
34
+ transitive: source.transitiveCallees('dplyr', 'lead', '1.1.4'),
35
+ deps: source.dependencies('dplyr', '1.1.4'),
36
+ exports: source.lookup('dplyr')?.exported,
37
+ s3Classes: source.lookup('zoo')?.s3Classes,
38
+ classOwner: source.classOwner('zoo')
39
+ };
40
+ }
26
41
  /** a coarse duration in short units (`µs`/`ms`); we only ever quote estimates, never false precision */
27
42
  function roughDuration(ms) {
28
43
  if (ms < 0.001) {
@@ -96,25 +111,25 @@ function shardContents(s) {
96
111
  function tierHistory(s) {
97
112
  return s.tier === 'current' ? 'latest only' : 'full history';
98
113
  }
99
- /** resolve a manifest-relative source to its shipped file, preferring the compressed `.br` */
114
+ /** resolve a manifest-relative source to its shipped file, preferring `.zst` over `.br` (whichever this Node can read) */
100
115
  function resolveShipped(baseDir, rel) {
101
- for (const candidate of [path_1.default.resolve(baseDir, rel + '.br'), path_1.default.resolve(baseDir, rel)]) {
116
+ for (const candidate of [rel + '.zst', rel + '.br', rel].map(c => path_1.default.resolve(baseDir, c))) {
102
117
  if (fs_1.default.existsSync(candidate)) {
103
118
  return candidate;
104
119
  }
105
120
  }
106
121
  return undefined;
107
122
  }
108
- /** time (at generation time) how long it takes to decompress one shipped `.br`, i.e. its first-touch load cost */
123
+ /** time (at generation time) how long it takes to decompress one shipped shard, i.e. its first-touch load cost */
109
124
  function measureLoad(file) {
110
- if (!file.endsWith('.br')) {
125
+ if (!/\.(br|zst|gz)$/.test(file)) {
111
126
  return undefined;
112
127
  }
113
128
  try {
114
129
  const raw = fs_1.default.readFileSync(file);
115
- const t0 = Date.now();
116
- zlib_1.default.brotliDecompressSync(raw, { params: { [zlib_1.default.constants.BROTLI_DECODER_PARAM_LARGE_WINDOW]: 1 } });
117
- return Date.now() - t0;
130
+ const t0 = process.hrtime.bigint();
131
+ (0, codec_1.decompressSyncFor)(file, raw);
132
+ return Number(process.hrtime.bigint() - t0) / 1e6;
118
133
  }
119
134
  catch {
120
135
  return undefined;
@@ -129,7 +144,7 @@ function measureLoad(file) {
129
144
  * without generated data).
130
145
  */
131
146
  function bundledDatabaseTable() {
132
- const manifestPaths = (0, manifest_1.defaultSigDbPaths)().filter(p => /\.manifest\.json(\.br)?$/.test(p));
147
+ const manifestPaths = (0, manifest_1.defaultSigDbPaths)().filter(p => new RegExp(`\\.manifest\\.json${codec_1.CompressedExtPattern}$`).test(p));
133
148
  if (manifestPaths.length === 0) {
134
149
  return undefined;
135
150
  }
@@ -139,16 +154,11 @@ function bundledDatabaseTable() {
139
154
  return load !== undefined ? `≈ ${roughDuration(load)}` : 'n/a';
140
155
  };
141
156
  const shardRows = [];
142
- const dictRows = [];
143
157
  const seenShards = new Set();
144
- const seenDicts = new Set();
145
158
  for (const manifestPath of manifestPaths) {
146
159
  let shards;
147
- let dicts;
148
160
  try {
149
- const manifest = (0, manifest_1.readManifestFile)(manifestPath);
150
- shards = manifest.shards;
151
- dicts = manifest.dicts ?? [];
161
+ shards = (0, manifest_1.readManifestFile)(manifestPath).shards;
152
162
  }
153
163
  catch {
154
164
  continue;
@@ -162,30 +172,20 @@ function bundledDatabaseTable() {
162
172
  const file = resolveShipped(baseDir, s.path);
163
173
  shardRows.push(`| \`${s.id}\` | ${shardContents(s)} | ${tierHistory(s)} | ${groupThousands(s.packages)} | ${groupThousands(s.versions)} | ${sizeOf(file)} | ${loadOf(file)} |`);
164
174
  }
165
- for (const d of dicts) {
166
- // every manifest names its dict id `shared`; the files differ per scope, so dedupe (and label) by path
167
- if (seenDicts.has(d.path)) {
168
- continue;
169
- }
170
- seenDicts.add(d.path);
171
- const file = resolveShipped(baseDir, d.path);
172
- const label = path_1.default.basename(d.path).replace(/\.sigs\.ndjson$/, '');
173
- dictRows.push(`| \`${label}\` | ${groupThousands(d.strings)} shared strings | - | - | - | ${sizeOf(file)} | ${loadOf(file)} |`);
174
- }
175
175
  }
176
176
  if (shardRows.length === 0) {
177
177
  return undefined;
178
178
  }
179
179
  return `| Shard | Contents | Versions kept | Packages | Versions | Size (\`.br\`) | Load (first touch) |
180
180
  |-------|----------|---------------|---------:|---------:|-------------:|-------------------:|
181
- ${[...shardRows, ...dictRows].join('\n')}`;
181
+ ${shardRows.join('\n')}`;
182
182
  }
183
183
  /** link a built-in plugin key (e.g. `versions:sigdb`) to its registration */
184
184
  function pluginLink(key) {
185
185
  return `[\`${key}\`](${doc_files_1.RemoteFlowrFilePathBaseRef}src/project/plugins/plugin-registry.ts)`;
186
186
  }
187
187
  /**
188
- * https://github.com/flowr-analysis/flowr/wiki/Package-Database
188
+ * https://github.com/flowr-analysis/flowr/wiki/Signature-Database
189
189
  */
190
190
  class WikiSignatureDatabase extends doc_maker_1.DocMaker {
191
191
  constructor() {
@@ -216,6 +216,32 @@ After \`library(ggplot2)\`, a call to \`ggplot()\` resolves to \`ggplot2::ggplot
216
216
  qualifies bare names and backs various components like the ${ctx.linkPage('wiki/Query API', 'dependencies and call-context queries')}
217
217
  as well as the ${ctx.linkPage('wiki/Linter', 'undefined symbol')} rule.
218
218
 
219
+ ## What is stored
220
+
221
+ Every function is a ${ctx.link('DecodedFunction')}:
222
+
223
+ | field | holds |
224
+ |-------|-------|
225
+ | ${ctx.link('DecodedFunction::exported')} | whether the name is a package export |
226
+ | ${ctx.link('DecodedFunction::signature')} | the parameters, with defaults and forced or optional flags |
227
+ | ${ctx.link('DecodedFunction::callees')} | the function's own local calls |
228
+ | ${ctx.link('DecodedFunction::topic')} | the Rd help topic when it differs from the name |
229
+ | ${ctx.link('DecodedFunction::file')}, ${ctx.link('DecodedFunction::line')} | source location |
230
+ | ${ctx.link('DecodedFunction::props')} | flags like higher-order, recursive, deprecated |
231
+
232
+ Per version the source also answers declared dependencies (${ctx.link('ResolvedDependency')}), release dates, the plain export view (${ctx.link('LibraryExports')}), and the versions it carries (${ctx.link('AvailableVersion')}).
233
+
234
+ Beyond the flags above, ${ctx.link('DecodedFunction::props')} also carry ${ctx.link('FnProp::NoDoc')} (a documented package has no help page for this name), ${ctx.link('FnProp::S3Method')} (a registered S3 method, from the package NAMESPACE or base R's method table), and ${ctx.link('FnProp::S3Owner')} (an exported constructor for an S3 class this package OWNS: it also registers at least one S3 method for that class). The owned classes of a version are ${ctx.link('LibraryExports::s3Classes')}, and ${ctx.linkM(reader_1.SigDatabase, 'classOwner')} answers, for a class name, which package owns it (backed by a reverse index built once). This lets ${ctx.linkPage('wiki/Query API', 'version guessing')} mark a package used when the analyzed project's own NAMESPACE registers an S3 method for a class it owns, even with no direct call -- e.g. tseries's \`S3method("as.irts","zoo")\` marks \`zoo\` used.
235
+
236
+ These are derived on demand by the ${ctx.linkPage('wiki/Query API', 'signature query')}, not stored:
237
+ - the rdrr.io documentation link ${ctx.link('SignatureFunctionView::docUrl')} (base R \`/r/<pkg>/<topic>\`, CRAN \`/cran/<pkg>/man/<topic>\`), omitted for a ${ctx.link('FnProp::NoDoc')} function
238
+ - the S3 method to generic backlink ${ctx.link('SignatureFunctionView::s3method')}, for a ${ctx.link('FnProp::S3Method')} function, resolving its generic
239
+ - the transitive call graph ${ctx.linkM(reader_1.SigDatabase, 'transitiveCallees')}, expanding the stored local callees inside one version
240
+
241
+ Read it back like this:
242
+
243
+ ${ctx.code(accessTheDatabase, { dropLinesStart: 1 })}
244
+
219
245
  ## Configuration
220
246
 
221
247
  The exports come from ${pluginLink('versions:sigdb')}, which reads bundled databases. It is enabled by
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Machine-readable renderings of linting results, for the tools that consume them (a CI, a code scanner, an editor).
3
+ * @module
4
+ */
5
+ import { type LintingRuleNames } from './linter-rules';
6
+ import { LintingResults } from './linter-format';
7
+ /** The linting results of every rule that ran, i.e. what a linter query returns. */
8
+ export type LintResultsByRule = {
9
+ [L in LintingRuleNames]?: LintingResults<L>;
10
+ };
11
+ /** The formats linting results are reported in. */
12
+ export declare enum LinterOutputFormat {
13
+ /** flowR's own summary, made to be read by a human. The default, and the one {@link formatLints} leaves to flowR. */
14
+ Text = "text",
15
+ /** [SARIF 2.1.0](https://docs.oasis-open.org/sarif/sarif/v2.1.0/sarif-v2.1.0.html), e.g. to upload to GitHub code scanning */
16
+ Sarif = "sarif",
17
+ /** [GitHub workflow commands](https://docs.github.com/actions/reference/workflow-commands-for-github-actions), one annotation per finding */
18
+ Github = "github"
19
+ }
20
+ /**
21
+ * Renders the linting results in the given {@link LinterOutputFormat|format}, `undefined` for
22
+ * {@link LinterOutputFormat.Text|Text}: that one is flowR's own summary, which only flowR itself renders.
23
+ */
24
+ export declare function formatLints(results: LintResultsByRule, format: LinterOutputFormat, flowrVersion: string): string | undefined;
@@ -0,0 +1,117 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LinterOutputFormat = void 0;
4
+ exports.formatLints = formatLints;
5
+ /**
6
+ * Machine-readable renderings of linting results, for the tools that consume them (a CI, a code scanner, an editor).
7
+ * @module
8
+ */
9
+ const linter_rules_1 = require("./linter-rules");
10
+ const linter_format_1 = require("./linter-format");
11
+ const files_1 = require("../util/files");
12
+ const doc_files_1 = require("../documentation/doc-util/doc-files");
13
+ /** The formats linting results are reported in. */
14
+ var LinterOutputFormat;
15
+ (function (LinterOutputFormat) {
16
+ /** flowR's own summary, made to be read by a human. The default, and the one {@link formatLints} leaves to flowR. */
17
+ LinterOutputFormat["Text"] = "text";
18
+ /** [SARIF 2.1.0](https://docs.oasis-open.org/sarif/sarif/v2.1.0/sarif-v2.1.0.html), e.g. to upload to GitHub code scanning */
19
+ LinterOutputFormat["Sarif"] = "sarif";
20
+ /** [GitHub workflow commands](https://docs.github.com/actions/reference/workflow-commands-for-github-actions), one annotation per finding */
21
+ LinterOutputFormat["Github"] = "github";
22
+ })(LinterOutputFormat || (exports.LinterOutputFormat = LinterOutputFormat = {}));
23
+ /** flattened, as neither format groups by rule */
24
+ function findings(results) {
25
+ return Object.entries(results).flatMap(([name, perRuleResults]) => {
26
+ const rule = name;
27
+ const perRule = perRuleResults;
28
+ /* staying silent about a rule that threw would claim it passed */
29
+ if (linter_format_1.LintingResults.isError(perRule)) {
30
+ return [{ rule, message: `the linting rule failed: ${linter_format_1.LintingResults.stringifyError(perRule)}`, level: 'error', loc: undefined }];
31
+ }
32
+ return perRule.results.map(result => ({
33
+ rule,
34
+ message: linter_rules_1.LintingRules[rule].prettyPrint[linter_format_1.LintingPrettyPrintContext.Query](result, perRule['.meta']),
35
+ level: (result.certainty === linter_format_1.LintingResultCertainty.Certain ? 'warning' : 'note'),
36
+ loc: result.loc
37
+ }));
38
+ });
39
+ }
40
+ /** Neither a github annotation nor its sarif ingestion attaches to an absolute path, so report it from the workspace. */
41
+ function reportedPath(file) {
42
+ return (0, files_1.relativeTo)(process.env.GITHUB_WORKSPACE ?? process.cwd(), file);
43
+ }
44
+ /** a finding flowR cannot locate carries no location, rather than a broken one */
45
+ function sarifLocation(loc) {
46
+ if (loc === undefined || loc[4] === undefined) {
47
+ return [];
48
+ }
49
+ return [{
50
+ physicalLocation: {
51
+ artifactLocation: { uri: reportedPath(loc[4]) },
52
+ region: { startLine: loc[0], startColumn: loc[1], endLine: loc[2], endColumn: loc[3] }
53
+ }
54
+ }];
55
+ }
56
+ /**
57
+ * Renders the linting results as SARIF 2.1.0, the format code scanners (e.g. GitHub's) ingest, on a single line.
58
+ * Only the rules that produced a finding are described, as SARIF requires every reported rule to be declared.
59
+ */
60
+ function lintsToSarif(results, flowrVersion) {
61
+ const flat = findings(results);
62
+ const reported = [...new Set(flat.map(f => f.rule))];
63
+ return JSON.stringify({
64
+ $schema: 'https://json.schemastore.org/sarif-2.1.0.json',
65
+ version: '2.1.0',
66
+ runs: [{
67
+ tool: {
68
+ driver: {
69
+ name: 'flowR',
70
+ informationUri: doc_files_1.FlowrGithubRef,
71
+ version: flowrVersion,
72
+ rules: reported.map(name => ({
73
+ id: name,
74
+ name: linter_rules_1.LintingRules[name].info.name,
75
+ shortDescription: { text: linter_rules_1.LintingRules[name].info.description },
76
+ properties: { tags: linter_rules_1.LintingRules[name].info.tags }
77
+ }))
78
+ }
79
+ },
80
+ results: flat.map(f => ({
81
+ ruleId: f.rule,
82
+ level: f.level,
83
+ message: { text: f.message },
84
+ locations: sarifLocation(f.loc)
85
+ }))
86
+ }]
87
+ });
88
+ }
89
+ /** GitHub has no 'note' */
90
+ const githubCommand = { error: 'error', warning: 'warning', note: 'notice' };
91
+ /** `%`, `\r` and `\n` would end the workflow command */
92
+ function escapeGithubData(text) {
93
+ return text.replaceAll('%', '%25').replaceAll('\r', '%0D').replaceAll('\n', '%0A');
94
+ }
95
+ /** Renders the linting results as GitHub workflow commands, which a workflow run turns into annotations. */
96
+ function lintsToGithub(results) {
97
+ return findings(results).map(f => {
98
+ const loc = f.loc !== undefined && f.loc[4] !== undefined ? f.loc : undefined;
99
+ const where = loc === undefined ? '' : ` file=${escapeGithubData(reportedPath(loc[4]))},line=${loc[0]},col=${loc[1]},endLine=${loc[2]},endColumn=${loc[3]},`;
100
+ return `::${githubCommand[f.level]}${where}${loc === undefined ? ' ' : ''}title=${escapeGithubData(f.rule)}::${escapeGithubData(f.message)}`;
101
+ }).join('\n');
102
+ }
103
+ /**
104
+ * Renders the linting results in the given {@link LinterOutputFormat|format}, `undefined` for
105
+ * {@link LinterOutputFormat.Text|Text}: that one is flowR's own summary, which only flowR itself renders.
106
+ */
107
+ function formatLints(results, format, flowrVersion) {
108
+ switch (format) {
109
+ case LinterOutputFormat.Sarif:
110
+ return lintsToSarif(results, flowrVersion);
111
+ case LinterOutputFormat.Github:
112
+ return lintsToGithub(results);
113
+ case LinterOutputFormat.Text:
114
+ return undefined;
115
+ }
116
+ }
117
+ //# sourceMappingURL=linter-output.js.map
@@ -5,10 +5,8 @@ import type { LintingRule } from './linter-format';
5
5
  */
6
6
  export declare const LintingRules: {
7
7
  readonly 'deprecated-functions': {
8
- readonly createSearch: (config: import("./rules/function-finder-util").FunctionsToDetectConfig) => import("../search/flowr-search-builder").FlowrSearchBuilder<"all", ["filter", "with", "filter"], import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, Promise<import("../search/flowr-search").FlowrSearchElements<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, [] | import("../search/flowr-search").FlowrSearchElement<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation>[]>>>;
9
- readonly processSearchResult: <T extends import("../search/flowr-search").FlowrSearchElement<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation>[]>(this: void, elements: import("../search/flowr-search").FlowrSearchElements<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, T>, _config: unknown, _data: unknown, refineSearch?: (elements: T) => import("ts-essentials").AsyncOrSync<(T[number] & {
10
- certainty?: import("./linter-format").LintingResultCertainty;
11
- })[]>) => Promise<{
8
+ readonly createSearch: (_config: import("./rules/function-finder-util").FunctionsToDetectConfig) => import("../search/flowr-search-builder").FlowrSearchBuilder<"all", ["filter", "with"], import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, Promise<import("../search/flowr-search").FlowrSearchElements<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, import("../search/flowr-search").FlowrSearchElement<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation>[]>>>;
9
+ readonly processSearchResult: (elements: import("../search/flowr-search").FlowrSearchElements<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, import("../search/flowr-search").FlowrSearchElement<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation>[]>, config: import("./rules/function-finder-util").FunctionsToDetectConfig, data: import("../project/flowr-analyzer").ReadonlyFlowrAnalysisProvider<import("../r-bridge/parser").KnownParser>) => Promise<{
12
10
  results: import("./rules/function-finder-util").FunctionsResult[];
13
11
  '.meta': import("./rules/function-finder-util").FunctionsMetadata;
14
12
  }>;
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DATA_FRAME_ACCESS_VALIDATION = void 0;
4
4
  const shape_inference_1 = require("../../abstract-interpretation/data-frame/shape-inference");
5
- const satisfiable_domain_1 = require("../../abstract-interpretation/domains/satisfiable-domain");
5
+ const value_abstract_domain_1 = require("../../abstract-interpretation/domains/value-abstract-domain");
6
6
  const config_1 = require("../../config");
7
7
  const identifier_1 = require("../../dataflow/environments/identifier");
8
8
  const cfg_kind_1 = require("../../project/cfg-kind");
@@ -103,15 +103,15 @@ function findInvalidDataFrameAccesses({ operandShape, accessedCols, accessedRows
103
103
  const invalidAccesses = [];
104
104
  if (operandShape !== undefined) {
105
105
  for (const row of accessedRows ?? []) {
106
- if (operandShape.rows.satisfies(row, satisfiable_domain_1.NumericalComparator.LessOrEqual) === logic_1.Ternary.Never) {
106
+ if (operandShape.rows.satisfies(row, value_abstract_domain_1.NumericalComparator.LessOrEqual) === logic_1.Ternary.Never) {
107
107
  invalidAccesses.push({ type: 'row', accessed: row });
108
108
  }
109
109
  }
110
110
  for (const col of accessedCols ?? []) {
111
- if (typeof col === 'string' && operandShape.colnames.satisfies([col], satisfiable_domain_1.SetComparator.SubsetOrEqual) === logic_1.Ternary.Never) {
111
+ if (typeof col === 'string' && operandShape.colnames.satisfies([col], value_abstract_domain_1.SetComparator.SubsetOrEqual) === logic_1.Ternary.Never) {
112
112
  invalidAccesses.push({ type: 'column', accessed: col });
113
113
  }
114
- else if (typeof col === 'number' && operandShape.cols.satisfies(col, satisfiable_domain_1.NumericalComparator.LessOrEqual) === logic_1.Ternary.Never) {
114
+ else if (typeof col === 'number' && operandShape.cols.satisfies(col, value_abstract_domain_1.NumericalComparator.LessOrEqual) === logic_1.Ternary.Never) {
115
115
  invalidAccesses.push({ type: 'column', accessed: col });
116
116
  }
117
117
  }
@@ -2,10 +2,8 @@ import { LintingRuleCertainty } from '../linter-format';
2
2
  import { LintingRuleTag } from '../linter-tags';
3
3
  import { type FunctionsMetadata, type FunctionsResult, type FunctionsToDetectConfig } from './function-finder-util';
4
4
  export declare const DEPRECATED_FUNCTIONS: {
5
- readonly createSearch: (config: FunctionsToDetectConfig) => import("../../search/flowr-search-builder").FlowrSearchBuilder<"all", ["filter", "with", "filter"], import("../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, Promise<import("../../search/flowr-search").FlowrSearchElements<import("../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, [] | import("../../search/flowr-search").FlowrSearchElement<import("../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation>[]>>>;
6
- readonly processSearchResult: <T extends import("../../search/flowr-search").FlowrSearchElement<import("../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation>[]>(this: void, elements: import("../../search/flowr-search").FlowrSearchElements<import("../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, T>, _config: unknown, _data: unknown, refineSearch?: (elements: T) => import("ts-essentials").AsyncOrSync<(T[number] & {
7
- certainty?: import("../linter-format").LintingResultCertainty;
8
- })[]>) => Promise<{
5
+ readonly createSearch: (_config: FunctionsToDetectConfig) => import("../../search/flowr-search-builder").FlowrSearchBuilder<"all", ["filter", "with"], import("../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, Promise<import("../../search/flowr-search").FlowrSearchElements<import("../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, import("../../search/flowr-search").FlowrSearchElement<import("../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation>[]>>>;
6
+ readonly processSearchResult: (elements: import("../../search/flowr-search").FlowrSearchElements<import("../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, import("../../search/flowr-search").FlowrSearchElement<import("../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation>[]>, config: FunctionsToDetectConfig, data: import("../../project/flowr-analyzer").ReadonlyFlowrAnalysisProvider<import("../../r-bridge/parser").KnownParser>) => Promise<{
9
7
  results: FunctionsResult[];
10
8
  '.meta': FunctionsMetadata;
11
9
  }>;
@@ -1,17 +1,72 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DEPRECATED_FUNCTIONS = void 0;
4
+ const vertex_1 = require("../../dataflow/graph/vertex");
5
+ const df_helper_1 = require("../../dataflow/graph/df-helper");
6
+ const identifier_1 = require("../../dataflow/environments/identifier");
7
+ const flowr_search_builder_1 = require("../../search/flowr-search-builder");
8
+ const search_enrichers_1 = require("../../search/search-executor/search-enrichers");
9
+ const flowr_search_filters_1 = require("../../search/flowr-search-filters");
10
+ const range_1 = require("../../util/range");
4
11
  const linter_format_1 = require("../linter-format");
5
12
  const linter_tags_1 = require("../linter-tags");
6
13
  const function_finder_util_1 = require("./function-finder-util");
7
14
  exports.DEPRECATED_FUNCTIONS = {
8
- createSearch: (config) => function_finder_util_1.functionFinderUtil.createSearch(config.fns),
9
- processSearchResult: function_finder_util_1.functionFinderUtil.processSearchResult,
15
+ // unlike functionFinderUtil.createSearch(config.fns), this does not pre-filter to the hardcoded list: the
16
+ // sigdb-driven pass below needs every resolved call, so the `fns` filtering happens in processSearchResult instead
17
+ createSearch: (_config) => flowr_search_builder_1.Q.all().filter(vertex_1.VertexType.FunctionCall).with(search_enrichers_1.Enrichment.CallTargets, { onlyBuiltin: true }),
18
+ processSearchResult: async (elements, config, data) => {
19
+ const matchesConfiguredFns = (0, flowr_search_filters_1.testFunctionsIgnoringPackage)(config.fns);
20
+ const hardcoded = await function_finder_util_1.functionFinderUtil.processSearchResult(elements, config, data, es => es.filter(e => (0, search_enrichers_1.enrichmentContent)(e, search_enrichers_1.Enrichment.CallTargets)?.targets
21
+ .some(t => typeof t === 'string' && matchesConfiguredFns.test(t))));
22
+ const deps = data.inspectContext().deps;
23
+ if (deps.signatureSources().length === 0) {
24
+ return hardcoded;
25
+ }
26
+ // sigdb-driven detection: flag any resolved call whose signature-database entry marks it deprecated,
27
+ // even when it is not part of the hardcoded `fns` list above
28
+ const graph = (await data.dataflow()).graph;
29
+ const alreadyFlagged = new Set(hardcoded.results.map(r => r.involvedId));
30
+ const sigdbFlagged = [];
31
+ for (const element of elements.getElements()) {
32
+ const id = element.node.info.id;
33
+ if (alreadyFlagged.has(id)) {
34
+ continue;
35
+ }
36
+ const qualified = df_helper_1.Dataflow.qualify(id, graph);
37
+ if (qualified === undefined) {
38
+ continue;
39
+ }
40
+ const fn = deps.signatureOf(qualified);
41
+ if (fn === undefined || !fn.props.includes('deprecated')) {
42
+ continue;
43
+ }
44
+ const loc = range_1.SourceLocation.fromNode(element.node);
45
+ if (loc === undefined) {
46
+ continue;
47
+ }
48
+ alreadyFlagged.add(id);
49
+ sigdbFlagged.push({
50
+ certainty: linter_format_1.LintingResultCertainty.Certain,
51
+ involvedId: id,
52
+ function: identifier_1.Identifier.toString(qualified),
53
+ loc
54
+ });
55
+ }
56
+ return {
57
+ results: [...hardcoded.results, ...sigdbFlagged],
58
+ '.meta': {
59
+ totalCalls: hardcoded['.meta'].totalCalls + sigdbFlagged.length,
60
+ totalFunctionDefinitions: hardcoded['.meta'].totalFunctionDefinitions + sigdbFlagged.length
61
+ }
62
+ };
63
+ },
10
64
  prettyPrint: function_finder_util_1.functionFinderUtil.prettyPrint('deprecated'),
11
65
  info: {
12
66
  name: 'Deprecated Functions',
13
67
  tags: [linter_tags_1.LintingRuleTag.Deprecated, linter_tags_1.LintingRuleTag.Smell, linter_tags_1.LintingRuleTag.Usability, linter_tags_1.LintingRuleTag.Reproducibility],
14
- // ensures all deprecated functions found are actually deprecated through its limited config, but doesn't find all deprecated functions since the config is pre-crawled
68
+ // the hardcoded `fns` list ensures every reported hit is real, but the list is pre-crawled and hence
69
+ // incomplete; the signature-database pass above adds recall for whichever packages are resolved
15
70
  certainty: linter_format_1.LintingRuleCertainty.BestEffort,
16
71
  description: 'Marks deprecated functions that should not be used anymore.',
17
72
  defaultConfig: {
@@ -10,19 +10,21 @@ const assert_1 = require("../../util/assert");
10
10
  const range_1 = require("../../util/range");
11
11
  const flowr_file_1 = require("../../project/context/flowr-file");
12
12
  const type_1 = require("../../r-bridge/lang-4.x/ast/model/type");
13
- const r_base_primitives_generated_1 = require("../../data/r-base-primitives.generated");
13
+ const r_base_packages_1 = require("../../util/r-base-packages");
14
14
  const linter_format_1 = require("../linter-format");
15
15
  const linter_tags_1 = require("../linter-tags");
16
16
  const undefined_symbol_util_1 = require("./undefined-symbol-util");
17
17
  /** calls that load a package; an unresolved one means we cannot enumerate all exports in scope */
18
18
  const LibraryLoadFunctions = new Set(['library', 'require', 'requireNamespace', 'loadNamespace', 'attachNamespace', 'load_all', 'use', 'p_load']);
19
- /**
20
- * Packages a standard R session attaches by default (`getOption("defaultPackages")` plus `base`); their
21
- * exports are in scope without an explicit `library()`. Non-attached base-priority packages (`tools`,
22
- * `parallel`, `grid`, ...) still need loading and are flagged with a hint. Hardcoded for now; making this
23
- * configurable (to respect `R_DEFAULT_PACKAGES`/`.Rprofile`) is left for later.
24
- */
19
+ // standard packages attached by default; exports are in scope without library()
25
20
  const AttachedBasePackages = ['base', 'stats', 'graphics', 'grDevices', 'utils', 'datasets', 'methods'];
21
+ /** test frameworks whose namespace a test file runs under implicitly (e.g. `tests/testthat/test-*.R` sees testthat's exports without a `library()`) */
22
+ const ImplicitTestFrameworks = new Set(['testthat', 'tinytest', 'RUnit']);
23
+ /** whether name is an export of a default-attached base package (needs no library()) */
24
+ function isAttachedBaseName(name) {
25
+ const owner = (0, r_base_packages_1.baseRExportOwner)(name);
26
+ return owner !== undefined && AttachedBasePackages.includes(owner);
27
+ }
26
28
  /** upper bound on the number of packages named in a "did you forget to load it" hint */
27
29
  const MaxHintPackages = 5;
28
30
  /**
@@ -47,6 +49,9 @@ exports.UNDEFINED_SYMBOL = {
47
49
  // FileRole.Install role, with a path fallback for requests that bypass the file-role plugins.
48
50
  const installedFiles = new Set(ctx.files.getFilesByRole(flowr_file_1.FileRole.Install).map(f => f.path()));
49
51
  const isInstalledFile = (file) => file !== undefined && (installedFiles.has(file) || (0, undefined_symbol_util_1.isInstalledResourceFile)(file));
52
+ // test files run under their framework's attached namespace, so a bare name a test framework exports is defined there
53
+ const testFiles = new Set(ctx.files.getFilesByRole(flowr_file_1.FileRole.Test).map(f => f.path()));
54
+ const isImplicitTestExport = (name, file) => file !== undefined && testFiles.has(file) && deps.packagesExporting(name).some(p => ImplicitTestFrameworks.has(p));
50
55
  // a library() we could not resolve could export any of these symbols; we still report but flag the
51
56
  // findings as low-confidence (`mayBeProvidedByUnresolvedLibrary`) so the severity can be lowered
52
57
  const unknownIds = new Set();
@@ -118,11 +123,14 @@ exports.UNDEFINED_SYMBOL = {
118
123
  if (kind === 'function' && namespace === undefined && ctx.env.builtInEnvironment.memory.has(name)) {
119
124
  return undefined;
120
125
  }
121
- // a bare base-R primitive/internal (`is.na`) or base data constant (`.Machine`) is defined but
122
- // missing from the sigdb export list, so recognise it directly (covers calls and variable reads)
123
- if (namespace === undefined && r_base_primitives_generated_1.RBasePrimitives.has(name)) {
126
+ // a bare name from a default-attached base package (or a primitive) is defined without a library() call
127
+ if (namespace === undefined && isAttachedBaseName(name)) {
124
128
  return undefined;
125
129
  }
130
+ // a bare name a test framework exports, used in a test file where that framework's namespace is attached
131
+ if (namespace === undefined && isImplicitTestExport(name, element.node.info.file)) {
132
+ return suppress('loadedPackage');
133
+ }
126
134
  // exported by a package in scope (`pkg::fn`, a loaded package, or a default-attached base package)
127
135
  if (namespace !== undefined ? deps.getDependency(namespace)?.has(name) === true : loadedPackages.some(p => p.has(name))) {
128
136
  return suppress('loadedPackage');
@@ -12,6 +12,7 @@ const flowr_search_filters_1 = require("../../search/flowr-search-filters");
12
12
  const flowr_file_1 = require("../../project/context/flowr-file");
13
13
  const flowr_namespace_file_1 = require("../../project/plugins/file-plugins/files/flowr-namespace-file");
14
14
  const identifier_1 = require("../../dataflow/environments/identifier");
15
+ const type_1 = require("../../r-bridge/lang-4.x/ast/model/type");
15
16
  const retriever_1 = require("../../r-bridge/retriever");
16
17
  const r_function_call_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
17
18
  const r_function_definition_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-function-definition");
@@ -171,6 +172,26 @@ function onlyKeepSupersetOfUnused(elements) {
171
172
  return !locs.some(r => range_1.SourceLocation.compare(r, otherLoc) !== 0 && range_1.SourceLocation.isSubsetOf(otherLoc, r)); // there is no smaller remove
172
173
  });
173
174
  }
175
+ /** Whether the node sits inside a promise, i.e. an argument default value or a `delayedAssign` body, which may never run. */
176
+ function isWithinPromise(node, idMap) {
177
+ let child = node;
178
+ let parentId = node.info.parent;
179
+ while (parentId !== undefined) {
180
+ const parent = idMap.get(parentId);
181
+ if (parent === undefined) {
182
+ return false;
183
+ }
184
+ if (parent.type === type_1.RType.Parameter && parent.defaultValue?.info.id === child.info.id) {
185
+ return true;
186
+ }
187
+ if (parent.type === type_1.RType.FunctionCall && parent.named && identifier_1.Identifier.getName(parent.functionName.content) === 'delayedAssign') {
188
+ return true;
189
+ }
190
+ child = parent;
191
+ parentId = parent.info.parent;
192
+ }
193
+ return false;
194
+ }
174
195
  exports.UNUSED_DEFINITION = {
175
196
  /* this can be done better once we have types */
176
197
  createSearch: config => flowr_search_builder_1.Q.all().filter(config.includeFunctionDefinitions ? flowr_search_filters_1.F.or(vertex_1.VertexType.VariableDefinition, vertex_1.VertexType.FunctionDefinition) : vertex_1.VertexType.VariableDefinition),
@@ -186,6 +207,9 @@ exports.UNUSED_DEFINITION = {
186
207
  return {
187
208
  results: onlyKeepSupersetOfUnused(elements.getElements().flatMap(element => {
188
209
  metadata.totalConsidered++;
210
+ if (isWithinPromise(element.node, normalize.idMap)) {
211
+ return [];
212
+ }
189
213
  const dfgVertex = dataflow.graph.getVertex(element.node.info.id);
190
214
  if (!dfgVertex || (!(0, vertex_1.isVariableDefinitionVertex)(dfgVertex)
191
215
  && (0, vertex_1.isFunctionDefinitionVertex)(dfgVertex) && !config.includeFunctionDefinitions)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eagleoutice/flowr",
3
- "version": "2.12.3",
3
+ "version": "2.13.1",
4
4
  "description": "Static Dataflow Analyzer and Program Slicer for the R Programming Language",
5
5
  "types": "dist/src/index.d.ts",
6
6
  "repository": {
@@ -37,7 +37,7 @@
37
37
  "build:copy-wasm": "mkdir -p dist/node_modules/@davisvaughan/tree-sitter-r/ && mkdir -p dist/node_modules/web-tree-sitter && cp node_modules/@davisvaughan/tree-sitter-r/tree-sitter-r.wasm dist/node_modules/@davisvaughan/tree-sitter-r/ && cp node_modules/web-tree-sitter/tree-sitter.wasm dist/node_modules/web-tree-sitter/",
38
38
  "lint-local": "npx eslint --version && npx eslint src/ test/ scripts/ --rule \"no-warning-comments: off\"",
39
39
  "lint": "npm run license-compat -- --summary && npx eslint --version && npx eslint src/ test/ scripts/",
40
- "license-compat": "license-checker-rseidelsohn --onlyAllow 'MIT;MPL-2.0;MIT OR X11;GPLv2;LGPL;GNUGPL;ISC;Apache-2.0;FreeBSD;BSD-2-Clause;clearbsd;ModifiedBSD;BSD-3-Clause;Python-2.0;Unlicense;WTFPL;BlueOak-1.0.0;CC-BY-4.0;CC-BY-3.0;CC0-1.0;0BSD'",
40
+ "license-compat": "license-checker-rseidelsohn --onlyAllow 'MIT;MPL-2.0;MIT OR X11;GPLv2;LGPL;GNUGPL;ISC;Apache-2.0;FreeBSD;BSD-2-Clause;clearbsd;ModifiedBSD;BSD-3-Clause;Python-2.0;Unlicense;WTFPL;BlueOak-1.0.0;CC-BY-4.0;CC-BY-3.0;CC0-1.0;0BSD' --clarificationsFile license-clarifications.json",
41
41
  "doc": "typedoc",
42
42
  "test": "vitest --exclude \"test/system-tests/**\" --config test/vitest.config.mts",
43
43
  "test:verbose": "FLOWR_VERBOSE=true vitest --exclude \"test/system-tests/**\" --config test/vitest.config.mts",
@@ -188,6 +188,7 @@
188
188
  "@types/command-line-usage": "^5.0.4",
189
189
  "@types/commonmark": "^0.27.10",
190
190
  "@types/dagre": "^0.7.53",
191
+ "@types/n-readlines": "^1.0.6",
191
192
  "@types/n3": "^1.26.0",
192
193
  "@types/object-hash": "^3.0.6",
193
194
  "@types/object-path": "^0.11.4",
@@ -214,6 +215,7 @@
214
215
  "@davisvaughan/tree-sitter-r": "^1.2.0",
215
216
  "@jupyterlab/nbformat": "^4.5.4",
216
217
  "@xmldom/xmldom": "^0.9.7",
218
+ "bzip2": "^0.1.1",
217
219
  "clipboardy": "^4.0.0",
218
220
  "command-line-args": "^6.0.1",
219
221
  "command-line-usage": "^7.0.3",
@@ -231,6 +233,7 @@
231
233
  "rotating-file-stream": "^3.2.8",
232
234
  "seedrandom": "^3.0.5",
233
235
  "semver": "^7.7.4",
236
+ "smol-toml": "^1.7.0",
234
237
  "tar": "^7.4.3",
235
238
  "tmp": "^0.2.3",
236
239
  "ts-essentials": "^10.1.1",