@eagleoutice/flowr 2.15.9 → 2.16.0
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 +47 -41
- package/abstract-interpretation/absint-inference.d.ts +2 -2
- package/abstract-interpretation/absint-inference.js +32 -79
- package/abstract-interpretation/data-frame/arguments.js +11 -7
- 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 +7 -2
- package/control-flow/happens-before.js +55 -31
- package/control-flow/useless-loop.d.ts +1 -1
- package/control-flow/useless-loop.js +29 -42
- 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 +16 -1
- package/dataflow/environments/built-in-props.js +33 -20
- package/dataflow/environments/built-in.d.ts +8 -3
- package/dataflow/environments/built-in.js +52 -82
- package/dataflow/environments/default-builtin-config.d.ts +551 -21
- package/dataflow/environments/default-builtin-config.js +121 -45
- 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 +7 -5
- package/dataflow/environments/environment.js +55 -121
- package/dataflow/environments/identifier.d.ts +6 -2
- package/dataflow/environments/identifier.js +23 -69
- package/dataflow/environments/reference-to-maybe.d.ts +9 -0
- package/dataflow/environments/reference-to-maybe.js +23 -51
- package/dataflow/environments/resolve-by-name.js +37 -76
- package/dataflow/eval/resolve/resolve-argument.d.ts +3 -1
- package/dataflow/eval/resolve/resolve-argument.js +61 -64
- package/dataflow/eval/resolve/resolve-working-directory.d.ts +8 -2
- package/dataflow/eval/resolve/resolve-working-directory.js +12 -20
- package/dataflow/eval/resolve/resolve.d.ts +4 -0
- package/dataflow/eval/resolve/resolve.js +23 -14
- package/dataflow/extractor.js +180 -58
- package/dataflow/fn/class-declaration.d.ts +8 -13
- package/dataflow/fn/class-declaration.js +95 -116
- package/dataflow/fn/exceptions-of-function.js +68 -37
- package/dataflow/fn/frame-reflection.d.ts +12 -4
- package/dataflow/fn/frame-reflection.js +51 -41
- package/dataflow/fn/function-props.js +15 -33
- package/dataflow/fn/function-semantics.d.ts +11 -3
- package/dataflow/fn/function-semantics.js +6 -0
- package/dataflow/fn/higher-order-function.d.ts +9 -1
- package/dataflow/fn/higher-order-function.js +27 -24
- package/dataflow/fn/strict-function.d.ts +13 -0
- package/dataflow/fn/strict-function.js +291 -123
- package/dataflow/graph/call-graph.d.ts +7 -6
- package/dataflow/graph/call-graph.js +35 -46
- package/dataflow/graph/graph.d.ts +13 -1
- package/dataflow/graph/graph.js +74 -66
- package/dataflow/graph/vertex.d.ts +1 -1
- package/dataflow/info.d.ts +8 -1
- package/dataflow/info.js +24 -30
- package/dataflow/internal/control-flow.d.ts +31 -4
- package/dataflow/internal/control-flow.js +61 -39
- package/dataflow/internal/linker.d.ts +17 -8
- package/dataflow/internal/linker.js +286 -213
- package/dataflow/internal/process/functions/call/built-in/built-in-ambient-state.d.ts +179 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-ambient-state.js +874 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-apply.d.ts +3 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +60 -48
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.d.ts +4 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +135 -198
- package/dataflow/internal/process/functions/call/built-in/built-in-class-generator.js +7 -9
- 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.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +141 -146
- package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +56 -24
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +292 -253
- package/dataflow/internal/process/functions/call/built-in/built-in-get.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-get.js +30 -32
- package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.js +68 -67
- package/dataflow/internal/process/functions/call/built-in/built-in-library.js +91 -129
- package/dataflow/internal/process/functions/call/built-in/built-in-local.d.ts +1 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-local.js +16 -12
- package/dataflow/internal/process/functions/call/built-in/built-in-quote.d.ts +4 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-quote.js +9 -35
- 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-rm.js +8 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-s-four.d.ts +5 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-s-four.js +13 -31
- package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.js +42 -119
- package/dataflow/internal/process/functions/call/built-in/built-in-s-three-dispatch.d.ts +1 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-s-three-dispatch.js +21 -21
- package/dataflow/internal/process/functions/call/built-in/built-in-source.d.ts +2 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-source.js +93 -102
- package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.d.ts +7 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.js +173 -114
- package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.d.ts +1 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.js +23 -26
- package/dataflow/internal/process/functions/call/built-in/built-in-with.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-with.js +34 -9
- package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.js +119 -93
- package/dataflow/internal/process/functions/call/common.d.ts +4 -4
- package/dataflow/internal/process/functions/call/common.js +49 -71
- package/dataflow/internal/process/functions/call/deferred.d.ts +12 -2
- package/dataflow/internal/process/functions/call/deferred.js +81 -63
- package/dataflow/internal/process/functions/call/known-call-handling.d.ts +4 -2
- package/dataflow/internal/process/functions/call/known-call-handling.js +65 -68
- package/dataflow/internal/process/functions/call/named-call-handling.d.ts +3 -5
- package/dataflow/internal/process/functions/call/named-call-handling.js +48 -19
- package/dataflow/internal/process/functions/call/quoted.d.ts +2 -0
- package/dataflow/internal/process/functions/call/quoted.js +257 -154
- package/dataflow/internal/process/functions/call/unnamed-call-handling.js +17 -38
- package/dataflow/internal/process/functions/process-parameter.js +25 -32
- package/dataflow/internal/process/process-symbol.js +4 -3
- package/dataflow/internal/program-order.d.ts +26 -0
- package/dataflow/internal/program-order.js +49 -0
- 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-setup.js +23 -0
- package/documentation/wiki-signature-database.js +1 -1
- package/linter/linter-rules.d.ts +18 -9
- package/linter/rules/absolute-path.js +63 -87
- package/linter/rules/deprecated-functions.d.ts +1 -45
- package/linter/rules/deprecated-functions.js +24 -33
- package/linter/rules/file-path-validity.d.ts +4 -2
- package/linter/rules/file-path-validity.js +114 -80
- package/linter/rules/namespace-access.js +21 -33
- package/linter/rules/naming-convention.d.ts +1 -1
- package/linter/rules/naming-convention.js +60 -48
- package/linter/rules/network-functions.js +11 -7
- package/linter/rules/no-leaked-credentials.js +15 -18
- package/linter/rules/problematic-inputs.d.ts +2 -1
- package/linter/rules/problematic-inputs.js +39 -59
- package/linter/rules/roxygen-arguments.d.ts +9 -4
- package/linter/rules/roxygen-arguments.js +29 -48
- package/linter/rules/seeded-randomness.d.ts +7 -4
- package/linter/rules/seeded-randomness.js +128 -89
- package/linter/rules/stop-with-call-arg.d.ts +4 -2
- package/linter/rules/stop-with-call-arg.js +25 -22
- package/linter/rules/unclosed-connection.js +31 -24
- package/linter/rules/undefined-symbol.d.ts +4 -6
- package/linter/rules/undefined-symbol.js +58 -75
- package/linter/rules/unescaped-arguments.js +18 -44
- package/linter/rules/unused-definition.d.ts +6 -0
- package/linter/rules/unused-definition.js +105 -145
- package/linter/rules/unused-import.d.ts +3 -0
- package/linter/rules/unused-import.js +25 -43
- package/package.json +5 -2
- package/project/flowr-analyzer.d.ts +2 -0
- package/project/flowr-analyzer.js +28 -1
- package/project/plugins/file-plugins/files/flowr-jupyter-file.d.ts +2 -2
- package/project/plugins/file-plugins/files/flowr-jupyter-file.js +8 -12
- 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/files/flowr-rmarkdown-file.d.ts +7 -5
- package/project/plugins/file-plugins/files/flowr-rmarkdown-file.js +34 -56
- 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 +22 -45
- 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/base-query-format.js +1 -2
- package/queries/catalog/absint-query/absint-query-format.js +1 -1
- 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/dataflow-query/dataflow-query-executor.js +2 -2
- package/queries/catalog/dataflow-query/dataflow-query-format.d.ts +2 -0
- package/queries/catalog/dataflow-query/dataflow-query-format.js +4 -7
- package/queries/catalog/dependencies-query/dependencies-query-executor.js +50 -114
- package/queries/catalog/dependencies-query/function-info/library-functions.d.ts +5 -9
- package/queries/catalog/dependencies-query/function-info/library-functions.js +6 -0
- package/queries/catalog/dependencies-query/function-info/read-functions.js +1 -1
- package/queries/catalog/dependencies-query/function-info/write-functions.js +7 -3
- package/queries/catalog/input-sources-query/simple-input-classifier.d.ts +4 -4
- package/queries/catalog/input-sources-query/simple-input-classifier.js +192 -301
- 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/ast/model/model.d.ts +3 -1
- package/r-bridge/lang-4.x/ast/model/model.js +19 -43
- package/r-bridge/lang-4.x/ast/model/nodes/r-access.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-argument.d.ts +3 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-argument.js +5 -12
- package/r-bridge/lang-4.x/ast/model/nodes/r-binary-op.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-break.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-comment.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-expression-list.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-for-loop.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-definition.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-if-then-else.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-line-directive.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-logical.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-next.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-number.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-parameter.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-pipe.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-repeat-loop.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-string.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-symbol.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-unary-op.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-while-loop.d.ts +1 -0
- 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/r-bridge/roxygen2/roxygen-parse.js +28 -42
- package/r-bridge/shell.js +6 -0
- package/search/search-executor/search-enrichers.js +25 -37
- package/slicing/static/slice-call.d.ts +4 -3
- package/slicing/static/slice-call.js +56 -88
- package/slicing/static/static-slicer.js +115 -79
- package/slicing/static/visiting-queue.d.ts +4 -6
- package/slicing/static/visiting-queue.js +9 -13
- package/util/files.d.ts +2 -0
- package/util/files.js +3 -1
- package/util/mermaid/mermaid.js +6 -2
- package/util/proc.js +2 -1
- package/util/r-base-packages.d.ts +2 -0
- package/util/r-base-packages.js +23 -13
- package/util/text/playground-link.d.ts +12 -3
- package/util/text/playground-link.js +18 -27
- package/util/version.js +4 -10
|
@@ -47,29 +47,24 @@ function buildQuickFix(str, filePath, wd) {
|
|
|
47
47
|
replacement: `${str.content.quotes}${files_1.RPath.relative(wd, filePath)}${str.content.quotes}`
|
|
48
48
|
}];
|
|
49
49
|
}
|
|
50
|
-
/**
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
results.push(argValues.join(val));
|
|
69
|
-
}
|
|
70
|
-
return results;
|
|
71
|
-
}]
|
|
72
|
-
]);
|
|
50
|
+
/** The paths `file.path(...)` builds, `undefined` if a part is unknown. */
|
|
51
|
+
function filePathStrings(graph, vtx, ctx) {
|
|
52
|
+
const variables = ctx.config.solver.variables;
|
|
53
|
+
// in the future we can access `.Platform$file.sep` here
|
|
54
|
+
const fsep = (0, resolve_argument_1.getArgumentStringValue)(variables, graph, vtx, undefined, 'fsep', true, ctx);
|
|
55
|
+
const seps = fsep?.values().flatMap(s => s.values().filter(assert_1.isNotUndefined)).toArray() ?? ['/'];
|
|
56
|
+
if (seps.includes(dependencies_query_format_1.Unknown)) {
|
|
57
|
+
// if we have no fsep, we cannot construct a path
|
|
58
|
+
return undefined;
|
|
59
|
+
}
|
|
60
|
+
const unnamed = (0, resolve_argument_1.getArgumentStringValue)(variables, graph, vtx, 'unnamed', undefined, true, ctx);
|
|
61
|
+
const args = [...unnamed?.values() ?? []].flatMap(v => [...v]);
|
|
62
|
+
if (args.length === 0 || args.some(v => v === dependencies_query_format_1.Unknown || v === undefined)) {
|
|
63
|
+
// if we have no arguments, we cannot construct a path
|
|
64
|
+
return undefined;
|
|
65
|
+
}
|
|
66
|
+
return seps.map(sep => args.join(sep));
|
|
67
|
+
}
|
|
73
68
|
/**
|
|
74
69
|
* Resolve a raw string value to the path that should be checked for absoluteness.
|
|
75
70
|
* - `file://` URIs: extract the local path (always checked, ignoreUrls has no effect)
|
|
@@ -83,24 +78,24 @@ function resolvePathForAbsoluteCheck(value, ignoreUrls) {
|
|
|
83
78
|
}
|
|
84
79
|
return ignoreUrls && (0, strings_1.isUrl)(value) ? undefined : value;
|
|
85
80
|
}
|
|
81
|
+
/** A path built within a call that already reports it, as `file.path` within `read.csv`, is one finding. */
|
|
82
|
+
function withoutNested(results) {
|
|
83
|
+
return results.filter((r, i) => !results.some((o, j) => i !== j && o.filePath === r.filePath
|
|
84
|
+
&& (range_1.SourceRange.isStrictSubsetOf(r.loc, o.loc) || (j < i && range_1.SourceRange.equals(r.loc, o.loc)))));
|
|
85
|
+
}
|
|
86
86
|
exports.ABSOLUTE_PATH = {
|
|
87
87
|
/* this can be done better once we have types */
|
|
88
88
|
createSearch: (config, data) => {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
ignoreDefaultFunctions: true,
|
|
98
|
-
readFunctions: (0, read_functions_1.readFunctions)(data.inspectContext()).concat((0, write_functions_1.writeFunctions)(data.inspectContext()), source_functions_1.SourceFunctions, other_path_functions_1.OtherPathFunctions, config.additionalPathFunctions),
|
|
99
|
-
});
|
|
100
|
-
}
|
|
89
|
+
const ctx = data.inspectContext();
|
|
90
|
+
const pathFunctions = (0, read_functions_1.readFunctions)(ctx).concat((0, write_functions_1.writeFunctions)(ctx), source_functions_1.SourceFunctions, other_path_functions_1.OtherPathFunctions, config.additionalPathFunctions);
|
|
91
|
+
let q = config.include.allStrings ? flowr_search_builder_1.Q.all().filter(type_1.RType.String) : flowr_search_builder_1.Q.fromQuery({
|
|
92
|
+
type: 'dependencies',
|
|
93
|
+
// we use the dependencies query to give us all functions that take a file path as input
|
|
94
|
+
ignoreDefaultFunctions: true,
|
|
95
|
+
readFunctions: pathFunctions,
|
|
96
|
+
});
|
|
101
97
|
if (config.include.constructed) {
|
|
102
98
|
q = q.merge(flowr_search_builder_1.Q.all().filter(vertex_1.VertexType.FunctionCall).with(search_enrichers_1.Enrichment.CallTargets));
|
|
103
|
-
/* in the future, we want to directly check whether this is one of the supported functions */
|
|
104
99
|
}
|
|
105
100
|
return q.unique();
|
|
106
101
|
},
|
|
@@ -111,76 +106,57 @@ exports.ABSOLUTE_PATH = {
|
|
|
111
106
|
};
|
|
112
107
|
const queryResults = elements.enrichmentContent(search_enrichers_1.Enrichment.QueryData)?.queries;
|
|
113
108
|
const regex = config.absolutePathRegex ? new RegExp(config.absolutePathRegex) : undefined;
|
|
114
|
-
const
|
|
115
|
-
const
|
|
109
|
+
const { idMap } = await data.normalize();
|
|
110
|
+
const { graph } = await data.dataflow();
|
|
116
111
|
const ctx = data.inspectContext();
|
|
112
|
+
const absolute = (value) => {
|
|
113
|
+
const path = resolvePathForAbsoluteCheck(value, config.ignoreUrls);
|
|
114
|
+
return path !== undefined && (0, strings_1.isAbsolutePath)(path, regex) ? path : undefined;
|
|
115
|
+
};
|
|
116
|
+
const finding = (certainty, filePath, node, wd) => (0, objects_1.compactRecord)({
|
|
117
|
+
certainty,
|
|
118
|
+
filePath,
|
|
119
|
+
loc: range_1.SourceLocation.fromNode(node) ?? range_1.SourceLocation.invalid(),
|
|
120
|
+
quickFix: buildQuickFix(node, filePath, wd)
|
|
121
|
+
});
|
|
117
122
|
return {
|
|
118
|
-
results: elements.getElements().flatMap(element => {
|
|
123
|
+
results: withoutNested(elements.getElements().flatMap(element => {
|
|
119
124
|
metadata.totalConsidered++;
|
|
120
125
|
const node = element.node;
|
|
121
126
|
const wd = inferWd(node.info.file, config.useAsWd, ctx);
|
|
127
|
+
const query = (0, search_enrichers_1.enrichmentContent)(element, search_enrichers_1.Enrichment.QueryData);
|
|
122
128
|
if (r_string_1.RString.is(node)) {
|
|
123
|
-
const
|
|
124
|
-
|
|
125
|
-
return [{
|
|
126
|
-
certainty: linter_format_1.LintingResultCertainty.Uncertain,
|
|
127
|
-
filePath: resolved,
|
|
128
|
-
loc: range_1.SourceLocation.fromNode(node) ?? range_1.SourceLocation.invalid(),
|
|
129
|
-
quickFix: buildQuickFix(node, resolved, wd)
|
|
130
|
-
}];
|
|
131
|
-
}
|
|
132
|
-
else {
|
|
133
|
-
return [];
|
|
134
|
-
}
|
|
129
|
+
const path = absolute(node.content.str);
|
|
130
|
+
return path !== undefined && path.length >= 3 ? [finding(linter_format_1.LintingResultCertainty.Uncertain, path, node, wd)] : [];
|
|
135
131
|
}
|
|
136
|
-
else if (
|
|
137
|
-
const result = queryResults[
|
|
138
|
-
const
|
|
132
|
+
else if (query) {
|
|
133
|
+
const result = queryResults[query.query];
|
|
134
|
+
const reads = result.read.filter(r => r.nodeId === node.info.id);
|
|
135
|
+
const found = reads.flatMap(r => {
|
|
139
136
|
if (r.value === undefined || r.value === dependencies_query_format_1.Unknown || r.nodeId === undefined) {
|
|
140
137
|
return [];
|
|
141
138
|
}
|
|
142
|
-
const
|
|
143
|
-
|
|
144
|
-
return [];
|
|
145
|
-
}
|
|
146
|
-
const elem = normalize.idMap.get(r.nodeId);
|
|
147
|
-
return [{
|
|
148
|
-
certainty: linter_format_1.LintingResultCertainty.Certain,
|
|
149
|
-
filePath: resolved,
|
|
150
|
-
loc: elem ? range_1.SourceLocation.fromNode(elem) ?? range_1.SourceLocation.invalid() : range_1.SourceLocation.invalid(),
|
|
151
|
-
quickFix: buildQuickFix(elem, resolved, wd)
|
|
152
|
-
}];
|
|
139
|
+
const path = absolute(r.value);
|
|
140
|
+
return path === undefined ? [] : [finding(linter_format_1.LintingResultCertainty.Certain, path, idMap.get(r.nodeId), wd)];
|
|
153
141
|
});
|
|
154
|
-
if
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
else if (result.read.every(r => r.value !== dependencies_query_format_1.Unknown)) {
|
|
158
|
-
// if we have no absolute paths, but all paths are known, we can return an empty array
|
|
159
|
-
return [];
|
|
142
|
+
// if we have no absolute paths, but all paths are known, we can return an empty array
|
|
143
|
+
if (found.length > 0 || reads.every(r => r.value !== dependencies_query_format_1.Unknown)) {
|
|
144
|
+
return found;
|
|
160
145
|
}
|
|
161
146
|
}
|
|
162
147
|
else {
|
|
163
|
-
const
|
|
164
|
-
if (vertex_1.DfgVertex.isFunctionCall(
|
|
165
|
-
|
|
166
|
-
const strings =
|
|
148
|
+
const vertex = graph.getVertex(node.info.id);
|
|
149
|
+
if (vertex_1.DfgVertex.isFunctionCall(vertex)) {
|
|
150
|
+
/* `file.path` is the only supported function that returns a file path */
|
|
151
|
+
const strings = vertex.name === 'file.path' ? filePathStrings(graph, vertex, ctx) : [];
|
|
167
152
|
if (strings) {
|
|
168
|
-
return strings.
|
|
169
|
-
const resolved = resolvePathForAbsoluteCheck(s, config.ignoreUrls);
|
|
170
|
-
return resolved !== undefined && (0, strings_1.isAbsolutePath)(resolved, regex) ? [resolved] : [];
|
|
171
|
-
}).map(str => ({
|
|
172
|
-
certainty: linter_format_1.LintingResultCertainty.Uncertain,
|
|
173
|
-
filePath: str,
|
|
174
|
-
loc: range_1.SourceLocation.fromNode(element.node) ?? range_1.SourceLocation.invalid(),
|
|
175
|
-
quickFix: undefined
|
|
176
|
-
}));
|
|
153
|
+
return strings.map(absolute).filter(assert_1.isNotUndefined).map(path => finding(linter_format_1.LintingResultCertainty.Uncertain, path, node));
|
|
177
154
|
}
|
|
178
155
|
}
|
|
179
|
-
// check whether the df node is a function call that returns a file path
|
|
180
156
|
}
|
|
181
157
|
metadata.totalUnknown++;
|
|
182
|
-
return
|
|
183
|
-
})
|
|
158
|
+
return [];
|
|
159
|
+
})),
|
|
184
160
|
'.meta': metadata
|
|
185
161
|
};
|
|
186
162
|
},
|
|
@@ -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
|
}
|
|
@@ -2,6 +2,8 @@ import { type LintingResult, LintingRuleCertainty } from '../linter-format';
|
|
|
2
2
|
import type { MergeableRecord } from '../../util/objects';
|
|
3
3
|
import type { FunctionInfo } from '../../queries/catalog/dependencies-query/function-info/function-info';
|
|
4
4
|
import { LintingRuleTag } from '../linter-tags';
|
|
5
|
+
import type { ParentInformation } from '../../r-bridge/lang-4.x/ast/model/processing/decorate';
|
|
6
|
+
import type { ReadonlyFlowrAnalysisProvider } from '../../project/flowr-analyzer';
|
|
5
7
|
export interface FilePathValidityResult extends LintingResult {
|
|
6
8
|
filePath: string;
|
|
7
9
|
}
|
|
@@ -34,8 +36,8 @@ export interface FilePathValidityMetadata extends MergeableRecord {
|
|
|
34
36
|
totalValid: number;
|
|
35
37
|
}
|
|
36
38
|
export declare const FILE_PATH_VALIDITY: {
|
|
37
|
-
readonly createSearch: (config: FilePathValidityConfig) => import("../../search/flowr-search-builder").FlowrSearchBuilder<"from-query", ["with"],
|
|
38
|
-
readonly processSearchResult: (elements: import("../../search/flowr-search").FlowrSearchElements<
|
|
39
|
+
readonly createSearch: (config: FilePathValidityConfig) => import("../../search/flowr-search-builder").FlowrSearchBuilder<"from-query", ["with"], ParentInformation, Promise<import("../../search/flowr-search").FlowrSearchElements<ParentInformation, import("../../search/flowr-search").FlowrSearchElement<ParentInformation>[]>>>;
|
|
40
|
+
readonly processSearchResult: (elements: import("../../search/flowr-search").FlowrSearchElements<ParentInformation, import("../../search/flowr-search").FlowrSearchElement<ParentInformation>[]>, config: FilePathValidityConfig, data: ReadonlyFlowrAnalysisProvider<import("../..").KnownParser>) => Promise<{
|
|
39
41
|
results: FilePathValidityResult[];
|
|
40
42
|
".meta": FilePathValidityMetadata;
|
|
41
43
|
}>;
|