@eagleoutice/flowr 2.10.7 → 2.10.8

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 (38) hide show
  1. package/README.md +9 -9
  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/documentation/wiki-linting-and-testing.js +1 -1
  7. package/documentation/wiki-mk/doc-context.d.ts +21 -1
  8. package/documentation/wiki-mk/doc-context.js +9 -0
  9. package/documentation/wiki-search.js +13 -2
  10. package/linter/linter-rules.d.ts +4 -2
  11. package/linter/rules/absolute-path.d.ts +3 -0
  12. package/linter/rules/absolute-path.js +37 -12
  13. package/linter/rules/file-path-validity.d.ts +9 -2
  14. package/linter/rules/file-path-validity.js +83 -36
  15. package/linter/rules/problematic-inputs.js +4 -1
  16. package/package.json +4 -3
  17. package/queries/catalog/dependencies-query/function-info/read-functions.js +21 -1
  18. package/queries/catalog/dependencies-query/function-info/write-functions.js +18 -1
  19. package/queries/catalog/input-sources-query/input-source-functions.d.ts +3 -1
  20. package/queries/catalog/input-sources-query/input-source-functions.js +322 -46
  21. package/queries/catalog/input-sources-query/input-sources-query-executor.js +14 -9
  22. package/queries/catalog/input-sources-query/input-sources-query-format.d.ts +4 -2
  23. package/queries/catalog/input-sources-query/input-sources-query-format.js +8 -4
  24. package/queries/catalog/input-sources-query/simple-input-classifier.d.ts +13 -6
  25. package/queries/catalog/input-sources-query/simple-input-classifier.js +33 -8
  26. package/queries/catalog/linter-query/linter-query-format.d.ts +2 -2
  27. package/queries/catalog/linter-query/linter-query-format.js +9 -3
  28. package/queries/query.d.ts +3 -2
  29. package/search/flowr-search-builder.d.ts +50 -16
  30. package/search/flowr-search-builder.js +33 -17
  31. package/search/flowr-search-filters.d.ts +10 -1
  32. package/search/flowr-search-filters.js +10 -0
  33. package/search/flowr-search.d.ts +8 -3
  34. package/search/search-executor/search-generators.d.ts +2 -0
  35. package/search/search-executor/search-generators.js +2 -2
  36. package/util/text/strings.d.ts +7 -0
  37. package/util/text/strings.js +23 -0
  38. package/util/version.js +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eagleoutice/flowr",
3
- "version": "2.10.7",
3
+ "version": "2.10.8",
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": {
@@ -41,11 +41,12 @@
41
41
  "test:system": "vitest --dir test/system-tests --config test/system-tests/vitest.config.mts",
42
42
  "test:coverage": "npm run test -- --coverage",
43
43
  "test:full": "npm run test-full",
44
+ "test:bench": "vitest bench --config test/vitest.config.mts",
44
45
  "test-full": "npm run test:coverage -- --no-watch -- --make-summary --test-installation",
45
46
  "performance-test": "func() { cd test/performance/ && bash run-all-suites.sh $1 $2 $3 $4; cd ../../; }; func",
46
47
  "test:performance": "npm run performance-test --",
47
48
  "detect-circular-deps": "npx madge --extensions ts,tsx --circular src/",
48
- "checkup": "npm run flowr -- --execute \":version\" && npm run lint && npm run test-full -- --allowOnly=false && npm run test:system -- --no-watch && docker build -t test-flowr -f scripts/Dockerfile . && npm run doc && npm run gen:readme && npm-run-all wiki:*"
49
+ "checkup": "npm run flowr -- --execute \":version\" && npm run lint && npm run test-full -- --allowOnly=false && npm run test:system -- --no-watch && docker build -t test-flowr -f scripts/Dockerfile . && npm run doc && npm run wiki"
49
50
  },
