@eagleoutice/flowr 2.13.2 → 2.13.4

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 (146) hide show
  1. package/README.md +45 -43
  2. package/abstract-interpretation/absint-visitor.js +2 -2
  3. package/abstract-interpretation/data-frame/mappers/access-mapper.js +1 -0
  4. package/abstract-interpretation/data-frame/mappers/arguments.js +2 -2
  5. package/abstract-interpretation/data-frame/mappers/function-mapper.d.ts +1 -1
  6. package/abstract-interpretation/data-frame/mappers/function-mapper.js +3 -0
  7. package/abstract-interpretation/data-frame/mappers/replacement-mapper.js +1 -1
  8. package/abstract-interpretation/domains/state-domain-like.d.ts +1 -1
  9. package/abstract-interpretation/unsupported-functions.js +1 -1
  10. package/config.d.ts +8 -0
  11. package/config.js +9 -1
  12. package/control-flow/cfg-dead-code.js +72 -11
  13. package/control-flow/control-flow-graph.js +2 -1
  14. package/control-flow/extract-cfg.js +85 -8
  15. package/control-flow/semantic-cfg-guided-visitor.d.ts +1 -1
  16. package/control-flow/semantic-cfg-guided-visitor.js +2 -0
  17. package/core/steps/all/core/11-normalize-tree-sitter.d.ts +1 -1
  18. package/dataflow/environments/append.d.ts +1 -1
  19. package/dataflow/environments/built-in-proc-name.d.ts +4 -0
  20. package/dataflow/environments/built-in-proc-name.js +4 -0
  21. package/dataflow/environments/built-in.d.ts +5 -1
  22. package/dataflow/environments/built-in.js +5 -1
  23. package/dataflow/environments/clone.d.ts +1 -1
  24. package/dataflow/environments/default-builtin-config.d.ts +59 -4
  25. package/dataflow/environments/default-builtin-config.js +23 -11
  26. package/dataflow/environments/environment.d.ts +28 -4
  27. package/dataflow/environments/environment.js +66 -11
  28. package/dataflow/environments/identifier.d.ts +1 -0
  29. package/dataflow/environments/overwrite.d.ts +1 -1
  30. package/dataflow/eval/resolve/alias-tracking.d.ts +3 -1
  31. package/dataflow/eval/resolve/alias-tracking.js +8 -1
  32. package/dataflow/eval/resolve/resolve.d.ts +14 -0
  33. package/dataflow/eval/resolve/resolve.js +47 -0
  34. package/dataflow/fn/higher-order-function.js +3 -3
  35. package/dataflow/fn/recursive-function.js +1 -1
  36. package/dataflow/graph/dataflowgraph-builder.d.ts +1 -1
  37. package/dataflow/graph/df-helper.js +1 -1
  38. package/dataflow/graph/vertex.d.ts +32 -25
  39. package/dataflow/graph/vertex.js +40 -36
  40. package/dataflow/internal/process/functions/call/built-in/built-in-access.d.ts +1 -0
  41. package/dataflow/internal/process/functions/call/built-in/built-in-access.js +7 -4
  42. package/dataflow/internal/process/functions/call/built-in/built-in-apply.d.ts +14 -0
  43. package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +28 -29
  44. package/dataflow/internal/process/functions/call/built-in/built-in-assignment.d.ts +1 -1
  45. package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +41 -48
  46. package/dataflow/internal/process/functions/call/built-in/built-in-attach.js +1 -1
  47. package/dataflow/internal/process/functions/call/built-in/built-in-class-generator.d.ts +14 -0
  48. package/dataflow/internal/process/functions/call/built-in/built-in-class-generator.js +45 -0
  49. package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.d.ts +14 -1
  50. package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.js +80 -0
  51. package/dataflow/internal/process/functions/call/built-in/built-in-eval.d.ts +1 -1
  52. package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +63 -3
  53. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.d.ts +1 -1
  54. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +63 -16
  55. package/dataflow/internal/process/functions/call/built-in/built-in-get.js +29 -9
  56. package/dataflow/internal/process/functions/call/built-in/built-in-library.d.ts +5 -2
  57. package/dataflow/internal/process/functions/call/built-in/built-in-library.js +15 -9
  58. package/dataflow/internal/process/functions/call/built-in/built-in-list.d.ts +4 -0
  59. package/dataflow/internal/process/functions/call/built-in/built-in-list.js +35 -0
  60. package/dataflow/internal/process/functions/call/built-in/built-in-new-env.js +2 -2
  61. package/dataflow/internal/process/functions/call/built-in/built-in-quote.d.ts +1 -1
  62. package/dataflow/internal/process/functions/call/built-in/built-in-recall.js +1 -1
  63. package/dataflow/internal/process/functions/call/built-in/built-in-register-hook.d.ts +1 -1
  64. package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-dispatch.d.ts +1 -1
  65. package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.d.ts +9 -1
  66. package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.js +55 -2
  67. package/dataflow/internal/process/functions/call/built-in/built-in-s-three-dispatch.d.ts +1 -1
  68. package/dataflow/internal/process/functions/call/built-in/built-in-stack-env.js +5 -3
  69. package/dataflow/internal/process/functions/call/built-in/built-in-vector.d.ts +1 -1
  70. package/dataflow/internal/process/functions/call/unnamed-call-handling.js +24 -0
  71. package/dataflow/internal/process/functions/process-parameter.js +2 -1
  72. package/documentation/doc-readme.js +14 -12
  73. package/documentation/doc-util/doc-normalized-ast.d.ts +1 -1
  74. package/documentation/wiki-dataflow-graph.js +4 -24
  75. package/documentation/wiki-query.js +47 -0
  76. package/documentation/wiki-signature-database.js +3 -2
  77. package/linter/rules/absolute-path.js +1 -1
  78. package/linter/rules/dataframe-access-validation.d.ts +1 -1
  79. package/linter/rules/function-finder-util.js +1 -1
  80. package/linter/rules/no-leaked-credentials.js +1 -1
  81. package/linter/rules/undefined-symbol-util.js +3 -1
  82. package/linter/rules/undefined-symbol.js +4 -5
  83. package/linter/rules/unused-definition.js +15 -10
  84. package/linter/rules/useless-loop.js +1 -1
  85. package/package.json +21 -9
  86. package/project/context/flowr-analyzer-context.d.ts +4 -4
  87. package/project/context/flowr-analyzer-context.js +3 -3
  88. package/project/context/flowr-analyzer-dependencies-context.d.ts +11 -5
  89. package/project/context/flowr-analyzer-dependencies-context.js +8 -3
  90. package/project/context/flowr-analyzer-meta-context.d.ts +1 -0
  91. package/project/dependency-version-space.d.ts +118 -26
  92. package/project/dependency-version-space.js +343 -87
  93. package/project/plugins/file-plugins/files/flowr-description-file.d.ts +4 -0
  94. package/project/plugins/file-plugins/files/flowr-description-file.js +8 -1
  95. package/project/plugins/file-plugins/files/flowr-rda-file.js +27 -25
  96. package/project/plugins/file-plugins/notebooks/flowr-analyzer-rmd-file-plugin.d.ts +1 -1
  97. package/project/plugins/file-plugins/notebooks/flowr-analyzer-sweave-file-plugin.d.ts +1 -1
  98. package/project/plugins/package-version-plugins/flowr-analyzer-meta-description-file-plugin.js +2 -1
  99. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.d.ts +1 -1
  100. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.js +4 -4
  101. package/project/plugins/package-version-plugins/package.d.ts +27 -10
  102. package/project/plugins/package-version-plugins/package.js +50 -25
  103. package/project/sigdb/reader.d.ts +26 -16
  104. package/project/sigdb/reader.js +52 -21
  105. package/queries/catalog/call-context-query/identify-link-to-last-call-relation.js +1 -1
  106. package/queries/catalog/call-context-query/identify-link-to-nested-call-relation.js +1 -1
  107. package/queries/catalog/dependencies-query/dependencies-query-executor.js +1 -1
  108. package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +2 -2
  109. package/queries/catalog/dependencies-query/dependencies-query-format.js +2 -2
  110. package/queries/catalog/dependencies-query/function-info/read-functions.js +1 -1
  111. package/queries/catalog/dependencies-query/function-info/write-functions.js +23 -24
  112. package/queries/catalog/does-call-query/does-call-query-format.d.ts +1 -1
  113. package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-executor.js +39 -77
  114. package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-format.d.ts +12 -0
  115. package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-format.js +53 -23
  116. package/queries/catalog/input-sources-query/input-source-functions.d.ts +14 -0
  117. package/queries/catalog/input-sources-query/input-source-functions.js +109 -20
  118. package/queries/catalog/input-sources-query/input-sources-query-executor.js +45 -4
  119. package/queries/catalog/input-sources-query/input-sources-query-format.js +22 -3
  120. package/queries/catalog/input-sources-query/input-types.d.ts +58 -0
  121. package/queries/catalog/input-sources-query/input-types.js +64 -0
  122. package/queries/catalog/input-sources-query/simple-input-classifier.d.ts +76 -53
  123. package/queries/catalog/input-sources-query/simple-input-classifier.js +358 -101
  124. package/queries/catalog/project-query/project-query-executor.js +1 -1
  125. package/queries/catalog/signature-query/signature-query-executor.d.ts +7 -1
  126. package/queries/catalog/signature-query/signature-query-executor.js +112 -39
  127. package/queries/catalog/signature-query/signature-query-format.d.ts +5 -1
  128. package/queries/catalog/signature-query/signature-query-format.js +1 -1
  129. package/queries/catalog/signature-query/signature-query-render.js +8 -3
  130. package/r-bridge/data/data.d.ts +2 -2
  131. package/r-bridge/data/data.js +2 -2
  132. package/r-bridge/lang-4.x/ast/parser/json/format.js +1 -1
  133. package/r-bridge/retriever.d.ts +1 -1
  134. package/reconstruct/inline/source-inline-map.js +1 -1
  135. package/search/flowr-search-printer.js +10 -8
  136. package/slicing/static/static-slicer.d.ts +2 -2
  137. package/util/mermaid/dfg.js +1 -1
  138. package/util/objects.js +6 -4
  139. package/util/r-base-packages.d.ts +2 -0
  140. package/util/r-base-packages.js +3 -0
  141. package/util/r-license.js +1 -4
  142. package/util/r-version.d.ts +12 -0
  143. package/util/r-version.js +16 -0
  144. package/util/range.d.ts +6 -2
  145. package/util/range.js +33 -15
  146. package/util/version.js +1 -1
