@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
|
@@ -27,7 +27,6 @@ const r_argument_1 = require("../../../../../r-bridge/lang-4.x/ast/model/nodes/r
|
|
|
27
27
|
const happens_before_1 = require("../../../../../control-flow/happens-before");
|
|
28
28
|
const query_fn_props_1 = require("../../../../environments/query-fn-props");
|
|
29
29
|
const built_in_props_1 = require("../../../../environments/built-in-props");
|
|
30
|
-
const frame_reflection_1 = require("../../../../fn/frame-reflection");
|
|
31
30
|
const defaultmap_1 = require("../../../../../util/collections/defaultmap");
|
|
32
31
|
/** Calls whose result is a language object although they read their arguments like any other call. */
|
|
33
32
|
const CapturingCalls = new Set(['expression']);
|
|
@@ -78,7 +77,7 @@ exports.Quoted = {
|
|
|
78
77
|
for (let parent = idMap?.get(id)?.info.parent; parent !== undefined; parent = idMap?.get(parent)?.info.parent) {
|
|
79
78
|
const captured = exports.Quoted.capturedBy(graph, parent);
|
|
80
79
|
if (captured.length > 0) {
|
|
81
|
-
const evaluating = captured.flatMap(expr =>
|
|
80
|
+
const evaluating = captured.flatMap(expr => df_helper_1.Dataflow.sourcesOf(graph, expr, edge_1.EdgeType.Returns | edge_1.EdgeType.Reads | edge_1.EdgeType.Calls));
|
|
82
81
|
return [parent, ...evaluating.filter(from => from !== parent)];
|
|
83
82
|
}
|
|
84
83
|
}
|
|
@@ -110,6 +109,8 @@ exports.Quoted = {
|
|
|
110
109
|
const reaches = new defaultmap_1.DefaultMap(() => ({}));
|
|
111
110
|
const reachOf = (sites) => reaches.get(sites.join('\0'));
|
|
112
111
|
let enclosing;
|
|
112
|
+
/* every call of a function lists the arguments of all its calls, so each is linked once per forces it meets */
|
|
113
|
+
const linkedWith = new Map();
|
|
113
114
|
for (const [id, vertex] of graph.verticesOfType(vertex_1.VertexType.FunctionCall)) {
|
|
114
115
|
const masks = nse_1.Nse.dropResolvedMask(graph, id, vertex.name);
|
|
115
116
|
if (masks !== undefined) {
|
|
@@ -162,7 +163,8 @@ exports.Quoted = {
|
|
|
162
163
|
for (const argument of df_helper_1.Dataflow.argumentsBoundTo(graph, parameter)) {
|
|
163
164
|
const index = namesOnce();
|
|
164
165
|
const forces = forcesOf(graph, parameter, flow, forcing, reachOf);
|
|
165
|
-
if (forces !== undefined) {
|
|
166
|
+
if (forces !== undefined && linkedWith.get(argument) !== forces) {
|
|
167
|
+
linkedWith.set(argument, forces);
|
|
166
168
|
deferred_1.Deferred.link(graph, argument, index, idMap, forces);
|
|
167
169
|
}
|
|
168
170
|
}
|
|
@@ -185,7 +187,7 @@ function forcesOf(graph, parameter, cfg, forcing, reachOf) {
|
|
|
185
187
|
return known.forces;
|
|
186
188
|
}
|
|
187
189
|
/* counting is only needed once something touched the reads, and the same count still means the same forces */
|
|
188
|
-
const reads =
|
|
190
|
+
const reads = df_helper_1.Dataflow.sourcesOf(graph, parameter, edge_1.EdgeType.Reads).length;
|
|
189
191
|
if (known?.reads === reads) {
|
|
190
192
|
forcing.set(parameter, { ...known, version });
|
|
191
193
|
return known.forces;
|
|
@@ -197,11 +199,11 @@ function forcesOf(graph, parameter, cfg, forcing, reachOf) {
|
|
|
197
199
|
}
|
|
198
200
|
/** The name a delaying call binds, which is the definition its reads have to go through. */
|
|
199
201
|
function boundBy(graph, id) {
|
|
200
|
-
return
|
|
202
|
+
return df_helper_1.Dataflow.sourcesOf(graph, id, edge_1.EdgeType.DefinedBy).find(target => vertex_1.DfgVertex.isVariableDefinition(graph.getVertex(target)));
|
|
201
203
|
}
|
|
202
204
|
/** Every read of the delayed name takes the promised expression's value, so all of them get the link, not just whichever forces it first. */
|
|
203
205
|
function linkForcesToPromise(graph, binding, promise) {
|
|
204
|
-
for (const reader of
|
|
206
|
+
for (const reader of df_helper_1.Dataflow.sourcesOf(graph, binding, edge_1.EdgeType.Reads | edge_1.EdgeType.DefinedByOnCall)) {
|
|
205
207
|
if (reader !== promise) {
|
|
206
208
|
graph.addEdge(reader, promise, edge_1.EdgeType.Reads);
|
|
207
209
|
}
|
|
@@ -214,13 +216,13 @@ function trackedEnvOf(call, evalEnv) {
|
|
|
214
216
|
return env?.current.globalEnv || env?.current.builtInEnv ? undefined : env;
|
|
215
217
|
}
|
|
216
218
|
function* installedLanguageOf(graph, id, installers) {
|
|
217
|
-
for (const definition of
|
|
219
|
+
for (const definition of df_helper_1.Dataflow.targetsOf(graph, id, edge_1.EdgeType.Reads)) {
|
|
218
220
|
if (!vertex_1.DfgVertex.isVariableDefinition(graph.getVertex(definition))) {
|
|
219
221
|
continue;
|
|
220
222
|
}
|
|
221
223
|
let installs = false;
|
|
222
224
|
const captured = [];
|
|
223
|
-
for (const by of
|
|
225
|
+
for (const by of df_helper_1.Dataflow.targetsOf(graph, definition, edge_1.EdgeType.DefinedBy)) {
|
|
224
226
|
const captures = capturedArgumentsOf(graph, by, true);
|
|
225
227
|
if (captures.length > 0) {
|
|
226
228
|
captured.push(...captures);
|
|
@@ -265,7 +267,7 @@ function evaluationSites(graph, id, enclosing) {
|
|
|
265
267
|
const todo = [id];
|
|
266
268
|
for (let at = todo.pop(); at !== undefined; at = todo.pop()) {
|
|
267
269
|
for (const definition of enclosing.get(at) ?? []) {
|
|
268
|
-
for (const caller of
|
|
270
|
+
for (const caller of df_helper_1.Dataflow.sourcesOf(graph, definition, edge_1.EdgeType.Calls)) {
|
|
269
271
|
if (!sites.has(caller)) {
|
|
270
272
|
sites.add(caller);
|
|
271
273
|
todo.push(caller);
|
|
@@ -316,7 +318,7 @@ function linkAgainstAnyBinding(graph, open, bindings, sites, cfg, reach) {
|
|
|
316
318
|
}
|
|
317
319
|
}
|
|
318
320
|
function callsWithSideEffects(graph) {
|
|
319
|
-
return new Set(graph.vertices(true).flatMap(([from]) =>
|
|
321
|
+
return new Set(graph.vertices(true).flatMap(([from]) => df_helper_1.Dataflow.targetsOf(graph, from, edge_1.EdgeType.SideEffectOnCall)));
|
|
320
322
|
}
|
|
321
323
|
/** Links a capture handed to an evaluating call, in that call's scope. */
|
|
322
324
|
function resolveEvaluation(graph, call, idMap, names, bindings, cfg, reachOf, enclosing, evaluated) {
|
|
@@ -416,7 +418,7 @@ function* escapingArguments(graph, id) {
|
|
|
416
418
|
continue;
|
|
417
419
|
}
|
|
418
420
|
for (const parameter of df_helper_1.Dataflow.parametersOf(callee)) {
|
|
419
|
-
if (
|
|
421
|
+
if (df_helper_1.Dataflow.sourcesOf(graph, parameter, edge_1.EdgeType.Reads).some(reader => !closure.subflow.graph.has(reader))) {
|
|
420
422
|
continue;
|
|
421
423
|
}
|
|
422
424
|
for (const argument of df_helper_1.Dataflow.argumentsBoundTo(graph, parameter)) {
|
|
@@ -437,9 +439,9 @@ function readAtForcingCalls(graph, factoryCall, argument, closure, idMap) {
|
|
|
437
439
|
else if (!vertex_1.DfgVertex.isVariableDefinition(via) || !edge_1.DfEdge.includesType(edge, edge_1.EdgeType.DefinedBy)) {
|
|
438
440
|
return;
|
|
439
441
|
}
|
|
440
|
-
for (const reader of
|
|
442
|
+
for (const reader of df_helper_1.Dataflow.sourcesOf(graph, binding, edge_1.EdgeType.Reads)) {
|
|
441
443
|
const call = graph.getVertex(reader);
|
|
442
|
-
if (!vertex_1.DfgVertex.isFunctionCall(call) || !
|
|
444
|
+
if (!vertex_1.DfgVertex.isFunctionCall(call) || !df_helper_1.Dataflow.hasEdge(graph, reader, closure, edge_1.EdgeType.Calls)
|
|
443
445
|
|| call.environment === undefined || program_order_1.ProgramOrder.runsOnceAt(reader, graph) === undefined) {
|
|
444
446
|
return;
|
|
445
447
|
}
|
|
@@ -456,7 +458,7 @@ function readAtForcingCalls(graph, factoryCall, argument, closure, idMap) {
|
|
|
456
458
|
}
|
|
457
459
|
if (r_symbol_1.RSymbol.is(node)) {
|
|
458
460
|
const visible = new Set(environments.flatMap(env => resolve_helper_1.Resolve.byName(node.content, env) ?? []).map(d => d.nodeId));
|
|
459
|
-
for (const target of
|
|
461
|
+
for (const target of df_helper_1.Dataflow.targetsOf(graph, node.info.id, edge_1.EdgeType.Reads)) {
|
|
460
462
|
if (vertex_1.DfgVertex.isVariableDefinition(graph.getVertex(target)) && !visible.has(target)) {
|
|
461
463
|
graph.removeEdgeType(node.info.id, target, edge_1.EdgeType.Reads);
|
|
462
464
|
}
|
|
@@ -16,7 +16,7 @@ const built_in_proc_name_1 = require("../../../../environments/built-in-proc-nam
|
|
|
16
16
|
const node_id_1 = require("../../../../../r-bridge/lang-4.x/ast/model/processing/node-id");
|
|
17
17
|
const r_access_1 = require("../../../../../r-bridge/lang-4.x/ast/model/nodes/r-access");
|
|
18
18
|
const r_function_definition_1 = require("../../../../../r-bridge/lang-4.x/ast/model/nodes/r-function-definition");
|
|
19
|
-
const
|
|
19
|
+
const df_helper_1 = require("../../../../graph/df-helper");
|
|
20
20
|
exports.UnnamedFunctionCallPrefix = 'unnamed-fc-';
|
|
21
21
|
/**
|
|
22
22
|
* Whether a `$`/`[[` access callee resolved a field to a stored function: a resolved dispatch (`dispatch$foo()`)
|
|
@@ -25,7 +25,7 @@ exports.UnnamedFunctionCallPrefix = 'unnamed-fc-';
|
|
|
25
25
|
*/
|
|
26
26
|
function accessResolvesToField(graph, accessId, accessedId) {
|
|
27
27
|
const base = node_id_1.NodeId.normalize(accessedId);
|
|
28
|
-
return
|
|
28
|
+
return df_helper_1.Dataflow.targetsOf(graph, accessId, edge_1.EdgeType.Returns).some(target => node_id_1.NodeId.normalize(target) !== base);
|
|
29
29
|
}
|
|
30
30
|
/**
|
|
31
31
|
* Processes an unnamed function call.
|
|
@@ -3,11 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.processFunctionParameter = processFunctionParameter;
|
|
4
4
|
const processor_1 = require("../../../processor");
|
|
5
5
|
const identifier_1 = require("../../../environments/identifier");
|
|
6
|
-
const define_1 = require("../../../environments/define");
|
|
7
6
|
const edge_1 = require("../../../graph/edge");
|
|
8
7
|
const control_flow_1 = require("../../control-flow");
|
|
9
8
|
const logic_1 = require("../../../../util/logic");
|
|
10
9
|
const r_function_definition_1 = require("../../../../r-bridge/lang-4.x/ast/model/nodes/r-function-definition");
|
|
10
|
+
const environment_1 = require("../../../environments/environment");
|
|
11
11
|
function definedByDefault(parameter, defaultValue) {
|
|
12
12
|
if (defaultValue === undefined) {
|
|
13
13
|
return [];
|
|
@@ -34,7 +34,7 @@ function processFunctionParameter(parameter, data) {
|
|
|
34
34
|
for (const reference of name.unknownReferences) {
|
|
35
35
|
const written = { ...reference, type: identifier_1.ReferenceType.Parameter, definedAt: parameter.info.id };
|
|
36
36
|
graph.setDefinitionOfVertex(written, defaultValue === undefined ? [] : [defaultValue.entryPoint]);
|
|
37
|
-
environment =
|
|
37
|
+
environment = environment_1.REnvironment.define(written, false, environment);
|
|
38
38
|
for (const node of definedBy) {
|
|
39
39
|
graph.addEdge(written.nodeId, node, edge_1.EdgeType.DefinedBy);
|
|
40
40
|
}
|
|
@@ -42,7 +42,7 @@ function isChainNode(node) {
|
|
|
42
42
|
function chainLhsRaw(node) {
|
|
43
43
|
if (r_function_call_1.RFunctionCall.is(node)) {
|
|
44
44
|
const arg = node.arguments[0];
|
|
45
|
-
return r_argument_1.RArgument.
|
|
45
|
+
return r_argument_1.RArgument.valueOf(arg);
|
|
46
46
|
}
|
|
47
47
|
return r_argument_1.RArgument.is(node.lhs) ? node.lhs.value : node.lhs;
|
|
48
48
|
}
|
|
@@ -4,9 +4,9 @@ exports.getOriginInDfg = getOriginInDfg;
|
|
|
4
4
|
const node_id_1 = require("../../r-bridge/lang-4.x/ast/model/processing/node-id");
|
|
5
5
|
const vertex_1 = require("../graph/vertex");
|
|
6
6
|
const edge_1 = require("../graph/edge");
|
|
7
|
-
const linker_1 = require("../internal/linker");
|
|
8
7
|
const assert_1 = require("../../util/assert");
|
|
9
8
|
const vertex_2 = require("../graph/vertex");
|
|
9
|
+
const df_helper_1 = require("../graph/df-helper");
|
|
10
10
|
/**
|
|
11
11
|
* Obtain the (dataflow) origin of a given node in the dfg.
|
|
12
12
|
* @useInstead {@link Dataflow.origin}
|
|
@@ -112,7 +112,7 @@ function getCallTarget(dfg, call) {
|
|
|
112
112
|
id: call.id,
|
|
113
113
|
proc: o
|
|
114
114
|
})) : undefined;
|
|
115
|
-
const targets = new Set(
|
|
115
|
+
const targets = new Set(df_helper_1.Dataflow.callTargetsOf(call.id, dfg));
|
|
116
116
|
if (targets.size === 0) {
|
|
117
117
|
// resolve via variable use origin
|
|
118
118
|
return origins?.length === 0 ? getVariableUseOrigin(dfg, call) : origins;
|
|
@@ -14,6 +14,7 @@ import type { DataflowGraph } from '../graph/graph';
|
|
|
14
14
|
* @param graph - Dataflow Graph
|
|
15
15
|
* @param nodeId - NodeId of Symbol to resolve
|
|
16
16
|
* @returns List including the Definitions and References to that definition
|
|
17
|
+
* @useInstead {@link Dataflow.refsToSymbol}
|
|
17
18
|
* @example getAllRefsToSymbol('3\@y') returns ['3\@y', '4\@y']
|
|
18
19
|
*/
|
|
19
20
|
export declare function getAllRefsToSymbol(graph: DataflowGraph, nodeId: NodeId): NodeId[] | undefined;
|
|
@@ -18,6 +18,7 @@ const df_helper_1 = require("../graph/df-helper");
|
|
|
18
18
|
* @param graph - Dataflow Graph
|
|
19
19
|
* @param nodeId - NodeId of Symbol to resolve
|
|
20
20
|
* @returns List including the Definitions and References to that definition
|
|
21
|
+
* @useInstead {@link Dataflow.refsToSymbol}
|
|
21
22
|
* @example getAllRefsToSymbol('3\@y') returns ['3\@y', '4\@y']
|
|
22
23
|
*/
|
|
23
24
|
function getAllRefsToSymbol(graph, nodeId) {
|
|
@@ -34,14 +35,8 @@ function getAllRefsToSymbol(graph, nodeId) {
|
|
|
34
35
|
const res = new Set();
|
|
35
36
|
for (const { id } of definitiveOrigins) {
|
|
36
37
|
res.add(id);
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
.filter(([_, edge]) => edge_1.DfEdge.includesType(edge, edge_1.EdgeType.Reads))
|
|
40
|
-
.forEach(([node, _]) => res.add(node));
|
|
41
|
-
graph.outgoingEdges(id)
|
|
42
|
-
?.entries()
|
|
43
|
-
.filter(([_, edge]) => edge_1.DfEdge.includesType(edge, edge_1.EdgeType.DefinedByOnCall))
|
|
44
|
-
.forEach(([node, _]) => res.add(node));
|
|
38
|
+
df_helper_1.Dataflow.sourcesOf(graph, id, edge_1.EdgeType.Reads).forEach(node => res.add(node));
|
|
39
|
+
df_helper_1.Dataflow.targetsOf(graph, id, edge_1.EdgeType.DefinedByOnCall).forEach(node => res.add(node));
|
|
45
40
|
}
|
|
46
41
|
return [...res];
|
|
47
42
|
}
|
|
@@ -4,6 +4,7 @@ exports.FaqStore = void 0;
|
|
|
4
4
|
const doc_structure_1 = require("../../doc-util/doc-structure");
|
|
5
5
|
const defaultmap_1 = require("../../../util/collections/defaultmap");
|
|
6
6
|
const assert_1 = require("../../../util/assert");
|
|
7
|
+
const strings_1 = require("../../../util/text/strings");
|
|
7
8
|
const FlowrFaqTopics = {
|
|
8
9
|
'flowr.use': 'โจ Using <i>flowR</i>',
|
|
9
10
|
'flowr.development': '๐งโ๐ป <i>flowR</i> Development',
|
|
@@ -33,8 +34,7 @@ class FaqStore {
|
|
|
33
34
|
}
|
|
34
35
|
printAllTopics(topicsRegex) {
|
|
35
36
|
const topics = Array.from(this.faqs.keys())
|
|
36
|
-
.filter(topic => topicsRegex.test(topic))
|
|
37
|
-
.sort((a, b) => a.localeCompare(b));
|
|
37
|
+
.filter(topic => topicsRegex.test(topic)).sort(strings_1.compareByCodeUnit);
|
|
38
38
|
let output = '';
|
|
39
39
|
for (const topic of topics) {
|
|
40
40
|
const faqs = this.faqs.get(topic).sort(([q1], [q2]) => q1.localeCompare(q2));
|
|
@@ -14,6 +14,7 @@ const playground_link_1 = require("../util/text/playground-link");
|
|
|
14
14
|
const operators_1 = require("../r-bridge/lang-4.x/ast/model/operators");
|
|
15
15
|
const r_highlight_1 = require("../util/text/r-highlight");
|
|
16
16
|
const defaultmap_1 = require("../util/collections/defaultmap");
|
|
17
|
+
const arrays_1 = require("../util/collections/arrays");
|
|
17
18
|
const testSuites = Object.values(summary_def_1.TestSuites);
|
|
18
19
|
const maxSignatureTests = 3;
|
|
19
20
|
const preferredContext = 'dataflow';
|
|
@@ -29,7 +30,7 @@ function claimedCapabilities(array) {
|
|
|
29
30
|
for (const [, , operator] of array.matchAll(operatorSpreadRegex)) {
|
|
30
31
|
ids.push(...operators_1.OperatorDatabase[operator]?.capabilities ?? []);
|
|
31
32
|
}
|
|
32
|
-
return
|
|
33
|
+
return (0, arrays_1.uniqueArray)(ids);
|
|
33
34
|
}
|
|
34
35
|
/** a test name as the source spells it, with its escapes (`\\name`) resolved */
|
|
35
36
|
function unescapeSource(name) {
|
|
@@ -9,7 +9,7 @@ const assert_1 = require("../../util/assert");
|
|
|
9
9
|
const fs_1 = __importDefault(require("fs"));
|
|
10
10
|
const path_1 = __importDefault(require("path"));
|
|
11
11
|
const doc_types_1 = require("./doc-types");
|
|
12
|
-
function
|
|
12
|
+
function collectFunctionHierarchy(sourceFiles, options, fname) {
|
|
13
13
|
const hierarchyList = [];
|
|
14
14
|
const visit = (node, sourceFile) => {
|
|
15
15
|
if (!node) {
|
|
@@ -56,7 +56,7 @@ function getFunctionsFromFolder(options) {
|
|
|
56
56
|
const { files, program } = (0, doc_types_1.getTypeScriptSourceFiles)(fileNames);
|
|
57
57
|
(0, assert_1.guard)(files.length > 0, () => `No source files found for ${JSON.stringify(fileNames)}`);
|
|
58
58
|
const withProgram = { ...options, program };
|
|
59
|
-
const hierarchyList =
|
|
59
|
+
const hierarchyList = collectFunctionHierarchy(files, withProgram, options.fname);
|
|
60
60
|
return {
|
|
61
61
|
info: hierarchyList,
|
|
62
62
|
program
|
|
@@ -12,7 +12,7 @@ const prompt_1 = require("../../cli/repl/prompt");
|
|
|
12
12
|
const doc_code_1 = require("./doc-code");
|
|
13
13
|
const print_version_1 = require("../../cli/repl/print-version");
|
|
14
14
|
const flowr_analyzer_builder_1 = require("../../project/flowr-analyzer-builder");
|
|
15
|
-
function
|
|
15
|
+
function scriptHelpMarkdown(script, starredVersion) {
|
|
16
16
|
let base = `| **${(0, doc_cli_option_1.getReplCommand)(script[0], false, starredVersion !== undefined)}** | ${script[1].description}`;
|
|
17
17
|
if (starredVersion) {
|
|
18
18
|
base += ` (star: ${starredVersion.description})`;
|
|
@@ -34,7 +34,7 @@ function printReplHelpAsMarkdownTable() {
|
|
|
34
34
|
continue;
|
|
35
35
|
}
|
|
36
36
|
const starred = cmds[c[0] + '*'];
|
|
37
|
-
scriptHelp.push(
|
|
37
|
+
scriptHelp.push(scriptHelpMarkdown(c, starred));
|
|
38
38
|
}
|
|
39
39
|
return `
|
|
40
40
|
| Command | Description |
|
|
@@ -42,9 +42,9 @@ function printReplHelpAsMarkdownTable() {
|
|
|
42
42
|
${scriptHelp.sort().join('\n')}
|
|
43
43
|
`;
|
|
44
44
|
}
|
|
45
|
+
const AnsiEscapeCodes = new RegExp(`${String.fromCharCode(27)}\\[[0-9;]*[mK]`, 'g');
|
|
45
46
|
function dropAnsiEscapeCodesAndCodeTags(input) {
|
|
46
|
-
|
|
47
|
-
return input.replace(/\x1B\[[0-9;]*[mK]/g, '')
|
|
47
|
+
return input.replace(AnsiEscapeCodes, '')
|
|
48
48
|
.replace(/<\/?code>/g, '')
|
|
49
49
|
.replace(/\**([^*]+)\**/g, '$1')
|
|
50
50
|
.replace(/_([^_]+)_/g, '$1');
|
|
@@ -222,7 +222,7 @@ function heritageTypeNames(node, sourceFile) {
|
|
|
222
222
|
function genericNames(node, sourceFile) {
|
|
223
223
|
return node.typeParameters?.map(param => param.getText(sourceFile) ?? '') ?? [];
|
|
224
224
|
}
|
|
225
|
-
function
|
|
225
|
+
function collectTypeHierarchy(sourceFiles, options) {
|
|
226
226
|
const hierarchyList = [];
|
|
227
227
|
const typeChecker = options.program.getTypeChecker();
|
|
228
228
|
const visit = (node, sourceFile) => {
|
|
@@ -452,7 +452,7 @@ function getTypesFromFileAsMermaid(fileNames, options) {
|
|
|
452
452
|
const { files, program } = getTypeScriptSourceFiles(fileNames);
|
|
453
453
|
(0, assert_1.guard)(files.length > 0, () => `No source files found for ${JSON.stringify(fileNames)}`);
|
|
454
454
|
const withProgram = { ...options, program };
|
|
455
|
-
const hierarchyList =
|
|
455
|
+
const hierarchyList = collectTypeHierarchy(files, withProgram);
|
|
456
456
|
return {
|
|
457
457
|
mermaid: visualizeMermaidClassDiagram(hierarchyList, withProgram),
|
|
458
458
|
info: hierarchyList,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.WikiAbsint = exports.IntervalAnalysis = exports.IntervalSemantics = void 0;
|
|
4
|
+
const range_1 = require("../util/range");
|
|
4
5
|
const absint_inference_1 = require("../abstract-interpretation/absint-inference");
|
|
5
6
|
const abstract_domain_1 = require("../abstract-interpretation/domains/abstract-domain");
|
|
6
7
|
const bounded_set_domain_1 = require("../abstract-interpretation/domains/bounded-set-domain");
|
|
@@ -69,7 +70,7 @@ async function inferIntervals() {
|
|
|
69
70
|
}
|
|
70
71
|
function nodeIdToSlicingCriterion(id, idMap) {
|
|
71
72
|
const node = idMap.get(id);
|
|
72
|
-
return `${node?.location
|
|
73
|
+
return `${range_1.SourceRange.getStartLine(node?.location)}@${node?.lexeme}`;
|
|
73
74
|
}
|
|
74
75
|
function multiValueExample() {
|
|
75
76
|
const domain = {
|
|
@@ -17,6 +17,7 @@ const cfg_properties_1 = require("../control-flow/cfg-properties");
|
|
|
17
17
|
const basic_cfg_guided_visitor_1 = require("../control-flow/basic-cfg-guided-visitor");
|
|
18
18
|
const syntax_cfg_guided_visitor_1 = require("../control-flow/syntax-cfg-guided-visitor");
|
|
19
19
|
const diff_cfg_1 = require("../control-flow/diff-cfg");
|
|
20
|
+
const node_id_1 = require("../r-bridge/lang-4.x/ast/model/processing/node-id");
|
|
20
21
|
const model_1 = require("../r-bridge/lang-4.x/ast/model/model");
|
|
21
22
|
const dfg_cfg_guided_visitor_1 = require("../control-flow/dfg-cfg-guided-visitor");
|
|
22
23
|
const semantic_cfg_guided_visitor_1 = require("../control-flow/semantic-cfg-guided-visitor");
|
|
@@ -536,7 +537,7 @@ so the vertex of an expression *is* its exit point ‐ there are no separate
|
|
|
536
537
|
${(0, doc_structure_1.details)('Example: Where an if joins again', await (async function () {
|
|
537
538
|
const expr = 'if(u) 3 else 2';
|
|
538
539
|
const cfg = await (0, doc_cfg_1.getCfg)(shell, expr);
|
|
539
|
-
const [ifVertexId, ifVertex] = [...cfg.info.graph.vertices()].filter(([n]) => cfg.ast.idMap
|
|
540
|
+
const [ifVertexId, ifVertex] = [...cfg.info.graph.vertices()].filter(([n]) => node_id_1.NodeId.recoverName(n, cfg.ast.idMap) === 'if')[0];
|
|
540
541
|
(0, assert_1.guard)(control_flow_graph_1.CfgVertex.isStatement(ifVertex) || control_flow_graph_1.CfgVertex.isExpression(ifVertex));
|
|
541
542
|
return `${await (0, doc_cfg_1.printCfgCode)(shell, expr, { showCode: true, prefix: 'flowchart LR\n', ctx })}
|
|
542
543
|
|
|
@@ -17,7 +17,7 @@ function lintingRuleInfoFields(ctx) {
|
|
|
17
17
|
}).join('\n');
|
|
18
18
|
}
|
|
19
19
|
function defineRule() {
|
|
20
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
20
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention -- rule objects are named in upper snake case, as the text below says
|
|
21
21
|
const MY_NEW_RULE = {
|
|
22
22
|
createSearch: (_config) => flowr_search_builder_1.Q.all(),
|
|
23
23
|
processSearchResult: (_elements, _config, _data) => ({
|
|
@@ -27,7 +27,6 @@ const control_flow_graph_1 = require("../control-flow/control-flow-graph");
|
|
|
27
27
|
const identifier_1 = require("../dataflow/environments/identifier");
|
|
28
28
|
const r_function_call_1 = require("../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
|
|
29
29
|
const default_pipelines_1 = require("../core/steps/pipeline/default-pipelines");
|
|
30
|
-
const linker_1 = require("../dataflow/internal/linker");
|
|
31
30
|
const apply_kill_1 = require("../dataflow/environments/apply-kill");
|
|
32
31
|
const doc_normalized_ast_1 = require("./doc-util/doc-normalized-ast");
|
|
33
32
|
const identify_link_to_last_call_relation_1 = require("../queries/catalog/call-context-query/identify-link-to-last-call-relation");
|
|
@@ -49,6 +48,7 @@ const match_args_1 = require("../dataflow/graph/match-args");
|
|
|
49
48
|
const built_in_proc_name_1 = require("../dataflow/environments/built-in-proc-name");
|
|
50
49
|
const vertex_2 = require("../dataflow/graph/vertex");
|
|
51
50
|
const objects_1 = require("../util/objects");
|
|
51
|
+
const strings_1 = require("../util/text/strings");
|
|
52
52
|
async function subExplanation(parser, ctx, { description, code, expectedSubgraph }) {
|
|
53
53
|
expectedSubgraph = await (0, doc_dfg_1.verifyExpectedSubgraph)(parser, code, expectedSubgraph);
|
|
54
54
|
const marks = [];
|
|
@@ -344,8 +344,8 @@ For starters, let's have a look at the environment of the call to \`<-\` in the
|
|
|
344
344
|
${(0, doc_env_1.printEnvironmentToMarkdown)(env.current)}
|
|
345
345
|
|
|
346
346
|
Great, you should see a definition of \`<-\` which is constraint by the [control dependency](#branches) to the \`if\`.
|
|
347
|
-
Hence, trying to re-resolve the call using ${ctx.link(
|
|
348
|
-
the following target ids: { \`${[...
|
|
347
|
+
Hence, trying to re-resolve the call using ${ctx.link(df_helper_1.Dataflow.callTargetsOf)} (defined in ${(0, doc_files_1.getFilePathMd)('../dataflow/internal/linker.ts')}) with the id \`${id}\` of the call as starting point will present you with
|
|
348
|
+
the following target ids: { \`${[...df_helper_1.Dataflow.callTargetsOf(id, info.dataflow.graph)].join('`, `')}\` }.
|
|
349
349
|
This way we know that the call may refer to the built-in assignment operator or to the multiplication.
|
|
350
350
|
Similarly, trying to resolve the name with ${ctx.link(resolve_helper_1.Resolve.byNameAndType)}\` using the environment attached to the call vertex (filtering for any reference type) returns (in a similar fashion):
|
|
351
351
|
{ \`${resolve_helper_1.Resolve.byName(identifier_1.Identifier.make(name), env)?.map(d => d.nodeId).join('`, `')}\` } (however, the latter will not trace aliases).
|
|
@@ -356,7 +356,7 @@ Similarly, trying to resolve the name with ${ctx.link(resolve_helper_1.Resolve.b
|
|
|
356
356
|
`)}
|
|
357
357
|
|
|
358
358
|
|
|
359
|
-
Similar to finding the definitions read by a variable use, please use the ${ctx.link(
|
|
359
|
+
Similar to finding the definitions read by a variable use, please use the ${ctx.link(df_helper_1.Dataflow.callTargetsOf)} function to find all possible definitions of a function call,
|
|
360
360
|
as explained in the ${ctx.linkPage('wiki/Dataflow Graph', 'working with the dataflow graph', 'dfg-working')} section.`
|
|
361
361
|
})}
|
|
362
362
|
|
|
@@ -538,7 +538,7 @@ ${(0, doc_structure_1.block)({
|
|
|
538
538
|
content: `
|
|
539
539
|
A ${linkEdgeName(edge_1.EdgeType.Reads)} edge is not a transitive closure and only links the "directly read" definition(s).
|
|
540
540
|
Our abstract domains resolving transitive ${linkEdgeName(edge_1.EdgeType.Reads)} edges (and for that matter, following ${linkEdgeName(edge_1.EdgeType.Returns)} as well)
|
|
541
|
-
are currently tailored to what we need in _flowR_. Hence, we offer a function like ${ctx.link(
|
|
541
|
+
are currently tailored to what we need in _flowR_. Hence, we offer a function like ${ctx.link(df_helper_1.Dataflow.callTargetsOf)},
|
|
542
542
|
as well as ${ctx.link(resolve_helper_1.Resolve.toBuiltIn)} which do this for specific cases.
|
|
543
543
|
Refer to ${ctx.link(df_helper_1.Dataflow.origin)} for a more general solution, as explained in ${ctx.linkPage('wiki/Dataflow Graph', 'working with the dataflow graph', 'dfg-working')}.
|
|
544
544
|
|
|
@@ -1191,7 +1191,7 @@ ${ctx.hierarchy('Origin', { openTop: true })}
|
|
|
1191
1191
|
|
|
1192
1192
|
Their respective uses are documented alongside their implementation:
|
|
1193
1193
|
|
|
1194
|
-
${['SimpleOrigin', 'FunctionCallOrigin', 'BuiltInFunctionOrigin'].sort(
|
|
1194
|
+
${['SimpleOrigin', 'FunctionCallOrigin', 'BuiltInFunctionOrigin'].sort(strings_1.compareByCodeUnit).map(key => `- ${ctx.link(key)}\\\n${ctx.doc(key, { type: 'interface' })}`).join('\n')}
|
|
1195
1195
|
|
|
1196
1196
|
Please note, the current structure of this function is biased by what implementations already exist in flowR.
|
|
1197
1197
|
Hence, we do not just track definitions and constants, but also the origins of function calls, albeit we do not yet track the origins of values (only resorting to
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.WikiInterface = void 0;
|
|
4
|
+
const r_string_1 = require("../r-bridge/lang-4.x/ast/model/nodes/r-string");
|
|
4
5
|
const shell_1 = require("../r-bridge/shell");
|
|
5
6
|
const doc_query_1 = require("./doc-util/doc-query");
|
|
6
7
|
const doc_files_1 = require("./doc-util/doc-files");
|
|
@@ -66,7 +67,7 @@ ${(0, doc_code_1.codeBlock)('shell', 'nc 127.0.0.1 1042')}
|
|
|
66
67
|
|
|
67
68
|
Within the started session, type the following message (as a single line) and press enter to see the response:
|
|
68
69
|
|
|
69
|
-
${(0, doc_code_1.codeBlock)('json',
|
|
70
|
+
${(0, doc_code_1.codeBlock)('json', r_string_1.RString.unquote(JSON.stringify({ type: 'request-file-analysis', content: 'x <- 1', id: '1' })))}
|
|
70
71
|
|
|
71
72
|
</details>
|
|
72
73
|
</li>
|
|
@@ -84,7 +85,7 @@ with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
|
|
|
84
85
|
s.connect(('127.0.0.1', 1042))
|
|
85
86
|
print(s.recv(4096)) # for the hello message
|
|
86
87
|
|
|
87
|
-
s.send(b'${
|
|
88
|
+
s.send(b'${r_string_1.RString.unquote(JSON.stringify({ type: 'request-file-analysis', content: 'x <- 1', id: '1' }))}\\n')
|
|
88
89
|
|
|
89
90
|
print(s.recv(65536)) # for the response (please use a more sophisticated mechanism)
|
|
90
91
|
`)}
|
|
@@ -4,8 +4,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.WikiLinter = void 0;
|
|
7
|
+
const r_string_1 = require("../r-bridge/lang-4.x/ast/model/nodes/r-string");
|
|
7
8
|
const doc_auto_gen_1 = require("./doc-util/doc-auto-gen");
|
|
8
9
|
const doc_files_1 = require("./doc-util/doc-files");
|
|
10
|
+
const conformance_1 = require("../linter/rules/cmd-check/conformance");
|
|
9
11
|
const linter_rules_1 = require("../linter/linter-rules");
|
|
10
12
|
const doc_code_1 = require("./doc-util/doc-code");
|
|
11
13
|
const doc_query_1 = require("./doc-util/doc-query");
|
|
@@ -209,12 +211,12 @@ These examples are synthesized from the test cases in: ${(0, doc_files_1.linkFlo
|
|
|
209
211
|
continue;
|
|
210
212
|
}
|
|
211
213
|
// drop any quotes around the test name
|
|
212
|
-
const testNameClean =
|
|
214
|
+
const testNameClean = r_string_1.RString.unquote(testName);
|
|
213
215
|
result += `\n${(0, doc_structure_1.section)('Test Case: ' + testNameClean, 4)}
|
|
214
216
|
|
|
215
217
|
${report.comments ? report.comments.map(c => `> ${c}`).join('\n') + '\n' : ''}
|
|
216
218
|
Given the following input:
|
|
217
|
-
${(0, doc_code_1.codeBlock)('r', args[2].getText(report.source)
|
|
219
|
+
${(0, doc_code_1.codeBlock)('r', r_string_1.RString.unquote(args[2].getText(report.source)).replace(/\\n/g, '\n'))}
|
|
218
220
|
${args.length >= 7 ? `\nAnd using the following [configuration](#configuration): ${(0, doc_code_1.codeBlock)('ts', prettyPrintExpectedOutput(args[6].getText(report.source)))}` : ''}
|
|
219
221
|
|
|
220
222
|
We expect the linter to report the following:
|
|
@@ -276,6 +278,25 @@ function(x) {
|
|
|
276
278
|
rule(knownParser, 'unused-import', 'UnusedImportConfig', 'UNUSED_IMPORT', 'lint-unused-import', 'library(stats)\nprint("no stats function is used")', tagTypes);
|
|
277
279
|
rule(knownParser, 'unescaped-arguments', 'UnescapedArgumentsConfig', 'UNESCAPED_ARGUMENTS', 'lint-unescaped-arguments', 'function(dir) {\n\tsystem(paste0("ls ", dir))\n}', tagTypes);
|
|
278
280
|
rule(knownParser, 'namespace-access', 'NamespaceAccessConfig', 'NAMESPACE_ACCESS', 'lint-namespace-access', 'dplyr:::filter(df, x > 1)', tagTypes);
|
|
281
|
+
rule(knownParser, 'description-metadata', 'DescriptionMetadataConfig', 'DESCRIPTION_METADATA', 'cmd-check/lint-description-metadata', 'cat("a package with a malformed DESCRIPTION")', tagTypes);
|
|
282
|
+
rule(knownParser, 'documentation-mismatch', 'DocumentationMismatchConfig', 'DOCUMENTATION_MISMATCH', 'cmd-check/lint-documentation-mismatch', 'f <- function(x, y) x + y', tagTypes);
|
|
283
|
+
rule(knownParser, 'non-ascii-code', 'NonAsciiCodeConfig', 'NON_ASCII_CODE', 'cmd-check/lint-non-ascii-code', 'escaped <- function() message("Gr\\u00fc\\u00dfe")\nliteral <- function() message("Gr\u00fc\u00dfe")', tagTypes);
|
|
284
|
+
rule(knownParser, 'class-string-comparison', 'ClassStringComparisonConfig', 'CLASS_STRING_COMPARISON', 'cmd-check/lint-class-string-comparison', 'f <- function(x) if(class(x) == "data.frame") nrow(x) else length(x)', tagTypes);
|
|
285
|
+
rule(knownParser, 'true-false-abbreviation', 'TrueFalseAbbreviationConfig', 'TRUE_FALSE_ABBREVIATION', 'cmd-check/lint-true-false-abbreviation', 'f <- function(x) mean(x, na.rm = T)', tagTypes);
|
|
286
|
+
rule(knownParser, 'bogus-return', 'BogusReturnConfig', 'BOGUS_RETURN', 'cmd-check/lint-bogus-return', 'f <- function(x) {\n\tif(is.null(x)) return\n\tx + 1\n}', tagTypes);
|
|
287
|
+
rule(knownParser, 'package-hooks', 'PackageHooksConfig', 'PACKAGE_HOOKS', 'cmd-check/lint-package-hooks', '.onLoad <- function(libname, pkgname) {\n\tlibrary(stats)\n\tcat("Welcome!")\n}', tagTypes);
|
|
288
|
+
rule(knownParser, 'global-environment-modification', 'GlobalEnvironmentModificationConfig', 'GLOBAL_ENVIRONMENT_MODIFICATION', 'cmd-check/lint-global-environment-modification', 'cache <- function(v) assign("cached", v, envir = globalenv())\ncount <- function() counter <<- counter + 1', tagTypes);
|
|
289
|
+
rule(knownParser, 'namespace-tampering', 'NamespaceTamperingConfig', 'NAMESPACE_TAMPERING', 'cmd-check/lint-namespace-tampering', 'patch <- function() assignInNamespace("mean", function(x, ...) 42, "base")', tagTypes);
|
|
290
|
+
rule(knownParser, 's3-method-consistency', 'S3MethodConsistencyConfig', 'S3_METHOD_CONSISTENCY', 'cmd-check/lint-s-three-method-consistency', 'print.myclass <- function(obj) cat("myclass")\n`size<-` <- function(x, v) { attr(x, "size") <- v; x }', tagTypes);
|
|
291
|
+
rule(knownParser, 'foreign-function-calls', 'ForeignFunctionCallsConfig', 'FOREIGN_FUNCTION_CALLS', 'cmd-check/lint-foreign-function-calls', 'f <- function(x) .Call("C_mean", x)', tagTypes);
|
|
292
|
+
rule(knownParser, 'dependency-declaration', 'DependencyDeclarationConfig', 'DEPENDENCY_DECLARATION', 'cmd-check/lint-dependency-declaration', 'f <- function(df) {\n\tlibrary(dplyr)\n\ttidyr::drop_na(df)\n}', tagTypes);
|
|
293
|
+
rule(knownParser, 'call-arguments', 'CallArgumentsConfig', 'CALL_ARGUMENTS', 'cmd-check/lint-call-arguments', 'scale_by <- function(x, factor) x * factor\nf <- function(x) scale_by(x, fact = 2, center = TRUE)', tagTypes);
|
|
294
|
+
rule(knownParser, 'package-structure', 'PackageStructureConfig', 'PACKAGE_STRUCTURE', 'cmd-check/lint-package-structure', 'f <- function() 1', tagTypes);
|
|
295
|
+
rule(knownParser, 'compiled-code', 'CompiledCodeConfig', 'COMPILED_CODE', 'cmd-check/lint-compiled-code', 'f <- function(x) .Call("C_f", x)', tagTypes);
|
|
296
|
+
rule(knownParser, 'package-metafiles', 'PackageMetafilesConfig', 'PACKAGE_METAFILES', 'cmd-check/lint-package-metafiles', 'f <- function() 1', tagTypes);
|
|
297
|
+
rule(knownParser, 'rd-files', 'RdFilesConfig', 'RD_FILES', 'cmd-check/lint-rd-files', 'f <- function() 1', tagTypes);
|
|
298
|
+
rule(knownParser, 'package-data', 'PackageDataConfig', 'PACKAGE_DATA', 'cmd-check/lint-package-data', 'f <- function() 1', tagTypes);
|
|
299
|
+
rule(knownParser, 'package-runtime', 'PackageRuntimeConfig', 'PACKAGE_RUNTIME', 'cmd-check/lint-package-runtime', 'f <- function() library(pkg)', tagTypes);
|
|
279
300
|
function rule(parser, name, configType, ruleType, testfile, example, types) {
|
|
280
301
|
const rule = linter_rules_1.LintingRules[name];
|
|
281
302
|
const tags = rule.info.tags.toSorted((a, b) => {
|
|
@@ -299,7 +320,7 @@ function(x) {
|
|
|
299
320
|
if (format === 'short') {
|
|
300
321
|
ruleExplanations.set(name, () => Promise.resolve(`
|
|
301
322
|
**[${rule.info.name}](${doc_files_1.FlowrWikiBaseRef}/${encodeURIComponent(getPageNameForLintingRule(name))}):** ${rule.info.description} [see ${(0, doc_types_1.shortLinkFile)(ruleType, types)}]\\
|
|
302
|
-
${tags}
|
|
323
|
+
${tags}${cmdCheckStepsOf(name, false) === '' ? '' : `\\\n\t${cmdCheckStepsOf(name, false)}`}
|
|
303
324
|
|
|
304
325
|
`.trim()));
|
|
305
326
|
}
|
|
@@ -311,6 +332,7 @@ ${(0, doc_structure_1.section)(rule.info.name + ` <sup>[<a href="${doc_file
|
|
|
311
332
|
|
|
312
333
|
${tags}
|
|
313
334
|
|
|
335
|
+
${cmdCheckStepsOf(name, true)}
|
|
314
336
|
|
|
315
337
|
This rule is a ${certaintyText} rule.
|
|
316
338
|
|
|
@@ -333,13 +355,23 @@ The linting query can be used to run this rule on the above example:
|
|
|
333
355
|
|
|
334
356
|
${await (0, doc_query_1.showQuery)(parser, example, [{ type: 'linter', rules: [{ name, config: {} }] }], { collapseQuery: true })}
|
|
335
357
|
|
|
336
|
-
${buildSamplesFromLinterTestCases(parser, `${testfile}.test.ts`)}
|
|
358
|
+
${rule.info.tags.includes(linter_tags_1.LintingRuleTag.CmdCheck) ? `More examples are the test cases in ${(0, doc_files_1.linkFlowRSourceFile)(`test/functionality/linter/${testfile}.test.ts`)}.` : buildSamplesFromLinterTestCases(parser, `${testfile}.test.ts`)}
|
|
337
359
|
|
|
338
360
|
`.trim());
|
|
339
361
|
}
|
|
340
362
|
}
|
|
341
363
|
return ruleExplanations;
|
|
342
364
|
}
|
|
365
|
+
const ConformanceSymbol = {
|
|
366
|
+
[conformance_1.ConformanceLevel.Full]: '๐ฉ',
|
|
367
|
+
[conformance_1.ConformanceLevel.Static]: '๐ท',
|
|
368
|
+
[conformance_1.ConformanceLevel.Partial]: '๐ถ'
|
|
369
|
+
};
|
|
370
|
+
/** the R CMD check steps a rule covers, as links into the conformance table */
|
|
371
|
+
function cmdCheckStepsOf(name, withCoverage) {
|
|
372
|
+
const steps = (0, conformance_1.numberedConformance)().filter(e => e.rules.includes(name));
|
|
373
|
+
return steps.length === 0 ? '' : `R CMD check: ${steps.map(e => `[#${e.number}](${doc_files_1.FlowrWikiBaseRef}/Linter#cmd-check-${e.number})${withCoverage ? ` ${ConformanceSymbol[e.level]}` : ''}`).join(', ')}`;
|
|
374
|
+
}
|
|
343
375
|
function getAllLintingRulesWithTag(tag) {
|
|
344
376
|
return Object.entries(linter_rules_1.LintingRules).filter(([_, rule]) => rule.info.tags.includes(tag)).map(([name]) => name);
|
|
345
377
|
}
|
|
@@ -389,6 +421,24 @@ ${await (async () => {
|
|
|
389
421
|
return result;
|
|
390
422
|
})()}
|
|
391
423
|
|
|
424
|
+
${(0, doc_structure_1.section)('R CMD check Conformance', 2, 'r-cmd-check-conformance')}
|
|
425
|
+
|
|
426
|
+
Rules tagged ${makeTagBadge(linter_tags_1.LintingRuleTag.CmdCheck, tagTypes.info)} port \`R CMD check\` (R 4.6.1, see [Writing R Extensions](${conformance_1.WritingRExtensionsCmdCheck}) and [R Packages](${conformance_1.RPackagesCmdCheck})).
|
|
427
|
+
They run by default only for packages (config option \`linter.disabledTags\`).
|
|
428
|
+
Below are all steps of \`R CMD check\`, numbered by us (R itself prints them as \`* checking ...\`), each linked to its code in [R's \`check.R\`](${conformance_1.CmdCheckSource}) and its section in R Packages.
|
|
429
|
+
|
|
430
|
+
| | Coverage |
|
|
431
|
+
| :-: | :-- |
|
|
432
|
+
| ${ConformanceSymbol.full} | everything the step reports |
|
|
433
|
+
| ${ConformanceSymbol.static} | what can be decided without building, installing, or running the package |
|
|
434
|
+
| ${ConformanceSymbol.partial} | part of what the step reports |
|
|
435
|
+
|
|
436
|
+
${conformance_1.CmdCheckConformance.map(({ area }) => `${(0, doc_structure_1.section)(area, 3)}
|
|
437
|
+
|
|
438
|
+
| # | Step (\`checking ...\`) | | Rules | Note |
|
|
439
|
+
| --: | :-- | :-: | :-- | :-- |
|
|
440
|
+
${(0, conformance_1.numberedConformance)().filter(e => e.area === area).map(e => `| <a id="cmd-check-${e.number}"></a>${e.number} | [${e.check.replaceAll('|', '\\|')}](${conformance_1.CmdCheckSource}#L${e.line}) ([book](${conformance_1.RPackagesCmdCheck}#${e.book})) | ${ConformanceSymbol[e.level]} | ${e.rules.map(r => linkToRule(r)).join(', ')} | ${(e.note ?? '').replaceAll('|', '\\|')} |`).join('\n')}`).join('\n\n')}
|
|
441
|
+
|
|
392
442
|
${(0, doc_structure_1.section)('Quick Fixes', 2, 'quick-fixes')}
|
|
393
443
|
|
|
394
444
|
Rules tagged ${makeTagBadge(linter_tags_1.LintingRuleTag.QuickFix, tagTypes.info)} attach a ${(0, doc_types_1.shortLink)('LintQuickFix', tagTypes.info)} to their results,
|
|
@@ -33,8 +33,7 @@ const UrlEncodedHomePath = /(?:[a-z]%3A)?(%2F|%5C)(?:home|users)\1(?:[\w.%-]+\1)
|
|
|
33
33
|
const DefaultReplacementPatterns = [
|
|
34
34
|
// mute signature database load time variance in wiki table (before the `ms` rule, which would eat half of it)
|
|
35
35
|
[/โ\s*<?[\d.]+\s*[ยตm]s/g, ''],
|
|
36
|
-
|
|
37
|
-
[/\d+(\.\d+)?(โ|\s*)?ms/g, ''],
|
|
36
|
+
[/\d+(\.\d+)?(\u2009|\s*)?ms/g, ''],
|
|
38
37
|
[/tmp[%A-Za-z0-9-]+/g, ''],
|
|
39
38
|
[/"?(timing|searchTimeMs|processTimeMs|id|tsId)"?:\s*\d+(\.\d)?,?/g, ''],
|
|
40
39
|
[/"format":"compact"[^\n\r]*/giu, ''],
|