@eagleoutice/flowr 2.16.1 → 2.16.3
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 +10 -10
- package/abstract-interpretation/data-frame/arguments.js +4 -3
- package/abstract-interpretation/data-frame/dataframe-semantics.js +1 -2
- package/abstract-interpretation/data-frame/semantics.d.ts +2 -2
- package/abstract-interpretation/data-frame/semantics.js +2 -6
- package/benchmark/slicer.js +1 -3
- package/benchmark/summarizer/first-phase/input.js +1 -12
- package/benchmark/summarizer/second-phase/process.d.ts +7 -0
- package/benchmark/summarizer/second-phase/process.js +15 -12
- package/cli/repl/commands/repl-cfg.js +18 -49
- package/cli/repl/commands/repl-clipboard.d.ts +2 -0
- package/cli/repl/commands/repl-clipboard.js +5 -0
- package/cli/repl/commands/repl-commands.js +2 -2
- package/cli/repl/commands/repl-dataflow.js +21 -55
- package/cli/repl/commands/repl-normalize.js +15 -28
- package/cli/repl/commands/repl-parse.js +2 -2
- package/cli/repl/commands/repl-query.js +10 -10
- package/cli/repl/commands/repl-signature.js +4 -4
- package/cli/repl/server/connection.d.ts +1 -0
- package/cli/repl/server/connection.js +8 -30
- package/cli/repl/server/messages/message-analysis.js +1 -1
- package/config.d.ts +6 -0
- package/config.js +7 -4
- package/control-flow/cfg-dead-code.js +5 -14
- package/control-flow/cfg-to-basic-blocks.js +1 -6
- package/control-flow/control-flow-graph.d.ts +2 -16
- package/control-flow/control-flow-graph.js +8 -66
- package/control-flow/diff-cfg.js +10 -23
- package/control-flow/semantic-cfg-guided-visitor.js +5 -11
- package/control-flow/simple-visitor.js +2 -2
- package/core/steps/pipeline/default-pipelines.d.ts +138 -138
- package/data/r-base-packages.generated.js +0 -1
- package/data/r-base-primitives.generated.js +0 -1
- package/data/r-s3-generics.generated.d.ts +5 -0
- package/data/r-s3-generics.generated.js +103 -0
- package/dataflow/cluster.js +2 -1
- package/dataflow/environments/append.d.ts +1 -0
- package/dataflow/environments/built-in-props.d.ts +15 -2
- package/dataflow/environments/built-in-props.js +31 -4
- package/dataflow/environments/built-in.js +15 -9
- package/dataflow/environments/clone.d.ts +1 -0
- package/dataflow/environments/clone.js +1 -0
- package/dataflow/environments/default-builtin-config.d.ts +385 -25
- package/dataflow/environments/default-builtin-config.js +186 -106
- package/dataflow/environments/define.d.ts +1 -0
- package/dataflow/environments/define.js +1 -0
- package/dataflow/environments/environment.d.ts +27 -0
- package/dataflow/environments/environment.js +37 -16
- package/dataflow/environments/frame-memory.d.ts +9 -1
- package/dataflow/environments/frame-memory.js +12 -1
- package/dataflow/environments/identifier.d.ts +1 -2
- package/dataflow/environments/identifier.js +5 -7
- package/dataflow/environments/overwrite.js +1 -0
- package/dataflow/environments/query-fn-props.d.ts +3 -0
- package/dataflow/environments/query-fn-props.js +7 -0
- package/dataflow/environments/resolve-by-name.js +11 -4
- package/dataflow/environments/scoping.d.ts +3 -0
- package/dataflow/environments/scoping.js +3 -0
- package/dataflow/eval/resolve/alias-tracking.js +3 -3
- package/dataflow/eval/resolve/resolve-argument.d.ts +7 -3
- package/dataflow/eval/resolve/resolve-argument.js +21 -12
- package/dataflow/eval/resolve/resolve-numbers.js +5 -2
- package/dataflow/eval/resolve/resolve-strings.d.ts +1 -1
- package/dataflow/eval/resolve/resolve-working-directory.js +2 -2
- package/dataflow/eval/resolve/resolve.js +1 -2
- package/dataflow/eval/values/intervals/interval-constants.js +1 -6
- package/dataflow/eval/values/r-value.js +1 -6
- package/dataflow/extractor.js +17 -17
- package/dataflow/fn/argument-roles.js +15 -15
- package/dataflow/fn/class-declaration.js +7 -7
- package/dataflow/fn/frame-reflection.d.ts +1 -23
- package/dataflow/fn/frame-reflection.js +8 -95
- package/dataflow/fn/function-props.d.ts +0 -3
- package/dataflow/fn/function-props.js +9 -11
- package/dataflow/fn/function-semantics.d.ts +1 -0
- package/dataflow/fn/strict-function.js +15 -14
- package/dataflow/graph/call-graph.d.ts +8 -0
- package/dataflow/graph/call-graph.js +40 -25
- package/dataflow/graph/dataflowgraph-builder.d.ts +0 -60
- package/dataflow/graph/dataflowgraph-builder.js +15 -135
- package/dataflow/graph/df-helper.d.ts +56 -4
- package/dataflow/graph/df-helper.js +116 -1
- package/dataflow/graph/diff-dataflow-graph.js +13 -15
- package/dataflow/graph/graph-helper.d.ts +20 -0
- package/dataflow/graph/graph-helper.js +18 -0
- package/dataflow/graph/graph.js +15 -8
- package/dataflow/graph/match-args.d.ts +1 -1
- package/dataflow/graph/match-args.js +3 -3
- package/dataflow/internal/linker.d.ts +4 -10
- package/dataflow/internal/linker.js +21 -29
- package/dataflow/internal/process/functions/call/built-in/built-in-access.js +2 -8
- package/dataflow/internal/process/functions/call/built-in/built-in-ambient-state.d.ts +5 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-ambient-state.js +39 -22
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +19 -21
- package/dataflow/internal/process/functions/call/built-in/built-in-attach.js +3 -7
- package/dataflow/internal/process/functions/call/built-in/built-in-env-contents.js +6 -11
- package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.js +6 -8
- package/dataflow/internal/process/functions/call/built-in/built-in-eval.js +14 -13
- package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +27 -13
- package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +6 -8
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +33 -35
- package/dataflow/internal/process/functions/call/built-in/built-in-get.js +3 -5
- package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.js +6 -7
- package/dataflow/internal/process/functions/call/built-in/built-in-library.js +12 -5
- package/dataflow/internal/process/functions/call/built-in/built-in-list.js +3 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-load.js +7 -8
- package/dataflow/internal/process/functions/call/built-in/built-in-local.js +5 -6
- package/dataflow/internal/process/functions/call/built-in/built-in-new-env.js +3 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-pipe.js +2 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-purrr-formula.js +14 -7
- package/dataflow/internal/process/functions/call/built-in/built-in-quote.js +6 -5
- package/dataflow/internal/process/functions/call/built-in/built-in-repeat-loop.js +1 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-replacement.js +5 -6
- package/dataflow/internal/process/functions/call/built-in/built-in-rm.js +4 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-s-four.js +7 -7
- package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.js +1 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-s-three-dispatch.js +2 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-source.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-source.js +5 -7
- package/dataflow/internal/process/functions/call/built-in/built-in-stack-env.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-stack-env.js +4 -5
- package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.js +8 -9
- package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.js +4 -5
- package/dataflow/internal/process/functions/call/built-in/built-in-with.js +3 -3
- package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.js +36 -38
- package/dataflow/internal/process/functions/call/common.d.ts +3 -1
- package/dataflow/internal/process/functions/call/common.js +6 -7
- package/dataflow/internal/process/functions/call/deferred.js +8 -8
- package/dataflow/internal/process/functions/call/known-call-handling.d.ts +11 -4
- package/dataflow/internal/process/functions/call/known-call-handling.js +11 -7
- package/dataflow/internal/process/functions/call/named-call-handling.js +64 -11
- package/dataflow/internal/process/functions/call/nse.js +4 -4
- package/dataflow/internal/process/functions/call/quoted.js +16 -14
- package/dataflow/internal/process/functions/call/unnamed-call-handling.js +2 -2
- package/dataflow/internal/process/functions/process-parameter.js +2 -2
- package/dataflow/internal/process/process-named-call.js +1 -1
- package/dataflow/origin/dfg-get-origin.js +2 -2
- package/dataflow/origin/dfg-get-symbol-refs.d.ts +1 -0
- package/dataflow/origin/dfg-get-symbol-refs.js +3 -8
- package/documentation/data/faq/wiki-faq-store.js +2 -2
- package/documentation/doc-capabilities.js +2 -1
- package/documentation/doc-util/doc-functions.js +2 -2
- package/documentation/doc-util/doc-repl.js +4 -4
- package/documentation/doc-util/doc-types.js +2 -2
- package/documentation/wiki-absint.js +2 -1
- package/documentation/wiki-cfg.js +2 -1
- package/documentation/wiki-create-linting-rules.js +1 -1
- package/documentation/wiki-dataflow-graph.js +6 -6
- package/documentation/wiki-interface.js +3 -2
- package/documentation/wiki-linter.js +54 -4
- package/documentation/wiki-mk/doc-maker.js +1 -2
- package/documentation/wiki-query.js +25 -0
- package/documentation/wiki-search.js +2 -1
- package/documentation/wiki-signature-database.js +0 -2
- package/linter/linter-executor.js +4 -0
- package/linter/linter-rules.d.ts +526 -4
- package/linter/linter-rules.js +39 -1
- package/linter/linter-tags.d.ts +6 -0
- package/linter/linter-tags.js +6 -0
- package/linter/rules/absolute-path.js +4 -3
- package/linter/rules/cmd-check/bogus-return.d.ts +29 -0
- package/linter/rules/cmd-check/bogus-return.js +63 -0
- package/linter/rules/cmd-check/call-arguments.d.ts +63 -0
- package/linter/rules/cmd-check/call-arguments.js +211 -0
- package/linter/rules/cmd-check/class-string-comparison.d.ts +48 -0
- package/linter/rules/cmd-check/class-string-comparison.js +135 -0
- package/linter/rules/cmd-check/cmd-check-util.d.ts +67 -0
- package/linter/rules/cmd-check/cmd-check-util.js +169 -0
- package/linter/rules/cmd-check/compiled-code.d.ts +86 -0
- package/linter/rules/cmd-check/compiled-code.js +350 -0
- package/linter/rules/cmd-check/conformance.d.ts +47 -0
- package/linter/rules/cmd-check/conformance.js +166 -0
- package/linter/rules/cmd-check/dependency-declaration.d.ts +95 -0
- package/linter/rules/cmd-check/dependency-declaration.js +299 -0
- package/linter/rules/cmd-check/description-metadata.d.ts +63 -0
- package/linter/rules/cmd-check/description-metadata.js +393 -0
- package/linter/rules/cmd-check/documentation-mismatch.d.ts +54 -0
- package/linter/rules/cmd-check/documentation-mismatch.js +407 -0
- package/linter/rules/cmd-check/file-checks.d.ts +29 -0
- package/linter/rules/cmd-check/file-checks.js +34 -0
- package/linter/rules/cmd-check/foreign-function-calls.d.ts +54 -0
- package/linter/rules/cmd-check/foreign-function-calls.js +115 -0
- package/linter/rules/cmd-check/global-environment-modification.d.ts +61 -0
- package/linter/rules/cmd-check/global-environment-modification.js +237 -0
- package/linter/rules/cmd-check/namespace-tampering.d.ts +52 -0
- package/linter/rules/cmd-check/namespace-tampering.js +162 -0
- package/linter/rules/cmd-check/non-ascii-code.d.ts +51 -0
- package/linter/rules/cmd-check/non-ascii-code.js +112 -0
- package/linter/rules/cmd-check/package-code.d.ts +30 -0
- package/linter/rules/cmd-check/package-code.js +141 -0
- package/linter/rules/cmd-check/package-data.d.ts +49 -0
- package/linter/rules/cmd-check/package-data.js +181 -0
- package/linter/rules/cmd-check/package-files.d.ts +41 -0
- package/linter/rules/cmd-check/package-files.js +157 -0
- package/linter/rules/cmd-check/package-hooks.d.ts +57 -0
- package/linter/rules/cmd-check/package-hooks.js +165 -0
- package/linter/rules/cmd-check/package-metafiles.d.ts +49 -0
- package/linter/rules/cmd-check/package-metafiles.js +292 -0
- package/linter/rules/cmd-check/package-runtime.d.ts +67 -0
- package/linter/rules/cmd-check/package-runtime.js +284 -0
- package/linter/rules/cmd-check/package-structure.d.ts +85 -0
- package/linter/rules/cmd-check/package-structure.js +320 -0
- package/linter/rules/cmd-check/rd-files.d.ts +67 -0
- package/linter/rules/cmd-check/rd-files.js +621 -0
- package/linter/rules/cmd-check/s-three-method-consistency.d.ts +72 -0
- package/linter/rules/cmd-check/s-three-method-consistency.js +206 -0
- package/linter/rules/cmd-check/true-false-abbreviation.d.ts +45 -0
- package/linter/rules/cmd-check/true-false-abbreviation.js +121 -0
- package/linter/rules/deprecated-functions.js +4 -4
- package/linter/rules/function-finder-util.d.ts +1 -1
- package/linter/rules/function-finder-util.js +1 -3
- package/linter/rules/naming-convention.d.ts +1 -1
- package/linter/rules/naming-convention.js +13 -14
- package/linter/rules/network-functions.d.ts +4 -3
- package/linter/rules/network-functions.js +14 -12
- package/linter/rules/no-leaked-credentials.d.ts +8 -3
- package/linter/rules/no-leaked-credentials.js +134 -36
- package/linter/rules/problematic-inputs.d.ts +1 -1
- package/linter/rules/problematic-inputs.js +21 -14
- package/linter/rules/seeded-randomness.js +5 -5
- package/linter/rules/software-has-license.d.ts +1 -1
- package/linter/rules/software-has-license.js +1 -1
- package/linter/rules/unclosed-connection.js +3 -3
- package/linter/rules/undefined-symbol-util.js +16 -32
- package/linter/rules/undefined-symbol.d.ts +2 -0
- package/linter/rules/undefined-symbol.js +33 -3
- package/linter/rules/unescaped-arguments.d.ts +13 -2
- package/linter/rules/unescaped-arguments.js +104 -15
- package/linter/rules/unused-definition.js +13 -19
- package/package.json +1 -1
- package/project/cache/flowr-analyzer-cache.js +1 -1
- package/project/context/flowr-analyzer-context.js +1 -1
- package/project/context/flowr-analyzer-environment-context.d.ts +1 -1
- package/project/context/flowr-analyzer-files-context.d.ts +6 -0
- package/project/context/flowr-analyzer-files-context.js +3 -0
- package/project/context/flowr-analyzer-incremental-analysis-context.d.ts +0 -2
- package/project/context/flowr-analyzer-incremental-analysis-context.js +0 -4
- package/project/context/flowr-file.d.ts +4 -0
- package/project/context/flowr-file.js +4 -0
- package/project/flowr-analyzer-builder.js +1 -1
- package/project/plugins/file-plugins/files/flowr-description-file.js +2 -2
- package/project/plugins/file-plugins/files/flowr-jupyter-file.d.ts +2 -0
- package/project/plugins/file-plugins/files/flowr-jupyter-file.js +4 -0
- package/project/plugins/file-plugins/files/flowr-manifest-files.d.ts +2 -0
- package/project/plugins/file-plugins/files/flowr-manifest-files.js +11 -14
- package/project/plugins/file-plugins/files/flowr-namespace-file.d.ts +3 -0
- package/project/plugins/file-plugins/files/flowr-namespace-file.js +25 -15
- package/project/plugins/file-plugins/files/flowr-rd-file.d.ts +44 -0
- package/project/plugins/file-plugins/files/flowr-rd-file.js +130 -61
- package/project/plugins/file-plugins/files/flowr-rda-file.d.ts +0 -1
- package/project/plugins/file-plugins/files/flowr-rda-file.js +4 -16
- package/project/plugins/file-plugins/files/flowr-rmarkdown-file.d.ts +2 -0
- package/project/plugins/file-plugins/files/flowr-rmarkdown-file.js +4 -0
- package/project/plugins/file-plugins/files/flowr-sweave-file.d.ts +2 -0
- package/project/plugins/file-plugins/files/flowr-sweave-file.js +4 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-description-file-plugin.d.ts +0 -1
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-description-file-plugin.js +1 -5
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-lockfile-plugin.d.ts +2 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-lockfile-plugin.js +2 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-session-info-plugin.js +3 -7
- package/project/sigdb/build.js +16 -30
- package/project/sigdb/dict.d.ts +4 -6
- package/project/sigdb/dict.js +125 -31
- package/project/sigdb/reader.js +2 -18
- package/project/sigdb/sigdb-download.js +14 -23
- package/queries/base-query-format.d.ts +2 -0
- package/queries/base-query-format.js +10 -2
- package/queries/catalog/absint-query/absint-query-format.d.ts +1 -1
- package/queries/catalog/absint-query/absint-query-format.js +5 -7
- package/queries/catalog/call-context-query/call-context-query-executor.js +26 -33
- package/queries/catalog/call-context-query/call-context-query-format.d.ts +1 -1
- package/queries/catalog/call-context-query/call-context-query-format.js +1 -3
- package/queries/catalog/call-context-query/identify-link-to-last-call-relation.js +2 -4
- package/queries/catalog/call-context-query/identify-link-to-nested-call-relation.js +1 -4
- package/queries/catalog/call-graph-query/call-graph-query-format.js +2 -3
- package/queries/catalog/config-query/config-query-format.js +3 -3
- package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.js +2 -3
- package/queries/catalog/dataflow-query/dataflow-query-format.js +2 -3
- package/queries/catalog/dependencies-query/data-flow.d.ts +43 -0
- package/queries/catalog/dependencies-query/data-flow.js +173 -0
- package/queries/catalog/dependencies-query/dependencies-query-executor.d.ts +18 -0
- package/queries/catalog/dependencies-query/dependencies-query-executor.js +108 -12
- package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +17 -1
- package/queries/catalog/dependencies-query/dependencies-query-format.js +14 -11
- package/queries/catalog/dependencies-query/function-info/derived-functions.js +2 -1
- package/queries/catalog/dependencies-query/function-info/function-info.d.ts +2 -0
- package/queries/catalog/dependencies-query/function-info/library-functions.js +13 -13
- package/queries/catalog/dependencies-query/function-info/read-functions.js +1 -1
- package/queries/catalog/dependencies-query/function-info/remote-functions.js +3 -3
- package/queries/catalog/dependencies-query/function-info/source-functions.js +2 -2
- package/queries/catalog/dependencies-query/function-info/test-functions.js +8 -8
- package/queries/catalog/dependencies-query/function-info/transform-functions.d.ts +8 -0
- package/queries/catalog/dependencies-query/function-info/transform-functions.js +17 -0
- package/queries/catalog/dependencies-query/function-info/write-functions.js +4 -0
- package/queries/catalog/dependencies-query/implicit-echo.d.ts +5 -3
- package/queries/catalog/dependencies-query/implicit-echo.js +33 -34
- package/queries/catalog/dependencies-query/link-devices.d.ts +3 -2
- package/queries/catalog/dependencies-query/link-devices.js +9 -6
- package/queries/catalog/dependencies-query/plot-description.d.ts +10 -0
- package/queries/catalog/dependencies-query/plot-description.js +119 -0
- package/queries/catalog/dependencies-query/plot-objects.d.ts +13 -0
- package/queries/catalog/dependencies-query/plot-objects.js +61 -0
- package/queries/catalog/dice-query/dice-query-format.d.ts +2 -2
- package/queries/catalog/dice-query/dice-query-format.js +3 -40
- package/queries/catalog/does-call-query/does-call-query-format.d.ts +1 -1
- package/queries/catalog/does-call-query/does-call-query-format.js +2 -2
- package/queries/catalog/function-info-query/function-info-query-format.js +2 -2
- package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-executor.js +2 -1
- package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-format.js +2 -2
- package/queries/catalog/happens-before-query/happens-before-query-format.js +2 -2
- package/queries/catalog/id-map-query/id-map-query-format.js +1 -3
- package/queries/catalog/input-sources-query/input-source-functions.d.ts +6 -4
- package/queries/catalog/input-sources-query/input-source-functions.js +11 -6
- package/queries/catalog/input-sources-query/input-sources-query-executor.js +3 -3
- package/queries/catalog/input-sources-query/input-sources-query-format.d.ts +1 -1
- package/queries/catalog/input-sources-query/input-sources-query-format.js +11 -5
- package/queries/catalog/input-sources-query/simple-input-classifier.d.ts +12 -4
- package/queries/catalog/input-sources-query/simple-input-classifier.js +237 -40
- package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.js +4 -7
- package/queries/catalog/inspect-fn-props-query/inspect-fn-props-query-executor.js +1 -1
- package/queries/catalog/inspect-fn-props-query/inspect-fn-props-query-format.js +3 -2
- package/queries/catalog/inspect-recursion-query/inspect-recursion-query-executor.js +2 -2
- package/queries/catalog/linter-query/linter-query-executor.js +10 -3
- package/queries/catalog/linter-query/linter-query-format.d.ts +4 -1
- package/queries/catalog/linter-query/linter-query-format.js +32 -21
- package/queries/catalog/location-map-query/location-map-query-format.d.ts +1 -1
- package/queries/catalog/location-map-query/location-map-query-format.js +1 -3
- package/queries/catalog/normalized-ast-query/normalized-ast-query-format.js +2 -3
- 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 +1 -1
- package/queries/catalog/origin-query/origin-query-format.js +4 -5
- package/queries/catalog/project-query/project-query-format.js +2 -2
- package/queries/catalog/provenance-query/provenance-query-format.js +2 -3
- package/queries/catalog/resolve-value-query/resolve-value-query-format.d.ts +1 -1
- package/queries/catalog/resolve-value-query/resolve-value-query-format.js +4 -4
- package/queries/catalog/search-query/search-query-format.js +1 -3
- package/queries/catalog/signature-query/signature-query-executor.js +3 -3
- package/queries/catalog/signature-query/signature-query-format.js +2 -2
- package/queries/catalog/slice-query-options.d.ts +16 -0
- package/queries/catalog/slice-query-options.js +28 -0
- package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +2 -2
- package/queries/catalog/static-slice-query/static-slice-query-format.js +3 -42
- package/queries/query-print.d.ts +4 -0
- package/queries/query-print.js +17 -1
- package/queries/query.d.ts +3 -3
- package/queries/query.js +3 -4
- package/r-bridge/lang-4.x/ast/model/model.d.ts +27 -3
- package/r-bridge/lang-4.x/ast/model/model.js +28 -1
- package/r-bridge/lang-4.x/ast/model/nodes/info/r-delimiter.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/info/r-delimiter.js +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-access.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-access.js +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-argument.d.ts +20 -1
- package/r-bridge/lang-4.x/ast/model/nodes/r-argument.js +25 -1
- package/r-bridge/lang-4.x/ast/model/nodes/r-binary-op.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-binary-op.js +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-break.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-break.js +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-comment.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-comment.js +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-expression-list.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-expression-list.js +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-for-loop.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-for-loop.js +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.d.ts +18 -2
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.js +15 -6
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-definition.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-definition.js +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-if-then-else.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-if-then-else.js +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-line-directive.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-line-directive.js +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-logical.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-logical.js +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-next.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-next.js +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-number.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-number.js +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-parameter.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-parameter.js +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-pipe.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-pipe.js +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-repeat-loop.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-repeat-loop.js +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-string.d.ts +17 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-string.js +20 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-symbol.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-symbol.js +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-unary-op.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-unary-op.js +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-while-loop.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-while-loop.js +1 -0
- package/r-bridge/lang-4.x/ast/model/operators.js +0 -2
- package/r-bridge/lang-4.x/ast/model/processing/decorate.js +1 -6
- package/r-bridge/lang-4.x/ast/model/processing/fold.js +1 -6
- package/r-bridge/lang-4.x/ast/model/processing/node-id.js +4 -3
- package/r-bridge/lang-4.x/ast/parser/json/format.js +2 -2
- package/r-bridge/lang-4.x/ast/parser/main/internal/control/normalize-if-then.js +1 -5
- package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-argument.js +2 -2
- package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-call.js +4 -20
- package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-definition.js +1 -5
- package/r-bridge/lang-4.x/ast/parser/main/internal/loops/normalize-next.js +1 -5
- package/r-bridge/lang-4.x/ast/parser/main/internal/loops/normalize-repeat.js +1 -5
- package/r-bridge/lang-4.x/ast/parser/main/internal/loops/normalize-while.js +2 -9
- package/r-bridge/lang-4.x/ast/parser/main/internal/normalize-access.js +1 -5
- package/r-bridge/lang-4.x/ast/parser/main/internal/operators/normalize-binary.js +2 -10
- package/r-bridge/lang-4.x/ast/parser/main/internal/operators/normalize-unary.js +2 -11
- package/r-bridge/lang-4.x/ast/parser/main/internal/structure/normalize-expressions.js +3 -11
- package/r-bridge/lang-4.x/ast/parser/main/internal/values/normalize-number.js +1 -5
- package/r-bridge/lang-4.x/ast/parser/main/internal/values/normalize-string.js +1 -5
- package/r-bridge/lang-4.x/ast/parser/main/internal/values/normalize-symbol.js +1 -5
- package/r-bridge/lang-4.x/ast/parser/main/normalize-meta.d.ts +6 -1
- package/r-bridge/lang-4.x/ast/parser/main/normalize-meta.js +7 -0
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.d.ts +0 -10
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +30 -82
- package/r-bridge/retriever.d.ts +0 -4
- package/r-bridge/retriever.js +0 -13
- package/r-bridge/roxygen2/documentation-provider.js +3 -7
- package/r-bridge/shell.js +3 -8
- package/reconstruct/auto-select/magic-comments.js +8 -7
- package/reconstruct/inline/source-inline-map.d.ts +3 -0
- package/reconstruct/inline/source-inline-map.js +8 -7
- package/reconstruct/reconstruct.d.ts +1 -1
- package/reconstruct/reconstruct.js +33 -109
- package/search/flowr-search-printer.js +4 -15
- package/search/search-executor/search-enrichers.js +5 -3
- package/search/search-executor/search-generators.js +1 -1
- package/slicing/criterion/filters/all-variables.js +1 -2
- package/slicing/static/fingerprint.js +11 -2
- package/slicing/static/slice-call.d.ts +2 -8
- package/slicing/static/slice-call.js +8 -18
- package/slicing/static/static-slicer.js +81 -6
- package/util/collections/arrays.js +1 -1
- package/util/collections/set.js +1 -1
- package/util/diff-graph.d.ts +4 -0
- package/util/diff-graph.js +12 -0
- package/util/files.js +2 -6
- package/util/json.js +1 -15
- package/util/mermaid/cfg.js +10 -17
- package/util/mermaid/dfg.js +6 -8
- package/util/objects.d.ts +1 -1
- package/util/quads.js +4 -13
- package/util/r-author.js +5 -5
- package/util/range.d.ts +9 -0
- package/util/range.js +11 -0
- package/util/schema.js +3 -3
- package/util/simple-df/dfg-view.js +2 -1
- package/util/text/ansi.js +1 -2
- package/util/text/playground-link.js +2 -1
- package/util/text/r-highlight.js +2 -1
- package/util/text/strings.d.ts +2 -0
- package/util/text/strings.js +5 -0
- package/util/text/time.js +1 -2
- package/util/version.js +4 -3
- package/dataflow/fn/recursive-function.d.ts +0 -6
- package/dataflow/fn/recursive-function.js +0 -32
- package/dataflow/internal/process/functions/call/argument/unpack-argument.d.ts +0 -16
- package/dataflow/internal/process/functions/call/argument/unpack-argument.js +0 -27
|
@@ -4,17 +4,17 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.LinterQueryDefinition = void 0;
|
|
7
|
+
const query_print_1 = require("../../query-print");
|
|
7
8
|
const joi_1 = __importDefault(require("joi"));
|
|
9
|
+
const linter_tags_1 = require("../../../linter/linter-tags");
|
|
8
10
|
const linter_query_executor_1 = require("./linter-query-executor");
|
|
9
11
|
const linter_rules_1 = require("../../../linter/linter-rules");
|
|
10
12
|
const linter_format_1 = require("../../../linter/linter-format");
|
|
11
13
|
const ansi_1 = require("../../../util/text/ansi");
|
|
12
|
-
const time_1 = require("../../../util/text/time");
|
|
13
14
|
const retriever_1 = require("../../../r-bridge/retriever");
|
|
14
15
|
const assert_1 = require("../../../util/assert");
|
|
15
|
-
const fs_1 = __importDefault(require("fs"));
|
|
16
16
|
const linter_output_1 = require("../../../linter/linter-output");
|
|
17
|
-
function rulesFromInput(
|
|
17
|
+
function rulesFromInput(rulesPart) {
|
|
18
18
|
return rulesPart
|
|
19
19
|
.reduce((acc, ruleName) => {
|
|
20
20
|
ruleName = ruleName.trim();
|
|
@@ -29,6 +29,7 @@ function rulesFromInput(output, rulesPart) {
|
|
|
29
29
|
}
|
|
30
30
|
const rulesPrefix = 'rules:';
|
|
31
31
|
const formatPrefix = 'format:';
|
|
32
|
+
const tagsPrefix = 'tags:';
|
|
32
33
|
/** the {@link LinterOutputFormat} of a `format:` argument, warning about an unknown one instead of ignoring it */
|
|
33
34
|
function formatFromInput(output, argument) {
|
|
34
35
|
const wanted = argument.slice(formatPrefix.length).trim();
|
|
@@ -42,14 +43,25 @@ function formatFromInput(output, argument) {
|
|
|
42
43
|
function linterQueryLineParser(output, line, _config) {
|
|
43
44
|
let rules = undefined;
|
|
44
45
|
let format = undefined;
|
|
46
|
+
let tags = undefined;
|
|
45
47
|
const rest = [...line];
|
|
46
|
-
while (rest.length > 0 &&
|
|
48
|
+
while (rest.length > 0 && [rulesPrefix, formatPrefix, tagsPrefix].some(p => rest[0].startsWith(p))) {
|
|
47
49
|
const argument = rest.shift();
|
|
48
50
|
if (argument.startsWith(formatPrefix)) {
|
|
49
51
|
format = formatFromInput(output, argument);
|
|
50
52
|
continue;
|
|
51
53
|
}
|
|
52
|
-
|
|
54
|
+
else if (argument.startsWith(tagsPrefix)) {
|
|
55
|
+
const known = new Set(Object.values(linter_tags_1.LintingRuleTag));
|
|
56
|
+
const given = argument.slice(tagsPrefix.length).split(',').map(t => t.trim());
|
|
57
|
+
const unknown = given.filter(t => !known.has(t));
|
|
58
|
+
if (unknown.length > 0) {
|
|
59
|
+
output.stderr(`Invalid linting rule tag(s): ${unknown.join(', ')}\nValid tags are: ${[...known].join(', ')}`);
|
|
60
|
+
}
|
|
61
|
+
tags = given.filter(t => known.has(t));
|
|
62
|
+
continue;
|
|
63
|
+
}
|
|
64
|
+
const parseResult = rulesFromInput(argument.slice(rulesPrefix.length).split(','));
|
|
53
65
|
if (parseResult.invalid.length > 0) {
|
|
54
66
|
output.stderr(`Invalid linting rule name(s): ${parseResult.invalid.map(r => (0, ansi_1.bold)(r, output.formatter)).join(', ')}`
|
|
55
67
|
+ `\nValid rule names are: ${Object.keys(linter_rules_1.LintingRules).map(r => (0, ansi_1.bold)(r, output.formatter)).join(', ')}`);
|
|
@@ -57,7 +69,7 @@ function linterQueryLineParser(output, line, _config) {
|
|
|
57
69
|
rules = parseResult.valid;
|
|
58
70
|
}
|
|
59
71
|
/* an absent format must not show up as a key, a query is compared by its fingerprint */
|
|
60
|
-
return { query: [{ type: 'linter', rules, ...(format ? { format } : {}) }], rCode: rest.join(' ').trim() || undefined };
|
|
72
|
+
return { query: [{ type: 'linter', rules, ...(tags ? { tags } : {}), ...(format ? { format } : {}) }], rCode: rest.join(' ').trim() || undefined };
|
|
61
73
|
}
|
|
62
74
|
function linterQueryCompleter(line, startingNewArg, _config) {
|
|
63
75
|
const current = startingNewArg ? '' : line[line.length - 1] ?? '';
|
|
@@ -102,21 +114,20 @@ exports.LinterQueryDefinition = {
|
|
|
102
114
|
result.push(out.formatted);
|
|
103
115
|
return true;
|
|
104
116
|
}
|
|
105
|
-
result.push(
|
|
117
|
+
result.push((0, query_print_1.queryHeader)('linter', formatter, out['.meta'].timing));
|
|
118
|
+
/* without any code, only the rules checking the project's files have something to say */
|
|
119
|
+
const missing = (0, query_print_1.missingRootsWithoutRequests)(analyzer);
|
|
120
|
+
if (missing !== undefined && missing.length > 0) {
|
|
121
|
+
result.push(formatter.format(`Path does not exist: ${missing.map(p => `'${p}'`).join(', ')}`, { color: 1 /* Colors.Red */, effect: ansi_1.ColorEffect.Foreground, style: 1 /* FontStyles.Bold */ }));
|
|
122
|
+
return true;
|
|
123
|
+
}
|
|
124
|
+
else if (missing !== undefined) {
|
|
125
|
+
result.push(formatter.format('No R code to lint was found in the analysis.', { color: 3 /* Colors.Yellow */, effect: ansi_1.ColorEffect.Foreground, style: 1 /* FontStyles.Bold */ }));
|
|
126
|
+
}
|
|
106
127
|
const allDidFail = Object.values(out.results).every(linter_format_1.LintingResults.isError);
|
|
107
128
|
if (allDidFail) {
|
|
108
129
|
result.push('All linting rules failed to execute.');
|
|
109
|
-
|
|
110
|
-
if (files.loadingOrder.getUnorderedRequests().length === 0) {
|
|
111
|
-
const missing = files.getRequestedRoots().filter(p => !fs_1.default.existsSync(p));
|
|
112
|
-
if (missing.length > 0) {
|
|
113
|
-
result.push(formatter.format(`Path does not exist: ${missing.map(p => `'${p}'`).join(', ')}`, { color: 1 /* Colors.Red */, effect: ansi_1.ColorEffect.Foreground, style: 1 /* FontStyles.Bold */ }));
|
|
114
|
-
return true;
|
|
115
|
-
}
|
|
116
|
-
result.push(formatter.format('No requests to lint for were found in the analysis.', { color: 1 /* Colors.Red */, effect: ansi_1.ColorEffect.Foreground, style: 1 /* FontStyles.Bold */ }));
|
|
117
|
-
result.push('If you consider this an error, please report a bug: ' + (0, assert_1.getGuardIssueUrl)('analyzer found no requests to lint for'));
|
|
118
|
-
}
|
|
119
|
-
else if (Object.values(out.results).length === 1) {
|
|
130
|
+
if (Object.values(out.results).length === 1) {
|
|
120
131
|
const fst = Object.values(out.results)[0];
|
|
121
132
|
result.push('Error: ' + linter_format_1.LintingResults.stringifyError(fst));
|
|
122
133
|
if (fst.error instanceof Error) {
|
|
@@ -134,7 +145,7 @@ exports.LinterQueryDefinition = {
|
|
|
134
145
|
},
|
|
135
146
|
completer: linterQueryCompleter,
|
|
136
147
|
fromLine: linterQueryLineParser,
|
|
137
|
-
syntax: '@linter [rules:<r1>,<r2>,...] [format:<fmt>] <code | file://path>',
|
|
148
|
+
syntax: '@linter [rules:<r1>,<r2>,...] [tags:<t1>,...] [format:<fmt>] <code | file://path>',
|
|
138
149
|
schema: joi_1.default.object({
|
|
139
150
|
type: joi_1.default.string().valid('linter').required().description('The type of the query.'),
|
|
140
151
|
format: joi_1.default.string().valid(...Object.values(linter_output_1.LinterOutputFormat)).optional().description('Print the findings in a machine-readable format instead of the human-readable summary.'),
|
|
@@ -142,6 +153,7 @@ exports.LinterQueryDefinition = {
|
|
|
142
153
|
name: joi_1.default.string().valid(...Object.keys(linter_rules_1.LintingRules)).required(),
|
|
143
154
|
config: joi_1.default.object()
|
|
144
155
|
})).description('The rules to lint for. If unset, all rules will be included.'),
|
|
156
|
+
tags: joi_1.default.array().items(joi_1.default.string().valid(...Object.values(linter_tags_1.LintingRuleTag))).optional().description('Lint for every rule carrying one of these tags, e.g. cmd-check for the R CMD check rules.')
|
|
145
157
|
}).description('The linter query lints for the given set of rules and returns the result.'),
|
|
146
158
|
flattenInvolvedNodes: (queryResults, _queries, certainty) => {
|
|
147
159
|
const out = queryResults;
|
|
@@ -160,9 +172,8 @@ function addLintingRuleResult(ruleName, results, result, formatter) {
|
|
|
160
172
|
const rule = linter_rules_1.LintingRules[ruleName];
|
|
161
173
|
const header = `${(0, ansi_1.bold)(rule.info.name, formatter)} (${ruleName})`;
|
|
162
174
|
if (linter_format_1.LintingResults.isError(results)) {
|
|
163
|
-
const error = linter_format_1.LintingResults.stringifyError(results).includes('At least one request must be set') ? 'No requests to lint for were found in the analysis.' : 'Error during execution of rule: ' + linter_format_1.LintingResults.stringifyError(results);
|
|
164
175
|
result.push(` ╰ ${header}:`);
|
|
165
|
-
result.push(` ╰ ${
|
|
176
|
+
result.push(` ╰ Error during execution of rule: ${linter_format_1.LintingResults.stringifyError(results)}`);
|
|
166
177
|
return;
|
|
167
178
|
}
|
|
168
179
|
// a rule with no findings collapses to a single line (no per-certainty block, no metadata)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { BaseQueryFormat, BaseQueryResult } from '../../base-query-format';
|
|
2
2
|
import { executeLocationMapQuery } from './location-map-query-executor';
|
|
3
|
-
import {
|
|
3
|
+
import type { OutputFormatter } from '../../../util/text/ansi';
|
|
4
4
|
import Joi from 'joi';
|
|
5
5
|
import type { NodeId } from '../../../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
6
6
|
import type { SourceRange } from '../../../util/range';
|
|
@@ -5,8 +5,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.LocationMapQueryDefinition = exports.LocationMapSpan = void 0;
|
|
7
7
|
const location_map_query_executor_1 = require("./location-map-query-executor");
|
|
8
|
-
const ansi_1 = require("../../../util/text/ansi");
|
|
9
|
-
const time_1 = require("../../../util/text/time");
|
|
10
8
|
const joi_1 = __importDefault(require("joi"));
|
|
11
9
|
const query_print_1 = require("../../query-print");
|
|
12
10
|
const slice_query_parser_1 = require("../../../cli/repl/parser/slice-query-parser");
|
|
@@ -41,7 +39,7 @@ exports.LocationMapQueryDefinition = {
|
|
|
41
39
|
executor: location_map_query_executor_1.executeLocationMapQuery,
|
|
42
40
|
asciiSummarizer: (formatter, _analyzer, queryResults, result) => {
|
|
43
41
|
const out = queryResults;
|
|
44
|
-
result.push(
|
|
42
|
+
result.push((0, query_print_1.queryHeader)('location-map', formatter, out['.meta'].timing));
|
|
45
43
|
result.push(' ╰ File List:');
|
|
46
44
|
for (const [id, file] of Object.entries(out.map.files)) {
|
|
47
45
|
result.push(` ╰ ${id}: \`${file}\``);
|
|
@@ -4,9 +4,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.NormalizedAstQueryDefinition = void 0;
|
|
7
|
+
const query_print_1 = require("../../query-print");
|
|
7
8
|
const normalized_ast_query_executor_1 = require("./normalized-ast-query-executor");
|
|
8
|
-
const ansi_1 = require("../../../util/text/ansi");
|
|
9
|
-
const time_1 = require("../../../util/text/time");
|
|
10
9
|
const ast_1 = require("../../../util/mermaid/ast");
|
|
11
10
|
const joi_1 = __importDefault(require("joi"));
|
|
12
11
|
exports.NormalizedAstQueryDefinition = {
|
|
@@ -14,7 +13,7 @@ exports.NormalizedAstQueryDefinition = {
|
|
|
14
13
|
executor: normalized_ast_query_executor_1.executeNormalizedAstQuery,
|
|
15
14
|
asciiSummarizer: (formatter, _analyzer, queryResults, result) => {
|
|
16
15
|
const out = queryResults;
|
|
17
|
-
result.push(
|
|
16
|
+
result.push((0, query_print_1.queryHeader)('normalized-ast', formatter, out['.meta'].timing));
|
|
18
17
|
result.push(` ╰ [Normalized AST](${(0, ast_1.normalizedAstToMermaidUrl)(out.normalized.ast)})`);
|
|
19
18
|
return true;
|
|
20
19
|
},
|
|
@@ -4,7 +4,7 @@ import type { OriginQuery, OriginQueryResult } from './origin-query-format';
|
|
|
4
4
|
/**
|
|
5
5
|
* Produce a fingerprint string for an origin query
|
|
6
6
|
*/
|
|
7
|
-
export declare function
|
|
7
|
+
export declare function criterionOfQuery(query: OriginQuery): SlicingCriterion;
|
|
8
8
|
/**
|
|
9
9
|
* Execute origin queries, catching duplicates with the same fingerprint
|
|
10
10
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.criterionOfQuery = criterionOfQuery;
|
|
4
4
|
exports.executeOriginQuery = executeOriginQuery;
|
|
5
5
|
const log_1 = require("../../../util/log");
|
|
6
6
|
const parse_1 = require("../../../slicing/criterion/parse");
|
|
@@ -8,7 +8,7 @@ const df_helper_1 = require("../../../dataflow/graph/df-helper");
|
|
|
8
8
|
/**
|
|
9
9
|
* Produce a fingerprint string for an origin query
|
|
10
10
|
*/
|
|
11
|
-
function
|
|
11
|
+
function criterionOfQuery(query) {
|
|
12
12
|
return query.criterion;
|
|
13
13
|
}
|
|
14
14
|
/**
|
|
@@ -18,7 +18,7 @@ async function executeOriginQuery({ analyzer }, queries) {
|
|
|
18
18
|
const start = Date.now();
|
|
19
19
|
const results = {};
|
|
20
20
|
for (const query of queries) {
|
|
21
|
-
const key =
|
|
21
|
+
const key = criterionOfQuery(query);
|
|
22
22
|
if (results[key]) {
|
|
23
23
|
log_1.log.warn(`Duplicate Key for origin-query: ${key}, skipping...`);
|
|
24
24
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type BaseQueryFormat, type BaseQueryResult } from '../../base-query-format';
|
|
2
2
|
import type { SlicingCriterion } from '../../../slicing/criterion/parse';
|
|
3
3
|
import type { ParsedQueryLine } from '../../query';
|
|
4
4
|
import Joi from 'joi';
|
|
@@ -4,16 +4,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.OriginQueryDefinition = void 0;
|
|
7
|
-
const
|
|
8
|
-
const
|
|
7
|
+
const base_query_format_1 = require("../../base-query-format");
|
|
8
|
+
const query_print_1 = require("../../query-print");
|
|
9
9
|
const joi_1 = __importDefault(require("joi"));
|
|
10
10
|
const origin_query_executor_1 = require("./origin-query-executor");
|
|
11
11
|
const slice_query_parser_1 = require("../../../cli/repl/parser/slice-query-parser");
|
|
12
12
|
function originQueryLineParser(output, line, _config) {
|
|
13
13
|
const criterion = (0, slice_query_parser_1.sliceCriterionParser)(line[0]);
|
|
14
14
|
if (!criterion) {
|
|
15
|
-
|
|
16
|
-
return { query: [] };
|
|
15
|
+
return (0, base_query_format_1.invalidQueryLine)(output, 'Invalid origin query format, slicing criterion must be given in parentheses, e.g. (2@var), (1:5) or ($10)');
|
|
17
16
|
}
|
|
18
17
|
return {
|
|
19
18
|
query: {
|
|
@@ -28,7 +27,7 @@ exports.OriginQueryDefinition = {
|
|
|
28
27
|
executor: origin_query_executor_1.executeOriginQuery,
|
|
29
28
|
asciiSummarizer: (formatter, _analyzer, queryResults, result) => {
|
|
30
29
|
const out = queryResults;
|
|
31
|
-
result.push(
|
|
30
|
+
result.push((0, query_print_1.queryHeader)('origin', formatter, out['.meta'].timing));
|
|
32
31
|
for (const [criteria, obj] of Object.entries(out.results)) {
|
|
33
32
|
result.push(` ╰ Origins for {${criteria}}`);
|
|
34
33
|
result.push(` ╰ ${obj?.map(o => JSON.stringify(o)).join(', ')}`);
|
|
@@ -5,8 +5,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.ProjectQueryDefinition = void 0;
|
|
7
7
|
const project_query_executor_1 = require("./project-query-executor");
|
|
8
|
+
const query_print_1 = require("../../query-print");
|
|
8
9
|
const ansi_1 = require("../../../util/text/ansi");
|
|
9
|
-
const time_1 = require("../../../util/text/time");
|
|
10
10
|
const joi_1 = __importDefault(require("joi"));
|
|
11
11
|
const r_author_1 = require("../../../util/r-author");
|
|
12
12
|
const r_license_1 = require("../../../util/r-license");
|
|
@@ -18,7 +18,7 @@ exports.ProjectQueryDefinition = {
|
|
|
18
18
|
executor: project_query_executor_1.executeProjectQuery,
|
|
19
19
|
asciiSummarizer: (formatter, analyzer, queryResults, result) => {
|
|
20
20
|
const out = queryResults;
|
|
21
|
-
result.push(
|
|
21
|
+
result.push((0, query_print_1.queryHeader)('project', formatter, out['.meta'].timing));
|
|
22
22
|
if (out.name) {
|
|
23
23
|
result.push(` ╰ Project Name: ${out.name}`);
|
|
24
24
|
}
|
|
@@ -6,8 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.ProvenanceQueryDefinition = void 0;
|
|
7
7
|
exports.fdefBoundaryParser = fdefBoundaryParser;
|
|
8
8
|
const base_query_format_1 = require("../../base-query-format");
|
|
9
|
-
const
|
|
10
|
-
const time_1 = require("../../../util/text/time");
|
|
9
|
+
const query_print_1 = require("../../query-print");
|
|
11
10
|
const joi_1 = __importDefault(require("joi"));
|
|
12
11
|
const slice_query_parser_1 = require("../../../cli/repl/parser/slice-query-parser");
|
|
13
12
|
const provenance_query_executor_1 = require("./provenance-query-executor");
|
|
@@ -25,7 +24,7 @@ exports.ProvenanceQueryDefinition = {
|
|
|
25
24
|
asciiSummarizer: async (formatter, analyzer, queryResults, result) => {
|
|
26
25
|
const out = queryResults;
|
|
27
26
|
const df = await analyzer.dataflow();
|
|
28
|
-
result.push(
|
|
27
|
+
result.push((0, query_print_1.queryHeader)('provenance', formatter, out['.meta'].timing));
|
|
29
28
|
for (const [key, obj] of Object.entries(out.results)) {
|
|
30
29
|
result.push(` ╰ Provenance for ${key}`);
|
|
31
30
|
const dfg = df_helper_1.Dataflow.reduceGraph(df.graph, new Set(obj));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type BaseQueryFormat, type BaseQueryResult } from '../../base-query-format';
|
|
2
2
|
import type { SlicingCriteria } from '../../../slicing/criterion/parse';
|
|
3
3
|
import type { ParsedQueryLine } from '../../query';
|
|
4
4
|
import Joi from 'joi';
|
|
@@ -4,8 +4,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.ResolveValueQueryDefinition = void 0;
|
|
7
|
+
const base_query_format_1 = require("../../base-query-format");
|
|
8
|
+
const query_print_1 = require("../../query-print");
|
|
7
9
|
const ansi_1 = require("../../../util/text/ansi");
|
|
8
|
-
const time_1 = require("../../../util/text/time");
|
|
9
10
|
const joi_1 = __importDefault(require("joi"));
|
|
10
11
|
const resolve_value_query_executor_1 = require("./resolve-value-query-executor");
|
|
11
12
|
const r_value_1 = require("../../../dataflow/eval/values/r-value");
|
|
@@ -13,8 +14,7 @@ const slice_query_parser_1 = require("../../../cli/repl/parser/slice-query-parse
|
|
|
13
14
|
function resolveValueLineParser(output, line, _config) {
|
|
14
15
|
const criteria = (0, slice_query_parser_1.sliceCriteriaParser)(line[0]);
|
|
15
16
|
if (!criteria || criteria.length == 0) {
|
|
16
|
-
|
|
17
|
-
return { query: [] };
|
|
17
|
+
return (0, base_query_format_1.invalidQueryLine)(output, 'Invalid resolve-value query format, slicing criteria must be given in the form "(criterion1;criterion2;...)"');
|
|
18
18
|
}
|
|
19
19
|
return {
|
|
20
20
|
query: [
|
|
@@ -35,7 +35,7 @@ exports.ResolveValueQueryDefinition = {
|
|
|
35
35
|
result.push(formatter.format('Resolve value failed (maybe your criterion does not exist?)!', { color: 1 /* Colors.Red */, effect: ansi_1.ColorEffect.Foreground, style: 1 /* FontStyles.Bold */ }));
|
|
36
36
|
return true;
|
|
37
37
|
}
|
|
38
|
-
result.push(
|
|
38
|
+
result.push((0, query_print_1.queryHeader)('resolve-value', formatter, out['.meta'].timing));
|
|
39
39
|
for (const [fingerprint, obj] of Object.entries(out.results)) {
|
|
40
40
|
const { criteria } = JSON.parse(fingerprint);
|
|
41
41
|
result.push(` ╰ Values for {${criteria.join(', ')}}`);
|
|
@@ -4,8 +4,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.SearchQueryDefinition = void 0;
|
|
7
|
-
const ansi_1 = require("../../../util/text/ansi");
|
|
8
|
-
const time_1 = require("../../../util/text/time");
|
|
9
7
|
const joi_1 = __importDefault(require("joi"));
|
|
10
8
|
const query_print_1 = require("../../query-print");
|
|
11
9
|
const search_query_executor_1 = require("./search-query-executor");
|
|
@@ -16,7 +14,7 @@ exports.SearchQueryDefinition = {
|
|
|
16
14
|
executor: search_query_executor_1.executeSearch,
|
|
17
15
|
asciiSummarizer: (formatter, _analyzer, queryResults, result) => {
|
|
18
16
|
const out = queryResults;
|
|
19
|
-
result.push(
|
|
17
|
+
result.push((0, query_print_1.queryHeader)('search', formatter, out['.meta'].timing));
|
|
20
18
|
for (const [, { ids, search }] of out.results.entries()) {
|
|
21
19
|
result.push(` ╰ [query](${mermaid_1.Mermaid.codeToUrl((0, flowr_search_printer_1.flowrSearchToMermaid)(search))}): {${(0, query_print_1.summarizeIdsIfTooLong)(formatter, ids)}}`);
|
|
22
20
|
}
|
|
@@ -514,7 +514,7 @@ function sourceForVersion(owning, pkg, version) {
|
|
|
514
514
|
return owning.find(s => availableVersions(s, pkg).includes(version));
|
|
515
515
|
}
|
|
516
516
|
/** the message shown when a known package has no release matching the requested version, listing what is available */
|
|
517
|
-
function versionNotFoundMessage(
|
|
517
|
+
function versionNotFoundMessage(lead, avail, base) {
|
|
518
518
|
// only nudge towards a full-history bundle when one is *not* already mounted (a single known version)
|
|
519
519
|
const hint = !base && avail.length <= 1
|
|
520
520
|
? ' Only the latest CRAN version is loaded; download the full history with `:signature download` (or mount one with `:signature add <path>`).'
|
|
@@ -845,7 +845,7 @@ async function executeSignatureQuery({ analyzer }, queries) {
|
|
|
845
845
|
const owning = sources.filter(s => s.has(q.package));
|
|
846
846
|
if (owning.length > 0) {
|
|
847
847
|
const avail = allAvailableVersions(owning, q.package);
|
|
848
|
-
return { ...meta(), message: versionNotFoundMessage(
|
|
848
|
+
return { ...meta(), message: versionNotFoundMessage(`no release of '${q.package}' matches '${q.version}'.`, avail, owning[0].isBaseR(q.package)) };
|
|
849
849
|
}
|
|
850
850
|
}
|
|
851
851
|
if (found.matchCount === 0 && q.function !== undefined && (literalFunction || !hasGlob(q.function))) {
|
|
@@ -868,7 +868,7 @@ async function executeSignatureQuery({ analyzer }, queries) {
|
|
|
868
868
|
const src = sourceForVersion(owning, q.package, version);
|
|
869
869
|
if (q.version !== undefined && src === undefined) {
|
|
870
870
|
const avail = allAvailableVersions(owning, q.package);
|
|
871
|
-
return { ...meta(), message: versionNotFoundMessage(
|
|
871
|
+
return { ...meta(), message: versionNotFoundMessage(`'${q.package}@${q.version}' is not in the loaded database.`, avail, owning[0].isBaseR(q.package)) };
|
|
872
872
|
}
|
|
873
873
|
const resolvedSrc = src ?? owning[0];
|
|
874
874
|
if (q.function) {
|
|
@@ -4,9 +4,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.SignatureQueryDefinition = exports.DefaultCallGraphMaxNodes = void 0;
|
|
7
|
+
const query_print_1 = require("../../query-print");
|
|
7
8
|
const joi_1 = __importDefault(require("joi"));
|
|
8
9
|
const ansi_1 = require("../../../util/text/ansi");
|
|
9
|
-
const time_1 = require("../../../util/text/time");
|
|
10
10
|
const signature_query_executor_1 = require("./signature-query-executor");
|
|
11
11
|
const signature_query_render_1 = require("./signature-query-render");
|
|
12
12
|
/**
|
|
@@ -84,7 +84,7 @@ exports.SignatureQueryDefinition = {
|
|
|
84
84
|
executor: signature_query_executor_1.executeSignatureQuery,
|
|
85
85
|
asciiSummarizer: (formatter, _analyzer, queryResults, result, _query) => {
|
|
86
86
|
const out = queryResults;
|
|
87
|
-
result.push(
|
|
87
|
+
result.push((0, query_print_1.queryHeader)('signature', formatter, out['.meta'].timing));
|
|
88
88
|
if (out.function) {
|
|
89
89
|
(0, signature_query_render_1.pushFunction)(result, formatter, out.function);
|
|
90
90
|
}
|
|
@@ -9,6 +9,7 @@ import type { NormalizedAst } from '../../r-bridge/lang-4.x/ast/model/processing
|
|
|
9
9
|
import type { SlicingCriteria } from '../../slicing/criterion/parse';
|
|
10
10
|
import type { DataflowGraph } from '../../dataflow/graph/graph';
|
|
11
11
|
import { type InlineFull, type ReconstructionResult } from '../../reconstruct/reconstruct';
|
|
12
|
+
import type { OutputFormatter } from '../../util/text/ansi';
|
|
12
13
|
/** The options every slicing query understands, independent of how it picks the nodes to keep. */
|
|
13
14
|
export interface SliceQueryOptions {
|
|
14
15
|
/**
|
|
@@ -93,4 +94,19 @@ export declare function timedSliceEntry<Slice extends object>(options: SliceQuer
|
|
|
93
94
|
slice: Timed<Slice>;
|
|
94
95
|
reconstruct?: Timed<ReconstructionResult>;
|
|
95
96
|
};
|
|
97
|
+
interface SliceSummaryInput {
|
|
98
|
+
readonly results: Readonly<Record<string, {
|
|
99
|
+
readonly slice: {
|
|
100
|
+
readonly result: ReadonlySet<NodeId>;
|
|
101
|
+
};
|
|
102
|
+
readonly reconstruct?: {
|
|
103
|
+
readonly code: string | readonly string[];
|
|
104
|
+
};
|
|
105
|
+
}>>;
|
|
106
|
+
readonly '.meta': {
|
|
107
|
+
readonly timing: number;
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
/** The ascii summary shared by the slicing queries; `describe` names what a result key slices, given its options if serialized. */
|
|
111
|
+
export declare function summarizeSliceResults<Q extends SliceQueryOptions>(formatter: OutputFormatter, name: string, out: SliceSummaryInput, result: string[], describe: (key: string, query: Q | undefined) => string): boolean;
|
|
96
112
|
export {};
|
|
@@ -10,6 +10,7 @@ exports.isSerializedQuery = isSerializedQuery;
|
|
|
10
10
|
exports.resolveSliceCriteria = resolveSliceCriteria;
|
|
11
11
|
exports.reconstructSlice = reconstructSlice;
|
|
12
12
|
exports.timedSliceEntry = timedSliceEntry;
|
|
13
|
+
exports.summarizeSliceResults = summarizeSliceResults;
|
|
13
14
|
/**
|
|
14
15
|
* The options shared by the queries that slice the dataflow graph (`static-slice` and `dice`), so both offer the
|
|
15
16
|
* same knobs without repeating their definition, schema, or reconstruction handling.
|
|
@@ -21,6 +22,7 @@ const reconstruct_1 = require("../../reconstruct/reconstruct");
|
|
|
21
22
|
const source_inline_map_1 = require("../../reconstruct/inline/source-inline-map");
|
|
22
23
|
const auto_select_defaults_1 = require("../../reconstruct/auto-select/auto-select-defaults");
|
|
23
24
|
const magic_comments_1 = require("../../reconstruct/auto-select/magic-comments");
|
|
25
|
+
const query_print_1 = require("../query-print");
|
|
24
26
|
/** The Joi keys of {@link SliceQueryOptions}, to be spread into the schema of every slicing query. */
|
|
25
27
|
exports.SliceQueryOptionsSchema = {
|
|
26
28
|
name: joi_1.default.string().min(1).optional().description('What to call this slice: the results are keyed by it instead of by the serialized query.'),
|
|
@@ -104,4 +106,30 @@ function timedSliceEntry(options, slice, sliceTiming, reconstruct) {
|
|
|
104
106
|
const result = reconstruct();
|
|
105
107
|
return { slice: timedSlice, reconstruct: { ...result, '.meta': { timing: Date.now() - start } } };
|
|
106
108
|
}
|
|
109
|
+
/** The ascii summary shared by the slicing queries; `describe` names what a result key slices, given its options if serialized. */
|
|
110
|
+
function summarizeSliceResults(formatter, name, out, result, describe) {
|
|
111
|
+
const entries = Object.entries(out.results);
|
|
112
|
+
if (entries.length === 1) {
|
|
113
|
+
const code = entries[0][1].reconstruct?.code;
|
|
114
|
+
if (typeof code === 'string' || code?.length === 1) {
|
|
115
|
+
result.push(typeof code === 'string' ? code : code[0]);
|
|
116
|
+
return true;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
result.push((0, query_print_1.queryHeader)(name, formatter, out['.meta'].timing));
|
|
120
|
+
for (const [key, obj] of entries) {
|
|
121
|
+
/* a named slice is keyed by its name, so there is nothing to parse */
|
|
122
|
+
const query = isSerializedQuery(key) ? JSON.parse(key) : undefined;
|
|
123
|
+
const addons = [query?.noReconstruction && 'no reconstruction', query?.noMagicComments && 'no magic comments'].filter(Boolean);
|
|
124
|
+
result.push(` ╰ ${describe(key, query)} ${addons.join(', ')}`);
|
|
125
|
+
if (obj.reconstruct) {
|
|
126
|
+
const code = typeof obj.reconstruct.code === 'string' ? [obj.reconstruct.code] : obj.reconstruct.code;
|
|
127
|
+
result.push(' ╰ Code (newline as <code>\n</code>): <code>' + code.flatMap(c => c.split('\n')).join('\\n') + '</code>');
|
|
128
|
+
}
|
|
129
|
+
else {
|
|
130
|
+
result.push(` ╰ Id List: {${(0, query_print_1.summarizeIdsIfTooLong)(formatter, [...obj.slice.result])}}`);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
return true;
|
|
134
|
+
}
|
|
107
135
|
//# sourceMappingURL=slice-query-options.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type BaseQueryFormat, type BaseQueryResult } from '../../base-query-format';
|
|
2
2
|
import type { PipelineOutput } from '../../../core/steps/pipeline/pipeline';
|
|
3
3
|
import type { DEFAULT_DATAFLOW_PIPELINE, DEFAULT_SLICE_WITHOUT_RECONSTRUCT_PIPELINE, DEFAULT_SLICING_PIPELINE } from '../../../core/steps/pipeline/default-pipelines';
|
|
4
4
|
import type { SlicingCriteria } from '../../../slicing/criterion/parse';
|
|
@@ -38,7 +38,7 @@ declare function sliceQueryLineParser(output: ReplOutput, line: readonly string[
|
|
|
38
38
|
export declare const StaticSliceQueryDefinition: {
|
|
39
39
|
readonly title: "Static Slice Query";
|
|
40
40
|
readonly executor: typeof executeStaticSliceQuery;
|
|
41
|
-
readonly asciiSummarizer: (formatter: import("../../../util/text/ansi").OutputFormatter, _analyzer: import("../../..").ReadonlyFlowrAnalysisProvider<import("../../..").KnownParser>, queryResults: BaseQueryResult, result: string[]) =>
|
|
41
|
+
readonly asciiSummarizer: (formatter: import("../../../util/text/ansi").OutputFormatter, _analyzer: import("../../..").ReadonlyFlowrAnalysisProvider<import("../../..").KnownParser>, queryResults: BaseQueryResult, result: string[]) => boolean;
|
|
42
42
|
readonly fromLine: typeof sliceQueryLineParser;
|
|
43
43
|
readonly completer: typeof criteriaQueryCompleter;
|
|
44
44
|
readonly syntax: "@static-slice (<crit>;...)[fiIcB] <code | file://path>";
|
|
@@ -4,11 +4,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.StaticSliceQueryDefinition = void 0;
|
|
7
|
-
const
|
|
8
|
-
const time_1 = require("../../../util/text/time");
|
|
7
|
+
const base_query_format_1 = require("../../base-query-format");
|
|
9
8
|
const joi_1 = __importDefault(require("joi"));
|
|
10
9
|
const static_slice_query_executor_1 = require("./static-slice-query-executor");
|
|
11
|
-
const query_print_1 = require("../../query-print");
|
|
12
10
|
const slice_query_parser_1 = require("../../../cli/repl/parser/slice-query-parser");
|
|
13
11
|
const slice_query_options_1 = require("../slice-query-options");
|
|
14
12
|
const slice_direction_1 = require("../../../util/slice-direction");
|
|
@@ -29,9 +27,7 @@ function sliceQueryLineParser(output, line, _config) {
|
|
|
29
27
|
const direction = (0, slice_query_parser_1.sliceDirectionParser)(line[0]);
|
|
30
28
|
const options = (0, slice_query_parser_1.sliceQueryOptionsParser)(line[0]);
|
|
31
29
|
if (!criteria || criteria.length === 0) {
|
|
32
|
-
|
|
33
|
-
output.stderr(SliceCriterionHelp);
|
|
34
|
-
return { query: [] };
|
|
30
|
+
return (0, base_query_format_1.invalidQueryLine)(output, 'Invalid static-slice query format, slicing criteria must be given in the form "(criterion1;criterion2;...)"', SliceCriterionHelp);
|
|
35
31
|
}
|
|
36
32
|
(0, slice_query_parser_1.warnAboutSliceFlags)(output, line[0], slice_query_parser_1.StaticSliceFlags);
|
|
37
33
|
return { query: [
|
|
@@ -46,42 +42,7 @@ function sliceQueryLineParser(output, line, _config) {
|
|
|
46
42
|
exports.StaticSliceQueryDefinition = {
|
|
47
43
|
title: 'Static Slice Query',
|
|
48
44
|
executor: static_slice_query_executor_1.executeStaticSliceQuery,
|
|
49
|
-
asciiSummarizer: (formatter, _analyzer, queryResults, result) => {
|
|
50
|
-
const out = queryResults;
|
|
51
|
-
if (Object.keys(out.results).length === 1) {
|
|
52
|
-
// just print the single result without fingerprint
|
|
53
|
-
const [, obj] = Object.entries(out.results)[0];
|
|
54
|
-
if ('reconstruct' in obj) {
|
|
55
|
-
const code = Array.isArray(obj.reconstruct.code) ? obj.reconstruct.code : [obj.reconstruct.code];
|
|
56
|
-
if (code.length === 1) {
|
|
57
|
-
result.push(code[0]);
|
|
58
|
-
return true;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
result.push(`Query: ${(0, ansi_1.bold)('static-slice', formatter)} (${(0, time_1.printAsMs)(out['.meta'].timing, 0)})`);
|
|
63
|
-
for (const [key, obj] of Object.entries(out.results)) {
|
|
64
|
-
/* a named slice is keyed by its name, which is the whole point of naming it, so there is nothing to parse */
|
|
65
|
-
const query = (0, slice_query_options_1.isSerializedQuery)(key) ? JSON.parse(key) : undefined;
|
|
66
|
-
const addons = [];
|
|
67
|
-
if (query?.noReconstruction) {
|
|
68
|
-
addons.push('no reconstruction');
|
|
69
|
-
}
|
|
70
|
-
if (query?.noMagicComments) {
|
|
71
|
-
addons.push('no magic comments');
|
|
72
|
-
}
|
|
73
|
-
const what = query === undefined ? `"${key}"` : `for {${query.criteria.join(', ')}}`;
|
|
74
|
-
result.push(` ╰ Slice ${what} ${addons.join(', ')}`);
|
|
75
|
-
if ('reconstruct' in obj) {
|
|
76
|
-
const code = Array.isArray(obj.reconstruct.code) ? obj.reconstruct.code : [obj.reconstruct.code];
|
|
77
|
-
result.push(' ╰ Code (newline as <code>\n</code>): <code>' + code.flatMap(c => c.split('\n')).join('\\n') + '</code>');
|
|
78
|
-
}
|
|
79
|
-
else {
|
|
80
|
-
result.push(` ╰ Id List: {${(0, query_print_1.summarizeIdsIfTooLong)(formatter, [...obj.slice.result])}}`);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
return true;
|
|
84
|
-
},
|
|
45
|
+
asciiSummarizer: (formatter, _analyzer, queryResults, result) => (0, slice_query_options_1.summarizeSliceResults)(formatter, 'static-slice', queryResults, result, (key, q) => `Slice ${q === undefined ? `"${key}"` : `for {${q.criteria.join(', ')}}`}`),
|
|
85
46
|
fromLine: sliceQueryLineParser,
|
|
86
47
|
completer: slice_query_parser_1.criteriaQueryCompleter,
|
|
87
48
|
syntax: '@static-slice (<crit>;...)[fiIcB] <code | file://path>',
|
package/queries/query-print.d.ts
CHANGED
|
@@ -3,6 +3,8 @@ import { type Queries, type QueryResults, type SupportedQueryTypes } from './que
|
|
|
3
3
|
import { NodeId } from '../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
4
4
|
import type { AstIdMap, ParentInformation } from '../r-bridge/lang-4.x/ast/model/processing/decorate';
|
|
5
5
|
import type { ReadonlyFlowrAnalysisProvider } from '../project/flowr-analyzer';
|
|
6
|
+
/** The first line of a query's ascii summary: its name and how long it took. */
|
|
7
|
+
export declare function queryHeader(name: string, formatter: OutputFormatter, timing: number): string;
|
|
6
8
|
/**
|
|
7
9
|
* Converts call context query results to an ASCII representation
|
|
8
10
|
*/
|
|
@@ -22,3 +24,5 @@ export declare function summarizeIdsIfTooLong(formatter: OutputFormatter, ids: r
|
|
|
22
24
|
* Generates an ASCII summary of the given query results
|
|
23
25
|
*/
|
|
24
26
|
export declare function asciiSummaryOfQueryResult<S extends SupportedQueryTypes>(formatter: OutputFormatter, totalInMs: number, results: QueryResults<S>, analyzer: ReadonlyFlowrAnalysisProvider, queries: Queries<S>): Promise<string>;
|
|
27
|
+
/** The requested roots that do not exist, if the analyzer found no requests to analyze at all (`undefined` otherwise). */
|
|
28
|
+
export declare function missingRootsWithoutRequests(analyzer: ReadonlyFlowrAnalysisProvider): string[] | undefined;
|
package/queries/query-print.js
CHANGED
|
@@ -1,14 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.queryHeader = queryHeader;
|
|
3
7
|
exports.asciiCallContext = asciiCallContext;
|
|
4
8
|
exports.summarizeIdsIfTooLong = summarizeIdsIfTooLong;
|
|
5
9
|
exports.asciiSummaryOfQueryResult = asciiSummaryOfQueryResult;
|
|
10
|
+
exports.missingRootsWithoutRequests = missingRootsWithoutRequests;
|
|
11
|
+
const range_1 = require("../util/range");
|
|
6
12
|
const ansi_1 = require("../util/text/ansi");
|
|
7
13
|
const query_1 = require("./query");
|
|
8
14
|
const node_id_1 = require("../r-bridge/lang-4.x/ast/model/processing/node-id");
|
|
9
15
|
const html_hover_over_1 = require("../util/html-hover-over");
|
|
10
16
|
const time_1 = require("../util/text/time");
|
|
11
17
|
const model_1 = require("../r-bridge/lang-4.x/ast/model/model");
|
|
18
|
+
const fs_1 = __importDefault(require("fs"));
|
|
19
|
+
/** The first line of a query's ascii summary: its name and how long it took. */
|
|
20
|
+
function queryHeader(name, formatter, timing) {
|
|
21
|
+
return `Query: ${(0, ansi_1.bold)(name, formatter)} (${(0, time_1.printAsMs)(timing, 0)})`;
|
|
22
|
+
}
|
|
12
23
|
function nodeString(nodeId, formatter, idMap) {
|
|
13
24
|
const isObj = typeof nodeId === 'object' && nodeId !== null && 'id' in nodeId;
|
|
14
25
|
const id = isObj ? nodeId?.id : nodeId;
|
|
@@ -20,7 +31,7 @@ function nodeString(nodeId, formatter, idMap) {
|
|
|
20
31
|
if (node === undefined) {
|
|
21
32
|
return `UNKNOWN: ${id} (info: ${JSON.stringify(info)})`;
|
|
22
33
|
}
|
|
23
|
-
return `${(0, ansi_1.italic)('`' + (model_1.RNode.lexeme(node) ?? 'UNKNOWN') + '`', formatter)} (L.${node.location
|
|
34
|
+
return `${(0, ansi_1.italic)('`' + (model_1.RNode.lexeme(node) ?? 'UNKNOWN') + '`', formatter)} (L.${range_1.SourceRange.getStartLine(node.location)}${info ? ', ' + JSON.stringify(info) : ''})`;
|
|
24
35
|
}
|
|
25
36
|
function asciiCallContextSubHit(formatter, results, idMap) {
|
|
26
37
|
const result = [];
|
|
@@ -123,4 +134,9 @@ async function asciiSummaryOfQueryResult(formatter, totalInMs, results, analyzer
|
|
|
123
134
|
}
|
|
124
135
|
return formatter.format(result.join('\n'));
|
|
125
136
|
}
|
|
137
|
+
/** The requested roots that do not exist, if the analyzer found no requests to analyze at all (`undefined` otherwise). */
|
|
138
|
+
function missingRootsWithoutRequests(analyzer) {
|
|
139
|
+
const files = analyzer.inspectContext().files;
|
|
140
|
+
return !files.hasRequests() ? files.getRequestedRoots().filter(p => !fs_1.default.existsSync(p)) : undefined;
|
|
141
|
+
}
|
|
126
142
|
//# sourceMappingURL=query-print.js.map
|