package/README.md CHANGED
@@ -12,6 +12,25 @@ available for [VSCode](https://marketplace.visualstudio.com/items?itemName=code-
12
12
  and [Docker](https://hub.docker.com/r/eagleoutice/flowr).
13
13
  It offers a wide variety of features, for example:
14
14
 
15
+ * 📚 **dependency analysis**\
16
+ Given your analysis project, flowR offers a plethora of so-called [queries](https://github.com/flowr-analysis/flowr/wiki/query-api) to get more information about your code.
17
+ An important query is the [dependencies query](https://github.com/flowr-analysis/flowr/wiki/%5BQuery%5D-Dependencies), which shows you the library your project needs,
18
+ the data files it reads, the scripts it sources, and the data it outputs.
19
+ Building on it, the [guess dependency versions query](https://github.com/flowr-analysis/flowr/wiki/%5BQuery%5D-Guess-Dependency-Versions) narrows down the version range each
20
+ of these libraries has to have, by combining the constraints your project declares with the functions your code actually calls.
21
+
22
+
23
+ <details><summary>Example: Dependency Analysis with flowR</summary>
24
+
25
+
26
+ The following showcases the dependency view of the [Visual Studio Code extension](https://marketplace.visualstudio.com/items?itemName=code-inspect.vscode-flowr):
27
+
28
+ ![Dependency Analysis](https://raw.githubusercontent.com/flowr-analysis/vscode-flowr/refs/heads/main/media/dependencies.png)
29
+
30
+
31
+
32
+ </details>
33
+
15
34
  * 🐞 **code linting**\
16
35
  Analyze your R scripts for common issues and potential bugs (see the [wiki page](https://github.com/flowr-analysis/flowr/wiki/linter) for more information on the currently supported linters).
17
36
 
@@ -24,7 +43,7 @@ It offers a wide variety of features, for example:
24
43
 
25
44
  ```shell
26
45
  $ docker run -it --rm eagleoutice/flowr # or npm run flowr
27
- flowR repl v2.13.0, R grammar v14 (tree-sitter engine)
46
+ flowR repl v2.13.3, R grammar v14 (tree-sitter engine)
28
47
  R> :query @linter "read.csv(\"/root/x.txt\")"
29
48
  ```
30
49
 
@@ -33,12 +52,12 @@ It offers a wide variety of features, for example:
33
52
 
34
53
 
35
54
  ```text
36
- Query: linter (9 ms)
55
+ Query: linter (4 ms)
37
56
  ╰ Deprecated Functions (deprecated-functions): no findings
38
57
  ╰ File Path Validity (file-path-validity):
39
58
  ╰ certain:
40
59
  ╰ Path `/root/x.txt` at 1.1-23
41
- ╰ Metadata: totalReads: 1, totalUnknown: 0, totalWritesBeforeAlways: 0, totalValid: 0, searchTimeMs: 1, processTimeMs: 0
60
+ ╰ Metadata: totalReads: 1, totalUnknown: 0, totalWritesBeforeAlways: 0, totalValid: 0, searchTimeMs: 0, processTimeMs: 1
42
61
  ╰ Seeded Randomness (seeded-randomness): no findings
43
62
  ╰ Absolute Paths (absolute-file-paths):
44
63
  ╰ certain:
@@ -54,7 +73,7 @@ It offers a wide variety of features, for example:
54
73
  ╰ Roxygen Arguments (roxygen-arguments): no findings
55
74
  ╰ No Leaked Credentials (no-leaked-credentials): no findings
56
75
  ╰ Undefined Symbol (undefined-symbol): no findings
57
- All queries together required ≈9 ms (1ms accuracy, total 9 ms)
76
+ All queries together required ≈4 ms (1ms accuracy, total 5 ms)
58
77
  ```
59
78
 
60
79
 
@@ -76,17 +95,17 @@ It offers a wide variety of features, for example:
76
95
 
77
96
  _Results (prettified and summarized):_
78
97
 
79
- Query: **linter** (11 ms)\
98
+ Query: **linter** (5 ms)\
80
99
  &nbsp;&nbsp;&nbsp;╰ **Deprecated Functions** (deprecated-functions): _no findings_\
81
100
  &nbsp;&nbsp;&nbsp;╰ **File Path Validity** (file-path-validity):\
82
101
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;╰ certain:\
83
102
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;╰ Path `/root/x.txt` at 1.1-23\
84
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;╰ _Metadata_: totalReads: 1, totalUnknown: 0, totalWritesBeforeAlways: 0, totalValid: 0, searchTimeMs: 1, processTimeMs: 0\
103
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;╰ _Metadata_: totalReads: 1, totalUnknown: 0, totalWritesBeforeAlways: 0, totalValid: 0, searchTimeMs: 0, processTimeMs: 1\
85
104
  &nbsp;&nbsp;&nbsp;╰ **Seeded Randomness** (seeded-randomness): _no findings_\
86
105
  &nbsp;&nbsp;&nbsp;╰ **Absolute Paths** (absolute-file-paths):\
87
106
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;╰ certain:\
88
107
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;╰ Path `/root/x.txt` at 1.1-23\
89
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;╰ _Metadata_: totalConsidered: 1, totalUnknown: 0, searchTimeMs: 0, processTimeMs: 0\
108
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;╰ _Metadata_: totalConsidered: 1, totalUnknown: 0, searchTimeMs: 1, processTimeMs: 0\
90
109
  &nbsp;&nbsp;&nbsp;╰ **Unused Definitions** (unused-definitions): _no findings_\
91
110
  &nbsp;&nbsp;&nbsp;╰ **Network Functions** (network-functions): _no findings_\
92
111
  &nbsp;&nbsp;&nbsp;╰ **Dataframe Access Validation** (dataframe-access-validation): _no findings_\
@@ -97,11 +116,11 @@ It offers a wide variety of features, for example:
97
116
  &nbsp;&nbsp;&nbsp;╰ **Roxygen Arguments** (roxygen-arguments): _no findings_\
98
117
  &nbsp;&nbsp;&nbsp;╰ **No Leaked Credentials** (no-leaked-credentials): _no findings_\
99
118
  &nbsp;&nbsp;&nbsp;╰ **Undefined Symbol** (undefined-symbol): _no findings_\
100
- _All queries together required ≈11 ms (1ms accuracy, total 12 ms)_
119
+ _All queries together required ≈5 ms (1ms accuracy, total 5 ms)_
101
120
 
102
121
  <details> <summary style="color:gray">Show Detailed Results as Json</summary>
103
122
 
104
- The analysis required _12.4 ms_ (including parsing and normalization and the query) within the generation environment.
123
+ The analysis required _4.9 ms_ (including parsing and normalization and the query) within the generation environment.
105
124
 
106
125
  In general, the JSON contains the Ids of the nodes in question as they are present in the normalized AST or the dataflow graph of flowR.
107
126
  Please consult the [Interface](https://github.com/flowr-analysis/flowr/wiki/Interface) wiki page for more information on how to get those.
@@ -118,8 +137,8 @@ It offers a wide variety of features, for example:
118
137
  ".meta": {
119
138
  "totalCalls": 0,
120
139
  "totalFunctionDefinitions": 0,
121
- "searchTimeMs": 3,
122
- "processTimeMs": 1
140
+ "searchTimeMs": 2,
141
+ "processTimeMs": 0
123
142
  }
124
143
  },
125
144
  "file-path-validity": {
@@ -141,8 +160,8 @@ It offers a wide variety of features, for example:
141
160
  "totalUnknown": 0,
142
161
  "totalWritesBeforeAlways": 0,
143
162
  "totalValid": 0,
144
- "searchTimeMs": 1,
145
- "processTimeMs": 0
163
+ "searchTimeMs": 0,
164
+ "processTimeMs": 1
146
165
  }
147
166
  },
148
167
  "seeded-randomness": {
@@ -153,7 +172,7 @@ It offers a wide variety of features, for example:
153
172
  "callsWithAssignmentProducers": 0,
154
173
  "callsWithNonConstantProducers": 0,
155
174
  "callsWithOtherBranchProducers": 0,
156
- "searchTimeMs": 1,
175
+ "searchTimeMs": 0,
157
176
  "processTimeMs": 0
158
177
  }
159
178
  },
@@ -173,7 +192,7 @@ It offers a wide variety of features, for example:
173
192
  ".meta": {
174
193
  "totalConsidered": 1,
175
194
  "totalUnknown": 0,
176
- "searchTimeMs": 0,
195
+ "searchTimeMs": 1,
177
196
  "processTimeMs": 0
178
197
  }
179
198
  },
@@ -182,7 +201,7 @@ It offers a wide variety of features, for example:
182
201
  ".meta": {
183
202
  "totalConsidered": 0,
184
203
  "searchTimeMs": 0,
185
- "processTimeMs": 1
204
+ "processTimeMs": 0
186
205
  }
187
206
  },
188
207
  "network-functions": {
@@ -201,7 +220,7 @@ It offers a wide variety of features, for example:
201
220
  "numAccesses": 0,
202
221
  "totalAccessed": 0,
203
222
  "searchTimeMs": 0,
204
- "processTimeMs": 1
223
+ "processTimeMs": 0
205
224
  }
206
225
  },
207
226
  "dead-code": {
@@ -216,7 +235,7 @@ It offers a wide variety of features, for example:
216
235
  ".meta": {
217
236
  "numOfUselessLoops": 0,
218
237
  "searchTimeMs": 0,
219
- "processTimeMs": 0
238
+ "processTimeMs": 1
220
239
  }
221
240
  },
222
241
  "problematic-inputs": {
@@ -262,16 +281,16 @@ It offers a wide variety of features, for example:
262
281
  "subscript": 0
263
282
  },
264
283
  "searchTimeMs": 0,
265
- "processTimeMs": 3
284
+ "processTimeMs": 0
266
285
  }
267
286
  }
268
287
  },
269
288
  ".meta": {
270
- "timing": 11
289
+ "timing": 5
271
290
  }
272
291
  },