50
51
  "keywords": [
51
52
  "static code analysis",
@@ -184,7 +185,7 @@
184
185
  "@types/ws": "^8.18.1",
185
186
  "@typescript-eslint/eslint-plugin": "^8.40.0",
186
187
  "@vitest/coverage-v8": "^4.1.8",
187
- "esbuild": "^0.27.2",
188
+ "esbuild": "^0.28.1",
188
189
  "eslint": "^9.39.2",
189
190
  "license-checker-rseidelsohn": "^4.4.2",
190
191
  "npm-run-all": "^4.1.5",
@@ -115,6 +115,26 @@ exports.ReadFunctions = [
115
115
  { package: 'readODS', name: 'read_ods', argIdx: 0, argName: 'path', resolveValue: true },
116
116
  { package: 'vroom', name: 'vroom', argIdx: 0, argName: 'file', resolveValue: true },
117
117
  { package: 'compiler', name: 'loadcmp', argIdx: 0, argName: 'file', resolveValue: true },
118
- { package: 'compiler', name: 'cmpfile', argIdx: 0, argName: 'infile', resolveValue: true }
118
+ { package: 'compiler', name: 'cmpfile', argIdx: 0, argName: 'infile', resolveValue: true },
119
+ /* image / raster */
120
+ { package: 'jpeg', name: 'readJPEG', argIdx: 0, argName: 'source', resolveValue: true },
121
+ { package: 'png', name: 'readPNG', argIdx: 0, argName: 'source', resolveValue: true },
122
+ { package: 'tiff', name: 'readTIFF', argIdx: 0, argName: 'source', resolveValue: true },
123
+ { package: 'imager', name: 'load.image', argIdx: 0, argName: 'file', resolveValue: true },
124
+ { package: 'imager', name: 'load.video', argIdx: 0, argName: 'file', resolveValue: true },
125
+ { package: 'imager', name: 'load.dir', argIdx: 0, argName: 'path', resolveValue: true },
126
+ { package: 'OpenImageR', name: 'readImage', argIdx: 0, argName: 'path', resolveValue: true },
127
+ { package: 'EBImage', name: 'readImage', argIdx: 0, argName: 'files', resolveValue: true },
128
+ /* audio / video */
129
+ { package: 'av', name: 'av_video_images', argIdx: 0, argName: 'video', resolveValue: true },
130
+ { package: 'av', name: 'read_audio_bin', argIdx: 0, argName: 'audio', resolveValue: true },
131
+ { package: 'av', name: 'read_audio_fft', argIdx: 0, argName: 'audio', resolveValue: true },
132
+ { package: 'tuneR', name: 'readWave', argIdx: 0, argName: 'filename', resolveValue: true },
133
+ { package: 'tuneR', name: 'readMP3', argIdx: 0, argName: 'file', resolveValue: true },
134
+ { package: 'tuneR', name: 'readMidi', argIdx: 0, argName: 'file', resolveValue: true },
135
+ { package: 'seewave', name: 'read.audacity', argIdx: 0, argName: 'file', resolveValue: true },
136
+ { package: 'audio', name: 'load.wave', argIdx: 0, argName: 'where', resolveValue: true },
137
+ /* shinyjs - loads an external JavaScript file */
138
+ { package: 'shinyjs', name: 'extendShinyjs', argIdx: 0, argName: 'script', resolveValue: true, ignoreIf: 'arg-missing' }
119
139
  ];
120
140
  //# sourceMappingURL=read-functions.js.map
@@ -123,6 +123,23 @@ exports.WriteFunctions = [
123
123
  { package: 'rio', name: 'export', argIdx: 1, argName: 'file', resolveValue: true },
124
124
  { package: 'rio', name: 'export_list', argIdx: 1, argName: 'file', resolveValue: true },
125
125
  { package: 'magick', name: 'image_write', argIdx: 1, argName: 'path', resolveValue: true, ignoreIf: 'arg-missing' },
126
- { package: 'compiler', name: 'cmpfile', argIdx: 1, argName: 'outfile', resolveValue: true }
126
+ { package: 'compiler', name: 'cmpfile', argIdx: 1, argName: 'outfile', resolveValue: true },
127
+ /* image / raster */
128
+ { package: 'jpeg', name: 'writeJPEG', argIdx: 1, argName: 'target', resolveValue: true, ignoreIf: 'arg-missing' },
129
+ { package: 'png', name: 'writePNG', argIdx: 1, argName: 'target', resolveValue: true, ignoreIf: 'arg-missing' },
130
+ { package: 'tiff', name: 'writeTIFF', argIdx: 1, argName: 'where', resolveValue: true },
131
+ { package: 'imager', name: 'make.video', argIdx: 1, argName: 'file', resolveValue: true },
132
+ { package: 'OpenImageR', name: 'writeImage', argIdx: 1, argName: 'file_name', resolveValue: true },
133
+ { package: 'EBImage', name: 'writeImage', argIdx: 1, argName: 'files', resolveValue: true },
134
+ { package: 'gifski', name: 'gifski', argIdx: 1, argName: 'gif_file', resolveValue: true },
135
+ { package: 'gifski', name: 'save_gif', argIdx: 1, argName: 'gif_file', resolveValue: true },
136
+ { package: 'svglite', name: 'svglite', argIdx: 0, argName: 'file', resolveValue: true },
137
+ /* audio / video */
138
+ { package: 'av', name: 'av_encode_video', argIdx: 1, argName: 'output', resolveValue: true },
139
+ { package: 'av', name: 'av_audio_convert', argIdx: 1, argName: 'output', resolveValue: true },
140
+ { package: 'av', name: 'av_capture_graphics', argIdx: 1, argName: 'output', resolveValue: true },
141
+ { package: 'tuneR', name: 'writeWave', argIdx: 1, argName: 'filename', resolveValue: true },
142
+ { package: 'seewave', name: 'savewav', argName: 'filename', resolveValue: true, defaultValue: '<wave-name>' },
143
+ { package: 'audio', name: 'save.wave', argIdx: 1, argName: 'where', resolveValue: true }
127
144
  ];
128
145
  //# sourceMappingURL=write-functions.js.map
@@ -1,7 +1,9 @@
1
- import type { Identifier } from '../../../dataflow/environments/identifier';
1
+ import { Identifier } from '../../../dataflow/environments/identifier';
2
2
  export declare const PureFunctions: Identifier[];
3
3
  export declare const SystemFunctions: Identifier[];
4
4
  export declare const FfiFunctions: Identifier[];
5
5
  export declare const LangFunctions: Identifier[];
6
6
  export declare const OptionsFunctions: Identifier[];
7
7
  export declare const UserFunctions: Identifier[];
8
+ /** R functions that produce temporary file/directory paths (sub-type of {@link InputType.File}). */
9
+ export declare const TempFileFunctions: Identifier[];
@@ -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
  }