@eagleoutice/flowr 2.2.12 → 2.2.14
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 +82 -20
- package/benchmark/slicer.js +2 -2
- package/benchmark/summarizer/first-phase/input.js +1 -1
- package/benchmark/summarizer/first-phase/process.js +3 -3
- package/benchmark/summarizer/second-phase/process.js +1 -1
- package/benchmark/summarizer/summarizer.js +1 -1
- package/cli/common/options.js +4 -4
- package/cli/common/script.js +1 -1
- package/cli/flowr.js +1 -1
- package/cli/repl/commands/repl-cfg.d.ts +2 -0
- package/cli/repl/commands/repl-cfg.js +38 -24
- package/cli/repl/commands/repl-commands.js +4 -2
- package/cli/repl/commands/repl-dataflow.js +3 -3
- package/cli/repl/commands/repl-execute.js +1 -1
- package/cli/repl/commands/repl-main.d.ts +1 -1
- package/cli/repl/commands/repl-main.js +1 -1
- package/cli/repl/commands/repl-normalize.js +1 -1
- package/cli/repl/commands/repl-query.js +2 -2
- package/cli/repl/core.js +1 -1
- package/cli/repl/prompt.js +1 -1
- package/cli/repl/server/connection.js +4 -4
- package/cli/repl/server/messages/message-analysis.d.ts +1 -1
- package/cli/script-core/statistics-core.js +1 -1
- package/cli/script-core/statistics-helper-core.js +4 -4
- package/config.d.ts +47 -24
- package/config.js +3 -3
- package/control-flow/basic-cfg-guided-visitor.d.ts +39 -0
- package/control-flow/basic-cfg-guided-visitor.js +114 -0
- package/control-flow/cfg-properties.d.ts +26 -0
- package/control-flow/cfg-properties.js +100 -0
- package/control-flow/cfg-simplification.d.ts +18 -0
- package/control-flow/cfg-simplification.js +55 -0
- package/control-flow/cfg-to-basic-blocks.d.ts +5 -0
- package/control-flow/cfg-to-basic-blocks.js +81 -0
- package/control-flow/control-flow-graph.d.ts +247 -0
- package/control-flow/control-flow-graph.js +290 -0
- package/control-flow/dfg-cfg-guided-visitor.d.ts +32 -0
- package/control-flow/dfg-cfg-guided-visitor.js +71 -0
- package/control-flow/diff-cfg.d.ts +11 -0
- package/control-flow/diff-cfg.js +161 -0
- package/control-flow/extract-cfg.d.ts +30 -0
- package/control-flow/extract-cfg.js +475 -0
- package/control-flow/happens-before.d.ts +7 -0
- package/{util/cfg → control-flow}/happens-before.js +3 -3
- package/control-flow/semantic-cfg-guided-visitor.d.ts +452 -0
- package/control-flow/semantic-cfg-guided-visitor.js +492 -0
- package/control-flow/simple-visitor.d.ts +25 -0
- package/control-flow/simple-visitor.js +80 -0
- package/control-flow/syntax-cfg-guided-visitor.d.ts +128 -0
- package/control-flow/syntax-cfg-guided-visitor.js +166 -0
- package/core/print/print.d.ts +1 -1
- package/core/print/slice-diff-ansi.js +1 -1
- package/core/steps/pipeline/create-pipeline.js +1 -1
- package/dataflow/environments/built-in-config.js +9 -6
- package/dataflow/environments/built-in.d.ts +8 -4
- package/dataflow/environments/built-in.js +47 -5
- package/dataflow/environments/default-builtin-config.d.ts +2 -0
- package/dataflow/environments/default-builtin-config.js +81 -14
- package/dataflow/environments/resolve-by-name.js +15 -4
- package/dataflow/extractor.js +2 -2
- package/dataflow/graph/dataflowgraph-builder.d.ts +3 -1
- package/dataflow/graph/dataflowgraph-builder.js +4 -2
- package/dataflow/graph/diff-dataflow-graph.d.ts +16 -0
- package/dataflow/graph/{diff.js → diff-dataflow-graph.js} +30 -56
- package/dataflow/graph/graph.d.ts +11 -3
- package/dataflow/graph/graph.js +27 -12
- package/dataflow/graph/vertex.d.ts +17 -2
- package/dataflow/internal/linker.d.ts +3 -2
- package/dataflow/internal/linker.js +33 -24
- package/dataflow/internal/process/functions/call/argument/unpack-argument.d.ts +1 -1
- package/dataflow/internal/process/functions/call/argument/unpack-argument.js +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-access.js +12 -9
- package/dataflow/internal/process/functions/call/built-in/built-in-apply.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +84 -16
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +23 -16
- package/dataflow/internal/process/functions/call/built-in/built-in-eval.js +5 -5
- package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +9 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +3 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +15 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-get.js +4 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.js +4 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-library.js +4 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-list.js +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-pipe.js +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-quote.js +9 -7
- package/dataflow/internal/process/functions/call/built-in/built-in-repeat-loop.js +3 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-replacement.d.ts +1 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-replacement.js +19 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-rm.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-source.js +19 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-special-bin-op.js +4 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-vector.js +3 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.js +3 -3
- package/dataflow/internal/process/functions/call/common.d.ts +4 -1
- package/dataflow/internal/process/functions/call/common.js +5 -3
- package/dataflow/internal/process/functions/call/known-call-handling.d.ts +3 -2
- package/dataflow/internal/process/functions/call/known-call-handling.js +2 -1
- package/dataflow/internal/process/functions/call/named-call-handling.js +1 -1
- package/dataflow/internal/process/functions/call/unnamed-call-handling.d.ts +1 -0
- package/dataflow/internal/process/functions/call/unnamed-call-handling.js +6 -4
- package/dataflow/internal/process/process-named-call.d.ts +1 -1
- package/dataflow/internal/process/process-named-call.js +5 -5
- package/dataflow/origin/dfg-get-origin.d.ts +82 -0
- package/dataflow/origin/dfg-get-origin.js +116 -0
- package/documentation/doc-util/doc-cfg.d.ts +13 -6
- package/documentation/doc-util/doc-cfg.js +20 -15
- package/documentation/doc-util/doc-cli-option.js +4 -2
- package/documentation/doc-util/doc-dfg.js +3 -3
- package/documentation/doc-util/doc-escape.d.ts +7 -0
- package/documentation/doc-util/doc-escape.js +19 -0
- package/documentation/doc-util/doc-files.d.ts +1 -0
- package/documentation/doc-util/doc-files.js +2 -1
- package/documentation/doc-util/doc-normalized-ast.js +3 -3
- package/documentation/doc-util/doc-query.js +2 -2
- package/documentation/doc-util/doc-repl.js +1 -1
- package/documentation/doc-util/doc-search.js +1 -1
- package/documentation/doc-util/doc-server-message.js +2 -2
- package/documentation/doc-util/doc-structure.d.ts +1 -0
- package/documentation/doc-util/doc-structure.js +5 -0
- package/documentation/doc-util/doc-types.d.ts +7 -1
- package/documentation/doc-util/doc-types.js +13 -2
- package/documentation/print-capabilities-markdown.js +27 -1
- package/documentation/print-cfg-wiki.js +508 -20
- package/documentation/print-dataflow-graph-wiki.js +180 -25
- package/documentation/print-engines-wiki.js +1 -1
- package/documentation/print-faq-wiki.d.ts +1 -0
- package/documentation/print-faq-wiki.js +75 -0
- package/documentation/print-interface-wiki.js +1 -1
- package/documentation/print-linter-wiki.d.ts +1 -0
- package/documentation/print-linter-wiki.js +76 -0
- package/documentation/print-linting-and-testing-wiki.js +52 -36
- package/documentation/print-normalized-ast-wiki.js +1 -1
- package/documentation/print-onboarding-wiki.d.ts +1 -0
- package/documentation/print-onboarding-wiki.js +42 -0
- package/documentation/print-query-wiki.js +21 -1
- package/documentation/print-readme.js +10 -3
- package/linter/linter-executor.d.ts +9 -0
- package/linter/linter-executor.js +26 -0
- package/linter/linter-format.d.ts +65 -0
- package/linter/linter-format.js +9 -0
- package/linter/linter-rules.d.ts +42 -0
- package/linter/linter-rules.js +14 -0
- package/linter/rules/1-deprecated-functions.d.ts +34 -0
- package/linter/rules/1-deprecated-functions.js +54 -0
- package/linter/rules/2-file-path-validity.d.ts +48 -0
- package/linter/rules/2-file-path-validity.js +93 -0
- package/package.json +10 -6
- package/queries/catalog/call-context-query/call-context-query-executor.js +5 -5
- package/queries/catalog/call-context-query/call-context-query-format.d.ts +3 -3
- package/queries/catalog/call-context-query/call-context-query-format.js +7 -3
- package/queries/catalog/call-context-query/identify-link-to-last-call-relation.d.ts +2 -2
- package/queries/catalog/call-context-query/identify-link-to-last-call-relation.js +24 -21
- package/queries/catalog/cluster-query/cluster-query-format.d.ts +3 -1
- package/queries/catalog/cluster-query/cluster-query-format.js +6 -2
- package/queries/catalog/config-query/config-query-format.d.ts +2 -1
- package/queries/catalog/config-query/config-query-format.js +4 -3
- package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.d.ts +2 -1
- package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.js +4 -3
- package/queries/catalog/dataflow-query/dataflow-query-format.d.ts +3 -1
- package/queries/catalog/dataflow-query/dataflow-query-format.js +11 -3
- package/queries/catalog/dependencies-query/dependencies-query-executor.js +4 -2
- package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +2 -1
- package/queries/catalog/dependencies-query/dependencies-query-format.js +12 -3
- package/queries/catalog/happens-before-query/happens-before-query-executor.d.ts +1 -1
- package/queries/catalog/happens-before-query/happens-before-query-executor.js +4 -4
- package/queries/catalog/happens-before-query/happens-before-query-format.d.ts +2 -1
- package/queries/catalog/happens-before-query/happens-before-query-format.js +4 -3
- package/queries/catalog/id-map-query/id-map-query-format.d.ts +2 -1
- package/queries/catalog/id-map-query/id-map-query-format.js +4 -3
- package/queries/catalog/lineage-query/lineage-query-format.d.ts +2 -1
- package/queries/catalog/lineage-query/lineage-query-format.js +7 -3
- package/queries/catalog/linter-query/linter-query-executor.d.ts +3 -0
- package/queries/catalog/linter-query/linter-query-executor.js +28 -0
- package/queries/catalog/linter-query/linter-query-format.d.ts +80 -0
- package/queries/catalog/linter-query/linter-query-format.js +43 -0
- package/queries/catalog/location-map-query/location-map-query-format.d.ts +2 -1
- package/queries/catalog/location-map-query/location-map-query-format.js +4 -3
- package/queries/catalog/normalized-ast-query/normalized-ast-query-format.d.ts +2 -1
- package/queries/catalog/normalized-ast-query/normalized-ast-query-format.js +4 -3
- package/queries/catalog/origin-query/origin-query-executor.d.ts +5 -0
- package/queries/catalog/origin-query/origin-query-executor.js +33 -0
- package/queries/catalog/origin-query/origin-query-format.d.ts +73 -0
- package/queries/catalog/origin-query/origin-query-format.js +31 -0
- package/queries/catalog/project-query/project-query-executor.js +1 -1
- package/queries/catalog/project-query/project-query-format.d.ts +2 -1
- package/queries/catalog/project-query/project-query-format.js +4 -3
- package/queries/catalog/resolve-value-query/resolve-value-query-format.d.ts +2 -1
- package/queries/catalog/resolve-value-query/resolve-value-query-format.js +4 -3
- package/queries/catalog/search-query/search-query-format.d.ts +2 -1
- package/queries/catalog/search-query/search-query-format.js +7 -3
- package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +3 -1
- package/queries/catalog/static-slice-query/static-slice-query-format.js +11 -3
- package/queries/query-print.d.ts +1 -1
- package/queries/query-print.js +4 -4
- package/queries/query.d.ts +143 -2
- package/queries/query.js +5 -1
- package/r-bridge/lang-4.x/ast/model/nodes/r-number.d.ts +3 -2
- package/r-bridge/lang-4.x/ast/model/nodes/r-number.js +5 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-string.d.ts +3 -2
- package/r-bridge/lang-4.x/ast/model/nodes/r-string.js +5 -0
- package/r-bridge/lang-4.x/ast/model/processing/decorate.d.ts +1 -1
- package/r-bridge/lang-4.x/ast/model/processing/decorate.js +1 -1
- package/r-bridge/lang-4.x/ast/model/processing/fold.js +3 -1
- package/r-bridge/lang-4.x/ast/model/processing/stateful-fold.d.ts +1 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/expression/normalize-expression.js +1 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-argument.js +1 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-call.js +1 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-definition.js +1 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/normalize-access.js +1 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/operators/normalize-binary.js +1 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/structure/normalize-root.js +1 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/values/normalize-symbol.js +1 -1
- 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 +4 -4
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +26 -8
- package/r-bridge/retriever.js +2 -2
- package/search/flowr-search-builder.d.ts +31 -2
- package/search/flowr-search-builder.js +30 -0
- package/search/flowr-search.d.ts +7 -1
- package/search/search-executor/search-enrichers.d.ts +73 -0
- package/search/search-executor/search-enrichers.js +98 -0
- package/search/search-executor/search-generators.d.ts +7 -2
- package/search/search-executor/search-generators.js +21 -1
- package/search/search-executor/search-mappers.d.ts +19 -0
- package/search/search-executor/search-mappers.js +21 -0
- package/search/search-executor/search-transformer.d.ts +13 -1
- package/search/search-executor/search-transformer.js +11 -1
- package/slicing/criterion/collect-all.js +1 -1
- package/slicing/static/slice-call.js +13 -3
- package/statistics/features/supported/assignments/post-process.js +1 -1
- package/statistics/features/supported/defined-functions/post-process.js +2 -2
- package/statistics/features/supported/used-functions/post-process.js +1 -1
- package/statistics/features/supported/used-packages/post-process.js +2 -2
- package/statistics/features/supported/values/post-process.js +2 -2
- package/statistics/output/print-stats.js +2 -2
- package/statistics/summarizer/post-process/clusterer.d.ts +1 -1
- package/statistics/summarizer/post-process/clusterer.js +1 -1
- package/statistics/summarizer/post-process/histogram.js +3 -3
- package/statistics/summarizer/post-process/post-process-output.js +3 -3
- package/statistics/summarizer/second-phase/process.js +2 -2
- package/statistics/summarizer/summarizer.js +2 -2
- package/util/assert.js +36 -1
- package/util/cfg/cfg.d.ts +0 -80
- package/util/cfg/cfg.js +0 -549
- package/util/{arrays.d.ts → collections/arrays.d.ts} +1 -1
- package/util/{arrays.js → collections/arrays.js} +3 -3
- package/util/collections/set.js +17 -0
- package/util/diff-graph.d.ts +47 -0
- package/util/diff-graph.js +61 -0
- package/util/diff.d.ts +6 -6
- package/util/diff.js +1 -1
- package/util/mermaid/cfg.d.ts +9 -2
- package/util/mermaid/cfg.js +64 -12
- package/util/mermaid/dfg.d.ts +2 -1
- package/util/mermaid/dfg.js +26 -10
- package/util/mermaid/mermaid.d.ts +2 -0
- package/util/mermaid/mermaid.js +6 -0
- package/util/quads.js +1 -1
- package/util/schema.d.ts +1 -1
- package/util/schema.js +1 -1
- package/util/summarizer.js +1 -1
- package/util/{text.js → text/text.js} +1 -1
- package/util/{time.js → text/time.js} +1 -1
- package/util/version.js +1 -1
- package/dataflow/graph/diff.d.ts +0 -36
- package/util/cfg/happens-before.d.ts +0 -7
- package/util/cfg/visitor.d.ts +0 -9
- package/util/cfg/visitor.js +0 -30
- package/util/set.js +0 -31
- /package/util/{bimap.d.ts → collections/bimap.d.ts} +0 -0
- /package/util/{bimap.js → collections/bimap.js} +0 -0
- /package/util/{defaultmap.d.ts → collections/defaultmap.d.ts} +0 -0
- /package/util/{defaultmap.js → collections/defaultmap.js} +0 -0
- /package/util/{set.d.ts → collections/set.d.ts} +0 -0
- /package/util/{ansi.d.ts → text/ansi.d.ts} +0 -0
- /package/util/{ansi.js → text/ansi.js} +0 -0
- /package/util/{args.d.ts → text/args.d.ts} +0 -0
- /package/util/{args.js → text/args.js} +0 -0
- /package/util/{strings.d.ts → text/strings.d.ts} +0 -0
- /package/util/{strings.js → text/strings.js} +0 -0
- /package/util/{text.d.ts → text/text.d.ts} +0 -0
- /package/util/{time.d.ts → text/time.d.ts} +0 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { LintingResult } from '../linter-format';
|
|
2
|
+
import type { MergeableRecord } from '../../util/objects';
|
|
3
|
+
import type { SourceRange } from '../../util/range';
|
|
4
|
+
import type { ParentInformation } from '../../r-bridge/lang-4.x/ast/model/processing/decorate';
|
|
5
|
+
import type { FlowrSearchElementFromQuery } from '../../search/flowr-search';
|
|
6
|
+
import type { FunctionInfo } from '../../queries/catalog/dependencies-query/function-info/function-info';
|
|
7
|
+
export interface FilePathValidityResult extends LintingResult {
|
|
8
|
+
filePath: string;
|
|
9
|
+
range: SourceRange;
|
|
10
|
+
}
|
|
11
|
+
export interface FilePathValidityConfig extends MergeableRecord {
|
|
12
|
+
/**
|
|
13
|
+
* The set of functions that should additionally be considered as reading a file path.
|
|
14
|
+
* Entries in this array use the {@link FunctionInfo} format from the dependencies query.
|
|
15
|
+
*/
|
|
16
|
+
additionalReadFunctions: FunctionInfo[];
|
|
17
|
+
/**
|
|
18
|
+
* The set of functions that should additionally be considered as writing to a file path.
|
|
19
|
+
* Entries in this array use the {@link FunctionInfo} format from the dependencies query.
|
|
20
|
+
*/
|
|
21
|
+
additionalWriteFunctions: FunctionInfo[];
|
|
22
|
+
/**
|
|
23
|
+
* Whether unknown file paths should be included as linting results.
|
|
24
|
+
*/
|
|
25
|
+
includeUnknown: boolean;
|
|
26
|
+
}
|
|
27
|
+
export interface FilePathValidityMetadata extends MergeableRecord {
|
|
28
|
+
totalReads: number;
|
|
29
|
+
totalUnknown: number;
|
|
30
|
+
totalWritesBeforeAlways: number;
|
|
31
|
+
totalValid: number;
|
|
32
|
+
}
|
|
33
|
+
export declare const R2_FILE_PATH_VALIDITY: {
|
|
34
|
+
readonly createSearch: (config: FilePathValidityConfig) => import("../../search/flowr-search-builder").FlowrSearchBuilder<"from-query", [], ParentInformation, import("../../search/flowr-search").FlowrSearchElements<ParentInformation, FlowrSearchElementFromQuery<ParentInformation>[]>>;
|
|
35
|
+
readonly processSearchResult: (elements: import("../../search/flowr-search").FlowrSearchElements<ParentInformation, FlowrSearchElementFromQuery<ParentInformation>[]>, config: FilePathValidityConfig, data: {
|
|
36
|
+
normalize: import("../../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
|
|
37
|
+
dataflow: import("../../dataflow/info").DataflowInformation;
|
|
38
|
+
}) => {
|
|
39
|
+
results: FilePathValidityResult[];
|
|
40
|
+
".meta": FilePathValidityMetadata;
|
|
41
|
+
};
|
|
42
|
+
readonly prettyPrint: (result: FilePathValidityResult) => string;
|
|
43
|
+
readonly defaultConfig: {
|
|
44
|
+
readonly additionalReadFunctions: [];
|
|
45
|
+
readonly additionalWriteFunctions: [];
|
|
46
|
+
readonly includeUnknown: false;
|
|
47
|
+
};
|
|
48
|
+
};
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.R2_FILE_PATH_VALIDITY = void 0;
|
|
4
|
+
const linter_format_1 = require("../linter-format");
|
|
5
|
+
const flowr_search_builder_1 = require("../../search/flowr-search-builder");
|
|
6
|
+
const dfg_1 = require("../../util/mermaid/dfg");
|
|
7
|
+
const dependencies_query_format_1 = require("../../queries/catalog/dependencies-query/dependencies-query-format");
|
|
8
|
+
const built_in_source_1 = require("../../dataflow/internal/process/functions/call/built-in/built-in-source");
|
|
9
|
+
const logic_1 = require("../../util/logic");
|
|
10
|
+
const config_1 = require("../../config");
|
|
11
|
+
const retriever_1 = require("../../r-bridge/retriever");
|
|
12
|
+
const read_functions_1 = require("../../queries/catalog/dependencies-query/function-info/read-functions");
|
|
13
|
+
const write_functions_1 = require("../../queries/catalog/dependencies-query/function-info/write-functions");
|
|
14
|
+
const extract_cfg_1 = require("../../control-flow/extract-cfg");
|
|
15
|
+
const happens_before_1 = require("../../control-flow/happens-before");
|
|
16
|
+
exports.R2_FILE_PATH_VALIDITY = {
|
|
17
|
+
createSearch: (config) => flowr_search_builder_1.Q.fromQuery({
|
|
18
|
+
type: 'dependencies',
|
|
19
|
+
// we only want to check read and write functions, so we explicitly clear all others
|
|
20
|
+
ignoreDefaultFunctions: true,
|
|
21
|
+
readFunctions: read_functions_1.ReadFunctions.concat(config.additionalReadFunctions),
|
|
22
|
+
writeFunctions: write_functions_1.WriteFunctions.concat(config.additionalWriteFunctions)
|
|
23
|
+
}),
|
|
24
|
+
processSearchResult: (elements, config, data) => {
|
|
25
|
+
const cfg = (0, extract_cfg_1.extractSimpleCfg)(data.normalize).graph;
|
|
26
|
+
const metadata = {
|
|
27
|
+
totalReads: 0,
|
|
28
|
+
totalUnknown: 0,
|
|
29
|
+
totalWritesBeforeAlways: 0,
|
|
30
|
+
totalValid: 0
|
|
31
|
+
};
|
|
32
|
+
return {
|
|
33
|
+
results: elements.getElements().flatMap(element => {
|
|
34
|
+
const results = element.queryResult;
|
|
35
|
+
const matchingRead = results.readData.find(r => r.nodeId == element.node.info.id);
|
|
36
|
+
if (!matchingRead) {
|
|
37
|
+
return [];
|
|
38
|
+
}
|
|
39
|
+
metadata.totalReads++;
|
|
40
|
+
const range = element.node.info.fullRange;
|
|
41
|
+
// check if we can't parse the file path statically
|
|
42
|
+
if (matchingRead.source === dependencies_query_format_1.Unknown) {
|
|
43
|
+
metadata.totalUnknown++;
|
|
44
|
+
if (config.includeUnknown) {
|
|
45
|
+
return [{
|
|
46
|
+
range,
|
|
47
|
+
filePath: dependencies_query_format_1.Unknown,
|
|
48
|
+
certainty: linter_format_1.LintingCertainty.Maybe
|
|
49
|
+
}];
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
return [];
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
// check if any write to the same file happens before the read, and exclude this case if so
|
|
56
|
+
const writesToFile = results.writtenData.filter(r => samePath(r.destination, matchingRead.source));
|
|
57
|
+
const writesBefore = writesToFile.map(w => (0, happens_before_1.happensBefore)(cfg, w.nodeId, element.node.info.id));
|
|
58
|
+
if (writesBefore.some(w => w === logic_1.Ternary.Always)) {
|
|
59
|
+
metadata.totalWritesBeforeAlways++;
|
|
60
|
+
return [];
|
|
61
|
+
}
|
|
62
|
+
// check if the file exists!
|
|
63
|
+
const paths = (0, built_in_source_1.findSource)(matchingRead.source, {
|
|
64
|
+
referenceChain: element.node.info.file ? [(0, retriever_1.requestFromInput)(`file://${element.node.info.file}`)] : []
|
|
65
|
+
});
|
|
66
|
+
if (paths && paths.length) {
|
|
67
|
+
metadata.totalValid++;
|
|
68
|
+
return [];
|
|
69
|
+
}
|
|
70
|
+
return [{
|
|
71
|
+
range,
|
|
72
|
+
filePath: matchingRead.source,
|
|
73
|
+
certainty: writesBefore && writesBefore.length && writesBefore.every(w => w === logic_1.Ternary.Maybe) ? linter_format_1.LintingCertainty.Maybe : linter_format_1.LintingCertainty.Definitely
|
|
74
|
+
}];
|
|
75
|
+
}),
|
|
76
|
+
'.meta': metadata
|
|
77
|
+
};
|
|
78
|
+
},
|
|
79
|
+
prettyPrint: result => `Path ${result.filePath} at ${(0, dfg_1.formatRange)(result.range)}`,
|
|
80
|
+
defaultConfig: {
|
|
81
|
+
additionalReadFunctions: [],
|
|
82
|
+
additionalWriteFunctions: [],
|
|
83
|
+
includeUnknown: false
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
function samePath(a, b) {
|
|
87
|
+
if ((0, config_1.getConfig)().solver.resolveSource?.ignoreCapitalization === true) {
|
|
88
|
+
a = a.toLowerCase();
|
|
89
|
+
b = b.toLowerCase();
|
|
90
|
+
}
|
|
91
|
+
return a === b;
|
|
92
|
+
}
|
|
93
|
+
//# sourceMappingURL=2-file-path-validity.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eagleoutice/flowr",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.14",
|
|
4
4
|
"description": "Static Dataflow Analyzer and Program Slicer for the R Programming Language",
|
|
5
5
|
"types": "dist/src/index.d.ts",
|
|
6
6
|
"repository": {
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
"url": "https://github.com/flowr-analysis/flowr/issues"
|
|
13
13
|
},
|
|
14
14
|
"scripts": {
|
|
15
|
+
"setup:dev": "git lfs fetch && npm ci && git config --local core.hooksPath .githooks/ && git push --dry-run",
|
|
15
16
|
"main": "npm run build:bundle-flowr && node dist/src/cli/flowr.min.js",
|
|
16
17
|
"flowr": "npm run main --",
|
|
17
18
|
"main-dev": "ts-node src/cli/flowr.ts",
|
|
@@ -33,13 +34,15 @@
|
|
|
33
34
|
"wiki:search-api": "ts-node src/documentation/print-search-wiki.ts",
|
|
34
35
|
"wiki:linting-and-testing": "ts-node src/documentation/print-linting-and-testing-wiki.ts",
|
|
35
36
|
"wiki:interface": "ts-node src/documentation/print-interface-wiki.ts",
|
|
37
|
+
"wiki:onboarding": "ts-node src/documentation/print-onboarding-wiki.ts",
|
|
38
|
+
"wiki:faq": "ts-node src/documentation/print-faq-wiki.ts",
|
|
36
39
|
"wiki:cfg": "ts-node src/documentation/print-cfg-wiki.ts",
|
|
40
|
+
"wiki:linter": "ts-node src/documentation/print-linter-wiki.ts",
|
|
37
41
|
"gen:readme": "ts-node src/documentation/print-readme.ts",
|
|
38
42
|
"build": "tsc --project .",
|
|
39
43
|
"build-dev": "npm run build && npm run build:copy-wasm",
|
|
40
|
-
"build:bundle-flowr": "npm run build && esbuild --bundle dist/src/cli/flowr.js --platform=node --tree-shaking=true --bundle --minify --external:clipboardy --target=node22 --outfile=dist/src/cli/flowr.min.js && npm run build:copy-wasm
|
|
41
|
-
"build:copy-wasm": "mkdir -p dist/
|
|
42
|
-
"build:copy-wasm-min": "mkdir -p dist/src/cli && cp src/r-bridge/lang-4.x/tree-sitter/tree-sitter-r.wasm src/r-bridge/lang-4.x/tree-sitter/tree-sitter.wasm dist/src/cli",
|
|
44
|
+
"build:bundle-flowr": "npm run build && esbuild --bundle dist/src/cli/flowr.js --platform=node --tree-shaking=true --bundle --minify --external:clipboardy --target=node22 --outfile=dist/src/cli/flowr.min.js && npm run build:copy-wasm",
|
|
45
|
+
"build:copy-wasm": "mkdir -p dist/node_modules/@eagleoutice/tree-sitter-r/ && mkdir -p dist/node_modules/web-tree-sitter && cp node_modules/@eagleoutice/tree-sitter-r/tree-sitter-r.wasm dist/node_modules/@eagleoutice/tree-sitter-r/ && cp node_modules/web-tree-sitter/tree-sitter.wasm dist/node_modules/web-tree-sitter/",
|
|
43
46
|
"lint-local": "npx eslint --version && npx eslint src/ test/ --rule \"no-warning-comments: off\"",
|
|
44
47
|
"lint": "npm run license-compat -- --summary && npx eslint --version && npx eslint src/ test/",
|
|
45
48
|
"license-compat": "license-checker --onlyAllow 'MIT;MIT OR X11;GPLv2;LGPL;GNUGPL;ISC;Apache-2.0;FreeBSD;BSD-2-Clause;clearbsd;ModifiedBSD;BSD-3-Clause;Python-2.0;Unlicense;WTFPL;BlueOak-1.0.0;CC-BY-4.0;CC-BY-3.0;CC0-1.0;0BSD'",
|
|
@@ -175,7 +178,7 @@
|
|
|
175
178
|
"@eagleoutice/eslint-config-flowr": "^1.0.17",
|
|
176
179
|
"@eslint/eslintrc": "^3.2.0",
|
|
177
180
|
"@eslint/js": "^9.20.0",
|
|
178
|
-
"@j-ulrich/release-it-regex-bumper": "^5.
|
|
181
|
+
"@j-ulrich/release-it-regex-bumper": "^5.3.0",
|
|
179
182
|
"@types/command-line-args": "^5.2.3",
|
|
180
183
|
"@types/command-line-usage": "^5.0.4",
|
|
181
184
|
"@types/n-readlines": "^1.0.6",
|
|
@@ -190,7 +193,7 @@
|
|
|
190
193
|
"eslint": "^9.20.1",
|
|
191
194
|
"license-checker": "^25.0.1",
|
|
192
195
|
"npm-run-all": "^4.1.5",
|
|
193
|
-
"release-it": "^
|
|
196
|
+
"release-it": "^19.0.2",
|
|
194
197
|
"ts-node": "^10.9.2",
|
|
195
198
|
"typedoc": "^0.27.7",
|
|
196
199
|
"typedoc-plugin-missing-exports": "^3.1.0",
|
|
@@ -200,6 +203,7 @@
|
|
|
200
203
|
"vitest": "^3.0.6"
|
|
201
204
|
},
|
|
202
205
|
"dependencies": {
|
|
206
|
+
"@eagleoutice/tree-sitter-r": "^1.1.2",
|
|
203
207
|
"@xmldom/xmldom": "^0.9.7",
|
|
204
208
|
"clipboardy": "^4.0.0",
|
|
205
209
|
"command-line-args": "^6.0.1",
|
|
@@ -4,7 +4,7 @@ exports.executeCallContextQueries = executeCallContextQueries;
|
|
|
4
4
|
const node_id_1 = require("../../../r-bridge/lang-4.x/ast/model/processing/node-id");
|
|
5
5
|
const vertex_1 = require("../../../dataflow/graph/vertex");
|
|
6
6
|
const edge_1 = require("../../../dataflow/graph/edge");
|
|
7
|
-
const
|
|
7
|
+
const extract_cfg_1 = require("../../../control-flow/extract-cfg");
|
|
8
8
|
const two_layer_collector_1 = require("../../two-layer-collector");
|
|
9
9
|
const objects_1 = require("../../../util/objects");
|
|
10
10
|
const identify_link_to_last_call_relation_1 = require("./identify-link-to-last-call-relation");
|
|
@@ -85,7 +85,7 @@ function retrieveAllCallAliases(nodeId, graph) {
|
|
|
85
85
|
const aliases = new Map();
|
|
86
86
|
const visited = new Set();
|
|
87
87
|
/* we store the current call name */
|
|
88
|
-
|
|
88
|
+
let queue = [[(0, node_id_1.recoverContent)(nodeId, graph) ?? '', nodeId]];
|
|
89
89
|
while (queue.length > 0) {
|
|
90
90
|
const [str, id] = queue.shift();
|
|
91
91
|
if (visited.has(id)) {
|
|
@@ -111,7 +111,7 @@ function retrieveAllCallAliases(nodeId, graph) {
|
|
|
111
111
|
.filter(([, { types }]) => (0, edge_1.edgeIncludesType)(types, edge_1.EdgeType.Reads | edge_1.EdgeType.DefinedBy | edge_1.EdgeType.DefinedByOnCall))
|
|
112
112
|
.map(([t]) => [(0, node_id_1.recoverContent)(t, graph) ?? '', t]);
|
|
113
113
|
/** only follow defined-by and reads */
|
|
114
|
-
queue.
|
|
114
|
+
queue = queue.concat(x);
|
|
115
115
|
continue;
|
|
116
116
|
}
|
|
117
117
|
let track = edge_1.EdgeType.Calls | edge_1.EdgeType.Reads | edge_1.EdgeType.DefinedBy | edge_1.EdgeType.DefinedByOnCall;
|
|
@@ -180,7 +180,7 @@ function executeCallContextQueries({ dataflow: { graph }, ast }, queries) {
|
|
|
180
180
|
const { promotedQueries, requiresCfg } = promoteQueryCallNames(queries);
|
|
181
181
|
let cfg = undefined;
|
|
182
182
|
if (requiresCfg) {
|
|
183
|
-
cfg = (0,
|
|
183
|
+
cfg = (0, extract_cfg_1.extractCfg)(ast, graph, []);
|
|
184
184
|
}
|
|
185
185
|
const queriesWhichWantAliases = promotedQueries.filter(q => q.includeAliases);
|
|
186
186
|
for (const [nodeId, info] of graph.vertices(true)) {
|
|
@@ -203,7 +203,7 @@ function executeCallContextQueries({ dataflow: { graph }, ast }, queries) {
|
|
|
203
203
|
}
|
|
204
204
|
}
|
|
205
205
|
}
|
|
206
|
-
for (const query of promotedQueries.filter(q => q.callName.test(info.name))) {
|
|
206
|
+
for (const query of promotedQueries.filter(q => !q.includeAliases && q.callName.test(info.name))) {
|
|
207
207
|
const file = ast.idMap.get(nodeId)?.info.file;
|
|
208
208
|
if (!doesFilepathMatch(file, query.fileFilter)) {
|
|
209
209
|
continue;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { BaseQueryFormat, BaseQueryResult } from '../../base-query-format';
|
|
2
2
|
import type { NodeId } from '../../../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
3
3
|
import { executeCallContextQueries } from './call-context-query-executor';
|
|
4
|
-
import type { OutputFormatter } from '../../../util/ansi';
|
|
4
|
+
import type { OutputFormatter } from '../../../util/text/ansi';
|
|
5
5
|
import Joi from 'joi';
|
|
6
6
|
import type { PipelineOutput } from '../../../core/steps/pipeline/pipeline';
|
|
7
7
|
import type { DEFAULT_DATAFLOW_PIPELINE } from '../../../core/steps/pipeline/default-pipelines';
|
|
@@ -56,7 +56,7 @@ export interface DefaultCallContextQueryFormat<RegexType extends RegExp | string
|
|
|
56
56
|
* For now, this uses the static Control-Flow-Graph produced by flowR as the FD over-approximation is still not stable (see #1005).
|
|
57
57
|
* In short, this means that we are unable to detect origins over function call boundaries but plan on being more precise in the future.
|
|
58
58
|
*/
|
|
59
|
-
interface LinkToLastCall<CallName extends RegExp | string = RegExp | string> extends BaseQueryFormat {
|
|
59
|
+
export interface LinkToLastCall<CallName extends RegExp | string = RegExp | string> extends BaseQueryFormat {
|
|
60
60
|
readonly type: 'link-to-last-call';
|
|
61
61
|
/** Regex regarding the function name of the last call. Similar to {@link DefaultCallContextQueryFormat#callName}, strings are interpreted as a `RegExp`. */
|
|
62
62
|
readonly callName: CallName;
|
|
@@ -110,5 +110,5 @@ export declare const CallContextQueryDefinition: {
|
|
|
110
110
|
readonly executor: typeof executeCallContextQueries;
|
|
111
111
|
readonly asciiSummarizer: (formatter: OutputFormatter, processed: PipelineOutput<typeof DEFAULT_DATAFLOW_PIPELINE>, queryResults: BaseQueryResult, result: string[]) => boolean;
|
|
112
112
|
readonly schema: Joi.ObjectSchema<any>;
|
|
113
|
+
readonly flattenInvolvedNodes: (queryResults: BaseQueryResult) => NodeId[];
|
|
113
114
|
};
|
|
114
|
-
export {};
|
|
@@ -5,8 +5,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.CallContextQueryDefinition = void 0;
|
|
7
7
|
const call_context_query_executor_1 = require("./call-context-query-executor");
|
|
8
|
-
const ansi_1 = require("../../../util/ansi");
|
|
9
|
-
const time_1 = require("../../../util/time");
|
|
8
|
+
const ansi_1 = require("../../../util/text/ansi");
|
|
9
|
+
const time_1 = require("../../../util/text/time");
|
|
10
10
|
const joi_1 = __importDefault(require("joi"));
|
|
11
11
|
const query_print_1 = require("../../query-print");
|
|
12
12
|
const identify_link_to_last_call_relation_1 = require("./identify-link-to-last-call-relation");
|
|
@@ -39,6 +39,10 @@ exports.CallContextQueryDefinition = {
|
|
|
39
39
|
includeUndefinedFiles: joi_1.default.boolean().optional().description('If `fileFilter` is set, but a nodes `file` attribute is `undefined`, should we include it in the results? Defaults to `true`.')
|
|
40
40
|
}).optional().description('Filter that, when set, a node\'s file attribute must match to be considered'),
|
|
41
41
|
linkTo: joi_1.default.alternatives(CallContextQueryLinkTo, joi_1.default.array().items(CallContextQueryLinkTo)).optional().description('Links the current call to the last call of the given kind. This way, you can link a call like `points` to the latest graphics plot etc.')
|
|
42
|
-
}).description('Call context query used to find calls in the dataflow graph')
|
|
42
|
+
}).description('Call context query used to find calls in the dataflow graph'),
|
|
43
|
+
flattenInvolvedNodes: (queryResults) => {
|
|
44
|
+
const out = queryResults;
|
|
45
|
+
return Object.values(out.kinds).flatMap(({ subkinds }) => Object.values(subkinds).flatMap(subkinds => subkinds.map(subkind => subkind.id)));
|
|
46
|
+
}
|
|
43
47
|
};
|
|
44
48
|
//# sourceMappingURL=call-context-query-format.js.map
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { NodeId } from '../../../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
2
|
-
import type { ControlFlowGraph } from '../../../util/cfg/cfg';
|
|
3
2
|
import type { DataflowGraph } from '../../../dataflow/graph/graph';
|
|
4
3
|
import type { DataflowGraphVertexFunctionCall } from '../../../dataflow/graph/vertex';
|
|
5
4
|
import { RType } from '../../../r-bridge/lang-4.x/ast/model/type';
|
|
6
5
|
import type { RNodeWithParent } from '../../../r-bridge/lang-4.x/ast/model/processing/decorate';
|
|
7
6
|
import type { LinkTo } from './call-context-query-format';
|
|
7
|
+
import type { ControlFlowGraph } from '../../../control-flow/control-flow-graph';
|
|
8
8
|
export declare enum CallTargets {
|
|
9
|
-
/** call targets a function that is not defined locally (e.g., the call targets a library function) */
|
|
9
|
+
/** call targets a function that is not defined locally in the script (e.g., the call targets a library function) */
|
|
10
10
|
OnlyGlobal = "global",
|
|
11
11
|
/** call targets a function that is defined locally or globally, but must include a global function */
|
|
12
12
|
MustIncludeGlobal = "must-include-global",
|
|
@@ -5,7 +5,7 @@ exports.satisfiesCallTargets = satisfiesCallTargets;
|
|
|
5
5
|
exports.getValueOfArgument = getValueOfArgument;
|
|
6
6
|
exports.identifyLinkToLastCallRelation = identifyLinkToLastCallRelation;
|
|
7
7
|
const graph_1 = require("../../../dataflow/graph/graph");
|
|
8
|
-
const
|
|
8
|
+
const simple_visitor_1 = require("../../../control-flow/simple-visitor");
|
|
9
9
|
const vertex_1 = require("../../../dataflow/graph/vertex");
|
|
10
10
|
const edge_1 = require("../../../dataflow/graph/edge");
|
|
11
11
|
const resolve_by_name_1 = require("../../../dataflow/environments/resolve-by-name");
|
|
@@ -17,7 +17,7 @@ const r_function_call_1 = require("../../../r-bridge/lang-4.x/ast/model/nodes/r-
|
|
|
17
17
|
const cascade_action_1 = require("./cascade-action");
|
|
18
18
|
var CallTargets;
|
|
19
19
|
(function (CallTargets) {
|
|
20
|
-
/** call targets a function that is not defined locally (e.g., the call targets a library function) */
|
|
20
|
+
/** call targets a function that is not defined locally in the script (e.g., the call targets a library function) */
|
|
21
21
|
CallTargets["OnlyGlobal"] = "global";
|
|
22
22
|
/** call targets a function that is defined locally or globally, but must include a global function */
|
|
23
23
|
CallTargets["MustIncludeGlobal"] = "must-include-global";
|
|
@@ -29,16 +29,19 @@ var CallTargets;
|
|
|
29
29
|
CallTargets["Any"] = "any";
|
|
30
30
|
})(CallTargets || (exports.CallTargets = CallTargets = {}));
|
|
31
31
|
function satisfiesCallTargets(id, graph, callTarget) {
|
|
32
|
-
const callVertex = graph.
|
|
33
|
-
if (callVertex === undefined || callVertex
|
|
32
|
+
const callVertex = graph.getVertex(id, true);
|
|
33
|
+
if (callVertex === undefined || callVertex.tag !== vertex_1.VertexType.FunctionCall) {
|
|
34
|
+
return 'no';
|
|
35
|
+
}
|
|
36
|
+
const outgoing = graph.outgoingEdges(id);
|
|
37
|
+
if (outgoing === undefined) {
|
|
34
38
|
return 'no';
|
|
35
39
|
}
|
|
36
|
-
const [info, outgoing] = callVertex;
|
|
37
40
|
const callTargets = [...outgoing]
|
|
38
|
-
.filter(([,
|
|
41
|
+
.filter(([, { types }]) => (0, edge_1.edgeIncludesType)(types, edge_1.EdgeType.Calls))
|
|
39
42
|
.map(([t]) => t);
|
|
40
43
|
let builtIn = false;
|
|
41
|
-
if (
|
|
44
|
+
if (callVertex.environment === undefined) {
|
|
42
45
|
/* if we have a call with an unbound environment,
|
|
43
46
|
* this only happens if we are sure of built-in relations and want to save references
|
|
44
47
|
*/
|
|
@@ -49,8 +52,8 @@ function satisfiesCallTargets(id, graph, callTarget) {
|
|
|
49
52
|
* for performance and scoping reasons, flowR will not identify the global linkage,
|
|
50
53
|
* including any potential built-in mapping.
|
|
51
54
|
*/
|
|
52
|
-
const reResolved = (0, resolve_by_name_1.resolveByName)(
|
|
53
|
-
if (reResolved?.some(t =>
|
|
55
|
+
const reResolved = (0, resolve_by_name_1.resolveByName)(callVertex.name, callVertex.environment, identifier_1.ReferenceType.Unknown);
|
|
56
|
+
if (reResolved?.some(t => (0, built_in_1.isBuiltIn)(t.definedAt))) {
|
|
54
57
|
builtIn = true;
|
|
55
58
|
}
|
|
56
59
|
}
|
|
@@ -58,19 +61,19 @@ function satisfiesCallTargets(id, graph, callTarget) {
|
|
|
58
61
|
case CallTargets.Any:
|
|
59
62
|
return callTargets;
|
|
60
63
|
case CallTargets.OnlyGlobal:
|
|
61
|
-
if (callTargets.
|
|
62
|
-
return builtIn ? [
|
|
64
|
+
if (callTargets.every(built_in_1.isBuiltIn)) {
|
|
65
|
+
return builtIn ? ['built-in'] : [];
|
|
63
66
|
}
|
|
64
67
|
else {
|
|
65
68
|
return 'no';
|
|
66
69
|
}
|
|
67
70
|
case CallTargets.MustIncludeGlobal:
|
|
68
|
-
return builtIn || callTargets.length === 0 ? [...callTargets,
|
|
71
|
+
return builtIn || callTargets.length === 0 ? [...callTargets, 'built-in'] : 'no';
|
|
69
72
|
case CallTargets.OnlyLocal:
|
|
70
73
|
return !builtIn && callTargets.length > 0 ? callTargets : 'no';
|
|
71
74
|
case CallTargets.MustIncludeLocal:
|
|
72
75
|
if (callTargets.length > 0) {
|
|
73
|
-
return builtIn ? [...callTargets,
|
|
76
|
+
return builtIn ? [...callTargets, 'built-in'] : callTargets;
|
|
74
77
|
}
|
|
75
78
|
else {
|
|
76
79
|
return 'no';
|
|
@@ -105,25 +108,25 @@ function getValueOfArgument(graph, call, argument, additionalAllowedTypes) {
|
|
|
105
108
|
}
|
|
106
109
|
}
|
|
107
110
|
function identifyLinkToLastCallRelation(from, cfg, graph, { callName, ignoreIf, cascadeIf }) {
|
|
108
|
-
const found = [];
|
|
109
111
|
if (ignoreIf && ignoreIf(from, graph)) {
|
|
110
|
-
return
|
|
112
|
+
return [];
|
|
111
113
|
}
|
|
112
|
-
|
|
114
|
+
const found = [];
|
|
115
|
+
(0, simple_visitor_1.visitCfgInReverseOrder)(cfg, [from], node => {
|
|
113
116
|
/* we ignore the start id as it cannot be the last call */
|
|
114
117
|
if (node === from) {
|
|
115
118
|
return;
|
|
116
119
|
}
|
|
117
|
-
const vertex = graph.
|
|
118
|
-
if (vertex === undefined || vertex
|
|
120
|
+
const vertex = graph.getVertex(node, true);
|
|
121
|
+
if (vertex === undefined || vertex.tag !== vertex_1.VertexType.FunctionCall) {
|
|
119
122
|
return;
|
|
120
123
|
}
|
|
121
|
-
if (callName.test(vertex
|
|
122
|
-
const act = cascadeIf ? cascadeIf(vertex
|
|
124
|
+
if (callName.test(vertex.name)) {
|
|
125
|
+
const act = cascadeIf ? cascadeIf(vertex, from, graph) : cascade_action_1.CascadeAction.Stop;
|
|
123
126
|
if (act === cascade_action_1.CascadeAction.Skip) {
|
|
124
127
|
return;
|
|
125
128
|
}
|
|
126
|
-
const tar = satisfiesCallTargets(vertex
|
|
129
|
+
const tar = satisfiesCallTargets(vertex.id, graph, CallTargets.MustIncludeGlobal);
|
|
127
130
|
if (tar === 'no') {
|
|
128
131
|
return act === cascade_action_1.CascadeAction.Stop;
|
|
129
132
|
}
|
|
@@ -2,6 +2,7 @@ import type { BaseQueryFormat, BaseQueryResult } from '../../base-query-format';
|
|
|
2
2
|
import Joi from 'joi';
|
|
3
3
|
import type { DataflowGraphClusters } from '../../../dataflow/cluster';
|
|
4
4
|
import { executeDataflowClusterQuery } from './cluster-query-executor';
|
|
5
|
+
import type { NodeId } from '../../../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
5
6
|
/**
|
|
6
7
|
* Calculates and returns all clusters encountered in the dataflow graph.
|
|
7
8
|
*/
|
|
@@ -14,7 +15,7 @@ export interface DataflowClusterQueryResult extends BaseQueryResult {
|
|
|
14
15
|
}
|
|
15
16
|
export declare const ClusterQueryDefinition: {
|
|
16
17
|
readonly executor: typeof executeDataflowClusterQuery;
|
|
17
|
-
readonly asciiSummarizer: (formatter: import("../../../util/ansi").OutputFormatter, processed: import("../../../core/steps/pipeline/pipeline").PipelineOutput<import("../../../core/steps/pipeline/pipeline").Pipeline<{
|
|
18
|
+
readonly asciiSummarizer: (formatter: import("../../../util/text/ansi").OutputFormatter, processed: import("../../../core/steps/pipeline/pipeline").PipelineOutput<import("../../../core/steps/pipeline/pipeline").Pipeline<{
|
|
18
19
|
readonly name: "parse";
|
|
19
20
|
readonly humanReadableName: "parse with R shell";
|
|
20
21
|
readonly description: "Parse the given R code into an AST";
|
|
@@ -69,4 +70,5 @@ export declare const ClusterQueryDefinition: {
|
|
|
69
70
|
readonly dependencies: readonly ["normalize"];
|
|
70
71
|
}>>, queryResults: BaseQueryResult, result: string[]) => true;
|
|
71
72
|
readonly schema: Joi.ObjectSchema<any>;
|
|
73
|
+
readonly flattenInvolvedNodes: (queryResults: BaseQueryResult) => NodeId[];
|
|
72
74
|
};
|
|
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.ClusterQueryDefinition = void 0;
|
|
7
|
-
const ansi_1 = require("../../../util/ansi");
|
|
7
|
+
const ansi_1 = require("../../../util/text/ansi");
|
|
8
8
|
const joi_1 = __importDefault(require("joi"));
|
|
9
9
|
const cluster_query_executor_1 = require("./cluster-query-executor");
|
|
10
10
|
const dfg_1 = require("../../../util/mermaid/dfg");
|
|
@@ -27,6 +27,10 @@ exports.ClusterQueryDefinition = {
|
|
|
27
27
|
},
|
|
28
28
|
schema: joi_1.default.object({
|
|
29
29
|
type: joi_1.default.string().valid('dataflow-cluster').required().description('The type of the query.'),
|
|
30
|
-
}).description('The cluster query calculates and returns all clusters in the dataflow graph.')
|
|
30
|
+
}).description('The cluster query calculates and returns all clusters in the dataflow graph.'),
|
|
31
|
+
flattenInvolvedNodes: (queryResults) => {
|
|
32
|
+
const out = queryResults;
|
|
33
|
+
return out.clusters.flatMap(({ members }) => members);
|
|
34
|
+
}
|
|
31
35
|
};
|
|
32
36
|
//# sourceMappingURL=cluster-query-format.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { BaseQueryFormat, BaseQueryResult } from '../../base-query-format';
|
|
2
2
|
import { executeConfigQuery } from './config-query-executor';
|
|
3
|
-
import { type OutputFormatter } from '../../../util/ansi';
|
|
3
|
+
import { type OutputFormatter } from '../../../util/text/ansi';
|
|
4
4
|
import Joi from 'joi';
|
|
5
5
|
import type { FlowrConfigOptions } from '../../../config';
|
|
6
6
|
export interface ConfigQuery extends BaseQueryFormat {
|
|
@@ -13,4 +13,5 @@ export declare const ConfigQueryDefinition: {
|
|
|
13
13
|
readonly executor: typeof executeConfigQuery;
|
|
14
14
|
readonly asciiSummarizer: (formatter: OutputFormatter, _processed: unknown, queryResults: BaseQueryResult, result: string[]) => boolean;
|
|
15
15
|
readonly schema: Joi.ObjectSchema<any>;
|
|
16
|
+
readonly flattenInvolvedNodes: () => never[];
|
|
16
17
|
};
|
|
@@ -5,8 +5,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.ConfigQueryDefinition = void 0;
|
|
7
7
|
const config_query_executor_1 = require("./config-query-executor");
|
|
8
|
-
const ansi_1 = require("../../../util/ansi");
|
|
9
|
-
const time_1 = require("../../../util/time");
|
|
8
|
+
const ansi_1 = require("../../../util/text/ansi");
|
|
9
|
+
const time_1 = require("../../../util/text/time");
|
|
10
10
|
const joi_1 = __importDefault(require("joi"));
|
|
11
11
|
const json_1 = require("../../../util/json");
|
|
12
12
|
exports.ConfigQueryDefinition = {
|
|
@@ -19,6 +19,7 @@ exports.ConfigQueryDefinition = {
|
|
|
19
19
|
},
|
|
20
20
|
schema: joi_1.default.object({
|
|
21
21
|
type: joi_1.default.string().valid('config').required().description('The type of the query.'),
|
|
22
|
-
}).description('The config query retrieves the current configuration of the flowR instance.')
|
|
22
|
+
}).description('The config query retrieves the current configuration of the flowR instance.'),
|
|
23
|
+
flattenInvolvedNodes: () => []
|
|
23
24
|
};
|
|
24
25
|
//# sourceMappingURL=config-query-format.js.map
|
|
@@ -14,7 +14,7 @@ export interface DataflowLensQueryResult extends BaseQueryResult {
|
|
|
14
14
|
}
|
|
15
15
|
export declare const DataflowLensQueryDefinition: {
|
|
16
16
|
readonly executor: typeof executeDataflowLensQuery;
|
|
17
|
-
readonly asciiSummarizer: (formatter: import("../../../util/ansi").OutputFormatter, _processed: import("../../../core/steps/pipeline/pipeline").PipelineOutput<import("../../../core/steps/pipeline/pipeline").Pipeline<{
|
|
17
|
+
readonly asciiSummarizer: (formatter: import("../../../util/text/ansi").OutputFormatter, _processed: import("../../../core/steps/pipeline/pipeline").PipelineOutput<import("../../../core/steps/pipeline/pipeline").Pipeline<{
|
|
18
18
|
readonly name: "parse";
|
|
19
19
|
readonly humanReadableName: "parse with R shell";
|
|
20
20
|
readonly description: "Parse the given R code into an AST";
|
|
@@ -69,4 +69,5 @@ export declare const DataflowLensQueryDefinition: {
|
|
|
69
69
|
readonly dependencies: readonly ["normalize"];
|
|
70
70
|
}>>, queryResults: BaseQueryResult, result: string[]) => true;
|
|
71
71
|
readonly schema: Joi.ObjectSchema<any>;
|
|
72
|
+
readonly flattenInvolvedNodes: () => never[];
|
|
72
73
|
};
|
|
@@ -5,8 +5,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.DataflowLensQueryDefinition = void 0;
|
|
7
7
|
const dataflow_lens_query_executor_1 = require("./dataflow-lens-query-executor");
|
|
8
|
-
const ansi_1 = require("../../../util/ansi");
|
|
9
|
-
const time_1 = require("../../../util/time");
|
|
8
|
+
const ansi_1 = require("../../../util/text/ansi");
|
|
9
|
+
const time_1 = require("../../../util/text/time");
|
|
10
10
|
const dfg_1 = require("../../../util/mermaid/dfg");
|
|
11
11
|
const joi_1 = __importDefault(require("joi"));
|
|
12
12
|
exports.DataflowLensQueryDefinition = {
|
|
@@ -19,6 +19,7 @@ exports.DataflowLensQueryDefinition = {
|
|
|
19
19
|
},
|
|
20
20
|
schema: joi_1.default.object({
|
|
21
21
|
type: joi_1.default.string().valid('dataflow-lens').required().description('The type of the query.'),
|
|
22
|
-
}).description('The dataflow-lens query returns a simplified view on the dataflow graph')
|
|
22
|
+
}).description('The dataflow-lens query returns a simplified view on the dataflow graph'),
|
|
23
|
+
flattenInvolvedNodes: () => []
|
|
23
24
|
};
|
|
24
25
|
//# sourceMappingURL=dataflow-lens-query-format.js.map
|
|
@@ -2,6 +2,7 @@ import type { BaseQueryFormat, BaseQueryResult } from '../../base-query-format';
|
|
|
2
2
|
import type { DataflowGraph } from '../../../dataflow/graph/graph';
|
|
3
3
|
import { executeDataflowQuery } from './dataflow-query-executor';
|
|
4
4
|
import Joi from 'joi';
|
|
5
|
+
import type { NodeId } from '../../../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
5
6
|
/**
|
|
6
7
|
* Simple re-returns the dataflow graph of the analysis.
|
|
7
8
|
*/
|
|
@@ -14,7 +15,7 @@ export interface DataflowQueryResult extends BaseQueryResult {
|
|
|
14
15
|
}
|
|
15
16
|
export declare const DataflowQueryDefinition: {
|
|
16
17
|
readonly executor: typeof executeDataflowQuery;
|
|
17
|
-
readonly asciiSummarizer: (formatter: import("../../../util/ansi").OutputFormatter, _processed: import("../../../core/steps/pipeline/pipeline").PipelineOutput<import("../../../core/steps/pipeline/pipeline").Pipeline<{
|
|
18
|
+
readonly asciiSummarizer: (formatter: import("../../../util/text/ansi").OutputFormatter, _processed: import("../../../core/steps/pipeline/pipeline").PipelineOutput<import("../../../core/steps/pipeline/pipeline").Pipeline<{
|
|
18
19
|
readonly name: "parse";
|
|
19
20
|
readonly humanReadableName: "parse with R shell";
|
|
20
21
|
readonly description: "Parse the given R code into an AST";
|
|
@@ -69,4 +70,5 @@ export declare const DataflowQueryDefinition: {
|
|
|
69
70
|
readonly dependencies: readonly ["normalize"];
|
|
70
71
|
}>>, queryResults: BaseQueryResult, result: string[]) => true;
|
|
71
72
|
readonly schema: Joi.ObjectSchema<any>;
|
|
73
|
+
readonly flattenInvolvedNodes: (queryResults: BaseQueryResult) => NodeId[];
|
|
72
74
|
};
|
|
@@ -5,8 +5,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.DataflowQueryDefinition = void 0;
|
|
7
7
|
const dataflow_query_executor_1 = require("./dataflow-query-executor");
|
|
8
|
-
const ansi_1 = require("../../../util/ansi");
|
|
9
|
-
const time_1 = require("../../../util/time");
|
|
8
|
+
const ansi_1 = require("../../../util/text/ansi");
|
|
9
|
+
const time_1 = require("../../../util/text/time");
|
|
10
10
|
const dfg_1 = require("../../../util/mermaid/dfg");
|
|
11
11
|
const joi_1 = __importDefault(require("joi"));
|
|
12
12
|
exports.DataflowQueryDefinition = {
|
|
@@ -19,6 +19,14 @@ exports.DataflowQueryDefinition = {
|
|
|
19
19
|
},
|
|
20
20
|
schema: joi_1.default.object({
|
|
21
21
|
type: joi_1.default.string().valid('dataflow').required().description('The type of the query.'),
|
|
22
|
-
}).description('The dataflow query simply returns the dataflow graph, there is no need to pass it multiple times!')
|
|
22
|
+
}).description('The dataflow query simply returns the dataflow graph, there is no need to pass it multiple times!'),
|
|
23
|
+
flattenInvolvedNodes: queryResults => {
|
|
24
|
+
const flattened = [];
|
|
25
|
+
const out = queryResults;
|
|
26
|
+
for (const id of out.graph.idMap?.keys() ?? []) {
|
|
27
|
+
flattened.push(id);
|
|
28
|
+
}
|
|
29
|
+
return flattened;
|
|
30
|
+
}
|
|
23
31
|
};
|
|
24
32
|
//# sourceMappingURL=dataflow-query-format.js.map
|
|
@@ -17,6 +17,7 @@ const source_functions_1 = require("./function-info/source-functions");
|
|
|
17
17
|
const read_functions_1 = require("./function-info/read-functions");
|
|
18
18
|
const write_functions_1 = require("./function-info/write-functions");
|
|
19
19
|
const function_info_1 = require("./function-info/function-info");
|
|
20
|
+
const identify_link_to_last_call_relation_1 = require("../call-context-query/identify-link-to-last-call-relation");
|
|
20
21
|
function collectNamespaceAccesses(data, libraries) {
|
|
21
22
|
/* for libraries, we have to additionally track all uses of `::` and `:::`, for this we currently simply traverse all uses */
|
|
22
23
|
(0, visitor_1.visitAst)(data.ast.ast, n => {
|
|
@@ -96,6 +97,7 @@ function makeCallContextQuery(functions, kind) {
|
|
|
96
97
|
return functions.map(f => ({
|
|
97
98
|
type: 'call-context',
|
|
98
99
|
callName: f.name,
|
|
100
|
+
callTargets: identify_link_to_last_call_relation_1.CallTargets.MustIncludeGlobal,
|
|
99
101
|
includeAliases: false,
|
|
100
102
|
callNameExact: true,
|
|
101
103
|
subkind: f.name,
|
|
@@ -279,9 +281,9 @@ function getArgumentValue(data, vertex, argumentIndex, argumentName, resolveValu
|
|
|
279
281
|
return undefined;
|
|
280
282
|
}
|
|
281
283
|
function getFunctionsToCheck(customFunctions, ignoreDefaultFunctions, defaultFunctions) {
|
|
282
|
-
|
|
284
|
+
let functions = ignoreDefaultFunctions ? [] : [...defaultFunctions];
|
|
283
285
|
if (customFunctions) {
|
|
284
|
-
functions.
|
|
286
|
+
functions = functions.concat(customFunctions);
|
|
285
287
|
}
|
|
286
288
|
return functions;
|
|
287
289
|
}
|