@eagleoutice/flowr 2.10.7 → 2.10.9

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 (49) hide show
  1. package/README.md +21 -21
  2. package/abstract-interpretation/domains/multi-value-state-domain.d.ts +4 -10
  3. package/abstract-interpretation/domains/multi-value-state-domain.js +1 -6
  4. package/abstract-interpretation/domains/partial-product-domain.d.ts +6 -2
  5. package/abstract-interpretation/domains/partial-product-domain.js +7 -3
  6. package/config.d.ts +10 -0
  7. package/config.js +6 -2
  8. package/control-flow/extract-cfg.js +9 -3
  9. package/dataflow/extractor.js +10 -1
  10. package/dataflow/graph/graph.js +6 -2
  11. package/dataflow/info.js +3 -1
  12. package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +3 -1
  13. package/dataflow/internal/process/functions/call/built-in/built-in-source.js +20 -0
  14. package/documentation/wiki-linting-and-testing.js +1 -1
  15. package/documentation/wiki-mk/doc-context.d.ts +21 -1
  16. package/documentation/wiki-mk/doc-context.js +9 -0
  17. package/documentation/wiki-search.js +13 -2
  18. package/linter/linter-rules.d.ts +4 -2
  19. package/linter/rules/absolute-path.d.ts +3 -0
  20. package/linter/rules/absolute-path.js +37 -12
  21. package/linter/rules/file-path-validity.d.ts +9 -2
  22. package/linter/rules/file-path-validity.js +83 -36
  23. package/linter/rules/problematic-inputs.js +4 -1
  24. package/package.json +4 -3
  25. package/queries/catalog/dependencies-query/function-info/read-functions.js +21 -1
  26. package/queries/catalog/dependencies-query/function-info/write-functions.js +18 -1
  27. package/queries/catalog/input-sources-query/input-source-functions.d.ts +3 -1
  28. package/queries/catalog/input-sources-query/input-source-functions.js +322 -46
  29. package/queries/catalog/input-sources-query/input-sources-query-executor.js +14 -9
  30. package/queries/catalog/input-sources-query/input-sources-query-format.d.ts +4 -2
  31. package/queries/catalog/input-sources-query/input-sources-query-format.js +8 -4
  32. package/queries/catalog/input-sources-query/simple-input-classifier.d.ts +13 -6
  33. package/queries/catalog/input-sources-query/simple-input-classifier.js +33 -8
  34. package/queries/catalog/linter-query/linter-query-format.d.ts +2 -2
  35. package/queries/catalog/linter-query/linter-query-format.js +9 -3
  36. package/queries/query.d.ts +3 -2
  37. package/r-bridge/lang-4.x/ast/model/processing/decorate.js +10 -1
  38. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +10 -2
  39. package/search/flowr-search-builder.d.ts +50 -16
  40. package/search/flowr-search-builder.js +33 -17
  41. package/search/flowr-search-filters.d.ts +10 -1
  42. package/search/flowr-search-filters.js +10 -0
  43. package/search/flowr-search.d.ts +8 -3
  44. package/search/search-executor/search-generators.d.ts +2 -0
  45. package/search/search-executor/search-generators.js +2 -2
  46. package/util/objects.js +3 -1
  47. package/util/text/strings.d.ts +7 -0
  48. package/util/text/strings.js +23 -0
  49. package/util/version.js +1 -1
