@eagleoutice/flowr 2.2.15 → 2.3.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 +226 -6
- package/abstract-interpretation/data-frame/absint-info.d.ts +109 -0
- package/abstract-interpretation/data-frame/absint-info.js +31 -0
- package/abstract-interpretation/data-frame/absint-visitor.d.ts +59 -0
- package/abstract-interpretation/data-frame/absint-visitor.js +173 -0
- package/abstract-interpretation/data-frame/domain.d.ts +107 -0
- package/abstract-interpretation/data-frame/domain.js +315 -0
- package/abstract-interpretation/data-frame/mappers/access-mapper.d.ts +17 -0
- package/abstract-interpretation/data-frame/mappers/access-mapper.js +166 -0
- package/abstract-interpretation/data-frame/mappers/arguments.d.ts +117 -0
- package/abstract-interpretation/data-frame/mappers/arguments.js +188 -0
- package/abstract-interpretation/data-frame/mappers/assignment-mapper.d.ts +20 -0
- package/abstract-interpretation/data-frame/mappers/assignment-mapper.js +34 -0
- package/abstract-interpretation/data-frame/mappers/function-mapper.d.ts +261 -0
- package/abstract-interpretation/data-frame/mappers/function-mapper.js +1219 -0
- package/abstract-interpretation/data-frame/mappers/replacement-mapper.d.ts +12 -0
- package/abstract-interpretation/data-frame/mappers/replacement-mapper.js +206 -0
- package/abstract-interpretation/data-frame/resolve-args.d.ts +42 -0
- package/abstract-interpretation/data-frame/resolve-args.js +118 -0
- package/abstract-interpretation/data-frame/semantics.d.ts +213 -0
- package/abstract-interpretation/data-frame/semantics.js +366 -0
- package/abstract-interpretation/data-frame/shape-inference.d.ts +38 -0
- package/abstract-interpretation/data-frame/shape-inference.js +117 -0
- package/benchmark/slicer.d.ts +18 -2
- package/benchmark/slicer.js +143 -5
- package/benchmark/stats/print.js +123 -45
- package/benchmark/stats/size-of.d.ts +7 -0
- package/benchmark/stats/size-of.js +1 -0
- package/benchmark/stats/stats.d.ts +30 -1
- package/benchmark/stats/stats.js +4 -2
- package/benchmark/summarizer/data.d.ts +33 -2
- package/benchmark/summarizer/first-phase/input.js +5 -1
- package/benchmark/summarizer/first-phase/process.d.ts +2 -1
- package/benchmark/summarizer/first-phase/process.js +49 -3
- package/benchmark/summarizer/second-phase/process.js +101 -3
- package/cli/benchmark-app.d.ts +2 -0
- package/cli/benchmark-app.js +5 -1
- package/cli/benchmark-helper-app.d.ts +2 -0
- package/cli/benchmark-helper-app.js +13 -8
- package/cli/common/options.js +4 -0
- package/cli/export-quads-app.js +2 -1
- package/cli/flowr.js +58 -57
- package/cli/repl/commands/repl-cfg.js +13 -13
- package/cli/repl/commands/repl-commands.js +2 -2
- package/cli/repl/commands/repl-dataflow.js +10 -10
- package/cli/repl/commands/repl-execute.d.ts +2 -3
- package/cli/repl/commands/repl-execute.js +4 -4
- package/cli/repl/commands/repl-lineage.js +4 -4
- package/cli/repl/commands/repl-main.d.ts +12 -1
- package/cli/repl/commands/repl-normalize.js +6 -6
- package/cli/repl/commands/repl-parse.js +2 -2
- package/cli/repl/commands/repl-query.js +9 -9
- package/cli/repl/commands/repl-version.js +1 -1
- package/cli/repl/core.d.ts +5 -2
- package/cli/repl/core.js +10 -8
- package/cli/repl/server/connection.d.ts +3 -1
- package/cli/repl/server/connection.js +7 -5
- package/cli/repl/server/server.d.ts +3 -2
- package/cli/repl/server/server.js +4 -2
- package/cli/script-core/statistics-core.d.ts +2 -1
- package/cli/script-core/statistics-core.js +2 -2
- package/cli/script-core/statistics-helper-core.d.ts +2 -1
- package/cli/script-core/statistics-helper-core.js +5 -4
- package/cli/slicer-app.js +4 -2
- package/cli/statistics-app.js +2 -1
- package/cli/statistics-helper-app.js +2 -1
- package/config.d.ts +43 -10
- package/config.js +47 -43
- package/control-flow/cfg-dead-code.js +45 -2
- package/control-flow/cfg-simplification.d.ts +2 -0
- package/control-flow/control-flow-graph.d.ts +2 -0
- package/control-flow/control-flow-graph.js +8 -0
- package/control-flow/dfg-cfg-guided-visitor.d.ts +5 -3
- package/control-flow/dfg-cfg-guided-visitor.js +15 -4
- package/control-flow/extract-cfg.d.ts +4 -2
- package/control-flow/extract-cfg.js +4 -3
- package/control-flow/semantic-cfg-guided-visitor.d.ts +20 -2
- package/control-flow/semantic-cfg-guided-visitor.js +24 -4
- package/core/pipeline-executor.d.ts +4 -1
- package/core/pipeline-executor.js +6 -5
- package/core/steps/all/core/10-normalize.d.ts +2 -0
- package/core/steps/all/core/10-normalize.js +1 -1
- package/core/steps/all/core/11-normalize-tree-sitter.d.ts +2 -1
- package/core/steps/all/core/11-normalize-tree-sitter.js +2 -2
- package/core/steps/all/core/20-dataflow.d.ts +2 -1
- package/core/steps/all/core/20-dataflow.js +2 -2
- package/core/steps/all/static-slicing/00-slice.d.ts +2 -1
- package/core/steps/all/static-slicing/00-slice.js +2 -2
- package/core/steps/pipeline/default-pipelines.d.ts +32 -31
- package/core/steps/pipeline/default-pipelines.js +8 -8
- package/core/steps/pipeline-step.d.ts +2 -1
- package/dataflow/environments/built-in-config.d.ts +3 -3
- package/dataflow/environments/built-in.d.ts +11 -3
- package/dataflow/environments/built-in.js +5 -3
- package/dataflow/environments/default-builtin-config.js +4 -2
- package/dataflow/environments/define.d.ts +2 -1
- package/dataflow/environments/define.js +4 -5
- package/dataflow/environments/remove.d.ts +6 -0
- package/dataflow/environments/remove.js +29 -0
- package/dataflow/eval/resolve/alias-tracking.d.ts +7 -2
- package/dataflow/eval/resolve/alias-tracking.js +11 -8
- package/dataflow/eval/resolve/resolve-argument.d.ts +8 -0
- package/dataflow/eval/resolve/resolve-argument.js +118 -0
- package/dataflow/eval/resolve/resolve.d.ts +65 -18
- package/dataflow/eval/resolve/resolve.js +144 -48
- package/dataflow/eval/values/string/string-constants.d.ts +1 -1
- package/dataflow/eval/values/string/string-constants.js +7 -2
- package/dataflow/extractor.d.ts +2 -1
- package/dataflow/extractor.js +2 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-access.js +5 -6
- package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +1 -1
- 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 +11 -11
- package/dataflow/internal/process/functions/call/built-in/built-in-eval.js +10 -11
- package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +7 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +2 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.js +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-list.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-replacement.js +2 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-source.d.ts +6 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-source.js +19 -15
- package/dataflow/internal/process/functions/call/built-in/built-in-vector.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.js +1 -1
- package/dataflow/internal/process/functions/call/common.js +1 -1
- package/dataflow/internal/process/functions/process-parameter.js +1 -1
- package/dataflow/origin/dfg-get-symbol-refs.d.ts +21 -0
- package/dataflow/origin/dfg-get-symbol-refs.js +50 -0
- package/dataflow/processor.d.ts +5 -0
- package/documentation/doc-util/doc-cfg.js +4 -3
- package/documentation/doc-util/doc-code.d.ts +1 -1
- package/documentation/doc-util/doc-dfg.js +3 -2
- package/documentation/doc-util/doc-functions.d.ts +24 -0
- package/documentation/doc-util/doc-functions.js +65 -0
- package/documentation/doc-util/doc-normalized-ast.js +3 -2
- package/documentation/doc-util/doc-print.d.ts +5 -0
- package/documentation/doc-util/doc-print.js +36 -0
- package/documentation/doc-util/doc-query.js +13 -2
- package/documentation/doc-util/doc-repl.js +2 -1
- package/documentation/doc-util/doc-search.js +3 -2
- package/documentation/doc-util/doc-types.d.ts +28 -6
- package/documentation/doc-util/doc-types.js +89 -45
- package/documentation/print-cfg-wiki.js +6 -7
- package/documentation/print-core-wiki.js +5 -5
- package/documentation/print-dataflow-graph-wiki.js +10 -10
- package/documentation/print-engines-wiki.js +1 -2
- package/documentation/print-faq-wiki.js +8 -2
- package/documentation/print-interface-wiki.js +12 -2
- package/documentation/print-linter-issue.d.ts +1 -0
- package/documentation/print-linter-issue.js +71 -0
- package/documentation/print-linter-wiki.js +223 -34
- package/documentation/print-linting-and-testing-wiki.js +2 -4
- package/documentation/print-normalized-ast-wiki.js +3 -3
- package/documentation/print-query-wiki.js +18 -2
- package/documentation/print-readme.js +24 -1
- package/documentation/print-search-wiki.js +1 -2
- package/linter/linter-executor.d.ts +3 -1
- package/linter/linter-executor.js +3 -2
- package/linter/linter-format.d.ts +67 -7
- package/linter/linter-format.js +12 -1
- package/linter/linter-rules.d.ts +178 -16
- package/linter/linter-rules.js +14 -4
- package/linter/linter-tags.d.ts +80 -0
- package/linter/linter-tags.js +85 -0
- package/linter/rules/absolute-path.d.ts +71 -0
- package/linter/rules/absolute-path.js +177 -0
- package/linter/rules/dataframe-access-validation.d.ts +53 -0
- package/linter/rules/dataframe-access-validation.js +116 -0
- package/linter/rules/deprecated-functions.d.ts +43 -0
- package/linter/rules/deprecated-functions.js +58 -0
- package/linter/rules/{2-file-path-validity.d.ts → file-path-validity.d.ts} +16 -6
- package/linter/rules/{2-file-path-validity.js → file-path-validity.js} +21 -13
- package/linter/rules/naming-convention.d.ts +71 -0
- package/linter/rules/naming-convention.js +168 -0
- package/linter/rules/seeded-randomness.d.ts +65 -0
- package/linter/rules/seeded-randomness.js +122 -0
- package/linter/rules/unused-definition.d.ts +41 -0
- package/linter/rules/unused-definition.js +105 -0
- package/package.json +5 -2
- package/queries/base-query-format.d.ts +2 -0
- package/queries/catalog/call-context-query/call-context-query-executor.d.ts +1 -1
- package/queries/catalog/call-context-query/call-context-query-executor.js +2 -2
- package/queries/catalog/cluster-query/cluster-query-format.d.ts +1 -1
- package/queries/catalog/config-query/config-query-executor.d.ts +1 -1
- package/queries/catalog/config-query/config-query-executor.js +2 -3
- package/queries/catalog/control-flow-query/control-flow-query-executor.d.ts +1 -1
- package/queries/catalog/control-flow-query/control-flow-query-executor.js +2 -2
- package/queries/catalog/control-flow-query/control-flow-query-format.d.ts +1 -1
- package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.d.ts +1 -1
- package/queries/catalog/dataflow-query/dataflow-query-format.d.ts +1 -1
- package/queries/catalog/dependencies-query/dependencies-query-executor.js +4 -116
- package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +1 -1
- package/queries/catalog/df-shape-query/df-shape-query-executor.d.ts +3 -0
- package/queries/catalog/df-shape-query/df-shape-query-executor.js +46 -0
- package/queries/catalog/df-shape-query/df-shape-query-format.d.ts +72 -0
- package/queries/catalog/df-shape-query/df-shape-query-format.js +31 -0
- package/queries/catalog/happens-before-query/happens-before-query-format.d.ts +1 -1
- package/queries/catalog/id-map-query/id-map-query-format.d.ts +1 -1
- package/queries/catalog/lineage-query/lineage-query-format.d.ts +1 -1
- package/queries/catalog/linter-query/linter-query-executor.d.ts +1 -1
- package/queries/catalog/linter-query/linter-query-executor.js +2 -2
- package/queries/catalog/linter-query/linter-query-format.d.ts +1 -1
- package/queries/catalog/linter-query/linter-query-format.js +16 -12
- package/queries/catalog/normalized-ast-query/normalized-ast-query-format.d.ts +1 -1
- package/queries/catalog/origin-query/origin-query-format.d.ts +1 -1
- package/queries/catalog/project-query/project-query-format.d.ts +1 -1
- package/queries/catalog/resolve-value-query/resolve-value-query-executor.d.ts +1 -1
- package/queries/catalog/resolve-value-query/resolve-value-query-executor.js +2 -2
- package/queries/catalog/resolve-value-query/resolve-value-query-format.d.ts +1 -1
- package/queries/catalog/search-query/search-query-executor.d.ts +1 -1
- package/queries/catalog/search-query/search-query-executor.js +2 -2
- package/queries/catalog/search-query/search-query-format.d.ts +1 -1
- package/queries/catalog/static-slice-query/static-slice-query-executor.d.ts +1 -1
- package/queries/catalog/static-slice-query/static-slice-query-executor.js +2 -2
- package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +1 -1
- package/queries/query.d.ts +76 -16
- package/queries/query.js +2 -0
- package/r-bridge/lang-4.x/ast/parser/json/parser.d.ts +2 -1
- package/r-bridge/lang-4.x/ast/parser/json/parser.js +4 -2
- package/r-bridge/lang-4.x/convert-values.js +2 -1
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-executor.d.ts +3 -1
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-executor.js +4 -4
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.d.ts +1 -1
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +7 -5
- package/r-bridge/shell.d.ts +3 -2
- package/r-bridge/shell.js +4 -5
- package/search/flowr-search-builder.d.ts +6 -2
- package/search/flowr-search-builder.js +7 -0
- package/search/flowr-search-filters.d.ts +32 -8
- package/search/flowr-search-filters.js +42 -15
- package/search/flowr-search.d.ts +4 -0
- package/search/search-executor/search-enrichers.d.ts +7 -3
- package/search/search-executor/search-enrichers.js +29 -20
- package/search/search-executor/search-generators.js +1 -1
- package/search/search-executor/search-transformer.d.ts +2 -0
- package/search/search-executor/search-transformer.js +10 -1
- package/slicing/static/static-slicer.d.ts +1 -1
- package/slicing/static/static-slicer.js +2 -3
- package/statistics/statistics.d.ts +3 -1
- package/statistics/statistics.js +5 -4
- package/util/containers.d.ts +12 -9
- package/util/containers.js +12 -9
- package/util/files.d.ts +8 -2
- package/util/files.js +22 -4
- package/util/objects.d.ts +5 -4
- package/util/r-value.d.ts +23 -0
- package/util/r-value.js +113 -0
- package/util/range.d.ts +5 -1
- package/util/range.js +11 -3
- package/util/text/strings.d.ts +6 -0
- package/util/text/strings.js +35 -0
- package/util/version.js +1 -1
- package/linter/rules/1-deprecated-functions.d.ts +0 -34
- package/linter/rules/1-deprecated-functions.js +0 -54
- package/util/cfg/cfg.d.ts +0 -0
- package/util/cfg/cfg.js +0 -2
|
@@ -55,7 +55,7 @@ export declare const ClusterQueryDefinition: {
|
|
|
55
55
|
}, input: {
|
|
56
56
|
request?: import("../../../r-bridge/retriever").RParseRequests;
|
|
57
57
|
parser?: import("../../../r-bridge/parser").Parser<import("../../../r-bridge/parser").KnownParserType>;
|
|
58
|
-
}) => import("../../../dataflow/info").DataflowInformation;
|
|
58
|
+
}, config: import("../../../config").FlowrConfigOptions) => import("../../../dataflow/info").DataflowInformation;
|
|
59
59
|
readonly requiredInput: {};
|
|
60
60
|
readonly name: "dataflow";
|
|
61
61
|
readonly description: "Construct the dataflow graph";
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { ConfigQuery, ConfigQueryResult } from './config-query-format';
|
|
2
2
|
import type { BasicQueryData } from '../../base-query-format';
|
|
3
|
-
export declare function executeConfigQuery(
|
|
3
|
+
export declare function executeConfigQuery({ config }: BasicQueryData, queries: readonly ConfigQuery[]): ConfigQueryResult;
|
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.executeConfigQuery = executeConfigQuery;
|
|
4
4
|
const log_1 = require("../../../util/log");
|
|
5
|
-
|
|
6
|
-
function executeConfigQuery(_, queries) {
|
|
5
|
+
function executeConfigQuery({ config }, queries) {
|
|
7
6
|
if (queries.length !== 1) {
|
|
8
7
|
log_1.log.warn('Config query expects only up to one query, but got', queries.length);
|
|
9
8
|
}
|
|
@@ -12,7 +11,7 @@ function executeConfigQuery(_, queries) {
|
|
|
12
11
|
/* there is no sense in measuring a get */
|
|
13
12
|
timing: 0
|
|
14
13
|
},
|
|
15
|
-
config:
|
|
14
|
+
config: config
|
|
16
15
|
};
|
|
17
16
|
}
|
|
18
17
|
//# sourceMappingURL=config-query-executor.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { ControlFlowQuery, ControlFlowQueryResult } from './control-flow-query-format';
|
|
2
2
|
import type { BasicQueryData } from '../../base-query-format';
|
|
3
|
-
export declare function executeControlFlowQuery({ dataflow: { graph }, ast }: BasicQueryData, queries: readonly ControlFlowQuery[]): ControlFlowQueryResult;
|
|
3
|
+
export declare function executeControlFlowQuery({ dataflow: { graph }, ast, config }: BasicQueryData, queries: readonly ControlFlowQuery[]): ControlFlowQueryResult;
|
|
@@ -3,13 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.executeControlFlowQuery = executeControlFlowQuery;
|
|
4
4
|
const log_1 = require("../../../util/log");
|
|
5
5
|
const extract_cfg_1 = require("../../../control-flow/extract-cfg");
|
|
6
|
-
function executeControlFlowQuery({ dataflow: { graph }, ast }, queries) {
|
|
6
|
+
function executeControlFlowQuery({ dataflow: { graph }, ast, config }, queries) {
|
|
7
7
|
if (queries.length !== 1) {
|
|
8
8
|
log_1.log.warn('The control flow query expects only up to one query, but got', queries.length);
|
|
9
9
|
}
|
|
10
10
|
const query = queries[0];
|
|
11
11
|
const start = Date.now();
|
|
12
|
-
const controlFlow = (0, extract_cfg_1.extractCfg)(ast, graph, query.config?.simplificationPasses);
|
|
12
|
+
const controlFlow = (0, extract_cfg_1.extractCfg)(ast, config, graph, query.config?.simplificationPasses);
|
|
13
13
|
return {
|
|
14
14
|
'.meta': {
|
|
15
15
|
timing: Date.now() - start
|
|
@@ -62,7 +62,7 @@ export declare const ControlFlowQueryDefinition: {
|
|
|
62
62
|
}, input: {
|
|
63
63
|
request?: import("../../../r-bridge/retriever").RParseRequests;
|
|
64
64
|
parser?: import("../../../r-bridge/parser").Parser<import("../../../r-bridge/parser").KnownParserType>;
|
|
65
|
-
}) => import("../../../dataflow/info").DataflowInformation;
|
|
65
|
+
}, config: import("../../../config").FlowrConfigOptions) => import("../../../dataflow/info").DataflowInformation;
|
|
66
66
|
readonly requiredInput: {};
|
|
67
67
|
readonly name: "dataflow";
|
|
68
68
|
readonly description: "Construct the dataflow graph";
|
|
@@ -54,7 +54,7 @@ export declare const DataflowLensQueryDefinition: {
|
|
|
54
54
|
}, input: {
|
|
55
55
|
request?: import("../../../r-bridge/retriever").RParseRequests;
|
|
56
56
|
parser?: import("../../../r-bridge/parser").Parser<import("../../../r-bridge/parser").KnownParserType>;
|
|
57
|
-
}) => import("../../../dataflow/info").DataflowInformation;
|
|
57
|
+
}, config: import("../../../config").FlowrConfigOptions) => import("../../../dataflow/info").DataflowInformation;
|
|
58
58
|
readonly requiredInput: {};
|
|
59
59
|
readonly name: "dataflow";
|
|
60
60
|
readonly description: "Construct the dataflow graph";
|
|
@@ -55,7 +55,7 @@ export declare const DataflowQueryDefinition: {
|
|
|
55
55
|
}, input: {
|
|
56
56
|
request?: import("../../../r-bridge/retriever").RParseRequests;
|
|
57
57
|
parser?: import("../../../r-bridge/parser").Parser<import("../../../r-bridge/parser").KnownParserType>;
|
|
58
|
-
}) => import("../../../dataflow/info").DataflowInformation;
|
|
58
|
+
}, config: import("../../../config").FlowrConfigOptions) => import("../../../dataflow/info").DataflowInformation;
|
|
59
59
|
readonly requiredInput: {};
|
|
60
60
|
readonly name: "dataflow";
|
|
61
61
|
readonly description: "Construct the dataflow graph";
|
|
@@ -4,12 +4,9 @@ exports.executeDependenciesQuery = executeDependenciesQuery;
|
|
|
4
4
|
const query_1 = require("../../query");
|
|
5
5
|
const dependencies_query_format_1 = require("./dependencies-query-format");
|
|
6
6
|
const vertex_1 = require("../../../dataflow/graph/vertex");
|
|
7
|
-
const graph_1 = require("../../../dataflow/graph/graph");
|
|
8
7
|
const log_1 = require("../../../util/log");
|
|
9
8
|
const type_1 = require("../../../r-bridge/lang-4.x/ast/model/type");
|
|
10
|
-
const r_function_call_1 = require("../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
|
|
11
9
|
const visitor_1 = require("../../../r-bridge/lang-4.x/ast/model/processing/visitor");
|
|
12
|
-
const assert_1 = require("../../../util/assert");
|
|
13
10
|
const objects_1 = require("../../../util/objects");
|
|
14
11
|
const library_functions_1 = require("./function-info/library-functions");
|
|
15
12
|
const source_functions_1 = require("./function-info/source-functions");
|
|
@@ -17,10 +14,7 @@ const read_functions_1 = require("./function-info/read-functions");
|
|
|
17
14
|
const write_functions_1 = require("./function-info/write-functions");
|
|
18
15
|
const function_info_1 = require("./function-info/function-info");
|
|
19
16
|
const identify_link_to_last_call_relation_1 = require("../call-context-query/identify-link-to-last-call-relation");
|
|
20
|
-
const
|
|
21
|
-
const general_1 = require("../../../dataflow/eval/values/general");
|
|
22
|
-
const alias_tracking_1 = require("../../../dataflow/eval/resolve/alias-tracking");
|
|
23
|
-
const string_constants_1 = require("../../../dataflow/eval/values/string/string-constants");
|
|
17
|
+
const resolve_argument_1 = require("../../../dataflow/eval/resolve/resolve-argument");
|
|
24
18
|
function collectNamespaceAccesses(data, libraries) {
|
|
25
19
|
/* for libraries, we have to additionally track all uses of `::` and `:::`, for this we currently simply traverse all uses */
|
|
26
20
|
(0, visitor_1.visitAst)(data.ast.ast, n => {
|
|
@@ -29,7 +23,7 @@ function collectNamespaceAccesses(data, libraries) {
|
|
|
29
23
|
libraries.push({
|
|
30
24
|
nodeId: n.info.id,
|
|
31
25
|
functionName: (n.info.fullLexeme ?? n.lexeme).includes(':::') ? ':::' : '::',
|
|
32
|
-
libraryName: n.namespace
|
|
26
|
+
libraryName: n.namespace,
|
|
33
27
|
});
|
|
34
28
|
}
|
|
35
29
|
});
|
|
@@ -119,7 +113,7 @@ function getResults(data, results, kind, functions, makeInfo) {
|
|
|
119
113
|
return kindEntries.flatMap(([name, results]) => results.flatMap(({ id, linkedIds }) => {
|
|
120
114
|
const vertex = data.dataflow.graph.getVertex(id);
|
|
121
115
|
const info = functions.find(f => f.name === name);
|
|
122
|
-
const args =
|
|
116
|
+
const args = (0, resolve_argument_1.getArgumentStringValue)(data.config.solver.variables, data.dataflow.graph, vertex, info.argIdx, info.argName, info.resolveValue);
|
|
123
117
|
const linkedArgs = collectValuesFromLinks(args, data, linkedIds);
|
|
124
118
|
const foundValues = linkedArgs ?? args;
|
|
125
119
|
if (!foundValues) {
|
|
@@ -161,7 +155,7 @@ function collectValuesFromLinks(args, data, linkedIds) {
|
|
|
161
155
|
if (vertex === undefined || vertex.tag !== vertex_1.VertexType.FunctionCall) {
|
|
162
156
|
continue;
|
|
163
157
|
}
|
|
164
|
-
const args =
|
|
158
|
+
const args = (0, resolve_argument_1.getArgumentStringValue)(data.config.solver.variables, data.dataflow.graph, vertex, info.argIdx, info.argName, info.resolveValue);
|
|
165
159
|
if (args === undefined) {
|
|
166
160
|
continue;
|
|
167
161
|
}
|
|
@@ -175,112 +169,6 @@ function collectValuesFromLinks(args, data, linkedIds) {
|
|
|
175
169
|
}
|
|
176
170
|
return map.size ? map : undefined;
|
|
177
171
|
}
|
|
178
|
-
function hasCharacterOnly(data, vertex, idMap) {
|
|
179
|
-
if (!vertex.args || vertex.args.length === 0 || !idMap) {
|
|
180
|
-
return false;
|
|
181
|
-
}
|
|
182
|
-
const treatAsChar = getArgumentValue(data, vertex, 5, 'character.only', true);
|
|
183
|
-
if (!treatAsChar) {
|
|
184
|
-
return false;
|
|
185
|
-
}
|
|
186
|
-
const hasTrue = [...treatAsChar.values()].some(set => set?.has('TRUE'));
|
|
187
|
-
const hasFalse = hasTrue ? [...treatAsChar.values()].some(set => set === undefined || set.has('FALSE')) : false;
|
|
188
|
-
if (hasTrue && hasFalse) {
|
|
189
|
-
return 'maybe';
|
|
190
|
-
}
|
|
191
|
-
else {
|
|
192
|
-
return hasTrue;
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
function resolveBasedOnConfig(data, vertex, argument, environment, idMap, resolveValue) {
|
|
196
|
-
let full = true;
|
|
197
|
-
if (!resolveValue) {
|
|
198
|
-
full = false;
|
|
199
|
-
}
|
|
200
|
-
if (resolveValue === 'library') {
|
|
201
|
-
const hasChar = hasCharacterOnly(data, vertex, idMap);
|
|
202
|
-
if (hasChar === false) {
|
|
203
|
-
if (argument.type === type_1.RType.Symbol) {
|
|
204
|
-
return [argument.lexeme];
|
|
205
|
-
}
|
|
206
|
-
full = false;
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
full = true;
|
|
210
|
-
const resolved = (0, general_1.valueSetGuard)((0, alias_tracking_1.resolveIdToValue)(argument, { environment, graph: data.dataflow.graph, full: full }));
|
|
211
|
-
if (resolved) {
|
|
212
|
-
const values = [];
|
|
213
|
-
for (const value of resolved.elements) {
|
|
214
|
-
if (!(0, r_value_1.isValue)(value)) {
|
|
215
|
-
return undefined;
|
|
216
|
-
}
|
|
217
|
-
if (value.type === 'string' && (0, r_value_1.isValue)(value.value)) {
|
|
218
|
-
values.push(value.value.str);
|
|
219
|
-
}
|
|
220
|
-
else if (value.type === 'logical' && (0, r_value_1.isValue)(value.value)) {
|
|
221
|
-
values.push(value.value.valueOf() ? 'TRUE' : 'FALSE');
|
|
222
|
-
}
|
|
223
|
-
else if (value.type === 'vector' && (0, r_value_1.isValue)(value.elements)) {
|
|
224
|
-
const elements = (0, string_constants_1.collectStrings)(value.elements);
|
|
225
|
-
if (elements === undefined) {
|
|
226
|
-
return undefined;
|
|
227
|
-
}
|
|
228
|
-
values.push(...elements);
|
|
229
|
-
}
|
|
230
|
-
else {
|
|
231
|
-
return undefined;
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
return values;
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
/**
|
|
238
|
-
* Get the values of all arguments matching the criteria.
|
|
239
|
-
*/
|
|
240
|
-
function getArgumentValue(data, vertex, argumentIndex, argumentName, resolveValue) {
|
|
241
|
-
const graph = data.dataflow.graph;
|
|
242
|
-
if (argumentName) {
|
|
243
|
-
const arg = vertex?.args.findIndex(arg => arg !== r_function_call_1.EmptyArgument && arg.name === argumentName);
|
|
244
|
-
if (arg >= 0) {
|
|
245
|
-
argumentIndex = arg;
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
if (!vertex || argumentIndex === undefined) {
|
|
249
|
-
return undefined;
|
|
250
|
-
}
|
|
251
|
-
if (argumentIndex === 'unnamed') {
|
|
252
|
-
// return all unnamed arguments
|
|
253
|
-
const references = vertex.args.filter(arg => arg !== r_function_call_1.EmptyArgument && !arg.name).map(graph_1.getReferenceOfArgument).filter(assert_1.isNotUndefined);
|
|
254
|
-
const map = new Map();
|
|
255
|
-
for (const ref of references) {
|
|
256
|
-
let valueNode = graph.idMap?.get(ref);
|
|
257
|
-
if (valueNode?.type === type_1.RType.Argument) {
|
|
258
|
-
valueNode = valueNode.value;
|
|
259
|
-
}
|
|
260
|
-
if (valueNode) {
|
|
261
|
-
// this should be evaluated in the callee-context
|
|
262
|
-
const values = resolveBasedOnConfig(data, vertex, valueNode, vertex.environment, graph.idMap, resolveValue) ?? [dependencies_query_format_1.Unknown];
|
|
263
|
-
map.set(ref, new Set(values));
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
return map;
|
|
267
|
-
}
|
|
268
|
-
if (argumentIndex < vertex.args.length) {
|
|
269
|
-
const arg = (0, graph_1.getReferenceOfArgument)(vertex.args[argumentIndex]);
|
|
270
|
-
if (!arg) {
|
|
271
|
-
return undefined;
|
|
272
|
-
}
|
|
273
|
-
let valueNode = graph.idMap?.get(arg);
|
|
274
|
-
if (valueNode?.type === type_1.RType.Argument) {
|
|
275
|
-
valueNode = valueNode.value;
|
|
276
|
-
}
|
|
277
|
-
if (valueNode) {
|
|
278
|
-
const values = resolveBasedOnConfig(data, vertex, valueNode, vertex.environment, graph.idMap, resolveValue) ?? [dependencies_query_format_1.Unknown];
|
|
279
|
-
return new Map([[arg, new Set(values)]]);
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
return undefined;
|
|
283
|
-
}
|
|
284
172
|
function getFunctionsToCheck(customFunctions, ignoreDefaultFunctions, defaultFunctions) {
|
|
285
173
|
let functions = ignoreDefaultFunctions ? [] : [...defaultFunctions];
|
|
286
174
|
if (customFunctions) {
|
|
@@ -79,7 +79,7 @@ export declare const DependenciesQueryDefinition: {
|
|
|
79
79
|
}, input: {
|
|
80
80
|
request?: import("../../../r-bridge/retriever").RParseRequests;
|
|
81
81
|
parser?: import("../../../r-bridge/parser").Parser<import("../../../r-bridge/parser").KnownParserType>;
|
|
82
|
-
}) => import("../../../dataflow/info").DataflowInformation;
|
|
82
|
+
}, config: import("../../../config").FlowrConfigOptions) => import("../../../dataflow/info").DataflowInformation;
|
|
83
83
|
readonly requiredInput: {};
|
|
84
84
|
readonly name: "dataflow";
|
|
85
85
|
readonly description: "Construct the dataflow graph";
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { DfShapeQuery, DfShapeQueryResult } from './df-shape-query-format';
|
|
2
|
+
import type { BasicQueryData } from '../../base-query-format';
|
|
3
|
+
export declare function executeDfShapeQuery({ dataflow: { graph }, ast, config }: BasicQueryData, queries: readonly DfShapeQuery[]): DfShapeQueryResult;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.executeDfShapeQuery = executeDfShapeQuery;
|
|
4
|
+
const log_1 = require("../../../util/log");
|
|
5
|
+
const extract_cfg_1 = require("../../../control-flow/extract-cfg");
|
|
6
|
+
const shape_inference_1 = require("../../../abstract-interpretation/data-frame/shape-inference");
|
|
7
|
+
const parse_1 = require("../../../slicing/criterion/parse");
|
|
8
|
+
function executeDfShapeQuery({ dataflow: { graph }, ast, config }, queries) {
|
|
9
|
+
if (queries.length !== 1 && queries.some(query => query.criterion === undefined)) {
|
|
10
|
+
log_1.log.warn('The dataframe shape query expects only up to one query without slicing criterion, but got', queries.length);
|
|
11
|
+
queries = [{ type: 'df-shape' }];
|
|
12
|
+
}
|
|
13
|
+
const start = Date.now();
|
|
14
|
+
const cfg = (0, extract_cfg_1.extractCfg)(ast, config, graph);
|
|
15
|
+
const domains = (0, shape_inference_1.inferDataFrameShapes)(cfg, graph, ast, config);
|
|
16
|
+
if (queries.length === 1 && queries[0].criterion === undefined) {
|
|
17
|
+
return {
|
|
18
|
+
'.meta': {
|
|
19
|
+
timing: Date.now() - start
|
|
20
|
+
},
|
|
21
|
+
domains: domains
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
const result = new Map();
|
|
25
|
+
for (const query of queries) {
|
|
26
|
+
if (query.criterion === undefined) {
|
|
27
|
+
log_1.log.warn('Missing criterion in dataframe shape query');
|
|
28
|
+
continue;
|
|
29
|
+
}
|
|
30
|
+
else if (result.has(query.criterion)) {
|
|
31
|
+
log_1.log.warn('Duplicate criterion in dataframe shape query:', query.criterion);
|
|
32
|
+
continue;
|
|
33
|
+
}
|
|
34
|
+
const nodeId = (0, parse_1.slicingCriterionToId)(query.criterion, ast.idMap);
|
|
35
|
+
const node = ast.idMap.get(nodeId);
|
|
36
|
+
const value = (0, shape_inference_1.resolveIdToDataFrameShape)(node?.info.id, graph);
|
|
37
|
+
result.set(query.criterion, value);
|
|
38
|
+
}
|
|
39
|
+
return {
|
|
40
|
+
'.meta': {
|
|
41
|
+
timing: Date.now() - start
|
|
42
|
+
},
|
|
43
|
+
domains: result
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=df-shape-query-executor.js.map
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import type { BaseQueryFormat, BaseQueryResult } from '../../base-query-format';
|
|
2
|
+
import Joi from 'joi';
|
|
3
|
+
import type { DataFrameDomain, DataFrameStateDomain } from '../../../abstract-interpretation/data-frame/domain';
|
|
4
|
+
import { executeDfShapeQuery } from './df-shape-query-executor';
|
|
5
|
+
import type { SingleSlicingCriterion } from '../../../slicing/criterion/parse';
|
|
6
|
+
/** Infer the shape of data frames using abstract interpretation. */
|
|
7
|
+
export interface DfShapeQuery extends BaseQueryFormat {
|
|
8
|
+
readonly type: 'df-shape';
|
|
9
|
+
readonly criterion?: SingleSlicingCriterion;
|
|
10
|
+
}
|
|
11
|
+
export interface DfShapeQueryResult extends BaseQueryResult {
|
|
12
|
+
domains: DataFrameStateDomain | Map<SingleSlicingCriterion, DataFrameDomain | undefined>;
|
|
13
|
+
}
|
|
14
|
+
export declare const DfShapeQueryDefinition: {
|
|
15
|
+
readonly executor: typeof executeDfShapeQuery;
|
|
16
|
+
readonly asciiSummarizer: (formatter: import("../../../util/text/ansi").OutputFormatter, _processed: import("../../../core/steps/pipeline/pipeline").PipelineOutput<import("../../../core/steps/pipeline/pipeline").Pipeline<{
|
|
17
|
+
readonly name: "parse";
|
|
18
|
+
readonly humanReadableName: "parse with R shell";
|
|
19
|
+
readonly description: "Parse the given R code into an AST";
|
|
20
|
+
readonly processor: (_results: unknown, input: Partial<import("../../../r-bridge/parser").ParseRequiredInput<string>>) => Promise<import("../../../r-bridge/parser").ParseStepOutput<string>>;
|
|
21
|
+
readonly executed: import("../../../core/steps/pipeline-step").PipelineStepStage.OncePerFile;
|
|
22
|
+
readonly printer: {
|
|
23
|
+
readonly 0: typeof import("../../../core/print/print").internalPrinter;
|
|
24
|
+
readonly 2: {
|
|
25
|
+
(value: any, replacer?: (this: any, key: string, value: any) => any, space?: string | number): string;
|
|
26
|
+
(value: any, replacer?: (number | string)[] | null, space?: string | number): string;
|
|
27
|
+
};
|
|
28
|
+
readonly 5: ({ parsed }: import("../../../r-bridge/parser").ParseStepOutput<string>, config: import("../../../util/quads").QuadSerializationConfiguration) => string;
|
|
29
|
+
};
|
|
30
|
+
readonly dependencies: readonly [];
|
|
31
|
+
readonly requiredInput: import("../../../r-bridge/parser").ParseRequiredInput<string>;
|
|
32
|
+
} | {
|
|
33
|
+
readonly name: "normalize";
|
|
34
|
+
readonly humanReadableName: "normalize";
|
|
35
|
+
readonly description: "Normalize the AST to flowR's AST";
|
|
36
|
+
readonly processor: (results: {
|
|
37
|
+
parse?: import("../../../r-bridge/parser").ParseStepOutput<string>;
|
|
38
|
+
}, input: Partial<import("../../../core/steps/all/core/10-normalize").NormalizeRequiredInput>) => import("../../../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst<import("../../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, import("../../../r-bridge/lang-4.x/ast/model/model").RNode<import("../../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation>>;
|
|
39
|
+
readonly executed: import("../../../core/steps/pipeline-step").PipelineStepStage.OncePerFile;
|
|
40
|
+
readonly printer: {
|
|
41
|
+
readonly 0: typeof import("../../../core/print/print").internalPrinter;
|
|
42
|
+
readonly 2: typeof import("../../../core/print/normalize-printer").normalizedAstToJson;
|
|
43
|
+
readonly 5: typeof import("../../../core/print/normalize-printer").normalizedAstToQuads;
|
|
44
|
+
readonly 3: typeof import("../../../core/print/normalize-printer").printNormalizedAstToMermaid;
|
|
45
|
+
readonly 4: typeof import("../../../core/print/normalize-printer").printNormalizedAstToMermaidUrl;
|
|
46
|
+
};
|
|
47
|
+
readonly dependencies: readonly ["parse"];
|
|
48
|
+
readonly requiredInput: import("../../../core/steps/all/core/10-normalize").NormalizeRequiredInput;
|
|
49
|
+
} | {
|
|
50
|
+
readonly humanReadableName: "dataflow";
|
|
51
|
+
readonly processor: (results: {
|
|
52
|
+
normalize?: import("../../../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
|
|
53
|
+
}, input: {
|
|
54
|
+
request?: import("../../../r-bridge/retriever").RParseRequests;
|
|
55
|
+
parser?: import("../../../r-bridge/parser").Parser<import("../../../r-bridge/parser").KnownParserType>;
|
|
56
|
+
}, config: import("../../../config").FlowrConfigOptions) => import("../../../dataflow/info").DataflowInformation;
|
|
57
|
+
readonly requiredInput: {};
|
|
58
|
+
readonly name: "dataflow";
|
|
59
|
+
readonly description: "Construct the dataflow graph";
|
|
60
|
+
readonly executed: import("../../../core/steps/pipeline-step").PipelineStepStage.OncePerFile;
|
|
61
|
+
readonly printer: {
|
|
62
|
+
readonly 0: typeof import("../../../core/print/print").internalPrinter;
|
|
63
|
+
readonly 2: typeof import("../../../core/print/dataflow-printer").dataflowGraphToJson;
|
|
64
|
+
readonly 5: typeof import("../../../core/print/dataflow-printer").dataflowGraphToQuads;
|
|
65
|
+
readonly 3: typeof import("../../../core/print/dataflow-printer").dataflowGraphToMermaid;
|
|
66
|
+
readonly 4: typeof import("../../../core/print/dataflow-printer").dataflowGraphToMermaidUrl;
|
|
67
|
+
};
|
|
68
|
+
readonly dependencies: readonly ["normalize"];
|
|
69
|
+
}>>, queryResults: BaseQueryResult, result: string[]) => true;
|
|
70
|
+
readonly schema: Joi.ObjectSchema<any>;
|
|
71
|
+
readonly flattenInvolvedNodes: () => never[];
|
|
72
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.DfShapeQueryDefinition = void 0;
|
|
7
|
+
const ansi_1 = require("../../../util/text/ansi");
|
|
8
|
+
const time_1 = require("../../../util/text/time");
|
|
9
|
+
const joi_1 = __importDefault(require("joi"));
|
|
10
|
+
const df_shape_query_executor_1 = require("./df-shape-query-executor");
|
|
11
|
+
const json_1 = require("../../../util/json");
|
|
12
|
+
exports.DfShapeQueryDefinition = {
|
|
13
|
+
executor: df_shape_query_executor_1.executeDfShapeQuery,
|
|
14
|
+
asciiSummarizer: (formatter, _processed, queryResults, result) => {
|
|
15
|
+
const out = queryResults;
|
|
16
|
+
result.push(`Query: ${(0, ansi_1.bold)('df-shape', formatter)} (${(0, time_1.printAsMs)(out['.meta'].timing, 0)})`);
|
|
17
|
+
result.push(...out.domains.entries().take(20).map(([key, domain]) => {
|
|
18
|
+
return ` ╰ ${key}: ${JSON.stringify(domain, json_1.jsonReplacer)}`;
|
|
19
|
+
}));
|
|
20
|
+
if (out.domains.size > 20) {
|
|
21
|
+
result.push(' ╰ ... (see JSON)');
|
|
22
|
+
}
|
|
23
|
+
return true;
|
|
24
|
+
},
|
|
25
|
+
schema: joi_1.default.object({
|
|
26
|
+
type: joi_1.default.string().valid('df-shape').required().description('The type of the query.'),
|
|
27
|
+
criterion: joi_1.default.string().optional().description('The slicing criterion of the node to get the dataframe shape for.')
|
|
28
|
+
}).description('The df-shape query retrieves information on the shape of dataframes'),
|
|
29
|
+
flattenInvolvedNodes: () => []
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=df-shape-query-format.js.map
|
|
@@ -53,7 +53,7 @@ export declare const HappensBeforeQueryDefinition: {
|
|
|
53
53
|
}, input: {
|
|
54
54
|
request?: import("../../../r-bridge/retriever").RParseRequests;
|
|
55
55
|
parser?: import("../../../r-bridge/parser").Parser<import("../../../r-bridge/parser").KnownParserType>;
|
|
56
|
-
}) => import("../../../dataflow/info").DataflowInformation;
|
|
56
|
+
}, config: import("../../../config").FlowrConfigOptions) => import("../../../dataflow/info").DataflowInformation;
|
|
57
57
|
readonly requiredInput: {};
|
|
58
58
|
readonly name: "dataflow";
|
|
59
59
|
readonly description: "Construct the dataflow graph";
|
|
@@ -50,7 +50,7 @@ export declare const IdMapQueryDefinition: {
|
|
|
50
50
|
}, input: {
|
|
51
51
|
request?: import("../../../r-bridge/retriever").RParseRequests;
|
|
52
52
|
parser?: import("../../../r-bridge/parser").Parser<import("../../../r-bridge/parser").KnownParserType>;
|
|
53
|
-
}) => import("../../../dataflow/info").DataflowInformation;
|
|
53
|
+
}, config: import("../../../config").FlowrConfigOptions) => import("../../../dataflow/info").DataflowInformation;
|
|
54
54
|
readonly requiredInput: {};
|
|
55
55
|
readonly name: "dataflow";
|
|
56
56
|
readonly description: "Construct the dataflow graph";
|
|
@@ -56,7 +56,7 @@ export declare const LineageQueryDefinition: {
|
|
|
56
56
|
}, input: {
|
|
57
57
|
request?: import("../../../r-bridge/retriever").RParseRequests;
|
|
58
58
|
parser?: import("../../../r-bridge/parser").Parser<import("../../../r-bridge/parser").KnownParserType>;
|
|
59
|
-
}) => import("../../../dataflow/info").DataflowInformation;
|
|
59
|
+
}, config: import("../../../config").FlowrConfigOptions) => import("../../../dataflow/info").DataflowInformation;
|
|
60
60
|
readonly requiredInput: {};
|
|
61
61
|
readonly name: "dataflow";
|
|
62
62
|
readonly description: "Construct the dataflow graph";
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { BasicQueryData } from '../../base-query-format';
|
|
2
2
|
import type { LinterQuery, LinterQueryResult } from './linter-query-format';
|
|
3
|
-
export declare function executeLinterQuery({ ast, dataflow }: BasicQueryData, queries: readonly LinterQuery[]): LinterQueryResult;
|
|
3
|
+
export declare function executeLinterQuery({ ast, dataflow, config }: BasicQueryData, queries: readonly LinterQuery[]): LinterQueryResult;
|
|
@@ -4,7 +4,7 @@ exports.executeLinterQuery = executeLinterQuery;
|
|
|
4
4
|
const linter_rules_1 = require("../../../linter/linter-rules");
|
|
5
5
|
const log_1 = require("../../../util/log");
|
|
6
6
|
const linter_executor_1 = require("../../../linter/linter-executor");
|
|
7
|
-
function executeLinterQuery({ ast, dataflow }, queries) {
|
|
7
|
+
function executeLinterQuery({ ast, dataflow, config }, queries) {
|
|
8
8
|
const flattened = queries.flatMap(q => q.rules ?? Object.keys(linter_rules_1.LintingRules));
|
|
9
9
|
const distinct = new Set(flattened);
|
|
10
10
|
if (distinct.size !== flattened.length) {
|
|
@@ -13,7 +13,7 @@ function executeLinterQuery({ ast, dataflow }, queries) {
|
|
|
13
13
|
}
|
|
14
14
|
const results = { results: {} };
|
|
15
15
|
const start = Date.now();
|
|
16
|
-
const input = { normalize: ast, dataflow };
|
|
16
|
+
const input = { normalize: ast, dataflow, config };
|
|
17
17
|
for (const entry of distinct) {
|
|
18
18
|
const ruleName = typeof entry === 'string' ? entry : entry.name;
|
|
19
19
|
results.results[ruleName] = (0, linter_executor_1.executeLintingRule)(ruleName, input, entry?.config);
|
|
@@ -61,7 +61,7 @@ export declare const LinterQueryDefinition: {
|
|
|
61
61
|
}, input: {
|
|
62
62
|
request?: import("../../../r-bridge/retriever").RParseRequests;
|
|
63
63
|
parser?: import("../../../r-bridge/parser").Parser<import("../../../r-bridge/parser").KnownParserType>;
|
|
64
|
-
}) => import("../../../dataflow/info").DataflowInformation;
|
|
64
|
+
}, config: import("../../../config").FlowrConfigOptions) => import("../../../dataflow/info").DataflowInformation;
|
|
65
65
|
readonly requiredInput: {};
|
|
66
66
|
readonly name: "dataflow";
|
|
67
67
|
readonly description: "Construct the dataflow graph";
|
|
@@ -17,18 +17,7 @@ exports.LinterQueryDefinition = {
|
|
|
17
17
|
const out = queryResults;
|
|
18
18
|
result.push(`Query: ${(0, ansi_1.bold)('linter', formatter)} (${(0, time_1.printAsMs)(out['.meta'].timing, 0)})`);
|
|
19
19
|
for (const [ruleName, results] of Object.entries(out.results)) {
|
|
20
|
-
|
|
21
|
-
result.push(` ╰ ${ruleName}:`);
|
|
22
|
-
for (const certainty of [linter_format_1.LintingCertainty.Definitely, linter_format_1.LintingCertainty.Maybe]) {
|
|
23
|
-
const certaintyResults = results.results.filter(r => r.certainty === certainty);
|
|
24
|
-
if (certaintyResults.length) {
|
|
25
|
-
result.push(` ╰ ${certainty}:`);
|
|
26
|
-
for (const res of certaintyResults) {
|
|
27
|
-
result.push(` ╰ ${rule.prettyPrint(res)}`);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
result.push(` ╰ _Metadata_: ${(0, doc_code_1.codeInline)(JSON.stringify(results['.meta']))}`);
|
|
20
|
+
addLintingRuleResult(ruleName, results, result);
|
|
32
21
|
}
|
|
33
22
|
return true;
|
|
34
23
|
},
|
|
@@ -41,4 +30,19 @@ exports.LinterQueryDefinition = {
|
|
|
41
30
|
}).description('The linter query lints for the given set of rules and returns the result.'),
|
|
42
31
|
flattenInvolvedNodes: () => []
|
|
43
32
|
};
|
|
33
|
+
function addLintingRuleResult(ruleName, results, result) {
|
|
34
|
+
const rule = linter_rules_1.LintingRules[ruleName];
|
|
35
|
+
result.push(` ╰ **${rule.info.name}** (${ruleName}):`);
|
|
36
|
+
for (const certainty of [linter_format_1.LintingCertainty.Definitely, linter_format_1.LintingCertainty.Maybe]) {
|
|
37
|
+
const certaintyResults = results.results.filter(r => r.certainty === certainty);
|
|
38
|
+
if (certaintyResults.length) {
|
|
39
|
+
result.push(` ╰ ${certainty}:`);
|
|
40
|
+
for (const res of certaintyResults) {
|
|
41
|
+
const pretty = rule.prettyPrint[linter_format_1.LintingPrettyPrintContext.Query](res, results['.meta']);
|
|
42
|
+
result.push(` ╰ ${pretty}${res.quickFix ? ` (${res.quickFix.length} quick fix(es) available)` : ''}`);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
result.push(` ╰ _Metadata_: ${(0, doc_code_1.codeInline)(JSON.stringify(results['.meta']))}`);
|
|
47
|
+
}
|
|
44
48
|
//# sourceMappingURL=linter-query-format.js.map
|
|
@@ -53,7 +53,7 @@ export declare const NormalizedAstQueryDefinition: {
|
|
|
53
53
|
}, input: {
|
|
54
54
|
request?: import("../../../r-bridge/retriever").RParseRequests;
|
|
55
55
|
parser?: import("../../../r-bridge/parser").Parser<import("../../../r-bridge/parser").KnownParserType>;
|
|
56
|
-
}) => import("../../../dataflow/info").DataflowInformation;
|
|
56
|
+
}, config: import("../../../config").FlowrConfigOptions) => import("../../../dataflow/info").DataflowInformation;
|
|
57
57
|
readonly requiredInput: {};
|
|
58
58
|
readonly name: "dataflow";
|
|
59
59
|
readonly description: "Construct the dataflow graph";
|
|
@@ -54,7 +54,7 @@ export declare const OriginQueryDefinition: {
|
|
|
54
54
|
}, input: {
|
|
55
55
|
request?: import("../../../r-bridge/retriever").RParseRequests;
|
|
56
56
|
parser?: import("../../../r-bridge/parser").Parser<import("../../../r-bridge/parser").KnownParserType>;
|
|
57
|
-
}) => import("../../../dataflow/info").DataflowInformation;
|
|
57
|
+
}, config: import("../../../config").FlowrConfigOptions) => import("../../../dataflow/info").DataflowInformation;
|
|
58
58
|
readonly requiredInput: {};
|
|
59
59
|
readonly name: "dataflow";
|
|
60
60
|
readonly description: "Construct the dataflow graph";
|
|
@@ -49,7 +49,7 @@ export declare const ProjectQueryDefinition: {
|
|
|
49
49
|
}, input: {
|
|
50
50
|
request?: import("../../../r-bridge/retriever").RParseRequests;
|
|
51
51
|
parser?: import("../../../r-bridge/parser").Parser<import("../../../r-bridge/parser").KnownParserType>;
|
|
52
|
-
}) => import("../../../dataflow/info").DataflowInformation;
|
|
52
|
+
}, config: import("../../../config").FlowrConfigOptions) => import("../../../dataflow/info").DataflowInformation;
|
|
53
53
|
readonly requiredInput: {};
|
|
54
54
|
readonly name: "dataflow";
|
|
55
55
|
readonly description: "Construct the dataflow graph";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { ResolveValueQuery, ResolveValueQueryResult } from './resolve-value-query-format';
|
|
2
2
|
import type { BasicQueryData } from '../../base-query-format';
|
|
3
3
|
export declare function fingerPrintOfQuery(query: ResolveValueQuery): string;
|
|
4
|
-
export declare function executeResolveValueQuery({ dataflow: { graph }, ast }: BasicQueryData, queries: readonly ResolveValueQuery[]): ResolveValueQueryResult;
|
|
4
|
+
export declare function executeResolveValueQuery({ dataflow: { graph }, ast, config }: BasicQueryData, queries: readonly ResolveValueQuery[]): ResolveValueQueryResult;
|
|
@@ -8,7 +8,7 @@ const alias_tracking_1 = require("../../../dataflow/eval/resolve/alias-tracking"
|
|
|
8
8
|
function fingerPrintOfQuery(query) {
|
|
9
9
|
return JSON.stringify(query);
|
|
10
10
|
}
|
|
11
|
-
function executeResolveValueQuery({ dataflow: { graph }, ast }, queries) {
|
|
11
|
+
function executeResolveValueQuery({ dataflow: { graph }, ast, config }, queries) {
|
|
12
12
|
const start = Date.now();
|
|
13
13
|
const results = {};
|
|
14
14
|
for (const query of queries) {
|
|
@@ -18,7 +18,7 @@ function executeResolveValueQuery({ dataflow: { graph }, ast }, queries) {
|
|
|
18
18
|
}
|
|
19
19
|
const values = query.criteria
|
|
20
20
|
.map(criteria => (0, parse_1.slicingCriterionToId)(criteria, ast.idMap))
|
|
21
|
-
.flatMap(ident => (0, alias_tracking_1.resolveIdToValue)(ident, { graph, full: true, idMap: ast.idMap }));
|
|
21
|
+
.flatMap(ident => (0, alias_tracking_1.resolveIdToValue)(ident, { graph, full: true, idMap: ast.idMap, resolve: config.solver.variables }));
|
|
22
22
|
results[key] = {
|
|
23
23
|
values: values
|
|
24
24
|
};
|
|
@@ -55,7 +55,7 @@ export declare const ResolveValueQueryDefinition: {
|
|
|
55
55
|
}, input: {
|
|
56
56
|
request?: import("../../../r-bridge/retriever").RParseRequests;
|
|
57
57
|
parser?: import("../../../r-bridge/parser").Parser<import("../../../r-bridge/parser").KnownParserType>;
|
|
58
|
-
}) => import("../../../dataflow/info").DataflowInformation;
|
|
58
|
+
}, config: import("../../../config").FlowrConfigOptions) => import("../../../dataflow/info").DataflowInformation;
|
|
59
59
|
readonly requiredInput: {};
|
|
60
60
|
readonly name: "dataflow";
|
|
61
61
|
readonly description: "Construct the dataflow graph";
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { BasicQueryData } from '../../base-query-format';
|
|
2
2
|
import type { SearchQuery, SearchQueryResult } from './search-query-format';
|
|
3
|
-
export declare function executeSearch({ ast, dataflow }: BasicQueryData, queries: readonly SearchQuery[]): SearchQueryResult;
|
|
3
|
+
export declare function executeSearch({ ast, dataflow, config }: BasicQueryData, queries: readonly SearchQuery[]): SearchQueryResult;
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.executeSearch = executeSearch;
|
|
4
4
|
const flowr_search_executor_1 = require("../../../search/flowr-search-executor");
|
|
5
|
-
function executeSearch({ ast, dataflow }, queries) {
|
|
5
|
+
function executeSearch({ ast, dataflow, config }, queries) {
|
|
6
6
|
const start = Date.now();
|
|
7
7
|
const results = [];
|
|
8
8
|
for (const query of queries) {
|
|
9
9
|
const { search } = query;
|
|
10
10
|
results.push({
|
|
11
|
-
ids: (0, flowr_search_executor_1.runSearch)(search, { normalize: ast, dataflow })
|
|
11
|
+
ids: (0, flowr_search_executor_1.runSearch)(search, { normalize: ast, dataflow, config })
|
|
12
12
|
.map(({ node }) => node.info.id),
|
|
13
13
|
search
|
|
14
14
|
});
|