@eagleoutice/flowr 2.16.6 → 2.16.8
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 +21 -15
- package/abstract-interpretation/data-frame/dataframe-semantics.d.ts +2 -0
- package/abstract-interpretation/data-frame/dataframe-semantics.js +3 -1
- package/abstract-interpretation/data-frame/resolve-args.d.ts +1 -7
- package/abstract-interpretation/data-frame/resolve-args.js +2 -11
- package/cli/repl/commands/repl-cfg.js +5 -19
- package/cli/repl/commands/repl-code-command.d.ts +10 -0
- package/cli/repl/commands/repl-code-command.js +18 -0
- package/cli/repl/commands/repl-dataflow.js +34 -59
- package/cli/repl/commands/repl-normalize.js +24 -41
- package/cli/repl/commands/repl-query.js +10 -17
- package/config.js +3 -3
- package/control-flow/cfg-dead-code.js +15 -2
- package/control-flow/useless-loop.js +1 -2
- package/data/r-base-packages.generated.d.ts +1 -1
- package/data/r-base-packages.generated.js +3 -3
- package/dataflow/environments/ambient-state-name.d.ts +80 -0
- package/dataflow/environments/ambient-state-name.js +113 -0
- package/dataflow/environments/built-in-eval-name.d.ts +3 -1
- package/dataflow/environments/built-in-eval-name.js +2 -0
- package/dataflow/environments/built-in-props.d.ts +27 -7
- package/dataflow/environments/built-in-props.js +59 -44
- package/dataflow/environments/built-in.d.ts +5 -2
- package/dataflow/environments/built-in.js +22 -5
- package/dataflow/environments/default-builtin-config.d.ts +538 -14
- package/dataflow/environments/default-builtin-config.js +189 -123
- package/dataflow/environments/environment.d.ts +7 -1
- package/dataflow/environments/environment.js +19 -1
- package/dataflow/environments/identifier.d.ts +12 -1
- package/dataflow/environments/reference-to-maybe.js +1 -6
- package/dataflow/eval/resolve/alias-tracking.d.ts +13 -3
- package/dataflow/eval/resolve/alias-tracking.js +66 -37
- package/dataflow/eval/resolve/resolve-argument.d.ts +4 -2
- package/dataflow/eval/resolve/resolve-argument.js +23 -11
- package/dataflow/eval/resolve/resolve.d.ts +5 -0
- package/dataflow/eval/resolve/resolve.js +25 -3
- package/dataflow/eval/values/r-value.d.ts +4 -2
- package/dataflow/eval/values/r-value.js +3 -1
- package/dataflow/eval/values/string/string-constants.d.ts +7 -1
- package/dataflow/eval/values/string/string-constants.js +38 -36
- package/dataflow/extractor.js +105 -2
- package/dataflow/fn/argument-roles.js +22 -8
- package/dataflow/fn/function-semantics.d.ts +3 -2
- package/dataflow/fn/strict-function.js +13 -2
- package/dataflow/graph/dataflowgraph-builder.d.ts +4 -4
- package/dataflow/graph/df-helper.d.ts +14 -1
- package/dataflow/graph/df-helper.js +37 -4
- package/dataflow/graph/graph.d.ts +6 -0
- package/dataflow/graph/graph.js +9 -10
- package/dataflow/graph/vertex.d.ts +1 -1
- package/dataflow/hooks.d.ts +1 -1
- package/dataflow/info.d.ts +3 -3
- package/dataflow/internal/linker.d.ts +4 -1
- package/dataflow/internal/linker.js +12 -8
- package/dataflow/internal/process/functions/call/built-in/built-in-ambient-keys.d.ts +41 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-ambient-keys.js +88 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-ambient-state.d.ts +21 -46
- package/dataflow/internal/process/functions/call/built-in/built-in-ambient-state.js +125 -158
- package/dataflow/internal/process/functions/call/built-in/built-in-apply.d.ts +6 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +35 -9
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +10 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-attach.d.ts +4 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-attach.js +6 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-eval.js +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +3 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.d.ts +7 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +21 -12
- package/dataflow/internal/process/functions/call/built-in/built-in-get.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-get.js +8 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-library.d.ts +4 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-library.js +5 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-local.js +5 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-pipe.js +11 -12
- 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 +6 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-string-template.js +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.d.ts +7 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.js +43 -7
- package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.d.ts +11 -0
- package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.js +29 -4
- package/dataflow/internal/process/functions/call/common.js +3 -4
- package/dataflow/internal/process/functions/call/deferred.d.ts +3 -2
- package/dataflow/internal/process/functions/call/deferred.js +17 -9
- package/dataflow/internal/process/functions/call/quoted.js +1 -1
- package/dataflow/processor.d.ts +1 -1
- package/documentation/doc-capabilities.js +3 -2
- package/documentation/doc-readme.js +1 -2
- package/documentation/doc-util/doc-dfg.js +2 -2
- package/documentation/doc-util/doc-query.d.ts +3 -1
- package/documentation/doc-util/doc-query.js +4 -4
- package/documentation/wiki-create-linting-rules.js +1 -1
- package/documentation/wiki-linter.js +16 -206
- package/documentation/wiki-linting-and-testing.js +31 -64
- package/documentation/wiki-query.js +41 -0
- package/index.d.ts +1 -0
- package/index.js +5 -1
- package/linter/linter-format.d.ts +6 -0
- package/linter/linter-format.js +10 -0
- package/linter/linter-rules.d.ts +155 -103
- package/linter/linter-rules.js +2 -0
- package/linter/linter-util.d.ts +23 -0
- package/linter/linter-util.js +58 -0
- package/linter/rules/absolute-path.d.ts +2 -2
- package/linter/rules/absolute-path.js +1 -4
- package/linter/rules/cmd-check/bogus-return.d.ts +2 -2
- package/linter/rules/cmd-check/bogus-return.js +3 -7
- package/linter/rules/cmd-check/call-arguments.d.ts +2 -2
- package/linter/rules/cmd-check/class-string-comparison.d.ts +2 -2
- package/linter/rules/cmd-check/class-string-comparison.js +3 -7
- package/linter/rules/cmd-check/cmd-check-util.d.ts +8 -9
- package/linter/rules/cmd-check/cmd-check-util.js +14 -26
- package/linter/rules/cmd-check/compiled-code.d.ts +8 -3
- package/linter/rules/cmd-check/compiled-code.js +3 -13
- package/linter/rules/cmd-check/dependency-declaration.d.ts +2 -2
- package/linter/rules/cmd-check/dependency-declaration.js +6 -7
- package/linter/rules/cmd-check/description-metadata.d.ts +4 -4
- package/linter/rules/cmd-check/documentation-mismatch.d.ts +2 -2
- package/linter/rules/cmd-check/documentation-mismatch.js +4 -11
- package/linter/rules/cmd-check/file-checks.d.ts +19 -6
- package/linter/rules/cmd-check/file-checks.js +13 -5
- package/linter/rules/cmd-check/foreign-function-calls.d.ts +2 -2
- package/linter/rules/cmd-check/global-environment-modification.d.ts +2 -2
- package/linter/rules/cmd-check/global-environment-modification.js +3 -2
- package/linter/rules/cmd-check/namespace-tampering.d.ts +2 -2
- package/linter/rules/cmd-check/namespace-tampering.js +9 -9
- package/linter/rules/cmd-check/non-ascii-code.d.ts +2 -2
- package/linter/rules/cmd-check/package-data.d.ts +11 -5
- package/linter/rules/cmd-check/package-data.js +5 -12
- package/linter/rules/cmd-check/package-files.js +4 -10
- package/linter/rules/cmd-check/package-hooks.d.ts +2 -2
- package/linter/rules/cmd-check/package-hooks.js +10 -8
- package/linter/rules/cmd-check/package-metafiles.d.ts +8 -3
- package/linter/rules/cmd-check/package-metafiles.js +3 -12
- package/linter/rules/cmd-check/package-runtime.d.ts +18 -5
- package/linter/rules/cmd-check/package-runtime.js +64 -20
- package/linter/rules/cmd-check/package-structure.d.ts +11 -5
- package/linter/rules/cmd-check/package-structure.js +4 -12
- package/linter/rules/cmd-check/rd-files.d.ts +8 -3
- package/linter/rules/cmd-check/rd-files.js +4 -14
- package/linter/rules/cmd-check/s-three-method-consistency.d.ts +2 -2
- package/linter/rules/cmd-check/s-three-method-consistency.js +3 -4
- package/linter/rules/cmd-check/true-false-abbreviation.d.ts +2 -2
- package/linter/rules/dataframe-access-validation.d.ts +2 -2
- package/linter/rules/dataframe-access-validation.js +5 -8
- package/linter/rules/dead-code.d.ts +5 -4
- package/linter/rules/dead-code.js +25 -14
- package/linter/rules/deprecated-functions.d.ts +3 -3
- package/linter/rules/deprecated-functions.js +16 -23
- package/linter/rules/file-path-validity.d.ts +2 -2
- package/linter/rules/file-path-validity.js +3 -6
- package/linter/rules/function-finder-util.d.ts +3 -3
- package/linter/rules/function-finder-util.js +7 -14
- package/linter/rules/namespace-access.d.ts +2 -2
- package/linter/rules/namespace-access.js +6 -9
- package/linter/rules/naming-convention.d.ts +2 -2
- package/linter/rules/naming-convention.js +1 -4
- package/linter/rules/network-functions.d.ts +3 -3
- package/linter/rules/no-leaked-credentials.d.ts +2 -2
- package/linter/rules/no-leaked-credentials.js +1 -4
- package/linter/rules/overwritten-file.d.ts +38 -0
- package/linter/rules/overwritten-file.js +102 -0
- package/linter/rules/problematic-inputs.d.ts +16 -6
- package/linter/rules/problematic-inputs.js +78 -34
- package/linter/rules/roxygen-arguments.d.ts +2 -2
- package/linter/rules/roxygen-arguments.js +1 -4
- package/linter/rules/seeded-randomness.d.ts +3 -3
- package/linter/rules/seeded-randomness.js +6 -23
- package/linter/rules/software-has-license.d.ts +2 -2
- package/linter/rules/software-has-license.js +1 -4
- package/linter/rules/software-has-tests.d.ts +2 -2
- package/linter/rules/software-has-tests.js +1 -4
- package/linter/rules/stop-with-call-arg.d.ts +2 -2
- package/linter/rules/stop-with-call-arg.js +4 -11
- package/linter/rules/syntactically-valid.d.ts +4 -2
- package/linter/rules/syntactically-valid.js +29 -10
- package/linter/rules/unclosed-connection.d.ts +2 -2
- package/linter/rules/unclosed-connection.js +1 -4
- package/linter/rules/undefined-symbol.d.ts +2 -2
- package/linter/rules/undefined-symbol.js +25 -22
- package/linter/rules/unescaped-arguments.d.ts +2 -2
- package/linter/rules/unescaped-arguments.js +1 -4
- package/linter/rules/unused-definition.d.ts +2 -2
- package/linter/rules/unused-definition.js +37 -25
- package/linter/rules/unused-import.d.ts +2 -2
- package/linter/rules/unused-import.js +9 -14
- package/linter/rules/useless-loop.d.ts +7 -6
- package/linter/rules/useless-loop.js +4 -8
- package/package.json +5 -3
- package/project/cache/flowr-analyzer-cache.d.ts +2 -0
- package/project/cache/flowr-analyzer-cache.js +15 -11
- package/project/context/flowr-analyzer-files-context.d.ts +3 -0
- package/project/context/flowr-analyzer-files-context.js +6 -0
- package/project/plugins/file-plugins/files/flowr-jupyter-file.d.ts +6 -1
- package/project/plugins/file-plugins/files/flowr-jupyter-file.js +35 -0
- package/project/plugins/file-plugins/files/flowr-namespace-file.js +2 -1
- package/project/plugins/file-plugins/files/flowr-rsession-file.d.ts +26 -0
- package/project/plugins/file-plugins/files/flowr-rsession-file.js +44 -0
- package/project/plugins/file-plugins/files/r-session.d.ts +20 -0
- package/project/plugins/file-plugins/files/r-session.js +58 -0
- package/project/plugins/file-plugins/files/recorded-runs.d.ts +18 -0
- package/project/plugins/file-plugins/files/recorded-runs.js +8 -0
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-rsession-file-plugin.d.ts +20 -0
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-rsession-file-plugin.js +28 -0
- package/project/plugins/plugin-registry.d.ts +2 -1
- package/project/plugins/plugin-registry.js +2 -0
- package/project/sigdb/spec-query.d.ts +73 -0
- package/project/sigdb/spec-query.js +339 -0
- package/queries/base-query-format.d.ts +1 -1
- package/queries/base-query-format.js +2 -2
- package/queries/catalog/absint-query/absint-query-executor.js +3 -6
- package/queries/catalog/call-context-query/call-context-query-executor.d.ts +1 -0
- package/queries/catalog/call-context-query/call-context-query-executor.js +113 -73
- package/queries/catalog/call-graph-query/call-graph-query-executor.js +2 -3
- package/queries/catalog/cluster-query/cluster-query-executor.js +2 -3
- package/queries/catalog/config-query/config-query-format.d.ts +0 -1
- package/queries/catalog/config-query/config-query-format.js +1 -2
- package/queries/catalog/control-flow-query/control-flow-query-executor.js +2 -3
- package/queries/catalog/dataflow-lens-query/dataflow-lens-query-executor.js +2 -4
- package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.d.ts +0 -1
- package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.js +1 -2
- package/queries/catalog/dataflow-query/dataflow-query-executor.js +2 -3
- package/queries/catalog/dependencies-query/dependencies-query-executor.d.ts +7 -0
- package/queries/catalog/dependencies-query/dependencies-query-executor.js +72 -42
- package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +24 -6
- package/queries/catalog/dependencies-query/dependencies-query-format.js +108 -3
- package/queries/catalog/dependencies-query/function-info/function-info.d.ts +6 -1
- package/queries/catalog/dependencies-query/function-info/read-functions.js +6 -6
- package/queries/catalog/dependencies-query/function-info/write-functions.js +13 -7
- package/queries/catalog/dependencies-query/implicit-echo.js +21 -7
- package/queries/catalog/dice-query/dice-query-executor.js +2 -3
- package/queries/catalog/does-call-query/does-call-query-executor.js +2 -3
- package/queries/catalog/files-query/files-query-executor.js +2 -3
- package/queries/catalog/function-info-query/function-info-query-executor.js +2 -1
- package/queries/catalog/function-info-query/function-info-query-format.d.ts +0 -2
- package/queries/catalog/function-info-query/function-info-query-format.js +1 -2
- package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-executor.js +3 -2
- package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-format.d.ts +0 -2
- package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-format.js +1 -2
- package/queries/catalog/happens-before-query/happens-before-query-executor.js +2 -3
- package/queries/catalog/happens-before-query/happens-before-query-format.d.ts +0 -1
- package/queries/catalog/happens-before-query/happens-before-query-format.js +1 -2
- package/queries/catalog/id-map-query/id-map-query-executor.js +2 -3
- package/queries/catalog/id-map-query/id-map-query-format.d.ts +0 -1
- package/queries/catalog/id-map-query/id-map-query-format.js +1 -2
- package/queries/catalog/input-sources-query/input-sources-query-executor.js +3 -4
- package/queries/catalog/input-sources-query/simple-input-classifier.d.ts +2 -1
- package/queries/catalog/input-sources-query/simple-input-classifier.js +60 -13
- package/queries/catalog/inspect-exceptions-query/inspect-exception-query-executor.js +2 -3
- package/queries/catalog/inspect-fn-props-query/inspect-fn-props-query-executor.js +2 -3
- package/queries/catalog/inspect-fn-props-query/inspect-fn-props-query-format.js +2 -1
- package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-executor.d.ts +3 -2
- package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-executor.js +1 -7
- package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.d.ts +6 -9
- package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.js +8 -33
- package/queries/catalog/inspect-recursion-query/inspect-recursion-query-executor.d.ts +3 -2
- package/queries/catalog/inspect-recursion-query/inspect-recursion-query-executor.js +1 -7
- package/queries/catalog/inspect-recursion-query/inspect-recursion-query-format.d.ts +6 -7
- package/queries/catalog/inspect-recursion-query/inspect-recursion-query-format.js +8 -31
- package/queries/catalog/linter-query/linter-query-executor.js +2 -3
- package/queries/catalog/location-map-query/location-map-query-executor.js +2 -3
- package/queries/catalog/location-map-query/location-map-query-format.d.ts +0 -1
- package/queries/catalog/location-map-query/location-map-query-format.js +1 -2
- package/queries/catalog/normalized-ast-query/normalized-ast-query-executor.js +2 -3
- package/queries/catalog/normalized-ast-query/normalized-ast-query-format.d.ts +0 -1
- package/queries/catalog/normalized-ast-query/normalized-ast-query-format.js +1 -2
- package/queries/catalog/origin-query/origin-query-executor.d.ts +0 -5
- package/queries/catalog/origin-query/origin-query-executor.js +3 -11
- package/queries/catalog/project-query/project-query-executor.js +23 -7
- package/queries/catalog/project-query/project-query-format.d.ts +5 -0
- package/queries/catalog/project-query/project-query-format.js +20 -2
- package/queries/catalog/provenance-query/provenance-query-executor.js +2 -3
- package/queries/catalog/resolve-value-query/resolve-value-query-executor.js +2 -3
- package/queries/catalog/resolve-value-query/resolve-value-query-format.d.ts +0 -1
- package/queries/catalog/resolve-value-query/resolve-value-query-format.js +1 -2
- package/queries/catalog/search-query/search-query-executor.js +2 -3
- package/queries/catalog/signature-query/signature-query-executor.js +39 -0
- package/queries/catalog/signature-query/signature-query-format.d.ts +7 -1
- package/queries/catalog/signature-query/signature-query-format.js +15 -1
- package/queries/catalog/signature-query/signature-query-render.js +2 -1
- package/queries/catalog/static-slice-query/static-slice-query-executor.js +2 -3
- package/queries/query-function-property.d.ts +28 -0
- package/queries/query-function-property.js +48 -0
- package/queries/query-meta.d.ts +3 -0
- package/queries/query-meta.js +8 -0
- package/queries/query.d.ts +13 -18
- package/r-bridge/lang-4.x/ast/model/processing/decorate.d.ts +2 -2
- package/r-bridge/lang-4.x/ast/model/processing/decorate.js +4 -3
- package/r-bridge/lang-4.x/ast/model/processing/node-id.d.ts +6 -0
- package/r-bridge/lang-4.x/ast/model/processing/node-id.js +9 -0
- package/r-bridge/lang-4.x/ast/model/syntax-version.d.ts +8 -0
- package/r-bridge/lang-4.x/ast/model/syntax-version.js +49 -0
- package/r-bridge/lang-4.x/ast/model/type.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/type.js +3 -0
- package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-parameter.js +4 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/structure/normalize-single-node.js +1 -0
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +1 -1
- package/reconstruct/reconstruct.js +35 -1
- package/search/search-executor/search-generators.js +1 -1
- package/slicing/static/fingerprint.js +7 -3
- package/slicing/static/static-slicer.js +6 -0
- package/util/assert.js +2 -2
- package/util/collections/arrays.d.ts +4 -0
- package/util/collections/arrays.js +11 -0
- package/util/collections/defaultmap.d.ts +5 -1
- package/util/collections/defaultmap.js +6 -1
- package/util/files.js +26 -5
- package/util/flowr-version.d.ts +10 -0
- package/util/flowr-version.js +20 -0
- package/util/glob.js +6 -4
- package/util/r-regex.d.ts +6 -0
- package/util/r-regex.js +17 -0
- package/util/text/args.d.ts +5 -0
- package/util/text/args.js +28 -22
- package/util/text/name-rank.d.ts +2 -0
- package/util/text/name-rank.js +3 -1
- package/util/text/regex.d.ts +10 -0
- package/util/text/regex.js +29 -0
- package/util/version.d.ts +1 -6
- package/util/version.js +6 -14
- package/documentation/doc-util/doc-functions.d.ts +0 -24
- package/documentation/doc-util/doc-functions.js +0 -65
package/README.md
CHANGED
|
@@ -38,7 +38,7 @@ It offers a wide variety of features, for example:
|
|
|
38
38
|
|
|
39
39
|
```shell
|
|
40
40
|
$ docker run -it --rm eagleoutice/flowr # or npm run flowr
|
|
41
|
-
flowR repl v2.16.
|
|
41
|
+
flowR repl v2.16.7, R grammar v14 (tree-sitter engine)
|
|
42
42
|
R> :query @linter "read.csv(\"/root/x.txt\")"
|
|
43
43
|
```
|
|
44
44
|
|
|
@@ -46,11 +46,15 @@ It offers a wide variety of features, for example:
|
|
|
46
46
|
<summary style='color:gray'>Output</summary>
|
|
47
47
|
|
|
48
48
|
```text
|
|
49
|
-
Query: linter (
|
|
49
|
+
Query: linter (16 ms)
|
|
50
50
|
╰ Deprecated Functions (deprecated-functions): no findings
|
|
51
|
-
╰ File Path Validity (file-path-validity):
|
|
51
|
+
╰ File Path Validity (file-path-validity):
|
|
52
|
+
╰ certain:
|
|
53
|
+
╰ Path `/root/x.txt` at 1.1-23
|
|
52
54
|
╰ Seeded Randomness (seeded-randomness): no findings
|
|
53
|
-
╰ Absolute Paths (absolute-file-paths):
|
|
55
|
+
╰ Absolute Paths (absolute-file-paths):
|
|
56
|
+
╰ certain:
|
|
57
|
+
╰ Path `/root/x.txt` at 1.1-23
|
|
54
58
|
╰ Unused Definitions (unused-definitions): no findings
|
|
55
59
|
╰ Network Functions (network-functions): no findings
|
|
56
60
|
╰ Dataframe Access Validation (dataframe-access-validation): no findings
|
|
@@ -63,9 +67,10 @@ It offers a wide variety of features, for example:
|
|
|
63
67
|
╰ Undefined Symbol (undefined-symbol): no findings
|
|
64
68
|
╰ Unused Import (unused-import): no findings
|
|
65
69
|
╰ Unclosed Connection (unclosed-connection): no findings
|
|
70
|
+
╰ Overwritten File (overwritten-file): no findings
|
|
66
71
|
╰ Unescaped Arguments (unescaped-arguments): no findings
|
|
67
72
|
╰ Namespace Access Validity (namespace-access): no findings
|
|
68
|
-
All queries together required ≈
|
|
73
|
+
All queries together required ≈16 ms (1ms accuracy, total 16 ms)
|
|
69
74
|
```
|
|
70
75
|
|
|
71
76
|
The linter will analyze the code and return any issues found.
|
|
@@ -79,7 +84,7 @@ It offers a wide variety of features, for example:
|
|
|
79
84
|
|
|
80
85
|
_Results (prettified and summarized):_
|
|
81
86
|
|
|
82
|
-
Query: **linter** (
|
|
87
|
+
Query: **linter** (31 ms)\
|
|
83
88
|
╰ **Deprecated Functions** (deprecated-functions): _no findings_\
|
|
84
89
|
╰ **File Path Validity** (file-path-validity):\
|
|
85
90
|
╰ certain:\
|
|
@@ -100,16 +105,16 @@ It offers a wide variety of features, for example:
|
|
|
100
105
|
╰ **Undefined Symbol** (undefined-symbol): _no findings_\
|
|
101
106
|
╰ **Unused Import** (unused-import): _no findings_\
|
|
102
107
|
╰ **Unclosed Connection** (unclosed-connection): _no findings_\
|
|
108
|
+
╰ **Overwritten File** (overwritten-file): _no findings_\
|
|
103
109
|
╰ **Unescaped Arguments** (unescaped-arguments): _no findings_\
|
|
104
110
|
╰ **Namespace Access Validity** (namespace-access): _no findings_\
|
|
105
|
-
_All queries together required ≈
|
|
111
|
+
_All queries together required ≈31 ms (1ms accuracy, total 31 ms)_
|
|
106
112
|
|
|
107
113
|
<details> <summary style="color:gray">Show Detailed Results as Json</summary>
|
|
108
114
|
|
|
109
115
|
The analysis ran (including parsing and normalization and the query) within the generation environment.
|
|
110
116
|
|
|
111
|
-
|
|
112
|
-
Please consult the [Interface](https://github.com/flowr-analysis/flowr/wiki/Interface) wiki page for more information on how to get those.
|
|
117
|
+
The JSON contains the ids of the nodes in question (see the [Interface](https://github.com/flowr-analysis/flowr/wiki/Interface) wiki page).
|
|
113
118
|
|
|
114
119
|
```json
|
|
115
120
|
{
|
|
@@ -144,6 +149,7 @@ It offers a wide variety of features, for example:
|
|
|
144
149
|
},
|
|
145
150
|
"unused-import": {"results":[],".meta":{"totalConsidered":0,"totalUnresolved":0,"totalMultiPackage":0,"totalUnused":0}},
|
|
146
151
|
"unclosed-connection": {"results":[],".meta":{"totalOpened":0,"totalClosed":0}},
|
|
152
|
+
"overwritten-file": {"results":[],".meta":{"totalFiles":0}},
|
|
147
153
|
"unescaped-arguments": {"results":[],".meta":{"totalCriticalArguments":0,"totalEscapedArguments":0}},
|
|
148
154
|
"namespace-access": {"results":[],".meta":{"unresolved":0}}
|
|
149
155
|
},
|
|
@@ -162,7 +168,7 @@ It offers a wide variety of features, for example:
|
|
|
162
168
|
* 🍕 **program slicing**\
|
|
163
169
|
Given a point of interest like the visualization of a plot, _flowR_ reduces the program to just the parts which are relevant
|
|
164
170
|
for the computation of the point of interest.
|
|
165
|
-
( [▶ Explore in Browser](https://flowr-analysis.github.io/flowr/wiki/playground/#c=zM4VwtgBAPAtBAMAoADgJwPYBMQGMAu0cAjIgO6EQDsiAchUUogGbqoQAUAlhJwHYREAXOxowiASnEQA3oggRQkWAvAQA1D3URSciGiy4Cy-dnwQAVD0QBfRIhwBDPOwBEAZXCCXAGhVhfLgA6vC7i9k6uAAoYpnheviaGAcGhiEA&h=slice&f=deps&
|
|
171
|
+
( [▶ Explore in Browser](https://flowr-analysis.github.io/flowr/wiki/playground/#c=zM4VwtgBAPAtBAMAoADgJwPYBMQGMAu0cAjIgO6EQDsiAchUUogGbqoQAUAlhJwHYREAXOxowiASnEQA3oggRQkWAvAQA1D3URSciGiy4Cy-dnwQAVD0QBfRIhwBDPOwBEAZXCCXAGhVhfLgA6vC7i9k6uAAoYpnheviaGAcGhiEA&h=slice&f=deps&p=11:13 "run the slicing example in flowR's playground, no setup") )
|
|
166
172
|
|
|
167
173
|
<details><summary>Example: Slicing with flowR</summary>
|
|
168
174
|
|
|
@@ -193,7 +199,7 @@ It offers a wide variety of features, for example:
|
|
|
193
199
|
|
|
194
200
|
```shell
|
|
195
201
|
$ docker run -it --rm eagleoutice/flowr # or npm run flowr
|
|
196
|
-
flowR repl v2.16.
|
|
202
|
+
flowR repl v2.16.7, R grammar v14 (tree-sitter engine)
|
|
197
203
|
R> :query @static-slice (11@sum) file://test/testfiles/example.R
|
|
198
204
|
```
|
|
199
205
|
|
|
@@ -206,7 +212,7 @@ It offers a wide variety of features, for example:
|
|
|
206
212
|
N <- 10
|
|
207
213
|
for(i in 1:(N-1)) sum <- sum + i + w
|
|
208
214
|
sum
|
|
209
|
-
All queries together required ≈
|
|
215
|
+
All queries together required ≈3 ms (1ms accuracy, total 3 ms)
|
|
210
216
|
```
|
|
211
217
|
|
|
212
218
|
</details>
|
|
@@ -214,7 +220,7 @@ It offers a wide variety of features, for example:
|
|
|
214
220
|
</details>
|
|
215
221
|
|
|
216
222
|
* 🚀 **fast call-graph, data-, and control-flow graphs**\
|
|
217
|
-
Within just [<i><span title="This measurement is automatically fetched from the latest benchmark!">
|
|
223
|
+
Within just [<i><span title="This measurement is automatically fetched from the latest benchmark!">104.2 ms</span></i> (as of Oct 27, 2026)](https://flowr-analysis.github.io/flowr/wiki/stats/benchmark),
|
|
218
224
|
_flowR_ can analyze the data- and control-flow of the average real-world R script. See the [benchmarks](https://flowr-analysis.github.io/flowr/wiki/stats/benchmark) for more information,
|
|
219
225
|
and consult the [wiki pages](https://github.com/flowr-analysis/flowr/wiki/Dataflow-Graph) for more details on the [dataflow graphs](https://github.com/flowr-analysis/flowr/wiki/Dataflow-Graph) as well as [call graphs](https://github.com/flowr-analysis/flowr/wiki/Dataflow-Graph#perspectives-cg).
|
|
220
226
|
( [▶ Explore in Browser](https://flowr-analysis.github.io/flowr/wiki/playground/#c=zDYSwRgTghhCeAUATADsWECUAoLBnAxlMAKYD6ALgPakC2UAHgAQA8AtIwGYCuAdvuSEo949DIyYB6RnXojsWaAHdGKlW0aIo5KADoO0GsXghEjALyMAjAC4AbABpGANyJdi5xvngBmRwA5HAHZHACZHAE5HABYMbHwSKB5VdQ4QYHJiCHglRxdgN0YAPkYQuISeABICImJTdWqSCmoZeHjiRIq8t3lcLho6OFJcbXJcFnZe-pgQXCM2xMdDRI8l4Qba2KxeLlnEJu1gNQm%2B7KhFTtdieUUIEAydfFwneEmB2CGR3EcAIleYWAeT2%2B2FQlHIrXKVUIJEQIMoIB4owh7UqJgwQA&p=13:1 "run this script in flowR's playground, no setup") )
|
|
@@ -245,7 +251,7 @@ It offers a wide variety of features, for example:
|
|
|
245
251
|
|
|
246
252
|
```shell
|
|
247
253
|
$ docker run -it --rm eagleoutice/flowr # or npm run flowr
|
|
248
|
-
flowR repl v2.16.
|
|
254
|
+
flowR repl v2.16.7, R grammar v14 (tree-sitter engine)
|
|
249
255
|
R> :dataflow* test/testfiles/example.R
|
|
250
256
|
```
|
|
251
257
|
|
|
@@ -549,7 +555,7 @@ It offers a wide variety of features, for example:
|
|
|
549
555
|
linkStyle 107 stroke:gray;
|
|
550
556
|
```
|
|
551
557
|
|
|
552
|
-
(The analysis ran (
|
|
558
|
+
(The analysis ran (parse and normalize with the [tree-sitter](https://github.com/flowr-analysis/flowr/wiki/Engines) engine) in the generation environment. No [signature database](https://github.com/flowr-analysis/flowr/wiki/Signature-Database) is mounted, so `library()` attaches no exports (base-R names are still qualified, e.g., `stats::acf`).)
|
|
553
559
|
|
|
554
560
|
</details>
|
|
555
561
|
|
|
@@ -11,6 +11,8 @@ type DataFrameStateDomain = StateDomain<DataFrameDomain>;
|
|
|
11
11
|
* A map storing the abstract data frame operations that the expressions of the analyzed program are mapped to.
|
|
12
12
|
*/
|
|
13
13
|
export type DataFrameOperationMap = Map<NodeId, readonly DataFrameOperation[]>;
|
|
14
|
+
/** the functions the shape inference knows to return a data frame, qualified as `pkg::name`, like `utils::read.csv` */
|
|
15
|
+
export declare const DataFrameFunctions: ReadonlySet<string>;
|
|
14
16
|
/**
|
|
15
17
|
* The options of the abstract semantics of the data frame shape inference (see {@link DataFrameShapeSemantics}).
|
|
16
18
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DataFrameShapeSemantics = void 0;
|
|
3
|
+
exports.DataFrameShapeSemantics = exports.DataFrameFunctions = void 0;
|
|
4
4
|
const config_1 = require("../../config");
|
|
5
5
|
const built_in_proc_name_1 = require("../../dataflow/environments/built-in-proc-name");
|
|
6
6
|
const resolve_helper_1 = require("../../dataflow/environments/resolve-helper");
|
|
@@ -403,6 +403,8 @@ const DataFrameSemantics = {
|
|
|
403
403
|
},
|
|
404
404
|
conditionSemantics: {}
|
|
405
405
|
};
|
|
406
|
+
/** the functions the shape inference knows to return a data frame, qualified as `pkg::name`, like `utils::read.csv` */
|
|
407
|
+
exports.DataFrameFunctions = new Set(Object.keys(DataFrameSemantics.functionCalls));
|
|
406
408
|
/**
|
|
407
409
|
* The abstract semantics of the data frame shape inference, applying the abstract semantics defined for the supported
|
|
408
410
|
* data frame functions, access operations, and replacement functions (see {@link DataFrameSemantics}).
|
|
@@ -34,13 +34,7 @@ export declare function unquoteArgument(argument: undefined): undefined;
|
|
|
34
34
|
export declare function unquoteArgument(argument: string): string;
|
|
35
35
|
export declare function unquoteArgument(argument: string | undefined): string | undefined;
|
|
36
36
|
/**
|
|
37
|
-
*
|
|
38
|
-
*/
|
|
39
|
-
export declare function unescapeQuotes(argument: undefined): undefined;
|
|
40
|
-
export declare function unescapeQuotes(argument: string): string;
|
|
41
|
-
export declare function unescapeQuotes(argument: string | undefined): string | undefined;
|
|
42
|
-
/**
|
|
43
|
-
* Unescapes escape sequences like `\r`, `\n`, `\t`, `\'`, `\"`, `\\` back into actual newlines, tabs, quotes, and backslashes
|
|
37
|
+
* The characters the content of an R string literal stands for, see {@link unescapeRString}; as written where R would reject it
|
|
44
38
|
*/
|
|
45
39
|
export declare function unescapeSpecialChars(argument: undefined): undefined;
|
|
46
40
|
export declare function unescapeSpecialChars(argument: string): string;
|
|
@@ -6,9 +6,9 @@ exports.resolveIdToArgStringVector = resolveIdToArgStringVector;
|
|
|
6
6
|
exports.resolveIdToArgValueSymbolName = resolveIdToArgValueSymbolName;
|
|
7
7
|
exports.resolveIdToArgVectorLength = resolveIdToArgVectorLength;
|
|
8
8
|
exports.unquoteArgument = unquoteArgument;
|
|
9
|
-
exports.unescapeQuotes = unescapeQuotes;
|
|
10
9
|
exports.unescapeSpecialChars = unescapeSpecialChars;
|
|
11
10
|
const identifier_1 = require("../../dataflow/environments/identifier");
|
|
11
|
+
const string_constants_1 = require("../../dataflow/eval/values/string/string-constants");
|
|
12
12
|
const resolve_helper_1 = require("../../dataflow/environments/resolve-helper");
|
|
13
13
|
const r_argument_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-argument");
|
|
14
14
|
const r_string_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-string");
|
|
@@ -110,16 +110,7 @@ function unquoteArgument(argument) {
|
|
|
110
110
|
}
|
|
111
111
|
return argument;
|
|
112
112
|
}
|
|
113
|
-
function unescapeQuotes(argument) {
|
|
114
|
-
if (argument === undefined) {
|
|
115
|
-
return undefined;
|
|
116
|
-
}
|
|
117
|
-
return argument.replaceAll('\\\'', '\'').replaceAll('\\"', '"');
|
|
118
|
-
}
|
|
119
113
|
function unescapeSpecialChars(argument) {
|
|
120
|
-
|
|
121
|
-
return undefined;
|
|
122
|
-
}
|
|
123
|
-
return unescapeQuotes(argument).replaceAll('\\r', '\r').replaceAll('\\n', '\n').replaceAll('\\t', '\t').replaceAll('\\\\', '\\');
|
|
114
|
+
return argument === undefined ? undefined : (0, string_constants_1.unescapeRString)(argument) ?? argument;
|
|
124
115
|
}
|
|
125
116
|
//# sourceMappingURL=resolve-args.js.map
|
|
@@ -3,26 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.controlflowBbStarCommand = exports.controlflowBbCommand = exports.controlflowStarCommand = exports.controlflowCommand = void 0;
|
|
4
4
|
const cfg_1 = require("../../../util/mermaid/cfg");
|
|
5
5
|
const cfg_simplification_1 = require("../../../control-flow/cfg-simplification");
|
|
6
|
-
const
|
|
7
|
-
const repl_clipboard_1 = require("./repl-clipboard");
|
|
8
|
-
async function produceAndPrintCfg(analyzer, output, simplifications, cfgConverter) {
|
|
9
|
-
const cfg = await analyzer.controlflow([...cfg_simplification_1.DefaultCfgSimplificationOrder, ...simplifications]);
|
|
10
|
-
const normalizedAst = await analyzer.normalize();
|
|
11
|
-
const mermaid = cfgConverter(cfg, normalizedAst);
|
|
12
|
-
await repl_clipboard_1.ReplClipboard.print(output, mermaid, repl_clipboard_1.ReplClipboard.note(output, 'mermaid code'));
|
|
13
|
-
}
|
|
6
|
+
const repl_code_command_1 = require("./repl-code-command");
|
|
14
7
|
function cfgCommand(description, usageExample, aliases, simplifications, cfgConverter) {
|
|
15
|
-
return {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
aliases,
|
|
20
|
-
script: false,
|
|
21
|
-
argsParser: (args) => (0, core_1.handleString)(args),
|
|
22
|
-
fn: async ({ output, analyzer }) => {
|
|
23
|
-
await produceAndPrintCfg(analyzer, output, simplifications, cfgConverter);
|
|
24
|
-
}
|
|
25
|
-
};
|
|
8
|
+
return (0, repl_code_command_1.clipboardCommand)(description, usageExample, aliases, async (analyzer) => {
|
|
9
|
+
const cfg = await analyzer.controlflow([...cfg_simplification_1.DefaultCfgSimplificationOrder, ...simplifications]);
|
|
10
|
+
return { text: cfgConverter(cfg, await analyzer.normalize()), type: 'mermaid code' };
|
|
11
|
+
});
|
|
26
12
|
}
|
|
27
13
|
exports.controlflowCommand = cfgCommand('Get mermaid code for the control-flow graph of R code', ':controlflow', ['cfg', 'cf'], [], cfg_1.cfgToMermaid);
|
|
28
14
|
exports.controlflowStarCommand = cfgCommand('Returns the URL to mermaid.live', ':controlflow*', ['cfg*', 'cf*'], [], cfg_1.cfgToMermaidUrl);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ReplCodeCommand, ReplCodeCommandInformation } from './repl-main';
|
|
2
|
+
/** A code command whose code is everything after the command, as for most analysis commands. */
|
|
3
|
+
export declare function codeCommand(description: string, usageExample: string, aliases: string[], fn: ReplCodeCommand['fn']): ReplCodeCommand;
|
|
4
|
+
/** A code command that prints `text` of the given `type` (and copies it to the clipboard), mentioning the timing of the pipeline `step` if given. */
|
|
5
|
+
export declare function clipboardCommand(description: string, usageExample: string, aliases: string[], produce: (analyzer: ReplCodeCommandInformation['analyzer']) => Promise<{
|
|
6
|
+
readonly text: string;
|
|
7
|
+
readonly type: string;
|
|
8
|
+
readonly step?: string;
|
|
9
|
+
readonly timing?: number;
|
|
10
|
+
}>): ReplCodeCommand;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.codeCommand = codeCommand;
|
|
4
|
+
exports.clipboardCommand = clipboardCommand;
|
|
5
|
+
const core_1 = require("../core");
|
|
6
|
+
const repl_clipboard_1 = require("./repl-clipboard");
|
|
7
|
+
/** A code command whose code is everything after the command, as for most analysis commands. */
|
|
8
|
+
function codeCommand(description, usageExample, aliases, fn) {
|
|
9
|
+
return { description, isCodeCommand: true, usageExample, aliases, script: false, argsParser: (args) => (0, core_1.handleString)(args), fn };
|
|
10
|
+
}
|
|
11
|
+
/** A code command that prints `text` of the given `type` (and copies it to the clipboard), mentioning the timing of the pipeline `step` if given. */
|
|
12
|
+
function clipboardCommand(description, usageExample, aliases, produce) {
|
|
13
|
+
return codeCommand(description, usageExample, aliases, async ({ output, analyzer }) => {
|
|
14
|
+
const { text, type, step, timing } = await produce(analyzer);
|
|
15
|
+
await repl_clipboard_1.ReplClipboard.print(output, text, repl_clipboard_1.ReplClipboard.note(output, type, step, timing));
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=repl-code-command.js.map
|
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.dataflowSimpleStarCommand = exports.dataflowSimplifiedCommand = exports.dataflowSilentCommand = exports.dataflowAsciiCommand = exports.dataflowStarCommand = exports.dataflowCommand = void 0;
|
|
4
4
|
const ansi_1 = require("../../../util/text/ansi");
|
|
5
|
-
const
|
|
6
|
-
const repl_clipboard_1 = require("./repl-clipboard");
|
|
5
|
+
const repl_code_command_1 = require("./repl-code-command");
|
|
7
6
|
const vertex_1 = require("../../../dataflow/graph/vertex");
|
|
8
7
|
const dfg_ascii_1 = require("../../../util/simple-df/dfg-ascii");
|
|
9
8
|
const df_helper_1 = require("../../../dataflow/graph/df-helper");
|
|
@@ -88,66 +87,42 @@ function printReferenceSections(output, sections) {
|
|
|
88
87
|
}
|
|
89
88
|
}
|
|
90
89
|
function mermaidCommand(description, usageExample, aliases, url, simplified) {
|
|
91
|
-
return {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
fn: async ({ output, analyzer }) => {
|
|
99
|
-
const result = await analyzer.dataflow();
|
|
100
|
-
const qualifyBaseR = (0, config_1.isSigDbEnabled)(analyzer.flowrConfig);
|
|
101
|
-
const mermaid = url ? df_helper_1.Dataflow.visualize.mermaid.url(result.graph, false, undefined, simplified, qualifyBaseR)
|
|
102
|
-
: df_helper_1.Dataflow.visualize.mermaid.convert({ graph: result.graph, includeEnvironments: false, simplified: simplified || undefined, qualifyBaseR }).string;
|
|
103
|
-
await repl_clipboard_1.ReplClipboard.print(output, mermaid, repl_clipboard_1.ReplClipboard.note(output, url ? 'mermaid url' : 'mermaid code', 'dataflow', result['.meta'].timing));
|
|
104
|
-
}
|
|
105
|
-
};
|
|
90
|
+
return (0, repl_code_command_1.clipboardCommand)(description, usageExample, aliases, async (analyzer) => {
|
|
91
|
+
const result = await analyzer.dataflow();
|
|
92
|
+
const qualifyBaseR = (0, config_1.isSigDbEnabled)(analyzer.flowrConfig);
|
|
93
|
+
const text = url ? df_helper_1.Dataflow.visualize.mermaid.url(result.graph, false, undefined, simplified, qualifyBaseR)
|
|
94
|
+
: df_helper_1.Dataflow.visualize.mermaid.convert({ graph: result.graph, includeEnvironments: false, simplified: simplified || undefined, qualifyBaseR }).string;
|
|
95
|
+
return { text, type: url ? 'mermaid url' : 'mermaid code', step: 'dataflow', timing: result['.meta'].timing };
|
|
96
|
+
});
|
|
106
97
|
}
|
|
107
98
|
exports.dataflowCommand = mermaidCommand('Get mermaid code for the dataflow graph', ':dataflow', ['d', 'df'], false, false);
|
|
108
99
|
exports.dataflowStarCommand = mermaidCommand('Returns the URL to mermaid.live', ':dataflow*', ['d*', 'df*'], true, false);
|
|
109
|
-
exports.dataflowAsciiCommand = {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
{ label: 'Vertices', value: numOfVertices },
|
|
136
|
-
...Object.entries(vertex_1.VertexType).map(([name, vertType]) => ({
|
|
137
|
-
label: name,
|
|
138
|
-
value: Array.from(result.graph.verticesOfType(vertType)).length,
|
|
139
|
-
indent: true
|
|
140
|
-
}))
|
|
141
|
-
]);
|
|
142
|
-
const { idMap } = await analyzer.normalize();
|
|
143
|
-
printReferenceSections(output, [
|
|
144
|
-
{ title: 'In', lines: result.in.map(r => referenceRow(r, idMap)) },
|
|
145
|
-
{ title: 'Out', lines: result.out.map(r => referenceRow(r, idMap)) },
|
|
146
|
-
{ title: 'Unknown References', lines: result.unknownReferences.map(r => referenceRow(r, idMap)) },
|
|
147
|
-
{ title: 'Kill', lines: (result.kill ?? []).map(k => killRow(k, idMap)) }
|
|
148
|
-
]);
|
|
149
|
-
}
|
|
150
|
-
};
|
|
100
|
+
exports.dataflowAsciiCommand = (0, repl_code_command_1.codeCommand)('Returns an ASCII representation of the dataflow graph', ':dataflowascii', ['df!'], async ({ output, analyzer }) => {
|
|
101
|
+
const result = await analyzer.dataflow();
|
|
102
|
+
output.stdout((0, dfg_ascii_1.dfgToAscii)(result.graph));
|
|
103
|
+
});
|
|
104
|
+
exports.dataflowSilentCommand = (0, repl_code_command_1.codeCommand)('Just calculates the DFG, but only prints summary info', ':dataflowsilent', ['d#', 'df#'], async ({ output, analyzer }) => {
|
|
105
|
+
const result = await analyzer.dataflow();
|
|
106
|
+
const numOfEdges = Array.from(result.graph.edges().flatMap(e => e[1].entries())).length;
|
|
107
|
+
const numOfVertices = Array.from(result.graph.vertices(true)).length;
|
|
108
|
+
output.stdout(output.formatter.format(`Dataflow calculated in ${result['.meta'].timing}ms.`, { color: 7 /* Colors.White */, effect: ansi_1.ColorEffect.Foreground, style: 3 /* FontStyles.Italic */ }));
|
|
109
|
+
printCounts(output, [
|
|
110
|
+
{ label: 'Edges', value: numOfEdges },
|
|
111
|
+
{ label: 'Vertices', value: numOfVertices },
|
|
112
|
+
...Object.entries(vertex_1.VertexType).map(([name, vertType]) => ({
|
|
113
|
+
label: name,
|
|
114
|
+
value: Array.from(result.graph.verticesOfType(vertType)).length,
|
|
115
|
+
indent: true
|
|
116
|
+
}))
|
|
117
|
+
]);
|
|
118
|
+
const { idMap } = await analyzer.normalize();
|
|
119
|
+
printReferenceSections(output, [
|
|
120
|
+
{ title: 'In', lines: result.in.map(r => referenceRow(r, idMap)) },
|
|
121
|
+
{ title: 'Out', lines: result.out.map(r => referenceRow(r, idMap)) },
|
|
122
|
+
{ title: 'Unknown References', lines: result.unknownReferences.map(r => referenceRow(r, idMap)) },
|
|
123
|
+
{ title: 'Kill', lines: (result.kill ?? []).map(k => killRow(k, idMap)) }
|
|
124
|
+
]);
|
|
125
|
+
});
|
|
151
126
|
exports.dataflowSimplifiedCommand = mermaidCommand('Get mermaid code for the simplified dataflow graph', ':dataflowsimple', ['ds', 'dfs'], false, true);
|
|
152
127
|
exports.dataflowSimpleStarCommand = mermaidCommand('Returns the URL to mermaid.live', ':dataflowsimple*', ['ds*', 'dfs*'], true, true);
|
|
153
128
|
//# sourceMappingURL=repl-dataflow.js.map
|
|
@@ -3,52 +3,35 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.normalizeHashCommand = exports.normalizeStarCommand = exports.normalizeCommand = void 0;
|
|
4
4
|
const ast_1 = require("../../../util/mermaid/ast");
|
|
5
5
|
const ansi_1 = require("../../../util/text/ansi");
|
|
6
|
-
const
|
|
7
|
-
const repl_clipboard_1 = require("./repl-clipboard");
|
|
6
|
+
const repl_code_command_1 = require("./repl-code-command");
|
|
8
7
|
const defaultmap_1 = require("../../../util/collections/defaultmap");
|
|
9
8
|
const r_project_1 = require("../../../r-bridge/lang-4.x/ast/model/nodes/r-project");
|
|
10
9
|
function normalizeMermaidCommand(description, usageExample, aliases, convert) {
|
|
11
|
-
return {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
aliases,
|
|
16
|
-
script: false,
|
|
17
|
-
argsParser: (args) => (0, core_1.handleString)(args),
|
|
18
|
-
fn: async ({ output, analyzer }) => {
|
|
19
|
-
const result = await analyzer.normalize();
|
|
20
|
-
await repl_clipboard_1.ReplClipboard.print(output, convert(result.ast), repl_clipboard_1.ReplClipboard.note(output, 'mermaid url', 'normalize', result['.meta'].timing));
|
|
21
|
-
}
|
|
22
|
-
};
|
|
10
|
+
return (0, repl_code_command_1.clipboardCommand)(description, usageExample, aliases, async (analyzer) => {
|
|
11
|
+
const result = await analyzer.normalize();
|
|
12
|
+
return { text: convert(result.ast), type: 'mermaid url', step: 'normalize', timing: result['.meta'].timing };
|
|
13
|
+
});
|
|
23
14
|
}
|
|
24
15
|
exports.normalizeCommand = normalizeMermaidCommand('Get mermaid code for the normalized AST of R code', ':normalize', ['n'], ast_1.normalizedAstToMermaid);
|
|
25
16
|
exports.normalizeStarCommand = normalizeMermaidCommand('Returns the URL to mermaid.live', ':normalize*', ['n*'], ast_1.normalizedAstToMermaidUrl);
|
|
26
|
-
exports.normalizeHashCommand = {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
output.
|
|
44
|
-
output.stdout(`${num(total)} nodes total over ${num(files)} file(s)`);
|
|
45
|
-
const longestType = counts.keys().map(p => p.toString().length).reduce((a, b) => Math.max(a, b), 0);
|
|
46
|
-
for (const [type, count] of counts.entries().toArray().sort((a, b) => b[1] - a[1])) {
|
|
47
|
-
output.stdout(` ${(type + ':').padEnd(longestType + 1, ' ')} ${num(count, 7)}`);
|
|
48
|
-
}
|
|
49
|
-
if (result.hasError) {
|
|
50
|
-
output.stderr(output.formatter.format('There were errors during normalization, enable lax mode to parse (see :parse)!', { color: 1 /* Colors.Red */, effect: ansi_1.ColorEffect.Foreground, style: 1 /* FontStyles.Bold */ }));
|
|
51
|
-
}
|
|
17
|
+
exports.normalizeHashCommand = (0, repl_code_command_1.codeCommand)('Returns summarization stats for the normalized AST', ':normalize#', ['n#'], async ({ output, analyzer }) => {
|
|
18
|
+
const result = await analyzer.normalize();
|
|
19
|
+
const counts = new defaultmap_1.DefaultMap(() => 0);
|
|
20
|
+
let total = 0;
|
|
21
|
+
const files = result.ast.files.length;
|
|
22
|
+
r_project_1.RProject.visitAst(result.ast, n => {
|
|
23
|
+
counts.set(n.type, counts.get(n.type) + 1);
|
|
24
|
+
total++;
|
|
25
|
+
});
|
|
26
|
+
const num = (s, pad = 0) => output.formatter.format(s.toString().padStart(pad, ' '), { color: 6 /* Colors.Cyan */, effect: ansi_1.ColorEffect.Foreground });
|
|
27
|
+
output.stdout(output.formatter.format('Calculated in ' + result['.meta'].timing + 'ms', { color: 7 /* Colors.White */, effect: ansi_1.ColorEffect.Foreground, style: 3 /* FontStyles.Italic */ }));
|
|
28
|
+
output.stdout(`${num(total)} nodes total over ${num(files)} file(s)`);
|
|
29
|
+
const longestType = counts.keys().map(p => p.toString().length).reduce((a, b) => Math.max(a, b), 0);
|
|
30
|
+
for (const [type, count] of counts.entries().toArray().sort((a, b) => b[1] - a[1])) {
|
|
31
|
+
output.stdout(` ${(type + ':').padEnd(longestType + 1, ' ')} ${num(count, 7)}`);
|
|
32
|
+
}
|
|
33
|
+
if (result.hasError) {
|
|
34
|
+
output.stderr(output.formatter.format('There were errors during normalization, enable lax mode to parse (see :parse)!', { color: 1 /* Colors.Red */, effect: ansi_1.ColorEffect.Foreground, style: 1 /* FontStyles.Bold */ }));
|
|
52
35
|
}
|
|
53
|
-
};
|
|
36
|
+
});
|
|
54
37
|
//# sourceMappingURL=repl-normalize.js.map
|
|
@@ -10,6 +10,7 @@ const json_1 = require("../../../util/json");
|
|
|
10
10
|
const args_1 = require("../../../util/text/args");
|
|
11
11
|
const record_1 = require("../../../util/record");
|
|
12
12
|
const retriever_1 = require("../../../r-bridge/retriever");
|
|
13
|
+
const string_constants_1 = require("../../../dataflow/eval/values/string/string-constants");
|
|
13
14
|
const path_input_1 = require("../path-input");
|
|
14
15
|
/**
|
|
15
16
|
* Whether the analyzer already holds exactly `input` as its sole request, so a prior analysis (e.g. a
|
|
@@ -180,20 +181,16 @@ function parseQueryArgs(line) {
|
|
|
180
181
|
};
|
|
181
182
|
}
|
|
182
183
|
/**
|
|
183
|
-
* Undoes a wrapping of the whole code in quotes, as `:query \@dependencies "library(x)"` writes it.
|
|
184
|
-
*
|
|
184
|
+
* Undoes a wrapping of the whole code in quotes, as `:query \@dependencies "library(x)"` writes it. Double quotes
|
|
185
|
+
* undo their escapes as R does, so `\n` separates statements; an escape R rejects, e.g. in a Windows path, is kept as written.
|
|
185
186
|
*/
|
|
186
187
|
function unwrapQuotedInput(code) {
|
|
187
188
|
const quote = code[0];
|
|
188
|
-
if ((quote !== '"' && quote !== '\'') || code
|
|
189
|
+
if ((quote !== '"' && quote !== '\'') || (0, args_1.closingQuote)(code) !== code.length - 1) {
|
|
189
190
|
return code;
|
|
190
191
|
}
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
return code;
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
return code.slice(1, -1);
|
|
192
|
+
const inner = code.slice(1, -1);
|
|
193
|
+
return quote === '"' ? (0, string_constants_1.unescapeRString)(inner) ?? inner : inner;
|
|
197
194
|
}
|
|
198
195
|
/**
|
|
199
196
|
* Separates the query from everything after it. The query is either a bare token (`@static-slice`) or the
|
|
@@ -201,16 +198,12 @@ function unwrapQuotedInput(code) {
|
|
|
201
198
|
*/
|
|
202
199
|
function splitQueryFromRest(line) {
|
|
203
200
|
const trimmed = line.trimStart();
|
|
204
|
-
|
|
205
|
-
if (quote !== '"' && quote !== '\'') {
|
|
201
|
+
if (trimmed[0] !== '"' && trimmed[0] !== '\'') {
|
|
206
202
|
const space = trimmed.indexOf(' ');
|
|
207
203
|
return space < 0 ? [trimmed, ''] : [trimmed.slice(0, space), trimmed.slice(space + 1)];
|
|
208
204
|
}
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
end++;
|
|
212
|
-
}
|
|
213
|
-
return [trimmed.slice(1, end).replace(/\\(.)/g, '$1'), trimmed.slice(end + 1).trimStart()];
|
|
205
|
+
const end = (0, args_1.closingQuote)(trimmed) ?? trimmed.length;
|
|
206
|
+
return [(0, args_1.unescapeArg)(trimmed.slice(1, end)), trimmed.slice(end + 1).trimStart()];
|
|
214
207
|
}
|
|
215
208
|
exports.queryCommand = {
|
|
216
209
|
description: 'Query the given R code (use \'help\' for more information)',
|
|
@@ -224,7 +217,7 @@ exports.queryCommand = {
|
|
|
224
217
|
const results = await processQueryArgs(output, analyzer, remainingArgs);
|
|
225
218
|
const totalEnd = Date.now();
|
|
226
219
|
if (results) {
|
|
227
|
-
output.stdout(await (0, query_print_1.asciiSummaryOfQueryResult)(
|
|
220
|
+
output.stdout(await (0, query_print_1.asciiSummaryOfQueryResult)(output.formatter, totalEnd - totalStart, results.query, results.analyzer, results.parsedQuery));
|
|
228
221
|
}
|
|
229
222
|
}
|
|
230
223
|
};
|
package/config.js
CHANGED
|
@@ -306,13 +306,13 @@ exports.FlowrConfig = {
|
|
|
306
306
|
assumeImplicitEcho: true
|
|
307
307
|
},
|
|
308
308
|
linter: {
|
|
309
|
-
|
|
310
|
-
|
|
309
|
+
/* tests and the R CMD check rules only make sense for a package, which re-enables them below */
|
|
310
|
+
disabledRules: ['software-has-tests'],
|
|
311
311
|
disabledTags: ['cmd-check']
|
|
312
312
|
},
|
|
313
313
|
specializeConfig: {
|
|
314
314
|
/* a package's top-level code runs at install time, its results are not echoed to anyone */
|
|
315
|
-
[project_kind_1.ProjectKind.Package]: { project: { assumeImplicitEcho: false }, solver: { resolveSource: { assumeFilesExist: true } }, linter: { disabledTags: [] } },
|
|
315
|
+
[project_kind_1.ProjectKind.Package]: { project: { assumeImplicitEcho: false }, solver: { resolveSource: { assumeFilesExist: true } }, linter: { disabledRules: [], disabledTags: [] } },
|
|
316
316
|
[project_kind_1.ProjectKind.Project]: { solver: { resolveSource: { assumeFilesExist: true } } },
|
|
317
317
|
[project_kind_1.ProjectKind.ShinyApp]: {
|
|
318
318
|
/* shiny evaluates global.R before the supporting files in R/, and the app itself last */
|
|
@@ -10,6 +10,7 @@ const graph_1 = require("../dataflow/graph/graph");
|
|
|
10
10
|
const node_value_1 = require("../dataflow/eval/resolve/node-value");
|
|
11
11
|
const built_in_proc_name_1 = require("../dataflow/environments/built-in-proc-name");
|
|
12
12
|
const log_1 = require("../util/log");
|
|
13
|
+
const function_semantics_1 = require("../dataflow/fn/function-semantics");
|
|
13
14
|
const r_function_call_1 = require("../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
|
|
14
15
|
const r_value_1 = require("../dataflow/eval/values/r-value");
|
|
15
16
|
const convert_values_1 = require("../r-bridge/lang-4.x/convert-values");
|
|
@@ -22,6 +23,7 @@ class CfgConditionalDeadCodeRemoval extends semantic_cfg_guided_visitor_1.Semant
|
|
|
22
23
|
cachedStatements = new Map();
|
|
23
24
|
cachedSwitch = new Map();
|
|
24
25
|
caught = new Map();
|
|
26
|
+
forcing;
|
|
25
27
|
getValue(id) {
|
|
26
28
|
const has = this.cachedConditions.get(id);
|
|
27
29
|
if (has) {
|
|
@@ -119,10 +121,12 @@ class CfgConditionalDeadCodeRemoval extends semantic_cfg_guided_visitor_1.Semant
|
|
|
119
121
|
this.handleWithCondition(data);
|
|
120
122
|
}
|
|
121
123
|
onStopCall(data) {
|
|
122
|
-
this.
|
|
124
|
+
if (!this.mayStayUnforced(data.call.id)) {
|
|
125
|
+
this.cachedStatements.set(data.call.id, true);
|
|
126
|
+
}
|
|
123
127
|
}
|
|
124
128
|
onStopIfNotCall(data) {
|
|
125
|
-
if (this.cachedStatements.has(data.call.id)) {
|
|
129
|
+
if (this.cachedStatements.has(data.call.id) || this.mayStayUnforced(data.call.id)) {
|
|
126
130
|
return;
|
|
127
131
|
}
|
|
128
132
|
const arg = this.getBoolArgValue(data);
|
|
@@ -130,6 +134,15 @@ class CfgConditionalDeadCodeRemoval extends semantic_cfg_guided_visitor_1.Semant
|
|
|
130
134
|
this.cachedStatements.set(data.call.id, !arg);
|
|
131
135
|
}
|
|
132
136
|
}
|
|
137
|
+
/** whether the call is in an argument that may never be evaluated: `stop("x")` in `f(1, stop("x"))` only runs if `f` uses it */
|
|
138
|
+
mayStayUnforced(id) {
|
|
139
|
+
const promised = this.config.dfg.getVertex(id)?.cds?.filter(cd => cd.byPromise === true) ?? [];
|
|
140
|
+
if (promised.length === 0) {
|
|
141
|
+
return false;
|
|
142
|
+
}
|
|
143
|
+
this.forcing ??= function_semantics_1.FunctionSemantics.promiseForcing(this.config.dfg, { ctx: this.config.ctx });
|
|
144
|
+
return promised.some(cd => this.forcing?.(cd.id, id) !== logic_1.Ternary.Always);
|
|
145
|
+
}
|
|
133
146
|
/**
|
|
134
147
|
* Whether an error raised here is caught before it can cut the flow, which is what `try` and `tryCatch`
|
|
135
148
|
* do to a `stop()` nested in them. The enclosing calls come from the AST: in the control flow graph a
|
|
@@ -55,8 +55,7 @@ function holdsOneElement(value, element = false) {
|
|
|
55
55
|
return false;
|
|
56
56
|
}
|
|
57
57
|
return value.type === 'vector' ? (0, r_value_1.isValue)(value.elements) && value.elements.length === 1 && holdsOneElement(value.elements[0], true)
|
|
58
|
-
: value.type === 'interval' ?
|
|
59
|
-
&& (0, r_value_1.isValue)(value.start.value) && (0, r_value_1.isValue)(value.end.value) && value.start.value.num === value.end.value.num
|
|
58
|
+
: value.type === 'interval' ? r_value_1.RValue.numberOf(value) !== undefined
|
|
60
59
|
: (value.type === 'string' || value.type === 'logical' || (element && value.type === 'number')) && (0, r_value_1.isValue)(value.value);
|
|
61
60
|
}
|
|
62
61
|
class CfgSingleIterationLoopDetector extends semantic_cfg_guided_visitor_1.SemanticCfgGuidedVisitor {
|