@@ -1,56 +1,332 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.UserFunctions = exports.OptionsFunctions = exports.LangFunctions = exports.FfiFunctions = exports.SystemFunctions = exports.PureFunctions = void 0;
3
+ exports.TempFileFunctions = exports.UserFunctions = exports.OptionsFunctions = exports.LangFunctions = exports.FfiFunctions = exports.SystemFunctions = exports.PureFunctions = void 0;
4
+ const identifier_1 = require("../../../dataflow/environments/identifier");
4
5
  exports.PureFunctions = [
5
- 'paste', 'paste0', 'parse', '+', '-', '*',
6
- '/', '^', '%%', '%/%', '&', '|', '!', '&&', '||',
6
+ /* operators - syntax elements, impossible to call with :: in practice */
7
+ '+', '-', '*', '/', '^', '%%', '%/%',
8
+ '&', '|', '!', '&&', '||',
7
9
  '<', '>', '<=', '>=', '==', '!=', ':',
8
- 'abs', 'sign', 'sqrt', 'exp', 'log', 'log10', 'log2',
9
- 'sin', 'cos', 'tan', 'asin', 'acos', 'atan',
10
- 'length', 'nchar', 'dim', 'nrow', 'ncol',
11
- 'c', 'list', 'data.frame',
12
- 'ifelse', 'switch', 'factor', 'as.factor',
13
- 'round', 'floor', 'ceiling', 'trunc',
14
- 'substr', 'substring', 'strsplit',
15
- 'min', 'max', 'range', 'sum', 'prod', 'mean', 'median', 'var', 'sd',
16
- 'head', 'tail', 'seq', 'rep',
17
- 'apply', 'lapply', 'sapply', 'vapply', 'tapply',
18
- 'matrix', 'array',
19
- 'rownames', 'colnames',
20
- 'list.files', 'tolower', 'toupper', 'printf',
21
- '<-', '->', '=', '<<-', '->>', 'assign', 'get',
22
- '[', '[[', '$', 'length<-', 'dim<-', 'names<-', 'colnames<-', 'rownames<-',
23
- 'as.character', 'as.numeric', 'as.logical', 'as.raw', 'as.list', 'as.data.frame', 'as.matrix', 'as.array',
24
- 'identity', 'invisible', 'return', 'force', 'missing',
25
- 'print', 'cat', 'message', 'warning', 'stop',
26
- 'format', 'sprintf', 'formatC',
27
- 'is.na', 'is.null', 'is.numeric', 'is.character',
28
- 'which', 'match', 'order', 'sort', 'unique', 'duplicated', 'na.omit',
29
- 'grep', 'grepl', 'sub', 'gsub', 'regexpr', 'gregexpr', 'regexec', 'regmatches',
30
- 'as.integer', 'as.double', 'as.complex',
31
- 'trimws', 'seq_len', 'seq_along', 'rep.int',
32
- 'pmin', 'pmax', 'cumsum', 'cumprod', 'cummax', 'cummin', 'diff', 'signif',
33
- 'table', 'prop.table', 'xtabs',
34
- 'rbind', 'cbind', 't', 'crossprod', 'tcrossprod',
35
- 'colSums', 'rowSums', 'colMeans', 'rowMeans',
36
- 'solve', 'det', 'eigen',
37
- 'is.factor', 'is.logical', 'is.vector', 'is.matrix', 'is.data.frame',
10
+ '<-', '->', '=', '<<-', '->>',
11
+ '[', '[[', '$',
12
+ 'length<-', 'dim<-', 'names<-', 'colnames<-', 'rownames<-',
13
+ /* base - string */
14
+ identifier_1.Identifier.make('paste', 'base'),
15
+ identifier_1.Identifier.make('paste0', 'base'),
16
+ identifier_1.Identifier.make('substr', 'base'),
17
+ identifier_1.Identifier.make('substring', 'base'),
18
+ identifier_1.Identifier.make('strsplit', 'base'),
19
+ identifier_1.Identifier.make('startsWith', 'base'),
20
+ identifier_1.Identifier.make('endsWith', 'base'),
21
+ identifier_1.Identifier.make('strrep', 'base'),
22
+ identifier_1.Identifier.make('chartr', 'base'),
23
+ identifier_1.Identifier.make('strtoi', 'base'),
24
+ identifier_1.Identifier.make('tolower', 'base'),
25
+ identifier_1.Identifier.make('toupper', 'base'),
26
+ identifier_1.Identifier.make('nchar', 'base'),
27
+ identifier_1.Identifier.make('trimws', 'base'),
28
+ identifier_1.Identifier.make('grep', 'base'),
29
+ identifier_1.Identifier.make('grepl', 'base'),
30
+ identifier_1.Identifier.make('sub', 'base'),
31
+ identifier_1.Identifier.make('gsub', 'base'),
32
+ identifier_1.Identifier.make('regexpr', 'base'),
33
+ identifier_1.Identifier.make('gregexpr', 'base'),
34
+ identifier_1.Identifier.make('regexec', 'base'),
35
+ identifier_1.Identifier.make('regmatches', 'base'),
36
+ identifier_1.Identifier.make('format', 'base'),
37
+ identifier_1.Identifier.make('sprintf', 'base'),
38
+ identifier_1.Identifier.make('formatC', 'base'),
39
+ /* base - math */
40
+ identifier_1.Identifier.make('abs', 'base'),
41
+ identifier_1.Identifier.make('sign', 'base'),
42
+ identifier_1.Identifier.make('sqrt', 'base'),
43
+ identifier_1.Identifier.make('exp', 'base'),
44
+ identifier_1.Identifier.make('log', 'base'),
45
+ identifier_1.Identifier.make('log10', 'base'),
46
+ identifier_1.Identifier.make('log2', 'base'),
47
+ identifier_1.Identifier.make('sin', 'base'),
48
+ identifier_1.Identifier.make('cos', 'base'),
49
+ identifier_1.Identifier.make('tan', 'base'),
50
+ identifier_1.Identifier.make('atan2', 'base'),
51
+ identifier_1.Identifier.make('asin', 'base'),
52
+ identifier_1.Identifier.make('acos', 'base'),
53
+ identifier_1.Identifier.make('atan', 'base'),
54
+ identifier_1.Identifier.make('sinh', 'base'),
55
+ identifier_1.Identifier.make('cosh', 'base'),
56
+ identifier_1.Identifier.make('tanh', 'base'),
57
+ identifier_1.Identifier.make('asinh', 'base'),
58
+ identifier_1.Identifier.make('acosh', 'base'),
59
+ identifier_1.Identifier.make('atanh', 'base'),
60
+ identifier_1.Identifier.make('round', 'base'),
61
+ identifier_1.Identifier.make('floor', 'base'),
62
+ identifier_1.Identifier.make('ceiling', 'base'),
63
+ identifier_1.Identifier.make('trunc', 'base'),
64
+ identifier_1.Identifier.make('signif', 'base'),
65
+ identifier_1.Identifier.make('Re', 'base'),
66
+ identifier_1.Identifier.make('Im', 'base'),
67
+ identifier_1.Identifier.make('Mod', 'base'),
68
+ identifier_1.Identifier.make('Arg', 'base'),
69
+ identifier_1.Identifier.make('Conj', 'base'),
70
+ identifier_1.Identifier.make('bitwNot', 'base'),
71
+ identifier_1.Identifier.make('bitwAnd', 'base'),
72
+ identifier_1.Identifier.make('bitwOr', 'base'),
73
+ identifier_1.Identifier.make('bitwXor', 'base'),
74
+ identifier_1.Identifier.make('bitwShiftL', 'base'),
75
+ identifier_1.Identifier.make('bitwShiftR', 'base'),
76
+ identifier_1.Identifier.make('xor', 'base'),
77
+ /* base - summary / sequence */
78
+ identifier_1.Identifier.make('min', 'base'),
79
+ identifier_1.Identifier.make('max', 'base'),
80
+ identifier_1.Identifier.make('range', 'base'),
81
+ identifier_1.Identifier.make('sum', 'base'),
82
+ identifier_1.Identifier.make('prod', 'base'),
83
+ identifier_1.Identifier.make('mean', 'base'),
84
+ identifier_1.Identifier.make('cumsum', 'base'),
85
+ identifier_1.Identifier.make('cumprod', 'base'),
86
+ identifier_1.Identifier.make('cummax', 'base'),
87
+ identifier_1.Identifier.make('cummin', 'base'),
88
+ identifier_1.Identifier.make('diff', 'base'),
89
+ identifier_1.Identifier.make('pmin', 'base'),
90
+ identifier_1.Identifier.make('pmax', 'base'),
91
+ identifier_1.Identifier.make('which', 'base'),
92
+ identifier_1.Identifier.make('which.min', 'base'),
93
+ identifier_1.Identifier.make('which.max', 'base'),
94
+ identifier_1.Identifier.make('match', 'base'),
95
+ identifier_1.Identifier.make('order', 'base'),
96
+ identifier_1.Identifier.make('sort', 'base'),
97
+ identifier_1.Identifier.make('unique', 'base'),
98
+ identifier_1.Identifier.make('duplicated', 'base'),
99
+ identifier_1.Identifier.make('seq', 'base'),
100
+ identifier_1.Identifier.make('rep', 'base'),
101
+ identifier_1.Identifier.make('seq_len', 'base'),
102
+ identifier_1.Identifier.make('seq_along', 'base'),
103
+ identifier_1.Identifier.make('rep.int', 'base'),
104
+ /* base - data structures */
105
+ identifier_1.Identifier.make('c', 'base'),
106
+ identifier_1.Identifier.make('list', 'base'),
107
+ identifier_1.Identifier.make('data.frame', 'base'),
108
+ identifier_1.Identifier.make('matrix', 'base'),
109
+ identifier_1.Identifier.make('array', 'base'),
110
+ identifier_1.Identifier.make('rbind', 'base'),
111
+ identifier_1.Identifier.make('cbind', 'base'),
112
+ identifier_1.Identifier.make('t', 'base'),
113
+ identifier_1.Identifier.make('crossprod', 'base'),
114
+ identifier_1.Identifier.make('tcrossprod', 'base'),
115
+ identifier_1.Identifier.make('append', 'base'),
116
+ identifier_1.Identifier.make('rev', 'base'),
117
+ identifier_1.Identifier.make('setdiff', 'base'),
118
+ identifier_1.Identifier.make('union', 'base'),
119
+ identifier_1.Identifier.make('intersect', 'base'),
120
+ identifier_1.Identifier.make('table', 'base'),
121
+ identifier_1.Identifier.make('prop.table', 'base'),
122
+ identifier_1.Identifier.make('rownames', 'base'),
123
+ identifier_1.Identifier.make('colnames', 'base'),
124
+ identifier_1.Identifier.make('length', 'base'),
125
+ identifier_1.Identifier.make('dim', 'base'),
126
+ identifier_1.Identifier.make('nrow', 'base'),
127
+ identifier_1.Identifier.make('ncol', 'base'),
128
+ identifier_1.Identifier.make('colSums', 'base'),
129
+ identifier_1.Identifier.make('rowSums', 'base'),
130
+ identifier_1.Identifier.make('colMeans', 'base'),
131
+ identifier_1.Identifier.make('rowMeans', 'base'),
132
+ /* base - linear algebra */
133
+ identifier_1.Identifier.make('solve', 'base'),
134
+ identifier_1.Identifier.make('det', 'base'),
135
+ identifier_1.Identifier.make('eigen', 'base'),
136
+ /* base - control flow / functional */
137
+ identifier_1.Identifier.make('ifelse', 'base'),
138
+ identifier_1.Identifier.make('switch', 'base'),
139
+ identifier_1.Identifier.make('do.call', 'base'),
140
+ identifier_1.Identifier.make('Reduce', 'base'),
141
+ identifier_1.Identifier.make('Filter', 'base'),
142
+ identifier_1.Identifier.make('Map', 'base'),
143
+ identifier_1.Identifier.make('Find', 'base'),
144
+ identifier_1.Identifier.make('Position', 'base'),
145
+ identifier_1.Identifier.make('Negate', 'base'),
146
+ identifier_1.Identifier.make('apply', 'base'),
147
+ identifier_1.Identifier.make('lapply', 'base'),
148
+ identifier_1.Identifier.make('sapply', 'base'),
149
+ identifier_1.Identifier.make('vapply', 'base'),
150
+ identifier_1.Identifier.make('tapply', 'base'),
151
+ identifier_1.Identifier.make('mapply', 'base'),
152
+ identifier_1.Identifier.make('rapply', 'base'),
153
+ /* base - type coercion & construction */
154
+ identifier_1.Identifier.make('factor', 'base'),
155
+ identifier_1.Identifier.make('as.factor', 'base'),
156
+ identifier_1.Identifier.make('as.character', 'base'),
157
+ identifier_1.Identifier.make('as.numeric', 'base'),
158
+ identifier_1.Identifier.make('as.logical', 'base'),
159
+ identifier_1.Identifier.make('as.raw', 'base'),
160
+ identifier_1.Identifier.make('as.list', 'base'),
161
+ identifier_1.Identifier.make('as.data.frame', 'base'),
162
+ identifier_1.Identifier.make('as.matrix', 'base'),
163
+ identifier_1.Identifier.make('as.array', 'base'),
164
+ identifier_1.Identifier.make('as.integer', 'base'),
165
+ identifier_1.Identifier.make('as.double', 'base'),
166
+ identifier_1.Identifier.make('as.complex', 'base'),
167
+ identifier_1.Identifier.make('numeric', 'base'),
168
+ identifier_1.Identifier.make('character', 'base'),
169
+ identifier_1.Identifier.make('logical', 'base'),
170
+ identifier_1.Identifier.make('integer', 'base'),
171
+ identifier_1.Identifier.make('double', 'base'),
172
+ identifier_1.Identifier.make('raw', 'base'),
173
+ identifier_1.Identifier.make('complex', 'base'),
174
+ /* base - type predicates */
175
+ identifier_1.Identifier.make('is.na', 'base'),
176
+ identifier_1.Identifier.make('is.null', 'base'),
177
+ identifier_1.Identifier.make('is.numeric', 'base'),
178
+ identifier_1.Identifier.make('is.character', 'base'),
179
+ identifier_1.Identifier.make('is.finite', 'base'),
180
+ identifier_1.Identifier.make('is.infinite', 'base'),
181
+ identifier_1.Identifier.make('is.nan', 'base'),
182
+ identifier_1.Identifier.make('is.factor', 'base'),
183
+ identifier_1.Identifier.make('is.logical', 'base'),
184
+ identifier_1.Identifier.make('is.vector', 'base'),
185
+ identifier_1.Identifier.make('is.matrix', 'base'),
186
+ identifier_1.Identifier.make('is.data.frame', 'base'),
187
+ /* base - environment / identity / flow */
188
+ identifier_1.Identifier.make('assign', 'base'),
189
+ identifier_1.Identifier.make('get', 'base'),
190
+ identifier_1.Identifier.make('identity', 'base'),
191
+ identifier_1.Identifier.make('invisible', 'base'),
192
+ identifier_1.Identifier.make('return', 'base'),
193
+ identifier_1.Identifier.make('force', 'base'),
194
+ identifier_1.Identifier.make('missing', 'base'),
195
+ identifier_1.Identifier.make('match.arg', 'base'),
196
+ identifier_1.Identifier.make('print', 'base'),
197
+ identifier_1.Identifier.make('cat', 'base'),
198
+ identifier_1.Identifier.make('message', 'base'),
199
+ identifier_1.Identifier.make('warning', 'base'),
200
+ identifier_1.Identifier.make('stop', 'base'),
201
+ identifier_1.Identifier.make('parse', 'base'),
202
+ identifier_1.Identifier.make('list.files', 'base'),
203
+ /* utils */
204
+ identifier_1.Identifier.make('head', 'utils'),
205
+ identifier_1.Identifier.make('tail', 'utils'),
206
+ /* stats - deterministic given their inputs */
207
+ identifier_1.Identifier.make('var', 'stats'),
208
+ identifier_1.Identifier.make('sd', 'stats'),
209
+ identifier_1.Identifier.make('median', 'stats'),
210
+ identifier_1.Identifier.make('quantile', 'stats'),
211
+ identifier_1.Identifier.make('cor', 'stats'),
212
+ identifier_1.Identifier.make('cov', 'stats'),
213
+ identifier_1.Identifier.make('na.omit', 'stats'),
214
+ identifier_1.Identifier.make('xtabs', 'stats'),
215
+ ];
216
+ exports.SystemFunctions = [
217
+ /* base */
218
+ identifier_1.Identifier.make('system', 'base'),
219
+ identifier_1.Identifier.make('system2', 'base'),
220
+ identifier_1.Identifier.make('pipe', 'base'),
221
+ identifier_1.Identifier.make('shell', 'base'),
222
+ identifier_1.Identifier.make('shell.exec', 'base'),
223
+ /* shinyjs - executes arbitrary JavaScript in the Shiny browser session */
224
+ identifier_1.Identifier.make('runjs', 'shinyjs'),
225
+ ];
226
+ exports.FfiFunctions = [
227
+ /* base */
228
+ identifier_1.Identifier.make('.C', 'base'),
229
+ identifier_1.Identifier.make('.Call', 'base'),
230
+ identifier_1.Identifier.make('.Fortran', 'base'),
231
+ identifier_1.Identifier.make('.External', 'base'),
232
+ identifier_1.Identifier.make('dyn.load', 'base'),
233
+ identifier_1.Identifier.make('getNativeSymbolInfo', 'base'),
234
+ /* Rcpp */
235
+ identifier_1.Identifier.make('sourceCpp', 'Rcpp'),
38
236
  ];
