@eagleoutice/flowr 2.15.9 → 2.15.10
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.
- package/README.md +34 -25
- package/abstract-interpretation/absint-inference.d.ts +2 -2
- package/abstract-interpretation/absint-inference.js +32 -79
- package/benchmark/slicer.d.ts +0 -1
- package/benchmark/slicer.js +1 -2
- package/cli/repl/commands/repl-signature.js +12 -3
- package/config.d.ts +5 -1
- package/control-flow/cfg-properties.js +0 -22
- package/control-flow/happens-before.d.ts +2 -2
- package/control-flow/happens-before.js +29 -19
- package/dataflow/environments/apply-kill.js +6 -2
- package/dataflow/environments/built-in-config.d.ts +2 -0
- package/dataflow/environments/built-in-props.d.ts +7 -1
- package/dataflow/environments/built-in-props.js +8 -1
- package/dataflow/environments/built-in.d.ts +7 -2
- package/dataflow/environments/built-in.js +11 -5
- package/dataflow/environments/default-builtin-config.d.ts +386 -8
- package/dataflow/environments/default-builtin-config.js +84 -22
- package/dataflow/environments/define.d.ts +3 -2
- package/dataflow/environments/define.js +4 -3
- package/dataflow/environments/deprecation-info.d.ts +45 -0
- package/dataflow/environments/deprecation-info.js +13 -0
- package/dataflow/environments/environment.d.ts +1 -1
- package/dataflow/environments/environment.js +5 -4
- package/dataflow/environments/identifier.d.ts +2 -0
- package/dataflow/extractor.js +6 -1
- package/dataflow/fn/class-declaration.d.ts +0 -11
- package/dataflow/fn/class-declaration.js +0 -20
- package/dataflow/fn/higher-order-function.d.ts +9 -1
- package/dataflow/fn/higher-order-function.js +14 -7
- package/dataflow/fn/strict-function.js +8 -3
- package/dataflow/graph/graph.d.ts +7 -0
- package/dataflow/graph/graph.js +17 -0
- package/dataflow/graph/vertex.d.ts +1 -1
- package/dataflow/internal/linker.d.ts +3 -0
- package/dataflow/internal/linker.js +67 -6
- package/dataflow/internal/process/functions/call/built-in/built-in-ambient-state.d.ts +113 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-ambient-state.js +506 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +9 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.d.ts +2 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +22 -19
- package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.d.ts +5 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.js +21 -14
- package/dataflow/internal/process/functions/call/built-in/built-in-eval.js +14 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +22 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +2 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +4 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-library.js +19 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-local.js +7 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-repeat-loop.js +2 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-s-four.d.ts +4 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-s-four.js +3 -5
- package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.js +2 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-s-three-dispatch.js +8 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.js +2 -0
- package/dataflow/internal/process/functions/call/common.d.ts +3 -1
- package/dataflow/internal/process/functions/call/common.js +22 -4
- package/dataflow/internal/process/functions/call/deferred.d.ts +6 -0
- package/dataflow/internal/process/functions/call/deferred.js +33 -12
- package/dataflow/internal/process/functions/call/known-call-handling.js +1 -1
- package/dataflow/internal/process/functions/call/named-call-handling.js +15 -0
- package/dataflow/internal/process/functions/call/quoted.js +137 -24
- package/dataflow/internal/process/process-symbol.js +6 -2
- package/documentation/data/faq/faqs.js +3 -3
- package/documentation/data/interface/doc-writing-code.js +1 -2
- package/documentation/data/server/doc-data-server-messages.js +7 -7
- package/documentation/doc-capabilities.js +80 -34
- package/documentation/doc-util/doc-query.d.ts +0 -3
- package/documentation/doc-util/doc-query.js +4 -3
- package/documentation/wiki-analyzer.js +1 -1
- package/documentation/wiki-cfg.js +5 -6
- package/documentation/wiki-core.js +8 -8
- package/documentation/wiki-dataflow-graph.js +10 -11
- package/documentation/wiki-interface.js +2 -2
- package/documentation/wiki-linting-and-testing.js +3 -3
- package/documentation/wiki-overview.js +6 -6
- package/documentation/wiki-query.js +9 -101
- package/documentation/wiki-signature-database.js +1 -1
- package/linter/linter-rules.d.ts +1 -1
- package/linter/rules/deprecated-functions.d.ts +1 -45
- package/linter/rules/deprecated-functions.js +24 -33
- package/package.json +1 -1
- package/project/flowr-analyzer.d.ts +2 -0
- package/project/flowr-analyzer.js +24 -1
- package/project/plugins/file-plugins/files/flowr-rda-file.d.ts +0 -2
- package/project/plugins/file-plugins/files/flowr-rda-file.js +10 -55
- package/project/plugins/file-plugins/flowr-analyzer-file-plugin.js +2 -1
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.js +6 -4
- package/project/plugins/project-discovery/flowr-analyzer-project-discovery-plugin.js +2 -2
- package/project/sigdb/build.js +4 -0
- package/project/sigdb/manifest.d.ts +2 -0
- package/project/sigdb/manifest.js +10 -1
- package/project/sigdb/reader.js +23 -61
- package/project/sigdb/sigdb-download.d.ts +29 -6
- package/project/sigdb/sigdb-download.js +212 -64
- package/queries/catalog/call-context-query/cascade-action.d.ts +3 -1
- package/queries/catalog/call-context-query/cascade-action.js +2 -0
- package/queries/catalog/call-context-query/identify-link-to-last-call-relation.js +3 -0
- package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-executor.js +2 -1
- package/queries/catalog/origin-query/origin-query-executor.d.ts +1 -1
- package/queries/catalog/origin-query/origin-query-executor.js +2 -2
- package/queries/catalog/origin-query/origin-query-format.d.ts +2 -2
- package/queries/catalog/origin-query/origin-query-format.js +1 -1
- package/queries/query.d.ts +1 -1
- package/r-bridge/data/data.d.ts +21 -14
- package/r-bridge/data/data.js +28 -20
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-executor.d.ts +2 -2
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-executor.js +11 -2
- package/util/files.d.ts +2 -0
- package/util/files.js +3 -1
- package/util/mermaid/mermaid.js +6 -2
- package/util/version.js +2 -2
|
@@ -7,53 +7,24 @@ const doc_files_1 = require("./doc-util/doc-files");
|
|
|
7
7
|
const doc_query_1 = require("./doc-util/doc-query");
|
|
8
8
|
const schema_1 = require("../util/schema");
|
|
9
9
|
const ansi_1 = require("../util/text/ansi");
|
|
10
|
-
const call_context_query_executor_1 = require("../queries/catalog/call-context-query/call-context-query-executor");
|
|
11
|
-
const compound_query_1 = require("../queries/virtual-query/compound-query");
|
|
12
10
|
const example_query_code_1 = require("./data/query/example-query-code");
|
|
13
11
|
const doc_structure_1 = require("./doc-util/doc-structure");
|
|
14
12
|
const doc_code_1 = require("./doc-util/doc-code");
|
|
15
|
-
const dataflow_query_executor_1 = require("../queries/catalog/dataflow-query/dataflow-query-executor");
|
|
16
|
-
const id_map_query_executor_1 = require("../queries/catalog/id-map-query/id-map-query-executor");
|
|
17
|
-
const normalized_ast_query_executor_1 = require("../queries/catalog/normalized-ast-query/normalized-ast-query-executor");
|
|
18
|
-
const cluster_query_executor_1 = require("../queries/catalog/cluster-query/cluster-query-executor");
|
|
19
|
-
const static_slice_query_executor_1 = require("../queries/catalog/static-slice-query/static-slice-query-executor");
|
|
20
|
-
const dependencies_query_executor_1 = require("../queries/catalog/dependencies-query/dependencies-query-executor");
|
|
21
13
|
const doc_cli_option_1 = require("./doc-util/doc-cli-option");
|
|
22
14
|
const doc_issue_1 = require("./doc-util/doc-issue");
|
|
23
|
-
const location_map_query_executor_1 = require("../queries/catalog/location-map-query/location-map-query-executor");
|
|
24
15
|
const identify_link_to_last_call_relation_1 = require("../queries/catalog/call-context-query/identify-link-to-last-call-relation");
|
|
25
|
-
const config_query_executor_1 = require("../queries/catalog/config-query/config-query-executor");
|
|
26
|
-
const search_query_executor_1 = require("../queries/catalog/search-query/search-query-executor");
|
|
27
16
|
const flowr_search_builder_1 = require("../search/flowr-search-builder");
|
|
28
17
|
const vertex_1 = require("../dataflow/graph/vertex");
|
|
29
|
-
const control_flow_query_executor_1 = require("../queries/catalog/control-flow-query/control-flow-query-executor");
|
|
30
18
|
const doc_cfg_1 = require("./doc-util/doc-cfg");
|
|
31
19
|
const doc_repl_1 = require("./doc-util/doc-repl");
|
|
32
|
-
const inspect_higher_order_query_executor_1 = require("../queries/catalog/inspect-higher-order-query/inspect-higher-order-query-executor");
|
|
33
20
|
const doc_escape_1 = require("./doc-util/doc-escape");
|
|
34
21
|
const config_1 = require("../config");
|
|
35
22
|
const doc_maker_1 = require("./wiki-mk/doc-maker");
|
|
36
|
-
const files_query_executor_1 = require("../queries/catalog/files-query/files-query-executor");
|
|
37
|
-
const call_graph_query_executor_1 = require("../queries/catalog/call-graph-query/call-graph-query-executor");
|
|
38
|
-
const inspect_recursion_query_executor_1 = require("../queries/catalog/inspect-recursion-query/inspect-recursion-query-executor");
|
|
39
|
-
const inspect_fn_props_query_executor_1 = require("../queries/catalog/inspect-fn-props-query/inspect-fn-props-query-executor");
|
|
40
|
-
const does_call_query_executor_1 = require("../queries/catalog/does-call-query/does-call-query-executor");
|
|
41
|
-
const inspect_exception_query_executor_1 = require("../queries/catalog/inspect-exceptions-query/inspect-exception-query-executor");
|
|
42
23
|
const slice_direction_1 = require("../util/slice-direction");
|
|
43
|
-
const provenance_query_executor_1 = require("../queries/catalog/provenance-query/provenance-query-executor");
|
|
44
|
-
const input_sources_query_executor_1 = require("../queries/catalog/input-sources-query/input-sources-query-executor");
|
|
45
|
-
const absint_query_executor_1 = require("../queries/catalog/absint-query/absint-query-executor");
|
|
46
|
-
const dice_query_executor_1 = require("../queries/catalog/dice-query/dice-query-executor");
|
|
47
|
-
const dataflow_lens_query_executor_1 = require("../queries/catalog/dataflow-lens-query/dataflow-lens-query-executor");
|
|
48
|
-
const signature_query_executor_1 = require("../queries/catalog/signature-query/signature-query-executor");
|
|
49
24
|
const doc_sigdb_1 = require("./doc-util/doc-sigdb");
|
|
50
|
-
const guess_dep_versions_query_executor_1 = require("../queries/catalog/guess-dep-versions-query/guess-dep-versions-query-executor");
|
|
51
|
-
const function_info_query_executor_1 = require("../queries/catalog/function-info-query/function-info-query-executor");
|
|
52
25
|
(0, doc_query_1.registerQueryDocumentation)('call-context', {
|
|
53
26
|
type: 'active',
|
|
54
27
|
shortDescription: 'Finds all calls in a set of files that matches specified criteria.',
|
|
55
|
-
functionName: call_context_query_executor_1.executeCallContextQueries.name,
|
|
56
|
-
functionFile: '../queries/catalog/call-context-query/call-context-query-executor.ts',
|
|
57
28
|
buildExplanation: async (shell, ctx) => {
|
|
58
29
|
return `
|
|
59
30
|
Call context queries can be used to identify calls to specific functions that match criteria of your interest.
|
|
@@ -86,7 +57,7 @@ ${await (0, doc_query_1.showQuery)(shell, example_query_code_1.exampleQueryCode,
|
|
|
86
57
|
{ type: 'call-context', callName: '^points$', kind: 'visualize', subkind: 'plot', linkTo: { type: 'link-to-last-call', callName: '^plot$' } }
|
|
87
58
|
], { showCode: false, ctx })}
|
|
88
59
|
|
|
89
|
-
|
|
60
|
+
All kinds and subkinds with the same name are grouped together.
|
|
90
61
|
Yet, re-stating common arguments and kinds may be cumbersome (although you can already use clever regex patterns).
|
|
91
62
|
See the ${(0, doc_query_1.linkToQueryOfName)('compound')} for a way to structure your queries more compactly if you think it gets too verbose.
|
|
92
63
|
|
|
@@ -108,8 +79,6 @@ my_test_function()
|
|
|
108
79
|
(0, doc_query_1.registerQueryDocumentation)('dataflow', {
|
|
109
80
|
type: 'active',
|
|
110
81
|
shortDescription: 'Returns the dataflow graph of the given code.',
|
|
111
|
-
functionName: dataflow_query_executor_1.executeDataflowQuery.name,
|
|
112
|
-
functionFile: '../queries/catalog/dataflow-query/dataflow-query-executor.ts',
|
|
113
82
|
buildExplanation: async (shell, ctx) => {
|
|
114
83
|
const exampleCode = 'x + 1';
|
|
115
84
|
return `
|
|
@@ -124,8 +93,6 @@ ${await (0, doc_query_1.showQuery)(shell, exampleCode, [{ type: 'dataflow' }], {
|
|
|
124
93
|
(0, doc_query_1.registerQueryDocumentation)('call-graph', {
|
|
125
94
|
type: 'active',
|
|
126
95
|
shortDescription: 'Returns the call graph of the given code.',
|
|
127
|
-
functionName: call_graph_query_executor_1.executeCallGraphQuery.name,
|
|
128
|
-
functionFile: '../queries/catalog/call-graph-query/call-graph-query-executor.ts',
|
|
129
96
|
buildExplanation: async (shell, ctx) => {
|
|
130
97
|
const exampleCode = 'x + 1';
|
|
131
98
|
return `
|
|
@@ -139,8 +106,6 @@ ${await (0, doc_query_1.showQuery)(shell, exampleCode, [{ type: 'call-graph' }],
|
|
|
139
106
|
(0, doc_query_1.registerQueryDocumentation)('does-call', {
|
|
140
107
|
type: 'active',
|
|
141
108
|
shortDescription: 'Checks whether a function calls another function matching given constraints.',
|
|
142
|
-
functionName: does_call_query_executor_1.executeDoesCallQuery.name,
|
|
143
|
-
functionFile: '../queries/catalog/does-call-query/does-call-query-executor.ts',
|
|
144
109
|
buildExplanation: async (shell, ctx) => {
|
|
145
110
|
const exampleCode = 'f <- function(x) { eval(x) };\nf("1 + 1")';
|
|
146
111
|
return `
|
|
@@ -156,8 +121,6 @@ ${await (0, doc_query_1.showQuery)(shell, exampleCode, [{ type: 'does-call', que
|
|
|
156
121
|
(0, doc_query_1.registerQueryDocumentation)('files', {
|
|
157
122
|
type: 'active',
|
|
158
123
|
shortDescription: 'Returns the files matching the given criteria.',
|
|
159
|
-
functionName: files_query_executor_1.executeFileQuery.name,
|
|
160
|
-
functionFile: '../queries/catalog/files-query/files-query-executor.ts',
|
|
161
124
|
buildExplanation: async (shell, ctx) => {
|
|
162
125
|
return `
|
|
163
126
|
This query returns the files that match the given criteria.
|
|
@@ -168,8 +131,6 @@ ${await (0, doc_query_1.showQuery)(shell, '', [{ type: 'files' }], { showCode: t
|
|
|
168
131
|
(0, doc_query_1.registerQueryDocumentation)('project', {
|
|
169
132
|
type: 'active',
|
|
170
133
|
shortDescription: 'Returns information about the analyzed project',
|
|
171
|
-
functionName: dataflow_query_executor_1.executeDataflowQuery.name,
|
|
172
|
-
functionFile: '../queries/catalog/project-query/project-query-executor.ts',
|
|
173
134
|
buildExplanation: async (shell, ctx) => {
|
|
174
135
|
const exampleCode = 'x + 1';
|
|
175
136
|
return `
|
|
@@ -183,8 +144,6 @@ ${await (0, doc_query_1.showQuery)(shell, exampleCode, [{ type: 'project' }], {
|
|
|
183
144
|
(0, doc_query_1.registerQueryDocumentation)('normalized-ast', {
|
|
184
145
|
type: 'active',
|
|
185
146
|
shortDescription: 'Returns the normalized AST of the given code.',
|
|
186
|
-
functionName: normalized_ast_query_executor_1.executeNormalizedAstQuery.name,
|
|
187
|
-
functionFile: '../queries/catalog/normalized-ast-query/normalized-ast-query-executor.ts',
|
|
188
147
|
buildExplanation: async (shell, ctx) => {
|
|
189
148
|
const exampleCode = 'x + 1';
|
|
190
149
|
return `
|
|
@@ -199,8 +158,6 @@ ${await (0, doc_query_1.showQuery)(shell, exampleCode, [{ type: 'normalized-ast'
|
|
|
199
158
|
(0, doc_query_1.registerQueryDocumentation)('dataflow-cluster', {
|
|
200
159
|
type: 'active',
|
|
201
160
|
shortDescription: 'Calculates and returns all the clusters present in the dataflow graph.',
|
|
202
|
-
functionName: cluster_query_executor_1.executeDataflowClusterQuery.name,
|
|
203
|
-
functionFile: '../queries/catalog/cluster-query/cluster-query-executor.ts',
|
|
204
161
|
buildExplanation: async (shell, ctx) => {
|
|
205
162
|
const exampleA = 'x <- 1; x';
|
|
206
163
|
const exampleB = 'x <- 1; y';
|
|
@@ -223,8 +180,6 @@ ${await (0, doc_query_1.showQuery)(shell, example_query_code_1.exampleQueryCode,
|
|
|
223
180
|
(0, doc_query_1.registerQueryDocumentation)('resolve-value', {
|
|
224
181
|
type: 'active',
|
|
225
182
|
shortDescription: 'Provides access to flowR\'s value tracking (which is configurable)',
|
|
226
|
-
functionName: search_query_executor_1.executeSearch.name,
|
|
227
|
-
functionFile: '../queries/catalog/resolve-value-query/resolve-value-query-executor.ts',
|
|
228
183
|
buildExplanation: async (shell, ctx) => {
|
|
229
184
|
const exampleCode = 'x <- 1\ny <-2\nprint(x)\nprint(y)';
|
|
230
185
|
const criteria = ['3@x', '4@y'];
|
|
@@ -240,8 +195,6 @@ ${await (0, doc_query_1.showQuery)(shell, exampleCode, [{ type: 'resolve-value',
|
|
|
240
195
|
(0, doc_query_1.registerQueryDocumentation)('inspect-higher-order', {
|
|
241
196
|
type: 'active',
|
|
242
197
|
shortDescription: 'Determine whether functions are higher-order functions',
|
|
243
|
-
functionName: inspect_higher_order_query_executor_1.executeHigherOrderQuery.name,
|
|
244
|
-
functionFile: '../queries/catalog/inspect-higher-order-query/inspect-higher-order-query-executor.ts',
|
|
245
198
|
buildExplanation: async (shell, ctx) => {
|
|
246
199
|
const exampleCode = 'f <- function() function(x) x; f()';
|
|
247
200
|
return `
|
|
@@ -260,8 +213,6 @@ ${await (0, doc_query_1.showQuery)(shell, exampleCode, [{ type: 'inspect-higher-
|
|
|
260
213
|
(0, doc_query_1.registerQueryDocumentation)('inspect-recursion', {
|
|
261
214
|
type: 'active',
|
|
262
215
|
shortDescription: 'Determine whether functions are recursive',
|
|
263
|
-
functionName: inspect_recursion_query_executor_1.executeRecursionQuery.name,
|
|
264
|
-
functionFile: '../queries/catalog/inspect-recursion-query/inspect-recursion-query-executor.ts',
|
|
265
216
|
buildExplanation: async (shell, ctx) => {
|
|
266
217
|
const exampleCode = 'fact <- function(n) { if(n <= 1) 1 else n * fact(n - 1) }';
|
|
267
218
|
return `
|
|
@@ -279,8 +230,6 @@ ${await (0, doc_query_1.showQuery)(shell, exampleCode, [{ type: 'inspect-recursi
|
|
|
279
230
|
(0, doc_query_1.registerQueryDocumentation)('inspect-fn-props', {
|
|
280
231
|
type: 'active',
|
|
281
232
|
shortDescription: 'Determine what functions and their formals do',
|
|
282
|
-
functionName: inspect_fn_props_query_executor_1.executeFnPropsQuery.name,
|
|
283
|
-
functionFile: '../queries/catalog/inspect-fn-props-query/inspect-fn-props-query-executor.ts',
|
|
284
233
|
buildExplanation: async (shell, ctx) => {
|
|
285
234
|
const exampleCode = 'f <- function(x, xs, FUN, opt) { if(missing(opt)) print(length(xs)); lapply(xs, FUN); x }';
|
|
286
235
|
return `
|
|
@@ -318,8 +267,6 @@ ${await (0, doc_query_1.showQuery)(shell, exampleCode, [{ type: 'inspect-fn-prop
|
|
|
318
267
|
(0, doc_query_1.registerQueryDocumentation)('inspect-exception', {
|
|
319
268
|
type: 'active',
|
|
320
269
|
shortDescription: 'Determine whether functions throw exceptions (known to flowR)',
|
|
321
|
-
functionName: inspect_exception_query_executor_1.executeExceptionQuery.name,
|
|
322
|
-
functionFile: '../queries/catalog/inspect-exceptions-query/inspect-exception-query-executor.ts',
|
|
323
270
|
buildExplanation: async (shell, ctx) => {
|
|
324
271
|
const exampleCode = `mayFail <- function(x) {
|
|
325
272
|
if(x < 0) stop("Negative value!")
|
|
@@ -344,8 +291,6 @@ ${await (0, doc_query_1.showQuery)(shell, exampleCode, [{ type: 'inspect-excepti
|
|
|
344
291
|
(0, doc_query_1.registerQueryDocumentation)('origin', {
|
|
345
292
|
type: 'active',
|
|
346
293
|
shortDescription: 'Retrieve the origin of a variable, function call, ...',
|
|
347
|
-
functionName: search_query_executor_1.executeSearch.name,
|
|
348
|
-
functionFile: '../queries/catalog/origin-query/origin-query-executor.ts',
|
|
349
294
|
buildExplanation: async (shell, ctx) => {
|
|
350
295
|
const exampleCode = 'x <- 1\nprint(x)';
|
|
351
296
|
const criterion = '2@x';
|
|
@@ -361,8 +306,6 @@ ${await (0, doc_query_1.showQuery)(shell, exampleCode, [{ type: 'origin', criter
|
|
|
361
306
|
(0, doc_query_1.registerQueryDocumentation)('search', {
|
|
362
307
|
type: 'active',
|
|
363
308
|
shortDescription: 'Provides access to flowR\'s search API',
|
|
364
|
-
functionName: search_query_executor_1.executeSearch.name,
|
|
365
|
-
functionFile: '../queries/catalog/search-query/search-query-executor.ts',
|
|
366
309
|
buildExplanation: async (shell, ctx) => {
|
|
367
310
|
const exampleCode = 'x + 1';
|
|
368
311
|
return `
|
|
@@ -376,8 +319,6 @@ ${await (0, doc_query_1.showQuery)(shell, exampleCode, [{ type: 'search', search
|
|
|
376
319
|
(0, doc_query_1.registerQueryDocumentation)('happens-before', {
|
|
377
320
|
type: 'active',
|
|
378
321
|
shortDescription: 'Check whether one normalized AST node happens before another in the CFG.',
|
|
379
|
-
functionName: search_query_executor_1.executeSearch.name,
|
|
380
|
-
functionFile: '../queries/catalog/happens-before-query/happens-before-query-executor.ts',
|
|
381
322
|
buildExplanation: async (shell, ctx) => {
|
|
382
323
|
const exampleCode = 'x <- 1\ny <- 2';
|
|
383
324
|
return `
|
|
@@ -395,8 +336,6 @@ ${await (0, doc_query_1.showQuery)(shell, exampleCode, [{ type: 'happens-before'
|
|
|
395
336
|
(0, doc_query_1.registerQueryDocumentation)('id-map', {
|
|
396
337
|
type: 'active',
|
|
397
338
|
shortDescription: 'Returns the id-map of the normalized AST of the given code.',
|
|
398
|
-
functionName: id_map_query_executor_1.executeIdMapQuery.name,
|
|
399
|
-
functionFile: '../queries/catalog/id-map-query/id-map-query-executor.ts',
|
|
400
339
|
buildExplanation: async (shell, ctx) => {
|
|
401
340
|
const exampleCode = 'x + 1';
|
|
402
341
|
return `
|
|
@@ -410,8 +349,6 @@ ${await (0, doc_query_1.showQuery)(shell, exampleCode, [{ type: 'id-map' }], { s
|
|
|
410
349
|
(0, doc_query_1.registerQueryDocumentation)('config', {
|
|
411
350
|
type: 'active',
|
|
412
351
|
shortDescription: 'Returns the current configuration of flowR.',
|
|
413
|
-
functionName: config_query_executor_1.executeConfigQuery.name,
|
|
414
|
-
functionFile: '../queries/catalog/config-query/config-query-format.ts',
|
|
415
352
|
buildExplanation: async (shell, ctx) => {
|
|
416
353
|
return `
|
|
417
354
|
This query provides access to the current configuration of the flowR instance. See the ${ctx.linkPage('wiki/Interface', 'Interface')} wiki page for more information on what the configuration represents.
|
|
@@ -438,8 +375,6 @@ enables quick statistics after each REPL command. Likewise, ${ctx.linkConfig('re
|
|
|
438
375
|
(0, doc_query_1.registerQueryDocumentation)('absint', {
|
|
439
376
|
type: 'active',
|
|
440
377
|
shortDescription: 'Returns the abstract values inferred for every expression or at specific locations.',
|
|
441
|
-
functionName: absint_query_executor_1.executeAbsintQuery.name,
|
|
442
|
-
functionFile: '../queries/catalog/absint-query/absint-query-format.ts',
|
|
443
378
|
buildExplanation: async (shell, ctx) => {
|
|
444
379
|
const criteria = ['1@df', '1@data.frame'];
|
|
445
380
|
const inference = 'df-shape';
|
|
@@ -457,8 +392,6 @@ ${await (0, doc_query_1.showQuery)(shell, exampleCode, [{ type: 'absint', infere
|
|
|
457
392
|
name: 'Compound Query',
|
|
458
393
|
type: 'virtual',
|
|
459
394
|
shortDescription: 'Combines multiple queries of the same type into one, specifying common arguments.',
|
|
460
|
-
functionName: compound_query_1.executeCompoundQueries.name,
|
|
461
|
-
functionFile: '../queries/virtual-query/compound-query.ts',
|
|
462
395
|
buildExplanation: async (shell, ctx) => {
|
|
463
396
|
return `
|
|
464
397
|
A compound query comes in use, whenever we want to state multiple queries of the same type with a set of common arguments.
|
|
@@ -473,7 +406,7 @@ assigned to the kind \`visualize\` and the subkind \`text\` (using the example c
|
|
|
473
406
|
|
|
474
407
|
${await (0, doc_query_1.showQuery)(shell, example_query_code_1.exampleQueryCode, [{ type: 'compound', query: 'call-context', commonArguments: { kind: 'visualize', subkind: 'text' }, arguments: [{ callName: '^mean$' }, { callName: '^print$' }] }], { showCode: false, ctx })}
|
|
475
408
|
|
|
476
|
-
|
|
409
|
+
In this specific scenario, the following query would be equivalent:
|
|
477
410
|
|
|
478
411
|
${await (0, doc_query_1.showQuery)(shell, example_query_code_1.exampleQueryCode, [{ type: 'call-context', callName: '^(mean|print)$', kind: 'visualize', subkind: 'text' }], { showCode: false, collapseResult: true, ctx })}
|
|
479
412
|
|
|
@@ -492,8 +425,6 @@ Now, the results no longer contain calls to \`plot\` that are not defined locall
|
|
|
492
425
|
(0, doc_query_1.registerQueryDocumentation)('static-slice', {
|
|
493
426
|
type: 'active',
|
|
494
427
|
shortDescription: 'Slice the dataflow graph reducing the code to just the parts relevant for the given criteria (backward and forward).',
|
|
495
|
-
functionName: static_slice_query_executor_1.executeStaticSliceQuery.name,
|
|
496
|
-
functionFile: '../queries/catalog/static-slice-query/static-slice-query-executor.ts',
|
|
497
428
|
buildExplanation: async (shell, ctx) => {
|
|
498
429
|
const exampleCode = 'x <- 1\ny <- 2\nz <- 3\nx';
|
|
499
430
|
const criteria = ['3@z', '4@x'];
|
|
@@ -540,8 +471,6 @@ This query replaces the old ${ctx.linkPage('wiki/Interface', '`request-slice`',
|
|
|
540
471
|
(0, doc_query_1.registerQueryDocumentation)('provenance', {
|
|
541
472
|
type: 'active',
|
|
542
473
|
shortDescription: 'Calculate the provenance of a given variable, optionally restricted to its enveloping fdef',
|
|
543
|
-
functionName: provenance_query_executor_1.executeProvenanceQuery.name,
|
|
544
|
-
functionFile: '../queries/catalog/provenance-query/provenance-query-executor.ts',
|
|
545
474
|
buildExplanation: async (shell, ctx) => {
|
|
546
475
|
const exampleCode = 'x <- 1\ny <- 2\nz <- 3\nx';
|
|
547
476
|
const criterion = '4@x';
|
|
@@ -560,8 +489,6 @@ ${await (0, doc_query_1.showQuery)(shell, exampleCode, [{ type: 'provenance', cr
|
|
|
560
489
|
(0, doc_query_1.registerQueryDocumentation)('input-sources', {
|
|
561
490
|
type: 'active',
|
|
562
491
|
shortDescription: 'Classify the input sources of function calls',
|
|
563
|
-
functionName: input_sources_query_executor_1.executeInputSourcesQuery.name,
|
|
564
|
-
functionFile: '../queries/catalog/input-sources-query/input-sources-query-executor.ts',
|
|
565
492
|
buildExplanation: async (shell, ctx) => {
|
|
566
493
|
const exampleCode = `
|
|
567
494
|
f <- function(x) {
|
|
@@ -617,8 +544,6 @@ ${(0, doc_code_1.codeBlock)('json', JSON.stringify({ inputSources: {
|
|
|
617
544
|
(0, doc_query_1.registerQueryDocumentation)('dependencies', {
|
|
618
545
|
type: 'active',
|
|
619
546
|
shortDescription: 'Returns all direct dependencies (in- and outputs) of a given R script',
|
|
620
|
-
functionName: dependencies_query_executor_1.executeDependenciesQuery.name,
|
|
621
|
-
functionFile: '../queries/catalog/dependencies-query/dependencies-query-executor.ts',
|
|
622
547
|
buildExplanation: async (shell, ctx) => {
|
|
623
548
|
const exampleCode = 'library(x)';
|
|
624
549
|
const longerCode = `
|
|
@@ -638,10 +563,10 @@ This query extracts all dependencies from an R script, using a combination of a
|
|
|
638
563
|
and more advanced tracking in the ${ctx.linkPage('wiki/Dataflow Graph', 'Dataflow Graph')}.
|
|
639
564
|
Loaded libraries are resolved against the ${ctx.linkPage('wiki/Signature Database', 'signature database')}.
|
|
640
565
|
|
|
641
|
-
|
|
566
|
+
For a script reading \`${exampleCode}\`, the following query returns the loaded library:
|
|
642
567
|
${await (0, doc_query_1.showQuery)(shell, exampleCode, [{ type: 'dependencies' }], { showCode: false, collapseQuery: true, ctx })}
|
|
643
568
|
|
|
644
|
-
|
|
569
|
+
The query also handles more complicated scripts and offers information on the loaded _libraries_, _sourced_ files, data which is _read_ and data which is _written_.
|
|
645
570
|
For example, consider the following script:
|
|
646
571
|
${(0, doc_code_1.codeBlock)('r', longerCode)}
|
|
647
572
|
The following query returns the dependencies of the script.
|
|
@@ -673,14 +598,12 @@ suggest a \`library\` call for.
|
|
|
673
598
|
(0, doc_query_1.registerQueryDocumentation)('linter', {
|
|
674
599
|
type: 'active',
|
|
675
600
|
shortDescription: 'Lints a given R script for common issues.',
|
|
676
|
-
functionName: dependencies_query_executor_1.executeDependenciesQuery.name,
|
|
677
|
-
functionFile: '../queries/catalog/linter-query/linter-query-executor.ts',
|
|
678
601
|
buildExplanation: async (shell, ctx) => {
|
|
679
602
|
const exampleCode = 'read.csv("i_do_not_exist.csv")';
|
|
680
603
|
return `
|
|
681
604
|
This query lints a given R script for common issues, such as missing files, unused variables, and more.
|
|
682
605
|
|
|
683
|
-
|
|
606
|
+
For a script reading \`${exampleCode}\`, the following query returns all smells detected:
|
|
684
607
|
${await (0, doc_query_1.showQuery)(shell, exampleCode, [{ type: 'linter' }], { showCode: false, collapseQuery: true, ctx })}
|
|
685
608
|
|
|
686
609
|
You can also configure which rules to apply and what settings to use for these rules:
|
|
@@ -693,14 +616,12 @@ We welcome any feedback and suggestions for new rules on this (consider opening
|
|
|
693
616
|
(0, doc_query_1.registerQueryDocumentation)('control-flow', {
|
|
694
617
|
type: 'active',
|
|
695
618
|
shortDescription: 'Provides the control-flow of the program.',
|
|
696
|
-
functionName: control_flow_query_executor_1.executeControlFlowQuery.name,
|
|
697
|
-
functionFile: '../queries/catalog/control-flow-query/control-flow-query-executor.ts',
|
|
698
619
|
buildExplanation: async (shell, ctx) => {
|
|
699
620
|
const exampleCode = 'if(TRUE) 1 else 2';
|
|
700
621
|
return `
|
|
701
622
|
This control-flow query provides you access to the control flow graph.
|
|
702
623
|
|
|
703
|
-
|
|
624
|
+
For a script reading \`${exampleCode}\`, the following query returns the CFG:
|
|
704
625
|
${await (0, doc_query_1.showQuery)(shell, exampleCode, [{ type: 'control-flow' }], { showCode: false, collapseQuery: true, collapseResult: true, ctx })}
|
|
705
626
|
|
|
706
627
|
You can also overwrite the simplification passes to tune the perspective. for example, if you want to have basic blocks:
|
|
@@ -732,8 +653,6 @@ ${await (0, doc_cfg_1.printCfgCode)(shell, exampleCode, { showCode: false, prefi
|
|
|
732
653
|
(0, doc_query_1.registerQueryDocumentation)('location-map', {
|
|
733
654
|
type: 'active',
|
|
734
655
|
shortDescription: 'Returns a simple mapping of ids to their location in the source file',
|
|
735
|
-
functionName: location_map_query_executor_1.executeLocationMapQuery.name,
|
|
736
|
-
functionFile: '../queries/catalog/location-map-query/location-map-query-executor.ts',
|
|
737
656
|
buildExplanation: async (shell, ctx) => {
|
|
738
657
|
const exampleCode = 'x + 1\nx * 2';
|
|
739
658
|
const criteria = ['1@x', '2@x'];
|
|
@@ -761,8 +680,6 @@ All locations are given as a ${ctx.link('SourceRange')} paired with the file id
|
|
|
761
680
|
(0, doc_query_1.registerQueryDocumentation)('dice', {
|
|
762
681
|
type: 'active',
|
|
763
682
|
shortDescription: 'Reduces the code to the parts that carry information from a given start point to a given end point.',
|
|
764
|
-
functionName: dice_query_executor_1.executeDiceQuery.name,
|
|
765
|
-
functionFile: '../queries/catalog/dice-query/dice-query-executor.ts',
|
|
766
683
|
buildExplanation: async (shell, ctx) => {
|
|
767
684
|
const exampleCode = 'x <- 1\ny <- 2\nz <- x + y\nw <- z * 2\nprint(z)';
|
|
768
685
|
return `
|
|
@@ -793,8 +710,6 @@ ${(0, doc_structure_1.details)('Multiple Criteria per Side', 'Each side accepts
|
|
|
793
710
|
(0, doc_query_1.registerQueryDocumentation)('dataflow-lens', {
|
|
794
711
|
type: 'active',
|
|
795
712
|
shortDescription: 'Returns a simplified view on the dataflow graph, reduced to definitions, uses, and calls.',
|
|
796
|
-
functionName: dataflow_lens_query_executor_1.executeDataflowLensQuery.name,
|
|
797
|
-
functionFile: '../queries/catalog/dataflow-lens-query/dataflow-lens-query-executor.ts',
|
|
798
713
|
buildExplanation: async (shell, ctx) => {
|
|
799
714
|
const exampleCode = 'f <- function(a) a + 1\nx <- 1\ny <- f(x)\nprint(y)';
|
|
800
715
|
return `
|
|
@@ -822,8 +737,6 @@ Use the ${(0, doc_query_1.linkToQueryOfName)('dataflow')} if you need the comple
|
|
|
822
737
|
(0, doc_query_1.registerQueryDocumentation)('signature', {
|
|
823
738
|
type: 'active',
|
|
824
739
|
shortDescription: 'Inspects the signature database: packages, function signatures, source and documentation links.',
|
|
825
|
-
functionName: signature_query_executor_1.executeSignatureQuery.name,
|
|
826
|
-
functionFile: '../queries/catalog/signature-query/signature-query-executor.ts',
|
|
827
740
|
buildExplanation: async (shell, ctx) => {
|
|
828
741
|
const exampleCode = 'library(dplyr)\nlead(1:10, n = 1)';
|
|
829
742
|
return `
|
|
@@ -874,8 +787,6 @@ function guessDepVersionsExampleOptions(ctx) {
|
|
|
874
787
|
(0, doc_query_1.registerQueryDocumentation)('guess-dep-versions', {
|
|
875
788
|
type: 'active',
|
|
876
789
|
shortDescription: 'Guesses the version range each dependency must have, from declared constraints and actual code usage.',
|
|
877
|
-
functionName: guess_dep_versions_query_executor_1.executeGuessDepVersionsQuery.name,
|
|
878
|
-
functionFile: '../queries/catalog/guess-dep-versions-query/guess-dep-versions-query-executor.ts',
|
|
879
790
|
buildExplanation: async (shell, ctx) => {
|
|
880
791
|
const exampleCode = 'library(dplyr)\nmutate(mtcars, across(everything(), round))';
|
|
881
792
|
return `
|
|
@@ -935,8 +846,6 @@ See the ${(0, doc_query_1.linkToQueryOfName)('signature')} to inspect the signat
|
|
|
935
846
|
(0, doc_query_1.registerQueryDocumentation)('function-info', {
|
|
936
847
|
type: 'active',
|
|
937
848
|
shortDescription: 'Reports where a function name comes from: which packages export it, their signature, and whether flowR itself has a built-in definition for it.',
|
|
938
|
-
functionName: function_info_query_executor_1.executeFunctionInfoQuery.name,
|
|
939
|
-
functionFile: '../queries/catalog/function-info-query/function-info-query-executor.ts',
|
|
940
849
|
buildExplanation: async (shell, ctx) => {
|
|
941
850
|
return `
|
|
942
851
|
This query answers "where does this function come from?" for a bare name, combining two sources flowR otherwise
|
|
@@ -1003,8 +912,7 @@ In general, we separate two types of queries:
|
|
|
1003
912
|
1. **Active Queries**: Are exactly what you would expect from a query (e.g., the ${(0, doc_query_1.linkToQueryOfName)('call-context')}). They fetch information from the dataflow graph.
|
|
1004
913
|
2. **Virtual Queries**: Are used to structure your queries (e.g., the ${(0, doc_query_1.linkToQueryOfName)('compound')}).
|
|
1005
914
|
|
|
1006
|
-
We
|
|
1007
|
-
For now, we support the following **active** queries (which we will refer to simply as a \`query\`):
|
|
915
|
+
We support the following **active** queries (which we refer to as a \`query\`):
|
|
1008
916
|
|
|
1009
917
|
${(0, doc_query_1.tocForQueryType)('active')}
|
|
1010
918
|
|
|
@@ -1017,7 +925,7 @@ ${(0, doc_query_1.tocForQueryType)('virtual')}
|
|
|
1017
925
|
|
|
1018
926
|
<summary>Detailed Query Format (Automatically Generated)</summary>
|
|
1019
927
|
|
|
1020
|
-
|
|
928
|
+
The schema of the query format:
|
|
1021
929
|
|
|
1022
930
|
${(0, schema_1.describeSchema)((0, query_1.QueriesSchema)(), ansi_1.markdownFormatter)}
|
|
1023
931
|
|
|
@@ -1025,7 +933,7 @@ ${(0, schema_1.describeSchema)((0, query_1.QueriesSchema)(), ansi_1.markdownForm
|
|
|
1025
933
|
|
|
1026
934
|
### Why Queries?
|
|
1027
935
|
|
|
1028
|
-
First, consider that you have a file like the following (
|
|
936
|
+
First, consider that you have a file like the following (a simple, artificial example):
|
|
1029
937
|
|
|
1030
938
|
\`\`\`r
|
|
1031
939
|
${example_query_code_1.exampleQueryCode}
|
|
@@ -258,7 +258,7 @@ what lets a package function answer the same questions a built-in does.
|
|
|
258
258
|
|
|
259
259
|
Per version the source also answers declared dependencies (${ctx.link('ResolvedDependency')}), release dates, the plain export view (${ctx.link('LibraryExports')}), the versions it carries (${ctx.link('AvailableVersion')}), and its class relations (${ctx.link('SigClassInfo')}, via ${ctx.linkM(reader_1.SigDatabase, 'classes')}).
|
|
260
260
|
|
|
261
|
-
A class record states what a declaration does: its direct superclasses, its slots with the types they were declared with, whether it is virtual, and whether it is a \`setClassUnion\` (whose supers are the members it unites). ${ctx.link('SigClassInfo::package')} names the package *defining* a class the record only relates to, which is what tells a class the package owns from one it inherits -- something the flat name list of ${ctx.link('LibraryExports::s4Classes')} has nowhere to hang. The same shape carries Reference classes, S7 and R6, since all four declare a name, a parent and a set of members. On the analysis side ${ctx.link('
|
|
261
|
+
A class record states what a declaration does: its direct superclasses, its slots with the types they were declared with, whether it is virtual, and whether it is a \`setClassUnion\` (whose supers are the members it unites). ${ctx.link('SigClassInfo::package')} names the package *defining* a class the record only relates to, which is what tells a class the package owns from one it inherits -- something the flat name list of ${ctx.link('LibraryExports::s4Classes')} has nowhere to hang. The same shape carries Reference classes, S7 and R6, since all four declare a name, a parent and a set of members. On the analysis side ${ctx.link('declaredClassesImpl')} reads these off \`setClass\`/\`setClassUnion\`/\`setIs\`/\`setRefClass\`/\`new_class\`/\`R6Class\` calls and ${ctx.link('toSigClassesImpl')} hands them over in this form.
|
|
262
262
|
|
|
263
263
|
Beyond the flags above, ${ctx.link('DecodedFunction::props')} also carry ${ctx.linkE('FnProp', 'NoDoc')} (a documented package has no help page for this name), ${ctx.linkE('FnProp', 'S3Method')} (a registered S3 method, from the package NAMESPACE or base R's method table), and ${ctx.linkE('FnProp', 'S3Owner')} (an exported constructor for an S3 class this package OWNS: it also registers at least one S3 method for that class). The owned classes of a version are ${ctx.link('LibraryExports::s3Classes')}, and ${ctx.linkM(reader_1.SigDatabase, 'classOwner')} answers, for a class name, which package owns it (backed by a reverse index built once). This lets ${ctx.linkPage('wiki/Query API', 'version guessing')} mark a package used when the analyzed project's own NAMESPACE registers an S3 method for a class it owns, even with no direct call, e.g. tseries's \`S3method("as.irts","zoo")\` marks \`zoo\` used.
|
|
264
264
|
|
package/linter/linter-rules.d.ts
CHANGED
|
@@ -24,7 +24,7 @@ export declare const LintingRules: {
|
|
|
24
24
|
readonly description: "Marks deprecated functions and deprecated arguments of still-current functions, offering the replacement as a quick fix where one is known. A call to a bare name whose package the code never attaches is reported as uncertain, as any function of that name would answer to it.";
|
|
25
25
|
readonly defaultConfig: (ctx: import("../project/context/flowr-analyzer-context").ReadOnlyFlowrAnalyzerContext) => {
|
|
26
26
|
always: import("..").Identifier[];
|
|
27
|
-
conditionally: Record<import("../dataflow/environments/identifier").BrandedIdentifier, import("
|
|
27
|
+
conditionally: Record<import("../dataflow/environments/identifier").BrandedIdentifier, import("../dataflow/environments/deprecation-info").DeprecatedFunctionInformation>;
|
|
28
28
|
};
|
|
29
29
|
};
|
|
30
30
|
};
|
|
@@ -8,43 +8,7 @@ import { LintingRuleTag } from '../linter-tags';
|
|
|
8
8
|
import type { ParentInformation } from '../../r-bridge/lang-4.x/ast/model/processing/decorate';
|
|
9
9
|
import type { ReadonlyFlowrAnalysisProvider } from '../../project/flowr-analyzer';
|
|
10
10
|
import type { KnownParser } from '../../r-bridge/parser';
|
|
11
|
-
|
|
12
|
-
* Information about an argument of a function that should be flagged as deprecated if it is called with this argument
|
|
13
|
-
*
|
|
14
|
-
* Used in {@link DeprecatedFunctionInformation} to mark a function argument as deprecated under certain conditions
|
|
15
|
-
*/
|
|
16
|
-
export interface DeprecatedArgumentInformation {
|
|
17
|
-
/** Index of the argument */
|
|
18
|
-
readonly argIdx?: number;
|
|
19
|
-
/** Name of the argument */
|
|
20
|
-
readonly argName?: string;
|
|
21
|
-
/** Only mark this argument as deprecated, if a specific value was provided */
|
|
22
|
-
readonly ifValue?: RegExp | string;
|
|
23
|
-
/** Suggested replacement for this argument */
|
|
24
|
-
readonly replacedBy?: string;
|
|
25
|
-
/** The version since this argument is deprecated */
|
|
26
|
-
readonly sinceVersion?: Range;
|
|
27
|
-
/** The state of deprecation {@link DeprecationState}, i.e. is the argument completely removed, or are there better alternatives */
|
|
28
|
-
readonly state?: DeprecationState;
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Information about a deprecated function
|
|
32
|
-
*
|
|
33
|
-
* Used in {@link DeprecatedFunctionsConfig.conditionally} to mark a function as deprecated under certain conditions
|
|
34
|
-
*/
|
|
35
|
-
export interface DeprecatedFunctionInformation {
|
|
36
|
-
/**
|
|
37
|
-
* Mark specific arguments as deprecated
|
|
38
|
-
* If only whenArgs is provided, and not sinceVersion, the function is only marked as deprecated, if the argument is provided.
|
|
39
|
-
*/
|
|
40
|
-
readonly whenArgs?: readonly DeprecatedArgumentInformation[];
|
|
41
|
-
/** Suggested replacement for this function */
|
|
42
|
-
readonly replacedBy?: string;
|
|
43
|
-
/** The version since this function is deprecated, if version is provided the entire function will be marked as deprecated, if the version range matches */
|
|
44
|
-
readonly sinceVersion?: Range;
|
|
45
|
-
/** Lifecycle State {@link DeprecationState}, i.e. is the function completely removed, or are there better alternatives */
|
|
46
|
-
readonly state?: DeprecationState;
|
|
47
|
-
}
|
|
11
|
+
import type { DeprecatedFunctionInformation, DeprecationState } from '../../dataflow/environments/deprecation-info';
|
|
48
12
|
/**
|
|
49
13
|
* Result of the {@link DEPRECATED_FUNCTIONS} linting rule
|
|
50
14
|
* See also the specializations {@link DeprecatedFunctionResult} and {@link DeprecatedArgumentResult}
|
|
@@ -76,14 +40,6 @@ export interface DeprecatedArgumentResult extends DeprecatedFunctionResultBase {
|
|
|
76
40
|
readonly arg: string | number;
|
|
77
41
|
}
|
|
78
42
|
export type DeprecatedFunctionRuleResult = DeprecatedFunctionResult | DeprecatedArgumentResult;
|
|
79
|
-
export declare enum DeprecationState {
|
|
80
|
-
/** A better alternative is available, but the function is kept (softer alternative to deprecated) {@link https://lifecycle.r-lib.org/articles/stages.html#superseded} */
|
|
81
|
-
Superseded = "superseded",
|
|
82
|
-
/** A better alternative is available, and the function is marked for removal {@link https://lifecycle.r-lib.org/articles/stages.html#deprecated} */
|
|
83
|
-
Deprecated = "deprecated",
|
|
84
|
-
/** No longer works and is removed and replaced by another function {@link https://www.rdocumentation.org/packages/base/versions/3.6.2/topics/Defunct} */
|
|
85
|
-
Defunct = "defunct"
|
|
86
|
-
}
|
|
87
43
|
export interface DeprecatedFunctionsConfig extends MergeableRecord {
|
|
88
44
|
/** Functions to always mark as deprecated */
|
|
89
45
|
always: readonly Identifier[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DEPRECATED_FUNCTIONS =
|
|
3
|
+
exports.DEPRECATED_FUNCTIONS = void 0;
|
|
4
4
|
const function_semantics_1 = require("../../dataflow/fn/function-semantics");
|
|
5
5
|
const identifier_1 = require("../../dataflow/environments/identifier");
|
|
6
6
|
const graph_1 = require("../../dataflow/graph/graph");
|
|
@@ -19,30 +19,6 @@ const function_finder_util_1 = require("./function-finder-util");
|
|
|
19
19
|
const logic_1 = require("../../util/logic");
|
|
20
20
|
const built_in_props_1 = require("../../dataflow/environments/built-in-props");
|
|
21
21
|
const dependencies_query_format_1 = require("../../queries/catalog/dependencies-query/dependencies-query-format");
|
|
22
|
-
var DeprecationState;
|
|
23
|
-
(function (DeprecationState) {
|
|
24
|
-
/** A better alternative is available, but the function is kept (softer alternative to deprecated) {@link https://lifecycle.r-lib.org/articles/stages.html#superseded} */
|
|
25
|
-
DeprecationState["Superseded"] = "superseded";
|
|
26
|
-
/** A better alternative is available, and the function is marked for removal {@link https://lifecycle.r-lib.org/articles/stages.html#deprecated} */
|
|
27
|
-
DeprecationState["Deprecated"] = "deprecated";
|
|
28
|
-
/** No longer works and is removed and replaced by another function {@link https://www.rdocumentation.org/packages/base/versions/3.6.2/topics/Defunct} */
|
|
29
|
-
DeprecationState["Defunct"] = "defunct";
|
|
30
|
-
})(DeprecationState || (exports.DeprecationState = DeprecationState = {}));
|
|
31
|
-
/**
|
|
32
|
-
* `size` names the stroke width of every line-based geom until ggplot2 4.0.0 renamed it: it gained
|
|
33
|
-
* `linewidth` beside it in 3.4.0, and 4.0.0 drops `size`.
|
|
34
|
-
*/
|
|
35
|
-
const GgplotLinewidth = {
|
|
36
|
-
whenArgs: [{ argName: 'size', state: DeprecationState.Deprecated, replacedBy: 'linewidth', sinceVersion: r_version_1.RRange.parse('>= 3.4.0') }]
|
|
37
|
-
};
|
|
38
|
-
const ConditionallyDeprecated = {
|
|
39
|
-
/* https://tidyverse.org/blog/2025/09/ggplot2-4-0-0/#violin--quantiles */
|
|
40
|
-
/* the quantiles moved to the stat, and the geom only kept arguments styling them, so neither is a rename of
|
|
41
|
-
`draw_quantiles = 0.5`: the value is a quantile, not a linetype, and `quantiles` is no formal of the geom */
|
|
42
|
-
'ggplot2::geom_violin': { whenArgs: [{ argName: 'draw_quantiles', state: DeprecationState.Deprecated, replacedBy: 'stat_ydensity(quantiles)', sinceVersion: r_version_1.RRange.parse('>= 4.0.0') }] },
|
|
43
|
-
'ggplot2::element_line': GgplotLinewidth,
|
|
44
|
-
'ggplot2::element_rect': GgplotLinewidth
|
|
45
|
-
};
|
|
46
22
|
/** The entries by bare name, as a call names its package only when written `pkg::fn`. */
|
|
47
23
|
function indexConditionals(conditionally) {
|
|
48
24
|
const index = new Map();
|
|
@@ -102,11 +78,24 @@ function certaintyOf(target, owners, attached) {
|
|
|
102
78
|
const sure = owners.some(owner => owner === undefined || owner === namespace || attached === undefined || attached.has(owner));
|
|
103
79
|
return sure ? linter_format_1.LintingResultCertainty.Certain : linter_format_1.LintingResultCertainty.Uncertain;
|
|
104
80
|
}
|
|
105
|
-
function
|
|
81
|
+
function alwayDeprecatedFromBuiltinConfig(definitions) {
|
|
106
82
|
return definitions.filter(def => def.type === 'function'
|
|
107
83
|
&& function_semantics_1.FunctionSemantics.call.props.hasAny(def.config, built_in_props_1.SemanticCallTag.Deprecated))
|
|
108
84
|
.flatMap(def => def.names);
|
|
109
85
|
}
|
|
86
|
+
function conditionalyDeprecatedFromBuiltinConfig(definitions) {
|
|
87
|
+
const result = {};
|
|
88
|
+
for (const def of definitions.filter(def => def.type === 'function')) {
|
|
89
|
+
const info = def.config?.deprInfo;
|
|
90
|
+
if (info === undefined) {
|
|
91
|
+
continue;
|
|
92
|
+
}
|
|
93
|
+
for (const name of def.names) {
|
|
94
|
+
result[identifier_1.Identifier.toString(name)] = info;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
return result;
|
|
98
|
+
}
|
|
110
99
|
exports.DEPRECATED_FUNCTIONS = {
|
|
111
100
|
// unlike functionFinderUtil.createSearch(config.fns), this does not pre-filter to the hardcoded list: the
|
|
112
101
|
// sigdb-driven pass below needs every resolved call, so the `fns` filtering happens in processSearchResult instead
|
|
@@ -219,8 +208,8 @@ exports.DEPRECATED_FUNCTIONS = {
|
|
|
219
208
|
certainty: linter_format_1.LintingRuleCertainty.BestEffort,
|
|
220
209
|
description: 'Marks deprecated functions and deprecated arguments of still-current functions, offering the replacement as a quick fix where one is known. A call to a bare name whose package the code never attaches is reported as uncertain, as any function of that name would answer to it.',
|
|
221
210
|
defaultConfig: ctx => ({
|
|
222
|
-
always: ctx.env.deriveFromDefinitions(
|
|
223
|
-
conditionally:
|
|
211
|
+
always: ctx.env.deriveFromDefinitions(alwayDeprecatedFromBuiltinConfig),
|
|
212
|
+
conditionally: ctx.env.deriveFromDefinitions(conditionalyDeprecatedFromBuiltinConfig)
|
|
224
213
|
})
|
|
225
214
|
}
|
|
226
215
|
};
|
|
@@ -260,7 +249,8 @@ function doesPackageVersionMatch(derivedVersion, info, setUncertain) {
|
|
|
260
249
|
return true;
|
|
261
250
|
}
|
|
262
251
|
else {
|
|
263
|
-
|
|
252
|
+
const version = r_version_1.RRange.parse(info.sinceVersion);
|
|
253
|
+
return version ? version?.intersects(derivedVersion) : false;
|
|
264
254
|
}
|
|
265
255
|
}
|
|
266
256
|
function doesArgumentValueMatch(info, vertex, analyzer, dataflow, setUncertain) {
|
|
@@ -337,15 +327,16 @@ function deprecateFunctionConditionally(candidate, dataflow, idMap, analyzer, en
|
|
|
337
327
|
arg: (deprecatedArgInfo.argName ?? deprecatedArgInfo.argIdx),
|
|
338
328
|
state: deprecatedArgInfo.state,
|
|
339
329
|
replacedBy: deprecatedArgInfo.replacedBy,
|
|
340
|
-
sinceVersion: deprecatedArgInfo.sinceVersion,
|
|
330
|
+
sinceVersion: deprecatedArgInfo.sinceVersion ? r_version_1.RRange.parse(deprecatedArgInfo.sinceVersion) : undefined,
|
|
341
331
|
loc: range_1.SourceLocation.fromNode(argNode) ?? candidate.sourceLocation,
|
|
342
332
|
quickFix: deprecatedArgInfo.argName === undefined ? undefined : renameFix(argNode, deprecatedArgInfo.replacedBy, `argument \`${deprecatedArgInfo.argName}\``)
|
|
343
333
|
});
|
|
344
334
|
}
|
|
345
335
|
}
|
|
346
336
|
// Deprecated Function: If `sinceVersion` is set, check package version before marking as deprecated
|
|
347
|
-
|
|
348
|
-
|
|
337
|
+
const fnSinceVersion = info.sinceVersion ? r_version_1.RRange.parse(info.sinceVersion) : undefined;
|
|
338
|
+
if (fnSinceVersion) {
|
|
339
|
+
const isDeprecatedVersion = derivedRange ? fnSinceVersion.intersects(derivedRange) : undefined;
|
|
349
340
|
if (isDeprecatedVersion === true || isDeprecatedVersion === undefined) {
|
|
350
341
|
results.push({
|
|
351
342
|
type: 'deprecated-function',
|
|
@@ -355,7 +346,7 @@ function deprecateFunctionConditionally(candidate, dataflow, idMap, analyzer, en
|
|
|
355
346
|
function: candidate.target,
|
|
356
347
|
state: info.state,
|
|
357
348
|
replacedBy: info.replacedBy,
|
|
358
|
-
sinceVersion:
|
|
349
|
+
sinceVersion: fnSinceVersion,
|
|
359
350
|
quickFix: renameFix(calledName(candidate.node), info.replacedBy, 'the call')
|
|
360
351
|
});
|
|
361
352
|
}
|
package/package.json
CHANGED
|
@@ -195,6 +195,8 @@ export declare class FlowrAnalyzer<Parser extends KnownParser = KnownParser> imp
|
|
|
195
195
|
private readonly cache;
|
|
196
196
|
private readonly ctx;
|
|
197
197
|
private parserInfo;
|
|
198
|
+
/** the graph whose calls are already being qualified in the background, see {@link qualifyInBackground} */
|
|
199
|
+
private qualifying;
|
|
198
200
|
/**
|
|
199
201
|
* Create a new analyzer instance.
|
|
200
202
|
* **Prefer the use of the {@link FlowrAnalyzerBuilder} instead of calling this constructor directly.**
|