@eagleoutice/flowr 2.9.12 → 2.9.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 +35 -23
- package/abstract-interpretation/absint-visitor.d.ts +1 -1
- package/abstract-interpretation/absint-visitor.js +20 -20
- package/abstract-interpretation/data-frame/mappers/replacement-mapper.js +2 -2
- package/benchmark/slicer.d.ts +5 -3
- package/benchmark/slicer.js +26 -10
- package/benchmark/stats/print.js +12 -0
- package/benchmark/stats/stats.d.ts +3 -2
- package/benchmark/stats/stats.js +1 -1
- package/benchmark/summarizer/data.d.ts +1 -0
- package/benchmark/summarizer/second-phase/process.js +5 -0
- package/cli/benchmark-app.d.ts +1 -0
- package/cli/benchmark-app.js +1 -0
- package/cli/benchmark-helper-app.d.ts +2 -1
- package/cli/benchmark-helper-app.js +6 -3
- package/cli/common/options.d.ts +8 -0
- package/cli/common/options.js +3 -1
- package/cli/common/scripts-info.d.ts +8 -0
- package/cli/export-quads-app.js +1 -1
- package/cli/flowr.js +3 -3
- package/cli/repl/commands/repl-dataflow.js +5 -5
- package/cli/repl/core.d.ts +3 -3
- package/cli/repl/parser/slice-query-parser.d.ts +1 -1
- package/cli/repl/parser/slice-query-parser.js +2 -2
- package/cli/repl/server/connection.d.ts +2 -2
- package/cli/repl/server/connection.js +2 -2
- package/cli/repl/server/messages/message-slice.d.ts +1 -1
- package/cli/repl/server/messages/message-slice.js +2 -2
- package/cli/repl/server/server.d.ts +2 -2
- package/cli/script-core/statistics-core.d.ts +2 -2
- package/cli/script-core/statistics-helper-core.d.ts +2 -2
- package/cli/script-core/statistics-helper-core.js +1 -1
- package/cli/slicer-app.js +2 -2
- package/cli/statistics-app.js +1 -1
- package/cli/statistics-helper-app.js +1 -1
- package/cli/wiki.js +2 -2
- package/config.d.ts +65 -24
- package/config.js +197 -161
- package/control-flow/extract-cfg.js +7 -10
- package/control-flow/semantic-cfg-guided-visitor.d.ts +1 -1
- package/control-flow/semantic-cfg-guided-visitor.js +43 -43
- package/control-flow/useless-loop.d.ts +1 -1
- package/control-flow/useless-loop.js +3 -3
- package/core/print/dataflow-printer.d.ts +0 -14
- package/core/print/dataflow-printer.js +0 -21
- package/core/steps/all/core/20-dataflow.d.ts +3 -3
- package/core/steps/all/core/20-dataflow.js +3 -2
- package/core/steps/all/static-slicing/00-slice.d.ts +2 -5
- package/core/steps/all/static-slicing/00-slice.js +6 -8
- package/core/steps/pipeline/default-pipelines.d.ts +89 -89
- package/core/steps/pipeline-step.d.ts +2 -2
- package/dataflow/environments/built-in-proc-name.d.ts +83 -0
- package/dataflow/environments/built-in-proc-name.js +88 -0
- package/dataflow/environments/built-in.d.ts +1 -83
- package/dataflow/environments/built-in.js +37 -120
- package/dataflow/environments/default-builtin-config.d.ts +1 -1
- package/dataflow/environments/default-builtin-config.js +75 -75
- package/dataflow/environments/identifier.d.ts +1 -0
- package/dataflow/environments/identifier.js +1 -0
- package/dataflow/eval/resolve/alias-tracking.js +12 -15
- package/dataflow/eval/resolve/resolve.js +2 -2
- package/dataflow/fn/exceptions-of-function.d.ts +1 -1
- package/dataflow/fn/exceptions-of-function.js +2 -2
- package/dataflow/graph/call-graph.d.ts +49 -19
- package/dataflow/graph/call-graph.js +117 -114
- package/dataflow/graph/dataflowgraph-builder.d.ts +1 -1
- package/dataflow/graph/dataflowgraph-builder.js +2 -2
- package/dataflow/graph/df-helper.d.ts +132 -0
- package/dataflow/graph/df-helper.js +131 -0
- package/dataflow/graph/diff-dataflow-graph.d.ts +5 -10
- package/dataflow/graph/diff-dataflow-graph.js +3 -28
- package/dataflow/graph/edge.d.ts +1 -0
- package/dataflow/graph/edge.js +1 -0
- package/dataflow/graph/graph-helper.d.ts +55 -0
- package/dataflow/graph/graph-helper.js +105 -0
- package/dataflow/graph/graph.d.ts +6 -1
- package/dataflow/graph/graph.js +14 -9
- package/dataflow/graph/vertex.d.ts +1 -1
- package/dataflow/info.d.ts +14 -4
- package/dataflow/info.js +28 -16
- package/dataflow/internal/linker.d.ts +14 -10
- package/dataflow/internal/linker.js +29 -32
- package/dataflow/internal/process/functions/call/built-in/built-in-access.js +5 -5
- package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +4 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +7 -6
- package/dataflow/internal/process/functions/call/built-in/built-in-eval.d.ts +1 -1
- 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 +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +4 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-get.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.js +3 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-library.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-list.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-local.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-local.js +5 -5
- package/dataflow/internal/process/functions/call/built-in/built-in-pipe.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-quote.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-recall.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-register-hook.js +5 -5
- package/dataflow/internal/process/functions/call/built-in/built-in-repeat-loop.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-replacement.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-replacement.js +5 -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-s-seven-dispatch.js +3 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.js +3 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-s-three-dispatch.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-s-three-dispatch.js +7 -7
- package/dataflow/internal/process/functions/call/built-in/built-in-source.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-source.js +23 -12
- package/dataflow/internal/process/functions/call/built-in/built-in-special-bin-op.js +3 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-stop-if-not.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.js +6 -9
- 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 +2 -2
- package/dataflow/internal/process/functions/call/known-call-handling.js +2 -2
- package/dataflow/internal/process/functions/call/named-call-handling.d.ts +1 -1
- package/dataflow/internal/process/functions/call/named-call-handling.js +1 -1
- package/dataflow/internal/process/functions/call/unnamed-call-handling.js +2 -2
- package/dataflow/internal/process/process-uninteresting-leaf.d.ts +1 -1
- package/dataflow/internal/process/process-uninteresting-leaf.js +1 -1
- package/dataflow/origin/dfg-get-origin.d.ts +1 -1
- package/dataflow/origin/dfg-get-symbol-refs.js +6 -6
- package/documentation/doc-readme.js +2 -2
- package/documentation/doc-util/doc-dfg.d.ts +3 -0
- package/documentation/doc-util/doc-dfg.js +5 -7
- package/documentation/doc-util/doc-normalized-ast.d.ts +0 -6
- package/documentation/doc-util/doc-normalized-ast.js +0 -23
- package/documentation/doc-util/doc-structure.js +3 -3
- package/documentation/doc-util/doc-types.js +3 -3
- package/documentation/wiki-analyzer.js +7 -5
- package/documentation/wiki-core.js +6 -7
- package/documentation/wiki-dataflow-graph.js +15 -13
- package/documentation/wiki-interface.js +8 -6
- package/documentation/wiki-linter.js +6 -5
- package/documentation/wiki-mk/doc-context.js +3 -4
- package/documentation/wiki-normalized-ast.js +5 -4
- package/documentation/wiki-query.js +28 -3
- package/engines.d.ts +2 -2
- package/engines.js +4 -4
- package/linter/linter-rules.d.ts +24 -1
- package/linter/linter-rules.js +3 -1
- package/linter/rules/dataframe-access-validation.js +5 -5
- package/linter/rules/naming-convention.d.ts +1 -1
- package/linter/rules/naming-convention.js +7 -3
- package/linter/rules/seeded-randomness.js +2 -2
- package/linter/rules/stop-with-call-arg.d.ts +35 -0
- package/linter/rules/stop-with-call-arg.js +72 -0
- package/linter/rules/useless-loop.d.ts +1 -1
- package/package.json +3 -1
- package/project/cache/flowr-analyzer-cache.d.ts +1 -1
- package/project/cache/flowr-analyzer-cache.js +1 -1
- package/project/context/flowr-analyzer-context.d.ts +6 -6
- package/project/context/flowr-analyzer-context.js +2 -2
- package/project/context/flowr-analyzer-files-context.d.ts +2 -2
- package/project/context/flowr-analyzer-files-context.js +28 -8
- package/project/flowr-analyzer-builder.d.ts +13 -6
- package/project/flowr-analyzer-builder.js +12 -3
- package/project/flowr-analyzer.d.ts +4 -4
- package/queries/catalog/call-context-query/identify-link-to-nested-call-relation.js +2 -2
- package/queries/catalog/call-graph-query/call-graph-query-format.d.ts +1 -1
- package/queries/catalog/call-graph-query/call-graph-query-format.js +2 -2
- package/queries/catalog/cluster-query/cluster-query-format.js +2 -2
- package/queries/catalog/config-query/config-query-format.d.ts +5 -5
- package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.js +2 -2
- package/queries/catalog/dataflow-query/dataflow-query-format.js +2 -2
- package/queries/catalog/df-shape-query/df-shape-query-executor.js +1 -2
- package/queries/catalog/df-shape-query/df-shape-query-format.d.ts +2 -2
- package/queries/catalog/does-call-query/does-call-query-executor.js +2 -2
- package/queries/catalog/does-call-query/does-call-query-format.d.ts +2 -2
- package/queries/catalog/files-query/files-query-format.d.ts +3 -3
- package/queries/catalog/happens-before-query/happens-before-query-executor.js +2 -2
- package/queries/catalog/inspect-exceptions-query/inspect-exception-query-executor.d.ts +1 -1
- package/queries/catalog/inspect-exceptions-query/inspect-exception-query-executor.js +1 -1
- package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.d.ts +2 -2
- package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-executor.js +3 -3
- package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.d.ts +2 -2
- package/queries/catalog/inspect-recursion-query/inspect-recursion-query-format.d.ts +2 -2
- package/queries/catalog/linter-query/linter-query-format.d.ts +3 -3
- package/queries/catalog/location-map-query/location-map-query-executor.js +2 -2
- package/queries/catalog/location-map-query/location-map-query-format.d.ts +2 -2
- package/queries/catalog/origin-query/origin-query-executor.d.ts +1 -1
- package/queries/catalog/origin-query/origin-query-executor.js +3 -3
- package/queries/catalog/origin-query/origin-query-format.d.ts +2 -2
- package/queries/catalog/provenance-query/provenance-query-executor.d.ts +9 -0
- package/queries/catalog/provenance-query/provenance-query-executor.js +37 -0
- package/queries/catalog/provenance-query/provenance-query-format.d.ts +35 -0
- package/queries/catalog/provenance-query/provenance-query-format.js +62 -0
- package/queries/catalog/resolve-value-query/resolve-value-query-executor.js +4 -4
- package/queries/catalog/resolve-value-query/resolve-value-query-format.d.ts +2 -2
- package/queries/catalog/resolve-value-query/resolve-value-query-format.js +4 -0
- package/queries/catalog/search-query/search-query-format.js +1 -1
- package/queries/catalog/static-slice-query/static-slice-query-executor.js +4 -2
- package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +4 -4
- package/queries/catalog/static-slice-query/static-slice-query-format.js +3 -3
- package/queries/query.d.ts +27 -19
- package/queries/query.js +2 -0
- package/r-bridge/lang-4.x/ast/model/model.d.ts +13 -2
- package/r-bridge/lang-4.x/ast/model/model.js +20 -1
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-definition.d.ts +8 -1
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-definition.js +13 -0
- package/r-bridge/lang-4.x/ast/parser/json/parser.d.ts +2 -2
- package/r-bridge/lang-4.x/ast/parser/json/parser.js +2 -2
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +6 -2
- package/search/flowr-search-filters.d.ts +1 -1
- package/search/flowr-search-printer.js +3 -3
- package/search/search-executor/search-enrichers.js +2 -2
- package/search/search-executor/search-generators.js +1 -1
- package/slicing/criterion/parse.d.ts +40 -16
- package/slicing/criterion/parse.js +67 -63
- package/slicing/static/slicer-types.d.ts +2 -3
- package/slicing/static/static-slicer.d.ts +3 -4
- package/slicing/static/static-slicer.js +9 -12
- package/statistics/statistics.d.ts +2 -2
- package/util/diff.d.ts +2 -2
- package/util/mermaid/ast.js +4 -4
- package/util/mermaid/cfg.js +5 -5
- package/util/mermaid/dfg.d.ts +33 -18
- package/util/mermaid/dfg.js +46 -31
- package/util/mermaid/mermaid.d.ts +57 -12
- package/util/mermaid/mermaid.js +74 -67
- package/util/objects.d.ts +12 -0
- package/util/objects.js +28 -0
- package/util/range.d.ts +8 -0
- package/util/range.js +13 -1
- package/util/slice-direction.d.ts +7 -0
- package/util/slice-direction.js +12 -0
- package/util/summarizer.js +1 -1
- package/util/version.js +1 -1
- package/dataflow/graph/invert-dfg.d.ts +0 -6
- package/dataflow/graph/invert-dfg.js +0 -20
- package/dataflow/graph/resolve-graph.d.ts +0 -8
- package/dataflow/graph/resolve-graph.js +0 -59
|
@@ -19,7 +19,7 @@ const vertex_1 = require("../../dataflow/graph/vertex");
|
|
|
19
19
|
const r_function_call_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
|
|
20
20
|
const r_value_1 = require("../../dataflow/eval/values/r-value");
|
|
21
21
|
const info_1 = require("../../dataflow/info");
|
|
22
|
-
const
|
|
22
|
+
const built_in_proc_name_1 = require("../../dataflow/environments/built-in-proc-name");
|
|
23
23
|
exports.SEEDED_RANDOMNESS = {
|
|
24
24
|
createSearch: (config) => flowr_search_builder_1.Q.all().filter(vertex_1.VertexType.FunctionCall)
|
|
25
25
|
.with(search_enrichers_1.Enrichment.CallTargets, { onlyBuiltin: true })
|
|
@@ -140,7 +140,7 @@ exports.SEEDED_RANDOMNESS = {
|
|
|
140
140
|
}
|
|
141
141
|
};
|
|
142
142
|
function getDefaultAssignments() {
|
|
143
|
-
return default_builtin_config_1.DefaultBuiltinConfig.filter(b => b.type === 'function' && (b.processor ===
|
|
143
|
+
return default_builtin_config_1.DefaultBuiltinConfig.filter(b => b.type === 'function' && (b.processor === built_in_proc_name_1.BuiltInProcName.Assignment || b.processor === built_in_proc_name_1.BuiltInProcName.AssignmentLike));
|
|
144
144
|
}
|
|
145
145
|
function isConstantArgument(graph, call, argIndex, ctx) {
|
|
146
146
|
const args = call.args.filter(arg => arg !== r_function_call_1.EmptyArgument && !arg.name).map(graph_1.FunctionArgument.getReference);
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type LintingResult, LintingRuleCertainty } from '../linter-format';
|
|
2
|
+
import { SourceLocation } from '../../util/range';
|
|
3
|
+
import type { MergeableRecord } from '../../util/objects';
|
|
4
|
+
import { LintingRuleTag } from '../linter-tags';
|
|
5
|
+
import type { Writable } from 'ts-essentials';
|
|
6
|
+
export interface StopWithCallResult extends LintingResult {
|
|
7
|
+
readonly loc: SourceLocation;
|
|
8
|
+
}
|
|
9
|
+
export type StopWithCallConfig = MergeableRecord;
|
|
10
|
+
export interface StopWithCallMetadata extends MergeableRecord {
|
|
11
|
+
consideredNodes: number;
|
|
12
|
+
}
|
|
13
|
+
export declare const STOP_WITH_CALL_ARG: {
|
|
14
|
+
readonly createSearch: () => import("../../search/flowr-search-builder").FlowrSearchBuilder<"get", ["filter"], import("../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, Promise<import("../../search/flowr-search").FlowrSearchElements<import("../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, [] | import("../../search/flowr-search").FlowrSearchElement<import("../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation>[]>>>;
|
|
15
|
+
readonly processSearchResult: (elements: import("../../search/flowr-search").FlowrSearchElements<import("../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, import("../../search/flowr-search").FlowrSearchElement<import("../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation>[]>, _config: MergeableRecord, { dataflow, analyzer }: {
|
|
16
|
+
normalize: import("../../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
|
|
17
|
+
dataflow: import("../../dataflow/info").DataflowInformation;
|
|
18
|
+
cfg: import("../../control-flow/control-flow-graph").ControlFlowInformation;
|
|
19
|
+
analyzer: import("../../project/flowr-analyzer").ReadonlyFlowrAnalysisProvider;
|
|
20
|
+
}) => {
|
|
21
|
+
results: Writable<StopWithCallResult>[];
|
|
22
|
+
'.meta': StopWithCallMetadata;
|
|
23
|
+
};
|
|
24
|
+
readonly prettyPrint: {
|
|
25
|
+
readonly query: (result: StopWithCallResult) => string;
|
|
26
|
+
readonly full: (result: StopWithCallResult) => string;
|
|
27
|
+
};
|
|
28
|
+
readonly info: {
|
|
29
|
+
readonly name: "Stop without call.=False argument";
|
|
30
|
+
readonly tags: readonly [LintingRuleTag.Smell];
|
|
31
|
+
readonly certainty: LintingRuleCertainty.BestEffort;
|
|
32
|
+
readonly description: "Checks whether stop calls without call. argument set to FALSE are used.";
|
|
33
|
+
readonly defaultConfig: {};
|
|
34
|
+
};
|
|
35
|
+
};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.STOP_WITH_CALL_ARG = void 0;
|
|
4
|
+
const linter_format_1 = require("../linter-format");
|
|
5
|
+
const range_1 = require("../../util/range");
|
|
6
|
+
const flowr_search_builder_1 = require("../../search/flowr-search-builder");
|
|
7
|
+
const linter_tags_1 = require("../linter-tags");
|
|
8
|
+
const assert_1 = require("../../util/assert");
|
|
9
|
+
const vertex_1 = require("../../dataflow/graph/vertex");
|
|
10
|
+
const alias_tracking_1 = require("../../dataflow/eval/resolve/alias-tracking");
|
|
11
|
+
const dfg_get_origin_1 = require("../../dataflow/origin/dfg-get-origin");
|
|
12
|
+
const linker_1 = require("../../dataflow/internal/linker");
|
|
13
|
+
const general_1 = require("../../dataflow/eval/values/general");
|
|
14
|
+
exports.STOP_WITH_CALL_ARG = {
|
|
15
|
+
createSearch: () => flowr_search_builder_1.Q.var('stop').filter(vertex_1.VertexType.FunctionCall),
|
|
16
|
+
processSearchResult: (elements, _config, { dataflow, analyzer }) => {
|
|
17
|
+
const meta = {
|
|
18
|
+
consideredNodes: 0
|
|
19
|
+
};
|
|
20
|
+
return {
|
|
21
|
+
results: elements.getElements()
|
|
22
|
+
.filter(element => {
|
|
23
|
+
//only built-in functions
|
|
24
|
+
const origins = (0, dfg_get_origin_1.getOriginInDfg)(dataflow.graph, element.node.info.id);
|
|
25
|
+
if ((0, assert_1.isNotUndefined)(origins)) {
|
|
26
|
+
const builtIn = origins.every(e => e.type === 3 /* OriginType.BuiltInFunctionOrigin */);
|
|
27
|
+
if (!builtIn) {
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
const fCall = dataflow.graph.getVertex(element.node.info.id);
|
|
32
|
+
//filter out function calls with argument "call." set to false
|
|
33
|
+
const stopParamMap = {
|
|
34
|
+
'...': '...',
|
|
35
|
+
'call.': 'call.',
|
|
36
|
+
'domain': 'domain'
|
|
37
|
+
};
|
|
38
|
+
const mapping = (0, linker_1.pMatch)(fCall.args, stopParamMap);
|
|
39
|
+
const mappedToStop = mapping.get('call.') ?? [];
|
|
40
|
+
for (const argId of mappedToStop) {
|
|
41
|
+
const res = (0, alias_tracking_1.resolveIdToValue)(argId, { graph: dataflow.graph, environment: fCall.environment, ctx: analyzer.inspectContext() });
|
|
42
|
+
const values = (0, general_1.valueSetGuard)(res);
|
|
43
|
+
if (values?.type === 'set' && values.elements.length !== 0) {
|
|
44
|
+
if (values.elements[0].type === 'logical') {
|
|
45
|
+
return values.elements[0].value;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return true;
|
|
50
|
+
})
|
|
51
|
+
.map(element => ({
|
|
52
|
+
certainty: linter_format_1.LintingResultCertainty.Uncertain,
|
|
53
|
+
involvedId: element.node.info.id,
|
|
54
|
+
loc: range_1.SourceLocation.fromNode(element.node)
|
|
55
|
+
}))
|
|
56
|
+
.filter(element => (0, assert_1.isNotUndefined)(element.loc)),
|
|
57
|
+
'.meta': meta
|
|
58
|
+
};
|
|
59
|
+
},
|
|
60
|
+
prettyPrint: {
|
|
61
|
+
[linter_format_1.LintingPrettyPrintContext.Query]: result => `Code at ${range_1.SourceLocation.format(result.loc)}`,
|
|
62
|
+
[linter_format_1.LintingPrettyPrintContext.Full]: result => `Code at ${range_1.SourceLocation.format(result.loc)} does call stop without setting call. to FALSE`,
|
|
63
|
+
},
|
|
64
|
+
info: {
|
|
65
|
+
name: 'Stop without call.=False argument',
|
|
66
|
+
tags: [linter_tags_1.LintingRuleTag.Smell],
|
|
67
|
+
certainty: linter_format_1.LintingRuleCertainty.BestEffort,
|
|
68
|
+
description: 'Checks whether stop calls without call. argument set to FALSE are used.',
|
|
69
|
+
defaultConfig: {}
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
//# sourceMappingURL=stop-with-call-arg.js.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { BuiltInProcName } from '../../dataflow/environments/built-in';
|
|
2
1
|
import type { MergeableRecord } from '../../util/objects';
|
|
3
2
|
import { SourceLocation } from '../../util/range';
|
|
4
3
|
import { type LintingResult, LintingResultCertainty, LintingRuleCertainty } from '../linter-format';
|
|
5
4
|
import { LintingRuleTag } from '../linter-tags';
|
|
5
|
+
import type { BuiltInProcName } from '../../dataflow/environments/built-in-proc-name';
|
|
6
6
|
export interface UselessLoopResult extends LintingResult {
|
|
7
7
|
name: string;
|
|
8
8
|
loc: SourceLocation;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eagleoutice/flowr",
|
|
3
|
-
"version": "2.9.
|
|
3
|
+
"version": "2.9.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": {
|
|
@@ -178,6 +178,7 @@
|
|
|
178
178
|
"@types/n-readlines": "^1.0.6",
|
|
179
179
|
"@types/n3": "^1.26.0",
|
|
180
180
|
"@types/object-hash": "^3.0.6",
|
|
181
|
+
"@types/object-path": "^0.11.4",
|
|
181
182
|
"@types/seedrandom": "^3.0.8",
|
|
182
183
|
"@types/semver": "^7.7.0",
|
|
183
184
|
"@types/tmp": "^0.2.6",
|
|
@@ -212,6 +213,7 @@
|
|
|
212
213
|
"n-readlines": "^1.0.3",
|
|
213
214
|
"n3": "^1.26.0",
|
|
214
215
|
"object-hash": "^3.0.0",
|
|
216
|
+
"object-path": "^0.11.8",
|
|
215
217
|
"object-sizeof": "^2.6.5",
|
|
216
218
|
"rotating-file-stream": "^3.2.8",
|
|
217
219
|
"seedrandom": "^3.0.5",
|
|
@@ -9,7 +9,7 @@ import type { CfgSimplificationPassName } from '../../control-flow/cfg-simplific
|
|
|
9
9
|
import type { ControlFlowInformation } from '../../control-flow/control-flow-graph';
|
|
10
10
|
import type { CfgKind } from '../cfg-kind';
|
|
11
11
|
import type { FlowrAnalyzerContext } from '../context/flowr-analyzer-context';
|
|
12
|
-
import
|
|
12
|
+
import { CallGraph } from '../../dataflow/graph/call-graph';
|
|
13
13
|
interface FlowrAnalyzerCacheOptions<Parser extends KnownParser> {
|
|
14
14
|
parser: Parser;
|
|
15
15
|
context: FlowrAnalyzerContext;
|
|
@@ -141,7 +141,7 @@ class FlowrAnalyzerCache extends flowr_cache_1.FlowrCache {
|
|
|
141
141
|
*/
|
|
142
142
|
async callGraph(force) {
|
|
143
143
|
if (!this.callGraphCache || force) {
|
|
144
|
-
this.callGraphCache =
|
|
144
|
+
this.callGraphCache = call_graph_1.CallGraph.compute((await this.dataflow(force)).graph);
|
|
145
145
|
}
|
|
146
146
|
return this.callGraphCache;
|
|
147
147
|
}
|
|
@@ -2,7 +2,7 @@ import { FlowrAnalyzerFilesContext, type RAnalysisRequest, type ReadOnlyFlowrAna
|
|
|
2
2
|
import { FlowrAnalyzerDependenciesContext, type ReadOnlyFlowrAnalyzerDependenciesContext } from './flowr-analyzer-dependencies-context';
|
|
3
3
|
import { type FlowrAnalyzerPlugin, PluginType } from '../plugins/flowr-analyzer-plugin';
|
|
4
4
|
import type { fileProtocol, RParseRequestFromFile, RParseRequests } from '../../r-bridge/retriever';
|
|
5
|
-
import
|
|
5
|
+
import { FlowrConfig } from '../../config';
|
|
6
6
|
import type { FlowrFileProvider } from './flowr-file';
|
|
7
7
|
import type { ReadOnlyFlowrAnalyzerEnvironmentContext } from './flowr-analyzer-environment-context';
|
|
8
8
|
import { FlowrAnalyzerEnvironmentContext } from './flowr-analyzer-environment-context';
|
|
@@ -34,7 +34,7 @@ export interface ReadOnlyFlowrAnalyzerContext {
|
|
|
34
34
|
/**
|
|
35
35
|
* The configuration options used by the analyzer.
|
|
36
36
|
*/
|
|
37
|
-
readonly config:
|
|
37
|
+
readonly config: FlowrConfig;
|
|
38
38
|
/**
|
|
39
39
|
* Run all resolution steps that can be done before the main analysis run.
|
|
40
40
|
*/
|
|
@@ -58,8 +58,8 @@ export declare class FlowrAnalyzerContext implements ReadOnlyFlowrAnalyzerContex
|
|
|
58
58
|
readonly deps: FlowrAnalyzerDependenciesContext;
|
|
59
59
|
readonly env: FlowrAnalyzerEnvironmentContext;
|
|
60
60
|
private _analyzer;
|
|
61
|
-
readonly config:
|
|
62
|
-
constructor(config:
|
|
61
|
+
readonly config: FlowrConfig;
|
|
62
|
+
constructor(config: FlowrConfig, plugins: ReadonlyMap<PluginType, readonly FlowrAnalyzerPlugin[]>);
|
|
63
63
|
/**
|
|
64
64
|
* Provides the analyzer associated with this context, if any.
|
|
65
65
|
* This is usually set when the context is used within an analyzer instance.
|
|
@@ -91,7 +91,7 @@ export declare class FlowrAnalyzerContext implements ReadOnlyFlowrAnalyzerContex
|
|
|
91
91
|
* @see {@link requestFromInput} - for details on how inputs are processed into requests.
|
|
92
92
|
* @see {@link contextFromSources} - to create a context from source code strings directly.
|
|
93
93
|
*/
|
|
94
|
-
export declare function contextFromInput(input: `${typeof fileProtocol}${string}` | string | readonly string[] | RParseRequests, config?:
|
|
94
|
+
export declare function contextFromInput(input: `${typeof fileProtocol}${string}` | string | readonly string[] | RParseRequests, config?: FlowrConfig, plugins?: FlowrAnalyzerPlugin[]): FlowrAnalyzerContext;
|
|
95
95
|
/**
|
|
96
96
|
* Create a {@link FlowrAnalyzerContext} from a set of source code strings.
|
|
97
97
|
* @param sources - A record mapping file paths to their source code content.
|
|
@@ -100,4 +100,4 @@ export declare function contextFromInput(input: `${typeof fileProtocol}${string}
|
|
|
100
100
|
* @see {@link contextFromInput} - to create a context from input requests.
|
|
101
101
|
* @see {@link FlowrInlineTextFile} - to create inline text files for the sources.
|
|
102
102
|
*/
|
|
103
|
-
export declare function contextFromSources(sources: Record<string, string>, config?:
|
|
103
|
+
export declare function contextFromSources(sources: Record<string, string>, config?: FlowrConfig, plugins?: FlowrAnalyzerPlugin[]): FlowrAnalyzerContext;
|
|
@@ -93,7 +93,7 @@ exports.FlowrAnalyzerContext = FlowrAnalyzerContext;
|
|
|
93
93
|
* @see {@link requestFromInput} - for details on how inputs are processed into requests.
|
|
94
94
|
* @see {@link contextFromSources} - to create a context from source code strings directly.
|
|
95
95
|
*/
|
|
96
|
-
function contextFromInput(input, config = config_1.
|
|
96
|
+
function contextFromInput(input, config = config_1.FlowrConfig.default(), plugins) {
|
|
97
97
|
const context = new FlowrAnalyzerContext(config, (0, arrays_1.arraysGroupBy)(plugins ?? [], (p) => p.type));
|
|
98
98
|
if (typeof input === 'string' || Array.isArray(input) && input.every(i => typeof i === 'string')) {
|
|
99
99
|
const requests = (0, retriever_1.requestFromInput)(input);
|
|
@@ -113,7 +113,7 @@ function contextFromInput(input, config = config_1.defaultConfigOptions, plugins
|
|
|
113
113
|
* @see {@link contextFromInput} - to create a context from input requests.
|
|
114
114
|
* @see {@link FlowrInlineTextFile} - to create inline text files for the sources.
|
|
115
115
|
*/
|
|
116
|
-
function contextFromSources(sources, config = config_1.
|
|
116
|
+
function contextFromSources(sources, config = config_1.FlowrConfig.default(), plugins) {
|
|
117
117
|
const context = new FlowrAnalyzerContext(config, (0, arrays_1.arraysGroupBy)(plugins ?? [], (p) => p.type));
|
|
118
118
|
for (const [p, c] of Object.entries(sources)) {
|
|
119
119
|
context.addFile(new flowr_file_1.FlowrInlineTextFile(p, c));
|
|
@@ -59,7 +59,7 @@ export interface ReadOnlyFlowrAnalyzerFilesContext {
|
|
|
59
59
|
/**
|
|
60
60
|
* Check if the context has a file with the given path.
|
|
61
61
|
* Please note, that this may also check the file system, depending on the configuration
|
|
62
|
-
* (see {@link
|
|
62
|
+
* (see {@link FlowrConfig.project.resolveUnknownPathsOnDisk}).
|
|
63
63
|
* @param path - The path to the file.
|
|
64
64
|
*
|
|
65
65
|
* If you do not know the exact path or, e.g., casing of the file, use {@link exists} instead.
|
|
@@ -70,7 +70,7 @@ export interface ReadOnlyFlowrAnalyzerFilesContext {
|
|
|
70
70
|
* @param path - The path to the file.
|
|
71
71
|
* @param ignoreCase - Whether to ignore case when checking for the file.
|
|
72
72
|
*
|
|
73
|
-
* Please note that this method checks the file system based on the configuration (see {@link
|
|
73
|
+
* Please note that this method checks the file system based on the configuration (see {@link FlowrConfig.project.resolveUnknownPathsOnDisk}).
|
|
74
74
|
* @returns The actual path of the file if it exists, otherwise `undefined`.
|
|
75
75
|
*/
|
|
76
76
|
exists(path: string, ignoreCase: boolean): string | undefined;
|
|
@@ -129,19 +129,39 @@ class FlowrAnalyzerFilesContext extends abstract_flowr_analyzer_context_1.Abstra
|
|
|
129
129
|
if (!ignoreCase) {
|
|
130
130
|
return this.hasFile(p) ? p : undefined;
|
|
131
131
|
}
|
|
132
|
+
if (this.hasFile(p)) {
|
|
133
|
+
return p;
|
|
134
|
+
}
|
|
132
135
|
// walk the directory and find the first match
|
|
133
136
|
const dir = path_1.default.dirname(p);
|
|
134
|
-
const file = path_1.default.basename(p);
|
|
137
|
+
const file = path_1.default.basename(p).toLowerCase();
|
|
135
138
|
// try to find in local known files first
|
|
136
|
-
const
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
139
|
+
for (const f of this.files.keys()) {
|
|
140
|
+
if (path_1.default.dirname(f).toLowerCase() !== dir.toLowerCase()) {
|
|
141
|
+
continue;
|
|
142
|
+
}
|
|
143
|
+
const lf = path_1.default.basename(f).toLowerCase();
|
|
144
|
+
if (file === lf) {
|
|
145
|
+
return f;
|
|
146
|
+
}
|
|
141
147
|
}
|
|
142
148
|
if (this.ctx.config.project.resolveUnknownPathsOnDisk) {
|
|
143
|
-
|
|
144
|
-
|
|
149
|
+
let files;
|
|
150
|
+
if (fs_1.default.existsSync(dir)) {
|
|
151
|
+
files = fs_1.default.readdirSync(dir);
|
|
152
|
+
}
|
|
153
|
+
else {
|
|
154
|
+
// try to find a dir in parent
|
|
155
|
+
const parentDir = path_1.default.dirname(dir);
|
|
156
|
+
if (fs_1.default.existsSync(parentDir)) {
|
|
157
|
+
const parentFiles = fs_1.default.readdirSync(parentDir);
|
|
158
|
+
const foundDir = parentFiles.find(f => f.toLowerCase() === path_1.default.basename(dir).toLowerCase());
|
|
159
|
+
if (foundDir) {
|
|
160
|
+
files = fs_1.default.readdirSync(path_1.default.join(parentDir, foundDir));
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
const found = files?.find(f => f.toLowerCase() === file);
|
|
145
165
|
return found ? path_1.default.join(dir, found) : undefined;
|
|
146
166
|
}
|
|
147
167
|
return undefined;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { type EngineConfig,
|
|
2
|
-
import type { DeepWritable } from 'ts-essentials';
|
|
1
|
+
import { type EngineConfig, FlowrConfig } from '../config';
|
|
2
|
+
import type { DeepWritable, PathValue } from 'ts-essentials';
|
|
3
3
|
import { FlowrAnalyzer } from './flowr-analyzer';
|
|
4
4
|
import type { KnownParser } from '../r-bridge/parser';
|
|
5
5
|
import type { FlowrAnalyzerPlugin } from './plugins/flowr-analyzer-plugin';
|
|
6
6
|
import type { NormalizeRequiredInput } from '../core/steps/all/core/10-normalize';
|
|
7
7
|
import type { BuiltInFlowrPluginName, PluginToRegister } from './plugins/plugin-registry';
|
|
8
|
+
import type { AutocompletablePaths } from '../util/objects';
|
|
8
9
|
/**
|
|
9
10
|
* Builder for the {@link FlowrAnalyzer}, use it to configure all analysis aspects before creating the analyzer instance
|
|
10
11
|
* with {@link FlowrAnalyzerBuilder#build|`.build()`} or {@link FlowrAnalyzerBuilder#buildSync|`.buildSync()`}.
|
|
@@ -32,7 +33,7 @@ export declare class FlowrAnalyzerBuilder {
|
|
|
32
33
|
private flowrConfig;
|
|
33
34
|
private parser?;
|
|
34
35
|
private input?;
|
|
35
|
-
private plugins;
|
|
36
|
+
private readonly plugins;
|
|
36
37
|
/**
|
|
37
38
|
* Creates a new builder for the {@link FlowrAnalyzer}.
|
|
38
39
|
* By default, the standard set of plugins as returned by {@link FlowrAnalyzerPluginDefaults} are registered.
|
|
@@ -44,15 +45,21 @@ export declare class FlowrAnalyzerBuilder {
|
|
|
44
45
|
constructor(withDefaultPlugins?: boolean);
|
|
45
46
|
/**
|
|
46
47
|
* Apply an amendment to the configuration the builder currently holds.
|
|
47
|
-
*
|
|
48
|
+
* This is mostly intended for more complex logic to transform the config.
|
|
49
|
+
* Please consider using {@link FlowrAnalyzerBuilder.configure} to set/amend individual values
|
|
50
|
+
* Per default, the value returned by {@link FlowrConfig.default} is used.
|
|
48
51
|
* @param func - Receives the current configuration of the builder and allows for amendment.
|
|
49
52
|
*/
|
|
50
|
-
amendConfig(func: (config: DeepWritable<
|
|
53
|
+
amendConfig(func: (config: DeepWritable<FlowrConfig>) => FlowrConfig | void): this;
|
|
51
54
|
/**
|
|
52
55
|
* Overwrite the configuration used by the resulting analyzer.
|
|
53
56
|
* @param config - The new configuration.
|
|
54
57
|
*/
|
|
55
|
-
setConfig(config:
|
|
58
|
+
setConfig(config: FlowrConfig): this;
|
|
59
|
+
/**
|
|
60
|
+
* Set a specific value in the configuration used by the resulting analyzer.
|
|
61
|
+
*/
|
|
62
|
+
configure<K extends AutocompletablePaths<FlowrConfig>>(key: K, value: PathValue<FlowrConfig, K>): this;
|
|
56
63
|
/**
|
|
57
64
|
* Set the parser instance used by the analyzer.
|
|
58
65
|
* This is an alternative to {@link FlowrAnalyzerBuilder#setEngine} if you already have a parser instance.
|
|
@@ -33,7 +33,7 @@ const plugin_registry_1 = require("./plugins/plugin-registry");
|
|
|
33
33
|
* @see https://github.com/flowr-analysis/flowr/wiki/Analyzer
|
|
34
34
|
*/
|
|
35
35
|
class FlowrAnalyzerBuilder {
|
|
36
|
-
flowrConfig =
|
|
36
|
+
flowrConfig = config_1.FlowrConfig.default();
|
|
37
37
|
parser;
|
|
38
38
|
input;
|
|
39
39
|
plugins = new Map();
|
|
@@ -52,12 +52,14 @@ class FlowrAnalyzerBuilder {
|
|
|
52
52
|
}
|
|
53
53
|
/**
|
|
54
54
|
* Apply an amendment to the configuration the builder currently holds.
|
|
55
|
-
*
|
|
55
|
+
* This is mostly intended for more complex logic to transform the config.
|
|
56
|
+
* Please consider using {@link FlowrAnalyzerBuilder.configure} to set/amend individual values
|
|
57
|
+
* Per default, the value returned by {@link FlowrConfig.default} is used.
|
|
56
58
|
* @param func - Receives the current configuration of the builder and allows for amendment.
|
|
57
59
|
*/
|
|
58
60
|
// eslint-disable-next-line @typescript-eslint/no-invalid-void-type
|
|
59
61
|
amendConfig(func) {
|
|
60
|
-
this.flowrConfig =
|
|
62
|
+
this.flowrConfig = config_1.FlowrConfig.amend(this.flowrConfig, func);
|
|
61
63
|
return this;
|
|
62
64
|
}
|
|
63
65
|
/**
|
|
@@ -68,6 +70,13 @@ class FlowrAnalyzerBuilder {
|
|
|
68
70
|
this.flowrConfig = config;
|
|
69
71
|
return this;
|
|
70
72
|
}
|
|
73
|
+
/**
|
|
74
|
+
* Set a specific value in the configuration used by the resulting analyzer.
|
|
75
|
+
*/
|
|
76
|
+
configure(key, value) {
|
|
77
|
+
config_1.FlowrConfig.setInConfigInPlace(this.flowrConfig, key, value);
|
|
78
|
+
return this;
|
|
79
|
+
}
|
|
71
80
|
/**
|
|
72
81
|
* Set the parser instance used by the analyzer.
|
|
73
82
|
* This is an alternative to {@link FlowrAnalyzerBuilder#setEngine} if you already have a parser instance.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { FlowrConfig } from '../config';
|
|
2
2
|
import type { KnownParser, KnownParserInformation } from '../r-bridge/parser';
|
|
3
3
|
import { type Queries, type QueryResults, type SupportedQueryTypes } from '../queries/query';
|
|
4
4
|
import type { ControlFlowInformation } from '../control-flow/control-flow-graph';
|
|
@@ -15,8 +15,8 @@ import type { RAnalysisRequest } from './context/flowr-analyzer-files-context';
|
|
|
15
15
|
import type { RParseRequest, RParseRequestFromFile } from '../r-bridge/retriever';
|
|
16
16
|
import { fileProtocol } from '../r-bridge/retriever';
|
|
17
17
|
import type { FlowrFileProvider } from './context/flowr-file';
|
|
18
|
-
import type { CallGraph } from '../dataflow/graph/call-graph';
|
|
19
18
|
import type { Tree } from 'web-tree-sitter';
|
|
19
|
+
import type { CallGraph } from '../dataflow/graph/call-graph';
|
|
20
20
|
/**
|
|
21
21
|
* Extends the {@link ReadonlyFlowrAnalysisProvider} with methods that allow modifying the analyzer state.
|
|
22
22
|
*/
|
|
@@ -139,7 +139,7 @@ export interface ReadonlyFlowrAnalysisProvider<Parser extends KnownParser = Know
|
|
|
139
139
|
*/
|
|
140
140
|
runFull(force?: boolean): Promise<void>;
|
|
141
141
|
/** This is the config used for the analyzer */
|
|
142
|
-
flowrConfig:
|
|
142
|
+
flowrConfig: FlowrConfig;
|
|
143
143
|
}
|
|
144
144
|
/**
|
|
145
145
|
* Central class for conducting analyses with FlowR.
|
|
@@ -165,7 +165,7 @@ export declare class FlowrAnalyzer<Parser extends KnownParser = KnownParser> imp
|
|
|
165
165
|
* @param cache - The caching layer to use for storing analysis results.
|
|
166
166
|
*/
|
|
167
167
|
constructor(parser: Parser, ctx: FlowrAnalyzerContext, cache: FlowrAnalyzerCache<Parser>);
|
|
168
|
-
get flowrConfig():
|
|
168
|
+
get flowrConfig(): FlowrConfig;
|
|
169
169
|
context(): FlowrAnalyzerContext;
|
|
170
170
|
parserInformation(): KnownParserInformation;
|
|
171
171
|
inspectContext(): ReadOnlyFlowrAnalyzerContext;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.identifyLinkToNestedRelation = identifyLinkToNestedRelation;
|
|
4
|
-
const call_graph_1 = require("../../../dataflow/graph/call-graph");
|
|
5
4
|
const vertex_1 = require("../../../dataflow/graph/vertex");
|
|
6
5
|
const identifier_1 = require("../../../dataflow/environments/identifier");
|
|
6
|
+
const call_graph_1 = require("../../../dataflow/graph/call-graph");
|
|
7
7
|
/**
|
|
8
8
|
* **Please refer to {@link identifyLinkToRelation}.**
|
|
9
9
|
*
|
|
@@ -19,7 +19,7 @@ async function identifyLinkToNestedRelation(from, analyzer, { callName, ignoreIf
|
|
|
19
19
|
const test = callName instanceof RegExp ? (t) => callName.test(t) : callName;
|
|
20
20
|
const found = [];
|
|
21
21
|
const cg = await analyzer.callGraph();
|
|
22
|
-
const subCg =
|
|
22
|
+
const subCg = call_graph_1.CallGraph.computeSubCallGraph(cg, new Set([from]));
|
|
23
23
|
for (const [, t] of subCg.vertices(true)) {
|
|
24
24
|
if (!(0, vertex_1.isFunctionCallVertex)(t)) {
|
|
25
25
|
continue;
|
|
@@ -2,7 +2,7 @@ import type { BaseQueryFormat, BaseQueryResult } from '../../base-query-format';
|
|
|
2
2
|
import { executeCallGraphQuery } from './call-graph-query-executor';
|
|
3
3
|
import Joi from 'joi';
|
|
4
4
|
import type { NodeId } from '../../../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
5
|
-
import
|
|
5
|
+
import { CallGraph } from '../../../dataflow/graph/call-graph';
|
|
6
6
|
/**
|
|
7
7
|
* Computes the Call Graph of the analyzed project.
|
|
8
8
|
*/
|
|
@@ -7,14 +7,14 @@ exports.CallGraphQueryDefinition = void 0;
|
|
|
7
7
|
const call_graph_query_executor_1 = require("./call-graph-query-executor");
|
|
8
8
|
const ansi_1 = require("../../../util/text/ansi");
|
|
9
9
|
const time_1 = require("../../../util/text/time");
|
|
10
|
-
const dfg_1 = require("../../../util/mermaid/dfg");
|
|
11
10
|
const joi_1 = __importDefault(require("joi"));
|
|
11
|
+
const call_graph_1 = require("../../../dataflow/graph/call-graph");
|
|
12
12
|
exports.CallGraphQueryDefinition = {
|
|
13
13
|
executor: call_graph_query_executor_1.executeCallGraphQuery,
|
|
14
14
|
asciiSummarizer: (formatter, _analyzer, queryResults, result) => {
|
|
15
15
|
const out = queryResults;
|
|
16
16
|
result.push(`Query: ${(0, ansi_1.bold)('call-graph', formatter)} (${(0, time_1.printAsMs)(out['.meta'].timing, 0)})`);
|
|
17
|
-
result.push(` ╰ [Call Graph](${
|
|
17
|
+
result.push(` ╰ [Call Graph](${call_graph_1.CallGraph.visualize.mermaid.url(out.graph)})`);
|
|
18
18
|
return true;
|
|
19
19
|
},
|
|
20
20
|
schema: joi_1.default.object({
|
|
@@ -7,8 +7,8 @@ exports.ClusterQueryDefinition = void 0;
|
|
|
7
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
|
-
const dfg_1 = require("../../../util/mermaid/dfg");
|
|
11
10
|
const query_print_1 = require("../../query-print");
|
|
11
|
+
const df_helper_1 = require("../../../dataflow/graph/df-helper");
|
|
12
12
|
exports.ClusterQueryDefinition = {
|
|
13
13
|
executor: cluster_query_executor_1.executeDataflowClusterQuery,
|
|
14
14
|
asciiSummarizer: async (formatter, analyzer, queryResults, result) => {
|
|
@@ -19,7 +19,7 @@ exports.ClusterQueryDefinition = {
|
|
|
19
19
|
const unknownSideEffects = cluster.hasUnknownSideEffects ? '(has unknown side effect)' : '';
|
|
20
20
|
let suffix = '';
|
|
21
21
|
if (formatter === ansi_1.markdownFormatter) {
|
|
22
|
-
suffix = `([marked](${
|
|
22
|
+
suffix = `([marked](${df_helper_1.Dataflow.visualize.mermaid.url((await analyzer.dataflow()).graph, false, new Set(cluster.members))}))`;
|
|
23
23
|
}
|
|
24
24
|
result.push(` ╰ ${unknownSideEffects} {${(0, query_print_1.summarizeIdsIfTooLong)(formatter, cluster.members)}} ${suffix}`);
|
|
25
25
|
}
|
|
@@ -2,20 +2,20 @@ import type { BaseQueryFormat, BaseQueryResult } from '../../base-query-format';
|
|
|
2
2
|
import { executeConfigQuery } from './config-query-executor';
|
|
3
3
|
import { type OutputFormatter } from '../../../util/text/ansi';
|
|
4
4
|
import Joi from 'joi';
|
|
5
|
-
import type {
|
|
5
|
+
import type { FlowrConfig } from '../../../config';
|
|
6
6
|
import type { DeepPartial } from 'ts-essentials';
|
|
7
7
|
import type { ParsedQueryLine, Query } from '../../query';
|
|
8
8
|
import type { ReplOutput } from '../../../cli/repl/commands/repl-main';
|
|
9
9
|
import type { CommandCompletions } from '../../../cli/repl/core';
|
|
10
10
|
export interface ConfigQuery extends BaseQueryFormat {
|
|
11
11
|
readonly type: 'config';
|
|
12
|
-
readonly update?: DeepPartial<
|
|
12
|
+
readonly update?: DeepPartial<FlowrConfig>;
|
|
13
13
|
}
|
|
14
14
|
export interface ConfigQueryResult extends BaseQueryResult {
|
|
15
|
-
readonly config:
|
|
15
|
+
readonly config: FlowrConfig;
|
|
16
16
|
}
|
|
17
|
-
declare function configReplCompleter(partialLine: readonly string[], _startingNewArg: boolean, config:
|
|
18
|
-
declare function configQueryLineParser(output: ReplOutput, line: readonly string[], _config:
|
|
17
|
+
declare function configReplCompleter(partialLine: readonly string[], _startingNewArg: boolean, config: FlowrConfig): CommandCompletions;
|
|
18
|
+
declare function configQueryLineParser(output: ReplOutput, line: readonly string[], _config: FlowrConfig): ParsedQueryLine<'config'>;
|
|
19
19
|
export declare const ConfigQueryDefinition: {
|
|
20
20
|
readonly executor: typeof executeConfigQuery;
|
|
21
21
|
readonly asciiSummarizer: (formatter: OutputFormatter, _analyzer: unknown, queryResults: BaseQueryResult, result: string[], queries: readonly Query[]) => true;
|
|
@@ -7,14 +7,14 @@ exports.DataflowLensQueryDefinition = void 0;
|
|
|
7
7
|
const dataflow_lens_query_executor_1 = require("./dataflow-lens-query-executor");
|
|
8
8
|
const ansi_1 = require("../../../util/text/ansi");
|
|
9
9
|
const time_1 = require("../../../util/text/time");
|
|
10
|
-
const dfg_1 = require("../../../util/mermaid/dfg");
|
|
11
10
|
const joi_1 = __importDefault(require("joi"));
|
|
11
|
+
const df_helper_1 = require("../../../dataflow/graph/df-helper");
|
|
12
12
|
exports.DataflowLensQueryDefinition = {
|
|
13
13
|
executor: dataflow_lens_query_executor_1.executeDataflowLensQuery,
|
|
14
14
|
asciiSummarizer: (formatter, _analyzer, queryResults, result) => {
|
|
15
15
|
const out = queryResults;
|
|
16
16
|
result.push(`Query: ${(0, ansi_1.bold)('dataflow-lens', formatter)} (${(0, time_1.printAsMs)(out['.meta'].timing, 0)})`);
|
|
17
|
-
result.push(` ╰ [Simplified Graph](${
|
|
17
|
+
result.push(` ╰ [Simplified Graph](${df_helper_1.Dataflow.visualize.mermaid.url(out.simplifiedGraph, false, undefined, true)})`);
|
|
18
18
|
return true;
|
|
19
19
|
},
|
|
20
20
|
schema: joi_1.default.object({
|
|
@@ -7,14 +7,14 @@ exports.DataflowQueryDefinition = void 0;
|
|
|
7
7
|
const dataflow_query_executor_1 = require("./dataflow-query-executor");
|
|
8
8
|
const ansi_1 = require("../../../util/text/ansi");
|
|
9
9
|
const time_1 = require("../../../util/text/time");
|
|
10
|
-
const dfg_1 = require("../../../util/mermaid/dfg");
|
|
11
10
|
const joi_1 = __importDefault(require("joi"));
|
|
11
|
+
const df_helper_1 = require("../../../dataflow/graph/df-helper");
|
|
12
12
|
exports.DataflowQueryDefinition = {
|
|
13
13
|
executor: dataflow_query_executor_1.executeDataflowQuery,
|
|
14
14
|
asciiSummarizer: (formatter, _analyzer, queryResults, result) => {
|
|
15
15
|
const out = queryResults;
|
|
16
16
|
result.push(`Query: ${(0, ansi_1.bold)('dataflow', formatter)} (${(0, time_1.printAsMs)(out['.meta'].timing, 0)})`);
|
|
17
|
-
result.push(` ╰ [Dataflow Graph](${
|
|
17
|
+
result.push(` ╰ [Dataflow Graph](${df_helper_1.Dataflow.visualize.mermaid.url(out.graph)})`);
|
|
18
18
|
return true;
|
|
19
19
|
},
|
|
20
20
|
schema: joi_1.default.object({
|
|
@@ -39,14 +39,13 @@ async function executeDfShapeQuery({ analyzer }, queries) {
|
|
|
39
39
|
continue;
|
|
40
40
|
}
|
|
41
41
|
try {
|
|
42
|
-
const nodeId =
|
|
42
|
+
const nodeId = parse_1.SingleSlicingCriterion.parse(query.criterion, ast.idMap);
|
|
43
43
|
const node = ast.idMap.get(nodeId);
|
|
44
44
|
const value = inference.getAbstractValue(node?.info.id);
|
|
45
45
|
result.set(query.criterion, value);
|
|
46
46
|
}
|
|
47
47
|
catch (e) {
|
|
48
48
|
console.error(e instanceof Error ? e.message : e);
|
|
49
|
-
continue;
|
|
50
49
|
}
|
|
51
50
|
}
|
|
52
51
|
return {
|
|
@@ -2,7 +2,7 @@ import Joi from 'joi';
|
|
|
2
2
|
import type { DataFrameDomain } from '../../../abstract-interpretation/data-frame/dataframe-domain';
|
|
3
3
|
import type { StateAbstractDomain } from '../../../abstract-interpretation/domains/state-abstract-domain';
|
|
4
4
|
import type { ReplOutput } from '../../../cli/repl/commands/repl-main';
|
|
5
|
-
import type {
|
|
5
|
+
import type { FlowrConfig } from '../../../config';
|
|
6
6
|
import type { SingleSlicingCriterion } from '../../../slicing/criterion/parse';
|
|
7
7
|
import type { BaseQueryFormat, BaseQueryResult } from '../../base-query-format';
|
|
8
8
|
import type { ParsedQueryLine } from '../../query';
|
|
@@ -15,7 +15,7 @@ export interface DfShapeQuery extends BaseQueryFormat {
|
|
|
15
15
|
export interface DfShapeQueryResult extends BaseQueryResult {
|
|
16
16
|
domains: StateAbstractDomain<DataFrameDomain> | Map<SingleSlicingCriterion, DataFrameDomain | undefined>;
|
|
17
17
|
}
|
|
18
|
-
declare function dfShapeQueryLineParser(_output: ReplOutput, line: readonly string[], _config:
|
|
18
|
+
declare function dfShapeQueryLineParser(_output: ReplOutput, line: readonly string[], _config: FlowrConfig): ParsedQueryLine<'df-shape'>;
|
|
19
19
|
export declare const DfShapeQueryDefinition: {
|
|
20
20
|
readonly executor: typeof executeDfShapeQuery;
|
|
21
21
|
readonly asciiSummarizer: (formatter: import("../../../util/text/ansi").OutputFormatter, _analyzer: import("../../../project/flowr-analyzer").ReadonlyFlowrAnalysisProvider<import("../../../r-bridge/parser").KnownParser>, queryResults: BaseQueryResult, result: string[]) => true;
|
|
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.executeDoesCallQuery = executeDoesCallQuery;
|
|
4
4
|
const log_1 = require("../../../util/log");
|
|
5
5
|
const node_id_1 = require("../../../r-bridge/lang-4.x/ast/model/processing/node-id");
|
|
6
|
-
const parse_1 = require("../../../slicing/criterion/parse");
|
|
7
6
|
const identifier_1 = require("../../../dataflow/environments/identifier");
|
|
7
|
+
const parse_1 = require("../../../slicing/criterion/parse");
|
|
8
8
|
/**
|
|
9
9
|
* Execute does call queries on the given analyzer.
|
|
10
10
|
*/
|
|
@@ -19,7 +19,7 @@ async function executeDoesCallQuery({ analyzer }, queries) {
|
|
|
19
19
|
log_1.log.warn(`Duplicate query id '${id}' in does-call queries, SKIP.`);
|
|
20
20
|
continue;
|
|
21
21
|
}
|
|
22
|
-
const nodeId =
|
|
22
|
+
const nodeId = parse_1.SingleSlicingCriterion.tryParse(query.call, idMap);
|
|
23
23
|
if (!nodeId) {
|
|
24
24
|
results[id] = false;
|
|
25
25
|
continue;
|