39
- exports.SystemFunctions = ['system', 'system2', 'pipe', 'shell', 'shell.exec'];
40
- exports.FfiFunctions = ['.C', '.Call', '.Fortran', '.External', 'dyn.load', 'sourceCpp', 'getNativeSymbolInfo'];
41
237
  exports.LangFunctions = [
42
- 'substitute', 'quote', 'enquote', 'bquote',
43
- 'call', 'as.call', 'expression', 'as.expression', // 'str2lang', 'str2expression',
44
- 'as.name', 'as.symbol', 'alist', 'as.language', 'evalq',
45
- 'expr', 'exprs', 'enexpr', 'enexprs', 'inject',
46
- 'quo', 'quos', 'enquo', 'enquos', 'enquo0', 'enquos0',
47
- 'sym', 'syms', 'ensym', 'ensyms'
238
+ /* base - quoting / AST construction */
239
+ identifier_1.Identifier.make('substitute', 'base'),
240
+ identifier_1.Identifier.make('quote', 'base'),
241
+ identifier_1.Identifier.make('enquote', 'base'),
242
+ identifier_1.Identifier.make('bquote', 'base'),
243
+ identifier_1.Identifier.make('call', 'base'),
244
+ identifier_1.Identifier.make('as.call', 'base'),
245
+ identifier_1.Identifier.make('expression', 'base'),
246
+ identifier_1.Identifier.make('as.expression', 'base'),
247
+ // 'str2lang', 'str2expression' - excluded: evaluated as strings, not AST
248
+ identifier_1.Identifier.make('as.name', 'base'),
249
+ identifier_1.Identifier.make('as.symbol', 'base'),
250
+ identifier_1.Identifier.make('alist', 'base'),
251
+ identifier_1.Identifier.make('as.language', 'base'),
252
+ identifier_1.Identifier.make('evalq', 'base'),
253
+ /* base - call / function introspection */
254
+ identifier_1.Identifier.make('match.call', 'base'),
255
+ identifier_1.Identifier.make('sys.call', 'base'),
256
+ identifier_1.Identifier.make('sys.function', 'base'),
257
+ identifier_1.Identifier.make('body', 'base'),
258
+ identifier_1.Identifier.make('formals', 'base'),
259
+ identifier_1.Identifier.make('args', 'base'),
260
+ identifier_1.Identifier.make('deparse', 'base'),
261
+ identifier_1.Identifier.make('deparse1', 'base'),
262
+ /* rlang - tidy evaluation */
263
+ identifier_1.Identifier.make('expr', 'rlang'),
264
+ identifier_1.Identifier.make('exprs', 'rlang'),
265
+ identifier_1.Identifier.make('enexpr', 'rlang'),
266
+ identifier_1.Identifier.make('enexprs', 'rlang'),
267
+ identifier_1.Identifier.make('inject', 'rlang'),
268
+ identifier_1.Identifier.make('quo', 'rlang'),
269
+ identifier_1.Identifier.make('quos', 'rlang'),
270
+ identifier_1.Identifier.make('enquo', 'rlang'),
271
+ identifier_1.Identifier.make('enquos', 'rlang'),
272
+ identifier_1.Identifier.make('enquo0', 'rlang'),
273
+ identifier_1.Identifier.make('enquos0', 'rlang'),
274
+ identifier_1.Identifier.make('sym', 'rlang'),
275
+ identifier_1.Identifier.make('syms', 'rlang'),
276
+ identifier_1.Identifier.make('ensym', 'rlang'),
277
+ identifier_1.Identifier.make('ensyms', 'rlang'),
278
+ identifier_1.Identifier.make('new_formula', 'rlang'),
279
+ identifier_1.Identifier.make('f_rhs', 'rlang'),
280
+ identifier_1.Identifier.make('f_lhs', 'rlang'),
281
+ identifier_1.Identifier.make('fn_body', 'rlang'),
282
+ identifier_1.Identifier.make('fn_fmls', 'rlang'),
283
+ identifier_1.Identifier.make('fn_fmls_names', 'rlang'),
284
+ ];
285
+ exports.OptionsFunctions = [
286
+ /* base */
287
+ identifier_1.Identifier.make('options', 'base'),
288
+ identifier_1.Identifier.make('getOption', 'base'),
289
+ identifier_1.Identifier.make('Sys.getenv', 'base'),
290
+ identifier_1.Identifier.make('Sys.info', 'base'),
291
+ identifier_1.Identifier.make('Sys.getpid', 'base'),
292
+ identifier_1.Identifier.make('getwd', 'base'),
293
+ identifier_1.Identifier.make('getRversion', 'base'),
294
+ identifier_1.Identifier.make('R.Version', 'base'),
48
295
  ];