273
292
  ".meta": {
274
- "timing": 11
293
+ "timing": 5
275
294
  }
276
295
  }
277
296
  ```
@@ -335,7 +354,7 @@ It offers a wide variety of features, for example:
335
354
 
336
355
  ```shell
337
356
  $ docker run -it --rm eagleoutice/flowr # or npm run flowr
338
- flowR repl v2.13.0, R grammar v14 (tree-sitter engine)
357
+ flowR repl v2.13.3, R grammar v14 (tree-sitter engine)
339
358
  R> :query @static-slice (11@sum) file://test/testfiles/example.R
340
359
  ```
341
360
 
@@ -349,7 +368,7 @@ It offers a wide variety of features, for example:
349
368
  N <- 10
350
369
  for(i in 1:(N-1)) sum <- sum + i + w
351
370
  sum
352
- All queries together required ≈6 ms (1ms accuracy, total 7 ms)
371
+ All queries together required ≈3 ms (1ms accuracy, total 3 ms)
353
372
  ```
354
373
 
355
374
 
@@ -363,25 +382,8 @@ It offers a wide variety of features, for example:
363
382
 
364
383
  </details>
365
384
 
366
- * 📚 **dependency analysis**\
367
- Given your analysis project, flowR offers a plethora of so-called [queries](https://github.com/flowr-analysis/flowr/wiki/query-api) to get more information about your code.
368
- An important query is the [dependencies query](https://github.com/flowr-analysis/flowr/wiki/%5BQuery%5D-Dependencies), which shows you the library your project needs,
369
- the data files it reads, the scripts it sources, and the data it outputs.
370
-
371
-
372
- <details><summary>Example: Dependency Analysis with flowR</summary>
373
-
374
-
375
- The following showcases the dependency view of the [Visual Studio Code extension](https://marketplace.visualstudio.com/items?itemName=code-inspect.vscode-flowr):
376
-
377
- ![Dependency Analysis](https://raw.githubusercontent.com/flowr-analysis/vscode-flowr/refs/heads/main/media/dependencies.png)
378
-
379
-
380
-
381
- </details>
382
-
383
385
  * 🚀 **fast call-graph, data-, and control-flow graphs**\
384
- Within just [<i><span title="This measurement is automatically fetched from the latest benchmark!">104.8 ms</span></i> (as of Jul 20, 2026)](https://flowr-analysis.github.io/flowr/wiki/stats/benchmark),
386
+ Within just [<i><span title="This measurement is automatically fetched from the latest benchmark!">101.8 ms</span></i> (as of Jul 25, 2026)](https://flowr-analysis.github.io/flowr/wiki/stats/benchmark),
385
387
  _flowR_ can analyze the data- and control-flow of the average real-world R&nbsp;script. See the [benchmarks](https://flowr-analysis.github.io/flowr/wiki/stats/benchmark) for more information,
386
388
  and consult the [wiki pages](https://github.com/flowr-analysis/flowr/wiki/dataflow-graph) for more details on the [dataflow graphs](https://github.com/flowr-analysis/flowr/wiki/dataflow-graph) as well as [call graphs](https://github.com/flowr-analysis/flowr/wiki/dataflow-graph#perspectives-cg).
387
389
 
@@ -417,7 +419,7 @@ It offers a wide variety of features, for example:
417
419
 
418
420
  ```shell
419
421
  $ docker run -it --rm eagleoutice/flowr # or npm run flowr
420
- flowR repl v2.13.0, R grammar v14 (tree-sitter engine)
422
+ flowR repl v2.13.3, R grammar v14 (tree-sitter engine)
421
423
  R> :dataflow* test/testfiles/example.R
422
424
  ```
423
425
 
@@ -690,7 +692,7 @@ It offers a wide variety of features, for example:
690
692
  ```
691
693
 
692
694
 
693
- (The analysis required _3.4 ms_ (including parse and normalize, using the [tree-sitter](https://github.com/flowr-analysis/flowr/wiki/Engines) engine) within the generation environment. No [signature database](https://github.com/flowr-analysis/flowr/wiki/Signature-Database) is mounted for these generated graphs, so `library()` calls attach no package exports; base-R names are still qualified via the generated base-package store (e.g. `acf` as `stats::acf`).)
695
+ (The analysis required _1.6 ms_ (including parse and normalize, using the [tree-sitter](https://github.com/flowr-analysis/flowr/wiki/Engines) engine) within the generation environment. No [signature database](https://github.com/flowr-analysis/flowr/wiki/Signature-Database) is mounted for these generated graphs, so `library()` calls attach no package exports; base-R names are still qualified via the generated base-package store (e.g. `acf` as `stats::acf`).)
694
696
 
695
697
 
696
698
 
@@ -62,7 +62,7 @@ class AbstractInterpretationVisitor extends semantic_cfg_guided_visitor_1.Semant
62
62
  return state.get(node.info.id);
63
63
  }
64
64
  const vertex = this.getDataflowGraph(node.info.id);
65
- const call = (0, vertex_1.isFunctionCallVertex)(vertex) ? vertex : undefined;
65
+ const call = vertex_1.FunctionCallVertex.is(vertex) ? vertex : undefined;
66
66
  const origins = Array.isArray(call?.origin) ? call.origin : [];
67
67
  if (node.type === type_1.RType.Symbol) {
68
68
  const values = this.getVariableOrigins(node.info.id)
@@ -189,7 +189,7 @@ class AbstractInterpretationVisitor extends semantic_cfg_guided_visitor_1.Semant
189
189
  this.replacements.delete(nodeId);
190
190
  for (const replacement of replacements) {
191
191
  const call = this.getDataflowGraph(replacement);
192
- if ((0, vertex_1.isFunctionCallVertex)(call)) {
192
+ if (vertex_1.FunctionCallVertex.is(call)) {
193
193
  this.onReplacementCall({ call, ...this.getSourceAndTarget(call) });
194
194
  }
195
195
  }
@@ -136,6 +136,7 @@ function mapDataFrameIndexColRowAccess(access, inference, info) {
136
136
  colnames: columns?.map(col => typeof col === 'string' ? col : undefined)
137
137
  });
138
138
  }
139
+ // eslint-disable-next-line no-useless-assignment -- ends the chain
139
140
  operand = undefined;
140
141
  }
141
142
  }
@@ -121,7 +121,7 @@ function getFunctionArgument(args, argument, info) {
121
121
  */
122
122
  function getFunctionArguments(node, dfg) {
123
123
  const vertex = dfg.getVertex(node.info.id);
124
- if ((0, vertex_1.isFunctionCallVertex)(vertex) && dfg.idMap !== undefined) {
124
+ if (vertex_1.FunctionCallVertex.is(vertex) && dfg.idMap !== undefined) {
125
125
  const idMap = dfg.idMap;
126
126
  return vertex.args
127
127
  .map(arg => graph_1.FunctionArgument.isEmpty(arg) ? arg : idMap.get(arg.nodeId))
@@ -145,7 +145,7 @@ function getUnresolvedSymbolsInExpression(expression, dfg) {
145
145
  const vertex = dfg.get(node.info.id);
146
146
  const symbolName = identifier_1.Identifier.mapName(node.content, resolve_args_1.unquoteArgument);
147
147
  // ignore symbols named ".", as they are used as argument placeholder in magrittr pipe operations
148
- if ((0, vertex_1.isUseVertex)(vertex?.[0]) && vertex[1].size === 0 && symbolName !== '.') {
148
+ if (vertex_1.UseVertex.is(vertex?.[0]) && vertex[1].size === 0 && symbolName !== '.') {
149
149
  unresolvedSymbols.push(symbolName);
150
150
  }
151
151
  }
@@ -1,4 +1,4 @@
1
- import { type ResolveInfo } from '../../../dataflow/eval/resolve/alias-tracking';
1
+ import type { ResolveInfo } from '../../../dataflow/eval/resolve/alias-tracking';
2
2
  import type { DataflowGraph } from '../../../dataflow/graph/graph';
3
3
  import type { ReadOnlyFlowrAnalyzerContext } from '../../../project/context/flowr-analyzer-context';
4
4
  import type { RNode } from '../../../r-bridge/lang-4.x/ast/model/model';
@@ -851,6 +851,7 @@ function mapDataFrameSubset(args, params, inference, info) {
851
851
  colnames: selectedCols?.map(col => typeof col === 'string' ? col : undefined),
852
852
  ...(duplicateCols || mixedAccess ? { options: { duplicateCols: true } } : {})
853
853
  });
854
+ // eslint-disable-next-line no-useless-assignment -- ends the chain
854
855
  operand = undefined;
855
856
  }
856
857
  }
@@ -932,6 +933,7 @@ function mapDataFrameSelect(args, params, inference, info) {
932
933
  colnames: selectedCols?.map(col => typeof col === 'string' ? col : undefined),
933
934
  ...(renamedCols ? { options: { renamedCols: true } } : {})
934
935
  });
936
+ // eslint-disable-next-line no-useless-assignment -- ends the chain
935
937
  operand = undefined;
936
938
  }
937
939
  return result;
@@ -982,6 +984,7 @@ function mapDataFrameMutate(args, params, inference, info) {
982
984
  colnames: deletedCols,
983
985
  options: { maybe: true }
984
986
  });
987
+ // eslint-disable-next-line no-useless-assignment -- ends the chain
985
988
  operand = undefined;
986
989
  }
987
990
  return result;
@@ -60,7 +60,7 @@ function isDataFrameReplacement(functionName) {
60
60
  }
61
61
  function hasParentReplacement(node, dfg) {
62
62
  const parentVertex = node.info.parent ? dfg.getVertex(node.info.parent) : undefined;
63
- return (0, vertex_1.isFunctionCallVertex)(parentVertex) && parentVertex.origin.includes(built_in_proc_name_1.BuiltInProcName.Replacement);
63
+ return vertex_1.FunctionCallVertex.is(parentVertex) && parentVertex.origin.includes(built_in_proc_name_1.BuiltInProcName.Replacement);
64
64
  }
65
65
  function mapDataFrameContentAssignment(access, expression, inference) {
66
66
  const dataFrame = access.accessed;
@@ -1,5 +1,5 @@
1
1
  import type { NodeId } from '../../r-bridge/lang-4.x/ast/model/processing/node-id';
2
- import { type AnyAbstractDomain } from './abstract-domain';
2
+ import type { AnyAbstractDomain } from './abstract-domain';
3
3
  /**
4
4
  * An interface for state-like domains that store abstract values for AST nodes.
5
5
  */
@@ -45,7 +45,7 @@ exports.UnsupportedFunctions = {
45
45
  * Checks whether a data flow graph vertex represents an unsupported (environment-changing) function call (e.g. `eval`, `load`, `attach`, `rm`, ...)
46
46
  */
47
47
  isUnsupportedCall(vertex, dfg) {
48
- if (!(0, vertex_1.isFunctionCallVertex)(vertex)) {
48
+ if (!vertex_1.FunctionCallVertex.is(vertex)) {
49
49
  return false;
50
50
  }
51
51
  const entry = UnsupportedFunctionsList.find(entry => identifier_1.Identifier.matches(vertex.name, entry.identifier));
package/config.d.ts CHANGED
@@ -10,6 +10,7 @@ import type { FlowrAnalyzerContext } from './project/context/flowr-analyzer-cont
10
10
  import { ProjectKind } from './project/context/project-kind';
11
11
  import type { BuiltInFlowrPluginArgs, BuiltInFlowrPluginName } from './project/plugins/plugin-registry';
12
12
  import { type FlowrGasConfig } from './gas';
13
+ import type { InputClassifierConfig } from './queries/catalog/input-sources-query/simple-input-classifier';
13
14
  export declare enum VariableResolve {
14
15
  /** Don't resolve constants at all */
15
16
  Disabled = "disabled",
@@ -201,6 +202,13 @@ export interface FlowrConfig extends MergeableRecord {
201
202
  /** Rule names excluded from the *default* rule set (a rule requested explicitly still runs). */
202
203
  readonly disabledRules: string[];
203
204
  };
205
+ /**
206
+ * Teaches the {@link InputSourcesQuery|input-sources} analysis (and with it the `problematic-inputs` linter)
207
+ * about further frameworks. Everything here is *added* to what flowR already knows, so a shiny app keeps its
208
+ * `input` even when you declare your own. Usually set per {@link ProjectKind} via {@link specializeConfig}.
209
+ * @see {@link InputClassifierConfig} - for what the entries mean
210
+ */
211
+ readonly inputSources?: DeepWritable<InputClassifierConfig<string[]>>;
204
212
  /**
205
213
  * Overwrite (parts of) this configuration depending on the {@link ProjectKind} flowR detects for the project,
206
214
  * e.g. to give a shiny app its implicit sources. An entry may `inherit` another kind's overwrite (merged first,
package/config.js CHANGED
@@ -18,6 +18,7 @@ const joi_1 = __importDefault(require("joi"));
18
18
  const project_kind_1 = require("./project/context/project-kind");
19
19
  const object_path_1 = __importDefault(require("object-path"));
20
20
  const gas_1 = require("./gas");
21
+ const input_types_1 = require("./queries/catalog/input-sources-query/input-types");
21
22
  var VariableResolve;
22
23
  (function (VariableResolve) {
23
24
  /** Don't resolve constants at all */
@@ -221,7 +222,8 @@ exports.FlowrConfig = {
221
222
  [project_kind_1.ProjectKind.Package]: { solver: { resolveSource: { assumeFilesExist: true } } },
222
223
  [project_kind_1.ProjectKind.Project]: { solver: { resolveSource: { assumeFilesExist: true } } },
223
224
  [project_kind_1.ProjectKind.ShinyApp]: {
224
- project: { implicitSources: ['global.R', 'ui.R', 'server.R', 'app.R'] },
225
+ /* shiny evaluates global.R before the supporting files in R/, and the app itself last */
226
+ project: { implicitSources: ['global.R', 'R/*.R', 'ui.R', 'server.R', 'app.R'] },
225
227
  solver: { resolveSource: { assumeFilesExist: true } }
226
228
  },
227
229
  [project_kind_1.ProjectKind.Script]: { inherit: project_kind_1.ProjectKind.Unknown },
@@ -320,6 +322,12 @@ exports.FlowrConfig = {
320
322
  linter: joi_1.default.object({
321
323
  disabledRules: joi_1.default.array().items(joi_1.default.string()).description('Linting rule names excluded from the default rule set (a rule requested explicitly via a linter query still runs). Usually set per project kind via specializeConfig.')
322
324
  }).description('Linter configuration options.'),
325
+ inputSources: joi_1.default.object({
326
+ pure: joi_1.default.array().items(joi_1.default.string()).optional().description('Functions that only pass the constantness of their arguments on.'),
327
+ ...Object.fromEntries(Object.values(input_types_1.InputType).map(t => [t, joi_1.default.array().items(joi_1.default.string()).optional().description(`Functions whose result is a '${t}' input.`)])),
328
+ linkedObjects: joi_1.default.array().items(joi_1.default.object()).optional().description('Objects a framework provides without a definition in the code, e.g. shiny\'s input.'),
329
+ linkedEntryPoints: joi_1.default.array().items(joi_1.default.object()).optional().description('Calls that hand a function to a framework, which binds its objects to the parameters by position.')
330
+ }).optional().description('Further frameworks the input-sources analysis should know about; entries are added to flowR\'s defaults.'),
323
331
  specializeConfig: joi_1.default.object().pattern(joi_1.default.string().valid(...Object.values(project_kind_1.ProjectKind)), joi_1.default.object({
324
332
  inherit: joi_1.default.string().valid(...Object.values(project_kind_1.ProjectKind)).optional().description('Inherit another kind\'s overwrite first (merged before this entry\'s own keys, which win).')
325
333
  }).unknown(true)).optional()
@@ -4,7 +4,10 @@ exports.cfgAnalyzeDeadCode = cfgAnalyzeDeadCode;
4
4
  const control_flow_graph_1 = require("./control-flow-graph");
5
5
  const logic_1 = require("../util/logic");
6
6
  const semantic_cfg_guided_visitor_1 = require("./semantic-cfg-guided-visitor");
7
+ const vertex_1 = require("../dataflow/graph/vertex");
8
+ const graph_1 = require("../dataflow/graph/graph");
7
9
  const alias_tracking_1 = require("../dataflow/eval/resolve/alias-tracking");
10
+ const built_in_proc_name_1 = require("../dataflow/environments/built-in-proc-name");
8
11
  const log_1 = require("../util/log");
9
12
  const r_function_call_1 = require("../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
10
13
  const general_1 = require("../dataflow/eval/values/general");
@@ -14,7 +17,8 @@ const convert_values_1 = require("../r-bridge/lang-4.x/convert-values");
14
17
  class CfgConditionalDeadCodeRemoval extends semantic_cfg_guided_visitor_1.SemanticCfgGuidedVisitor {
15
18
  cachedConditions = new Map();
16
19
  cachedStatements = new Map();
17
- inTry = new Set();
20
+ cachedSwitch = new Map();
21
+ jumpIsolated = new Set();
18
22
  getValue(id) {
19
23
  const has = this.cachedConditions.get(id);
20
24
  if (has) {
@@ -24,7 +28,7 @@ class CfgConditionalDeadCodeRemoval extends semantic_cfg_guided_visitor_1.Semant
24
28
  return this.cachedConditions.get(id) ?? logic_1.Ternary.Maybe;
25
29
  }
26
30
  isUnconditionalJump(id) {
27
- if (this.inTry.has(id)) {
31
+ if (this.jumpIsolated.has(id)) {
28
32
  return false;
29
33
  }
30
34
  const has = this.cachedStatements.get(id);
@@ -45,7 +49,12 @@ class CfgConditionalDeadCodeRemoval extends semantic_cfg_guided_visitor_1.Semant
45
49
  for (const [from, targets] of cfg.edges()) {
46
50
  for (const [target, edge] of targets) {
47
51
  if (control_flow_graph_1.CfgEdge.isControlDependency(edge)) {
48
- const og = this.getValue(control_flow_graph_1.CfgEdge.unpackCause(edge));
52
+ const cause = control_flow_graph_1.CfgEdge.unpackCause(edge);
53
+ if (this.switchArmDefinitelyNotTaken(cause, from)) {
54
+ cfg.removeEdge(from, target);
55
+ continue;
56
+ }
57
+ const og = this.getValue(cause);
49
58
  const w = control_flow_graph_1.CfgEdge.unpackWhen(edge);
50
59
  if (og === logic_1.Ternary.Always && w === convert_values_1.RFalse) {
51
60
  cfg.removeEdge(from, target);
@@ -126,21 +135,73 @@ class CfgConditionalDeadCodeRemoval extends semantic_cfg_guided_visitor_1.Semant
126
135
  this.cachedStatements.set(data.call.id, !arg);
127
136
  }
128
137
  }
138
+ protectSubgraph(nodeId) {
139
+ const start = this.getCfgVertex(nodeId);
140
+ if (!start) {
141
+ return;
142
+ }
143
+ (0, simple_visitor_1.visitCfgInOrder)(this.config.controlFlow.graph, [control_flow_graph_1.CfgVertex.getId(start)], n => {
144
+ if (control_flow_graph_1.CfgVertex.getEnd(start)?.includes(n)) {
145
+ return true;
146
+ }
147
+ this.jumpIsolated.add(n);
148
+ return false;
149
+ });
150
+ }
129
151
  onTryCall(data) {
130
152
  if (data.call.args.length < 1 || data.call.args[0] === r_function_call_1.EmptyArgument) {
131
153
  return;
132
154
  }
133
- const body = this.getCfgVertex(data.call.args[0].nodeId);
134
- if (!body) {
135
- return;
155
+ this.protectSubgraph(data.call.args[0].nodeId);
156
+ }
157
+ switchArmDefinitelyNotTaken(cause, from) {
158
+ const v = this.config.dfg.getVertex(cause);
159
+ if (!vertex_1.FunctionCallVertex.is(v) || !v.origin.includes(built_in_proc_name_1.BuiltInProcName.Switch)) {
160
+ return false;
136
161
  }
137
- (0, simple_visitor_1.visitCfgInOrder)(this.config.controlFlow.graph, [control_flow_graph_1.CfgVertex.getId(body)], n => {
138
- if (control_flow_graph_1.CfgVertex.getEnd(body)?.includes(n)) {
139
- return true;
140
- }
141
- this.inTry.add(n);
162
+ const selected = this.selectedSwitchArm(v);
163
+ if (selected === 'unknown') {
142
164
  return false;
165
+ }
166
+ const isArm = v.args.slice(1).some(a => graph_1.FunctionArgument.getReference(a) !== undefined && graph_1.FunctionArgument.getId(a) === from);
167
+ return isArm && from !== selected.id;
168
+ }
169
+ selectedSwitchArm(v) {
170
+ const cached = this.cachedSwitch.get(v.id);
171
+ if (cached !== undefined) {
172
+ return cached;
173
+ }
174
+ const result = this.computeSelectedSwitchArm(v);
175
+ this.cachedSwitch.set(v.id, result);
176
+ return result;
177
+ }
178
+ computeSelectedSwitchArm(v) {
179
+ const target = (0, alias_tracking_1.resolveIdToSingleString)(graph_1.FunctionArgument.getReference(v.args[0]), {
180
+ graph: this.config.dfg, full: true, idMap: this.config.normalizedAst.idMap, resolve: this.config.ctx.config.solver.variables, ctx: this.config.ctx
143
181
  });
182
+ if (target === undefined) {
183
+ return 'unknown';
184
+ }
185
+ const arms = v.args.slice(1);
186
+ for (let i = 0; i < arms.length; i++) {
187
+ if (graph_1.FunctionArgument.getName(arms[i]) === target) {
188
+ for (let j = i; j < arms.length; j++) {
189
+ if (graph_1.FunctionArgument.getReference(arms[j]) !== undefined) {
190
+ return { id: graph_1.FunctionArgument.getId(arms[j]) };
191
+ }
192
+ }
193
+ return { id: undefined };
194
+ }
195
+ }
196
+ let defaultId;
197
+ let defaults = 0;
198
+ for (const arm of arms) {
199
+ if (arm !== r_function_call_1.EmptyArgument && !graph_1.FunctionArgument.isNamed(arm) && graph_1.FunctionArgument.getReference(arm) !== undefined) {
200
+ defaults++;
201
+ defaultId = graph_1.FunctionArgument.getId(arm);
202
+ }
203
+ }
204
+ return defaults > 1 ? 'unknown' : { id: defaultId };
144
205
  }
145
206
  }
146
207
  /** Breaks unsatisfiable control dependencies */
@@ -224,7 +224,8 @@ exports.CfgVertex = {
224
224
  * @see {@link CfgVertex#getRootId|getRootId()} - for a way to get the root id of a vertex
225
225
  */
226
226
  getId(vertex) {
227
- return vertex === undefined ? undefined : (Array.isArray(vertex) ? vertex[1] : vertex);
227
+ const id = vertex === undefined ? undefined : (Array.isArray(vertex) ? vertex[1] : vertex);
228
+ return id;
228
229
  },
229
230
  /**
230
231
  * Check whether two vertices are equal, i.e., they have the same type, id, and if they are basic block vertices, they also have the same elements in the same order.