49
- exports.OptionsFunctions = ['options', 'getOption', 'Sys.getenv'];
50
296
  exports.UserFunctions = [
51
- 'readline', 'scan', 'askYesNo',
52
- 'file.choose', 'choose.files', 'choose.dir', 'menu', 'select.list', 'winDialogString', 'winDialog',
53
- 'showPrompt', 'askForPassword', 'selectDirectory', 'selectFile',
54
- 'dlgInput', 'dlgOpen',
297
+ /* base */
298
+ identifier_1.Identifier.make('readline', 'base'),
299
+ identifier_1.Identifier.make('scan', 'base'),
300
+ identifier_1.Identifier.make('file.choose', 'base'),
301
+ /* utils */
302
+ identifier_1.Identifier.make('askYesNo', 'utils'),
303
+ identifier_1.Identifier.make('choose.files', 'utils'),
304
+ identifier_1.Identifier.make('choose.dir', 'utils'),
305
+ identifier_1.Identifier.make('menu', 'utils'),
306
+ identifier_1.Identifier.make('select.list', 'utils'),
307
+ identifier_1.Identifier.make('winDialogString', 'utils'),
308
+ identifier_1.Identifier.make('winDialog', 'utils'),
309
+ /* rstudioapi */
310
+ identifier_1.Identifier.make('showPrompt', 'rstudioapi'),
311
+ identifier_1.Identifier.make('askForPassword', 'rstudioapi'),
312
+ identifier_1.Identifier.make('selectDirectory', 'rstudioapi'),
313
+ identifier_1.Identifier.make('selectFile', 'rstudioapi'),
314
+ identifier_1.Identifier.make('showQuestion', 'rstudioapi'),
315
+ /* svDialogs */
316
+ identifier_1.Identifier.make('dlgInput', 'svDialogs'),
317
+ identifier_1.Identifier.make('dlgOpen', 'svDialogs'),
318
+ identifier_1.Identifier.make('dlgList', 'svDialogs'),
319
+ identifier_1.Identifier.make('dlgSave', 'svDialogs'),
320
+ identifier_1.Identifier.make('dlgDir', 'svDialogs'),
321
+ /* tcltk */
322
+ identifier_1.Identifier.make('tk_choose.files', 'tcltk'),
323
+ identifier_1.Identifier.make('tk_choose.dir', 'tcltk'),
324
+ ];
325
+ /** R functions that produce temporary file/directory paths (sub-type of {@link InputType.File}). */
326
+ exports.TempFileFunctions = [
327
+ identifier_1.Identifier.make('tempfile', 'base'), identifier_1.Identifier.make('tempdir', 'base'),
328
+ identifier_1.Identifier.make('file_temp', 'fs'), identifier_1.Identifier.make('dir_temp', 'fs'),
329
+ identifier_1.Identifier.make('local_tempfile', 'withr'), identifier_1.Identifier.make('with_tempfile', 'withr'),
330
+ identifier_1.Identifier.make('local_tempdir', 'withr'), identifier_1.Identifier.make('with_tempdir', 'withr'),
55
331
  ];
56
332
  //# sourceMappingURL=input-source-functions.js.map
@@ -20,16 +20,21 @@ async function executeInputSourcesQuery({ analyzer }, queries) {
20
20
  const df = await analyzer.dataflow();
21
21
  const defaultConfig = await resolveSearches(analyzer, input_sources_query_format_1.DefaultInputClassifierConfig);
22
22
  for (const query of queries) {
23
- const key = query.criterion;
24
- if (results[key]) {
25
- log_1.log.warn(`Duplicate key for input-sources query: ${key}, skipping...`);
23
+ const criteria = Array.isArray(query.criterion)
24
+ ? query.criterion
25
+ : [query.criterion];
26
+ const config = { ...defaultConfig, ...(await resolveSearches(analyzer, query.config ?? {})) };
27
+ for (const criterion of criteria) {
28
+ if (results[criterion]) {
29
+ log_1.log.warn(`Duplicate key for input-sources query: ${criterion}, skipping...`);
30
+ continue;
31
+ }
32
+ const criterionId = parse_1.SlicingCriterion.tryParse(criterion, nast.idMap) ?? criterion;
33
+ const provenanceNode = nast.idMap.get(criterionId);
34
+ const fdef = r_function_definition_1.RFunctionDefinition.rootFunctionDefinition(provenanceNode, nast.idMap);
35
+ const provenance = df_helper_1.Dataflow.provenanceGraph(criterionId, df.graph, fdef ? model_1.RNode.collectAllIds(fdef) : undefined);
36
+ results[criterion] = (0, simple_input_classifier_1.classifyInput)(criterionId, provenance, config, df.graph);
26
37
  }
27
- const criterionId = parse_1.SlicingCriterion.tryParse(key, nast.idMap) ?? key;
28
- const provenanceNode = nast.idMap.get(criterionId);
29
- const fdef = r_function_definition_1.RFunctionDefinition.rootFunctionDefinition(provenanceNode, nast.idMap);
30
- const provenance = df_helper_1.Dataflow.provenanceGraph(criterionId, df.graph, fdef ? model_1.RNode.collectAllIds(fdef) : undefined);
31
- const config = { ...defaultConfig, ...(await resolveSearches(analyzer, query?.config ?? {})) };
32
- results[key] = (0, simple_input_classifier_1.classifyInput)(criterionId, provenance, config, df.graph);
33
38
  }
34
39
  return {
35
40
  '.meta': {
@@ -15,10 +15,12 @@ export type InputSourcesQueryConfig = InputClassifierConfig;
15
15
  export interface InputSourcesQuery extends BaseQueryFormat {
16
16
  readonly type: 'input-sources';
17
17
  /**
18
- * This takes a criterion (or a numerical id works too)
18
+ * One or more slicing criteria to analyze; each is resolved independently and keyed by its
19
+ * criterion string in the result map. Supplying an array allows batching multiple lookups
20
+ * into a single round-trip.
19
21
  * {@link SlicingCriterion.fromId}
20
22
  */
21
- readonly criterion: SlicingCriterion;
23
+ readonly criterion: SlicingCriterion | readonly SlicingCriterion[];
22
24
  readonly config?: InputSourcesQueryConfig;
23
25
  }
24
26
  export declare const DefaultInputClassifierConfig: InputClassifierConfig;
@@ -12,12 +12,14 @@ const slice_query_parser_1 = require("../../../cli/repl/parser/slice-query-parse
12
12
  const input_sources_query_executor_1 = require("./input-sources-query-executor");
13
13
  const range_1 = require("../../../util/range");
14
14
  const flowr_search_builder_1 = require("../../../search/flowr-search-builder");
15
+ const linter_format_1 = require("../../../linter/linter-format");
15
16
  const read_functions_1 = require("../dependencies-query/function-info/read-functions");
16
17
  const input_source_functions_1 = require("./input-source-functions");
17
18
  exports.DefaultInputClassifierConfig = {
18
19
  [simple_input_classifier_1.InputTraceType.Pure]: input_source_functions_1.PureFunctions,
19
20
  [simple_input_classifier_1.InputType.File]: read_functions_1.ReadFunctions.map(readFunction => readFunction.name),
20
- [simple_input_classifier_1.InputType.Network]: flowr_search_builder_1.Q.fromQuery({ type: 'linter', rules: ['network-functions'] }),
21
+ [simple_input_classifier_1.InputType.TempFile]: input_source_functions_1.TempFileFunctions,
22
+ [simple_input_classifier_1.InputType.Network]: flowr_search_builder_1.Q.fromQuery({ type: 'linter', rules: ['network-functions'] }, linter_format_1.LintingResultCertainty.Certain),
21
23
  [simple_input_classifier_1.InputType.Random]: flowr_search_builder_1.Q.fromQuery({ type: 'linter', rules: ['seeded-randomness'] }),
22
24
  [simple_input_classifier_1.InputType.System]: input_source_functions_1.SystemFunctions,
23
25
  [simple_input_classifier_1.InputType.Ffi]: input_source_functions_1.FfiFunctions,
@@ -44,11 +46,12 @@ exports.InputSourcesDefinition = {
44
46
  const nast = (await analyzer.normalize()).idMap;
45
47
  for (const [key, sources] of Object.entries(out.results)) {
46
48
  result.push(` ╰ Input Sources for ${key}`);
47
- for (const { id, trace, types, value } of sources) {
49
+ for (const { id, trace, types, name, value } of sources) {
48
50
  const kNode = nast.get(id);
49
51
  const kLoc = kNode ? range_1.SourceLocation.format(range_1.SourceLocation.fromNode(kNode)) : 'unknown location';
52
+ const nameStr = name !== undefined ? `, name: ${name}` : '';
50
53
  const valueStr = value !== undefined ? `, value: ${JSON.stringify(value)}` : '';
51
- result.push(` ╰ ${kLoc} (id: ${id}), type: ${JSON.stringify(types)}, trace: ${trace}${valueStr}`);
54
+ result.push(` ╰ ${kLoc} (id: ${id}), type: ${JSON.stringify(types)}, trace: ${trace}${nameStr}${valueStr}`);
52
55
  }
53
56
  }
54
57
  return true;
@@ -56,10 +59,11 @@ exports.InputSourcesDefinition = {
56
59
  fromLine: inputSourcesQueryLineParser,
57
60
  schema: joi_1.default.object({
58
61
  type: joi_1.default.string().valid('input-sources').required().description('The type of the query.'),
59
- criterion: joi_1.default.string().required().description('The slicing criterion to use.'),
62
+ criterion: joi_1.default.alternatives(joi_1.default.string(), joi_1.default.array().items(joi_1.default.string())).required().description('The slicing criterion or array of criteria to use.'),
60
63
  config: joi_1.default.object({
61
64
  [simple_input_classifier_1.InputTraceType.Pure]: joi_1.default.array().items(joi_1.default.string()).optional().description('Deterministic/pure functions: functions that preserve constantness of their inputs (e.g., arithmetic, parse).'),
62
65
  [simple_input_classifier_1.InputType.File]: joi_1.default.array().items(joi_1.default.string()).optional().description('Functions that read from the filesystem and produce data (e.g., read.csv, readRDS).'),
66
+ [simple_input_classifier_1.InputType.TempFile]: joi_1.default.array().items(joi_1.default.string()).optional().description('Functions that produce temporary file paths (sub-type of File; e.g., tempfile, tempdir).'),
63
67
  [simple_input_classifier_1.InputType.Network]: joi_1.default.array().items(joi_1.default.string()).optional().description('Functions that fetch data from the network (e.g., download.file, url connections).'),
64
68
  [simple_input_classifier_1.InputType.Random]: joi_1.default.array().items(joi_1.default.string()).optional().description('Functions that produce randomness (e.g., runif, rnorm).'),
65
69
  [simple_input_classifier_1.InputType.System]: joi_1.default.array().items(joi_1.default.string()).optional().description('Functions that execute system commands (e.g., system, system2, shell, pipe).'),
@@ -9,19 +9,24 @@ import type { FlowrSearchLike } from '../../../search/flowr-search-builder';
9
9
  * joining differing lattice elements.
10
10
  *
11
11
  *```
12
- * [ Unknown ]
13
- * |
14
- * [Param] [File] [Net] [User], ...
15
- * |
12
+ * [ Unknown ]
13
+ * |
14
+ * [Param] [File] [Net] [User], ...
15
+ * | | | |
16
+ * | [TempFile] | |
17
+ * +---------+------+------+- ...
18
+ * |
16
19
  * [ DerivedConstant ]
17
- * |
18
- * [ Constant ]
20
+ * |
21
+ * [ Constant ]
19
22
  *```
20
23
  *
21
24
  */
22
25
  export declare enum InputType {
23
26
  Parameter = "param",
24
27
  File = "file",
28
+ /** Temporary file paths produced by tempfile()/tempdir() and equivalents; a sub-type of {@link File} */
29
+ TempFile = "tempfile",
25
30
  Network = "net",
26
31
  Random = "rand",
27
32
  /** Calls to system/system2 and similar */
@@ -67,6 +72,8 @@ export interface InputSource extends MergeableRecord {
67
72
  trace: InputTraceType;
68
73
  /** if the trace is affected by control dependencies, they are classified too, this is a duplicate free array */
69
74
  cds?: InputType[];
75
+ /** argument name when this source originates from a named argument of the criterion function call */
76
+ name?: string;
70
77
  /** the concrete scalar value when the source is a constant or a pure alias of one */
71
78
  value?: ConstantValue;
72
79
  }
@@ -163,6 +163,24 @@ class InputClassifier {
163
163
  types.push(type);
164
164
  }
165
165
  }
166
+ // if a File-typed call reads from a temp path, replace File with TempFile
167
+ if (types.includes(InputType.File) && !types.includes(InputType.TempFile)) {
168
+ for (const arg of call.args) {
169
+ if (graph_1.FunctionArgument.isEmpty(arg)) {
170
+ continue;
171
+ }
172
+ const ref = graph_1.FunctionArgument.getReference(arg);
173
+ if (ref === undefined) {
174
+ continue;
175
+ }
176
+ const argVtx = this.dfg.getVertex(ref);
177
+ if (argVtx && this.classifyEntry(argVtx).types.includes(InputType.TempFile)) {
178
+ types.splice(types.indexOf(InputType.File), 1);
179
+ types.push(InputType.TempFile);
180
+ break;
181
+ }
182
+ }
183
+ }
166
184
  if (types.length === 0) {
167
185
  // if it is not pure, we cannot classify based on the inputs, in that case we do not know!
168
186
  types.push(InputType.Unknown);
@@ -308,13 +326,16 @@ class InputClassifier {
308
326
  * joining differing lattice elements.
309
327
  *
310
328
  *```
311
- * [ Unknown ]
312
- * |
313
- * [Param] [File] [Net] [User], ...
314
- * |
329
+ * [ Unknown ]
330
+ * |
331
+ * [Param] [File] [Net] [User], ...
332
+ * | | | |
333
+ * | [TempFile] | |
334
+ * +---------+------+------+- ...
335
+ * |
315
336
  * [ DerivedConstant ]
316
- * |
317
- * [ Constant ]
337
+ * |
338
+ * [ Constant ]
318
339
  *```
319
340
  *
320
341
  */
@@ -322,6 +343,8 @@ var InputType;
322
343
  (function (InputType) {
323
344
  InputType["Parameter"] = "param";
324
345
  InputType["File"] = "file";
346
+ /** Temporary file paths produced by tempfile()/tempdir() and equivalents; a sub-type of {@link File} */
347
+ InputType["TempFile"] = "tempfile";
325
348
  InputType["Network"] = "net";
326
349
  InputType["Random"] = "rand";
327
350
  /** Calls to system/system2 and similar */
@@ -357,7 +380,7 @@ function matchesList(fn, list) {
357
380
  return false;
358
381
  }
359
382
  for (const id of list) {
360
- if (fn.id === id || (identifier_1.Identifier.is(id) && identifier_1.Identifier.matches(id, fn.name))) {
383
+ if (fn.id === id || (identifier_1.Identifier.is(id) && (identifier_1.Identifier.matches(id, fn.name) || (identifier_1.Identifier.getNamespace(fn.name) === undefined && identifier_1.Identifier.matches(fn.name, id))))) {
361
384
  return true;
362
385
  }
363
386
  }
@@ -392,7 +415,9 @@ function classifyInput(id, dfg, config, fullDfg) {
392
415
  if (argVtx === undefined) {
393
416
  continue;
394
417
  }
395
- ret.push(c.classifyEntry(argVtx));
418
+ const entry = c.classifyEntry(argVtx);
419
+ const argName = graph_1.FunctionArgument.getName(arg);
420
+ ret.push(argName !== undefined ? { ...entry, name: argName } : entry);
396
421
  }
397
422
  return ret;
398
423
  }
@@ -3,7 +3,7 @@ import type { ParsedQueryLine } from '../../query';
3
3
  import Joi from 'joi';
4
4
  import { executeLinterQuery } from './linter-query-executor';
5
5
  import { type LintingRuleNames } from '../../../linter/linter-rules';
6
- import { type ConfiguredLintingRule, LintingResults } from '../../../linter/linter-format';
6
+ import { type ConfiguredLintingRule, LintingResultCertainty, LintingResults } from '../../../linter/linter-format';
7
7
  import type { FlowrConfig } from '../../../config';
8
8
  import type { ReplOutput } from '../../../cli/repl/commands/repl-main';
9
9
  import type { CommandCompletions } from '../../../cli/repl/core';
@@ -31,7 +31,7 @@ export declare const LinterQueryDefinition: {
31
31
  readonly completer: typeof linterQueryCompleter;
32
32
  readonly fromLine: typeof linterQueryLineParser;
33
33
  readonly schema: Joi.ObjectSchema<any>;
34
- readonly flattenInvolvedNodes: (queryResults: BaseQueryResult) => ((string & {
34
+ readonly flattenInvolvedNodes: (queryResults: BaseQueryResult, _queries: readonly import("../../query").Query[], certainty: LintingResultCertainty | undefined) => ((string & {
35
35
  __brand?: "node-id";
36
36
  }) | (number & {
37
37
  __brand?: "node-id";