@eagleoutice/flowr 2.16.2 → 2.16.4
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 +15 -15
- 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 +10 -0
- package/dataflow/environments/built-in-props.js +25 -1
- 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 +188 -14
- package/dataflow/environments/default-builtin-config.js +125 -65
- 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 +0 -2
- package/dataflow/environments/identifier.js +5 -7
- package/dataflow/environments/overwrite.js +1 -0
- package/dataflow/environments/query-fn-props.js +4 -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 +16 -11
- 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 +3 -8
- 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 +3 -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 +5 -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 +4 -3
- 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-query.d.ts +1 -1
- package/documentation/doc-util/doc-query.js +3 -1
- package/documentation/doc-util/doc-repl.js +4 -4
- package/documentation/doc-util/doc-timings.js +3 -2
- 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 +2 -2
- package/documentation/wiki-dataflow-graph.js +6 -6
- package/documentation/wiki-interface.js +3 -2
- package/documentation/wiki-linter.d.ts +14 -0
- package/documentation/wiki-linter.js +353 -88
- 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 +552 -35
- 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.d.ts +1 -1
- package/linter/rules/absolute-path.js +9 -6
- 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 +216 -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 +51 -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 +60 -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 +51 -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 +173 -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 +83 -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/dataframe-access-validation.d.ts +1 -1
- package/linter/rules/dataframe-access-validation.js +1 -1
- package/linter/rules/dead-code.d.ts +4 -4
- package/linter/rules/dead-code.js +19 -4
- package/linter/rules/deprecated-functions.d.ts +1 -1
- package/linter/rules/deprecated-functions.js +5 -5
- package/linter/rules/file-path-validity.d.ts +6 -2
- package/linter/rules/file-path-validity.js +7 -3
- package/linter/rules/namespace-access.d.ts +3 -3
- package/linter/rules/namespace-access.js +12 -3
- package/linter/rules/naming-convention.d.ts +2 -2
- package/linter/rules/naming-convention.js +14 -15
- package/linter/rules/network-functions.d.ts +1 -1
- package/linter/rules/network-functions.js +1 -1
- package/linter/rules/no-leaked-credentials.d.ts +1 -1
- package/linter/rules/no-leaked-credentials.js +5 -5
- package/linter/rules/problematic-inputs.d.ts +2 -2
- package/linter/rules/problematic-inputs.js +4 -3
- package/linter/rules/roxygen-arguments.d.ts +2 -2
- package/linter/rules/roxygen-arguments.js +2 -2
- package/linter/rules/seeded-randomness.d.ts +2 -2
- package/linter/rules/seeded-randomness.js +7 -7
- package/linter/rules/software-has-license.d.ts +3 -3
- package/linter/rules/software-has-license.js +3 -3
- package/linter/rules/software-has-tests.d.ts +2 -2
- package/linter/rules/software-has-tests.js +2 -2
- package/linter/rules/stop-with-call-arg.d.ts +3 -3
- package/linter/rules/stop-with-call-arg.js +21 -4
- package/linter/rules/syntactically-valid.d.ts +1 -1
- package/linter/rules/syntactically-valid.js +1 -1
- package/linter/rules/unclosed-connection.d.ts +2 -2
- package/linter/rules/unclosed-connection.js +5 -5
- package/linter/rules/undefined-symbol-util.js +16 -32
- package/linter/rules/undefined-symbol.d.ts +3 -1
- package/linter/rules/undefined-symbol.js +34 -4
- package/linter/rules/unescaped-arguments.d.ts +1 -1
- package/linter/rules/unescaped-arguments.js +11 -10
- package/linter/rules/unused-definition.d.ts +1 -1
- package/linter/rules/unused-definition.js +14 -20
- package/linter/rules/unused-import.d.ts +1 -1
- package/linter/rules/unused-import.js +1 -1
- package/linter/rules/useless-loop.d.ts +1 -1
- package/linter/rules/useless-loop.js +1 -1
- 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 +2 -2
- package/project/context/flowr-analyzer-environment-context.js +2 -1
- package/project/context/flowr-analyzer-files-context.d.ts +6 -0
- package/project/context/flowr-analyzer-files-context.js +15 -11
- 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/file-plugins/flowr-analyzer-test-file-plugin.js +1 -1
- package/project/plugins/file-plugins/flowr-analyzer-vignette-file-plugin.js +1 -1
- 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 +24 -32
- 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 +45 -0
- package/queries/catalog/dependencies-query/data-flow.js +179 -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 +36 -35
- 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-sources-query-executor.js +2 -2
- package/queries/catalog/input-sources-query/input-sources-query-format.js +2 -3
- package/queries/catalog/input-sources-query/simple-input-classifier.js +28 -29
- 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-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
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NON_ASCII_CODE = void 0;
|
|
4
|
+
const arrays_1 = require("../../../util/collections/arrays");
|
|
5
|
+
const linter_format_1 = require("../../linter-format");
|
|
6
|
+
const flowr_search_builder_1 = require("../../../search/flowr-search-builder");
|
|
7
|
+
const flowr_search_filters_1 = require("../../../search/flowr-search-filters");
|
|
8
|
+
const type_1 = require("../../../r-bridge/lang-4.x/ast/model/type");
|
|
9
|
+
const linter_tags_1 = require("../../linter-tags");
|
|
10
|
+
const range_1 = require("../../../util/range");
|
|
11
|
+
const r_string_1 = require("../../../r-bridge/lang-4.x/ast/model/nodes/r-string");
|
|
12
|
+
const r_symbol_1 = require("../../../r-bridge/lang-4.x/ast/model/nodes/r-symbol");
|
|
13
|
+
const identifier_1 = require("../../../dataflow/environments/identifier");
|
|
14
|
+
const cmd_check_util_1 = require("./cmd-check-util");
|
|
15
|
+
const package_files_1 = require("./package-files");
|
|
16
|
+
/** the distinct characters of `text` outside the ASCII range, by code point */
|
|
17
|
+
function nonAsciiCharacters(text) {
|
|
18
|
+
return (0, arrays_1.uniqueArray)([...text].filter(c => (c.codePointAt(0) ?? 0) > 0x7f));
|
|
19
|
+
}
|
|
20
|
+
/** `\uXXXX` for code points up to U+FFFF, `\U{XXXXX}` above */
|
|
21
|
+
function escape(char) {
|
|
22
|
+
const cp = char.codePointAt(0) ?? 0;
|
|
23
|
+
return cp > 0xffff ? `\\U{${cp.toString(16)}}` : `\\u${cp.toString(16).padStart(4, '0')}`;
|
|
24
|
+
}
|
|
25
|
+
/** the quick fix escaping the non-ASCII characters of a string literal, keeping its quotes (raw strings cannot escape) */
|
|
26
|
+
function quickFixFor(node) {
|
|
27
|
+
const { str, quotes, flag } = node.content;
|
|
28
|
+
const loc = range_1.SourceLocation.fromNode(node);
|
|
29
|
+
if (flag === 'raw' || quotes === 'none' || loc === undefined) {
|
|
30
|
+
return undefined;
|
|
31
|
+
}
|
|
32
|
+
const body = [...str].map(c => (c.codePointAt(0) ?? 0) > 0x7f ? escape(c) : c).join('');
|
|
33
|
+
const replacement = `${quotes}${body}${quotes}`;
|
|
34
|
+
return [{ type: 'replace', description: 'Escape the non-ASCII characters', replacement, loc }];
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Port of the `R CMD check` note "Found the following file with non-ASCII characters", from the check
|
|
38
|
+
* "checking code files for non-ASCII characters". Portable packages must use only ASCII in their R code outside
|
|
39
|
+
* of comments. Unlike the check, which only names the file, each offending string literal and symbol is reported
|
|
40
|
+
* with its characters. Comments and roxygen documentation are ignored, and so is code outside the R folder.
|
|
41
|
+
* The NAMESPACE file is inspected line by line, outside of comments, as `R CMD check` does.
|
|
42
|
+
*/
|
|
43
|
+
exports.NON_ASCII_CODE = {
|
|
44
|
+
createSearch: () => flowr_search_builder_1.Q.all().filter(flowr_search_filters_1.FlowrFilterCombinator.or(type_1.RType.String, type_1.RType.Symbol)),
|
|
45
|
+
processSearchResult: (elements, config, data) => {
|
|
46
|
+
const pkg = (0, cmd_check_util_1.packageInfo)(data.inspectContext());
|
|
47
|
+
let considered = 0;
|
|
48
|
+
const results = [];
|
|
49
|
+
for (const { node } of elements.getElements()) {
|
|
50
|
+
if (!pkg.isPackageCode(node.info.file) || !(r_string_1.RString.is(node) ? config.checkStrings : config.checkSymbols)) {
|
|
51
|
+
continue;
|
|
52
|
+
}
|
|
53
|
+
considered++;
|
|
54
|
+
const loc = range_1.SourceLocation.fromNode(node);
|
|
55
|
+
if (loc === undefined) {
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
58
|
+
if (r_string_1.RString.is(node)) {
|
|
59
|
+
const characters = nonAsciiCharacters(node.content.str);
|
|
60
|
+
if (characters.length > 0) {
|
|
61
|
+
results.push({
|
|
62
|
+
...(0, cmd_check_util_1.at)(node),
|
|
63
|
+
kind: 'string',
|
|
64
|
+
characters,
|
|
65
|
+
message: `Non-ASCII characters in string literal (${characters.join(', ')}), use \\uxxxx escapes instead`,
|
|
66
|
+
quickFix: quickFixFor(node)
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
else if (r_symbol_1.RSymbol.is(node)) {
|
|
71
|
+
const characters = nonAsciiCharacters(identifier_1.Identifier.getName(node.content));
|
|
72
|
+
if (characters.length > 0) {
|
|
73
|
+
results.push({
|
|
74
|
+
...(0, cmd_check_util_1.at)(node),
|
|
75
|
+
kind: 'symbol',
|
|
76
|
+
characters,
|
|
77
|
+
message: `Non-ASCII characters in symbol name (${characters.join(', ')}), use ASCII only`
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
const ctx = data.inspectContext();
|
|
83
|
+
const files = (0, package_files_1.packageFiles)(ctx, pkg.name);
|
|
84
|
+
const namespace = files?.read('NAMESPACE');
|
|
85
|
+
if (files !== undefined && namespace !== undefined) {
|
|
86
|
+
for (const [i, line] of namespace.split(/\r?\n/).entries()) {
|
|
87
|
+
const characters = nonAsciiCharacters(line.replace(/#.*$/, ''));
|
|
88
|
+
if (characters.length > 0) {
|
|
89
|
+
results.push({
|
|
90
|
+
...(0, cmd_check_util_1.at)(files.locate('NAMESPACE', i + 1)),
|
|
91
|
+
kind: 'namespace',
|
|
92
|
+
characters,
|
|
93
|
+
message: `Non-ASCII characters in the NAMESPACE file (${characters.join(', ')}), use ASCII only`
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
return { results, '.meta': { consideredTokens: considered } };
|
|
99
|
+
},
|
|
100
|
+
prettyPrint: (0, cmd_check_util_1.printer)(r => `non-ASCII ${r.kind} ${JSON.stringify(r.characters)}`),
|
|
101
|
+
info: {
|
|
102
|
+
name: 'Non-ASCII Code',
|
|
103
|
+
tags: [linter_tags_1.LintingRuleTag.Smell, linter_tags_1.LintingRuleTag.CmdCheck, linter_tags_1.LintingRuleTag.QuickFix],
|
|
104
|
+
certainty: linter_format_1.LintingRuleCertainty.BestEffort,
|
|
105
|
+
description: 'Finds non-ASCII characters in R code and the NAMESPACE outside of comments. Offers `\\u` escapes for strings as a quick fix.',
|
|
106
|
+
defaultConfig: () => ({
|
|
107
|
+
checkStrings: true,
|
|
108
|
+
checkSymbols: true
|
|
109
|
+
})
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
//# sourceMappingURL=non-ascii-code.js.map
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { PackageFiles } from './package-files';
|
|
2
|
+
/** Where code outside of the `R/` folder of a package comes from. */
|
|
3
|
+
export type CodeOrigin = 'tests' | 'vignettes' | 'examples';
|
|
4
|
+
/** A piece of R code of a package that does not live in `R/`, but which `R CMD check` still runs (or reads). */
|
|
5
|
+
export interface PackageCode {
|
|
6
|
+
readonly origin: CodeOrigin;
|
|
7
|
+
/** the file the code is taken from, relative to the package root */
|
|
8
|
+
readonly file: string;
|
|
9
|
+
/** the code itself, with the lines that are no R code blanked so that line numbers stay as they are in the file */
|
|
10
|
+
readonly code: string;
|
|
11
|
+
/** for a vignette, the packages its `%\VignetteDepends{}` names and the package of its `%\VignetteEngine{}` */
|
|
12
|
+
readonly depends?: readonly string[];
|
|
13
|
+
/** the line of {@link file} the first line of {@link code} is on */
|
|
14
|
+
readonly lineOffset: number;
|
|
15
|
+
}
|
|
16
|
+
/** keeps the code chunks of an R Markdown or Sweave document, blanking every other line */
|
|
17
|
+
export declare function vignetteChunks(text: string, sweave: boolean): string;
|
|
18
|
+
/** the index of the brace closing the one opened at `open`, honoring Rd escapes, `-1` if unbalanced */
|
|
19
|
+
export declare function closingBrace(text: string, open: number): number;
|
|
20
|
+
/**
|
|
21
|
+
* The code of the `\examples{}` section of an Rd page, as `R CMD check` runs it: `\dontrun{}` is dropped,
|
|
22
|
+
* `\donttest{}`, `\dontshow{}` and `\testonly{}` are kept, Rd escapes are undone. Lines keep their place.
|
|
23
|
+
* `undefined` if the page has no examples.
|
|
24
|
+
*/
|
|
25
|
+
export declare function rdExamples(rd: string): {
|
|
26
|
+
code: string;
|
|
27
|
+
lineOffset: number;
|
|
28
|
+
} | undefined;
|
|
29
|
+
/** The code of a package `R CMD check` looks at besides `R/`: the tests, the vignettes, and the examples of the manual. */
|
|
30
|
+
export declare function packageCode(files: PackageFiles): PackageCode[];
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.vignetteChunks = vignetteChunks;
|
|
4
|
+
exports.closingBrace = closingBrace;
|
|
5
|
+
exports.rdExamples = rdExamples;
|
|
6
|
+
exports.packageCode = packageCode;
|
|
7
|
+
/** the test frameworks whose folders `R CMD check` looks into, besides `tests/` itself */
|
|
8
|
+
const TestSubdirectories = ['testthat', 'testit', 'unitizer', 'RUnit'];
|
|
9
|
+
/** the files of the test code, as `tools:::.check_packages_used_in_tests` collects them */
|
|
10
|
+
function isTestFile(relative) {
|
|
11
|
+
if (!/\.[rR]$/.test(relative) || !relative.startsWith('tests/')) {
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
const rest = relative.slice('tests/'.length);
|
|
15
|
+
return !rest.includes('/') || TestSubdirectories.some(d => rest.startsWith(`${d}/`) && !rest.slice(d.length + 1).includes('/'));
|
|
16
|
+
}
|
|
17
|
+
/** keeps the code chunks of an R Markdown or Sweave document, blanking every other line */
|
|
18
|
+
function vignetteChunks(text, sweave) {
|
|
19
|
+
const lines = text.split(/\r?\n/);
|
|
20
|
+
let inChunk = false;
|
|
21
|
+
return lines.map(line => {
|
|
22
|
+
if (!inChunk && (sweave ? /^\s*<<.*>>=\s*$/.test(line) : /^\s*```+\s*\{\s*r\b[^}]*\}\s*$/i.test(line))) {
|
|
23
|
+
/* an R Markdown chunk with `eval = FALSE` is not run */
|
|
24
|
+
inChunk = sweave || !/\beval\s*=\s*(FALSE|F)\b/.test(line);
|
|
25
|
+
return '';
|
|
26
|
+
}
|
|
27
|
+
if (inChunk && (sweave ? /^\s*@\s*$/.test(line) : /^\s*```+\s*$/.test(line))) {
|
|
28
|
+
inChunk = false;
|
|
29
|
+
return '';
|
|
30
|
+
}
|
|
31
|
+
return inChunk ? line : '';
|
|
32
|
+
}).join('\n');
|
|
33
|
+
}
|
|
34
|
+
/** the packages a vignette's `\VignetteDepends{}` and `\VignetteEngine{pkg::engine}` require */
|
|
35
|
+
function vignetteDepends(text) {
|
|
36
|
+
const result = [];
|
|
37
|
+
for (const match of text.matchAll(/\\VignetteDepends\{([^}]*)\}/g)) {
|
|
38
|
+
result.push(...match[1].split(',').map(s => s.trim()).filter(s => s !== ''));
|
|
39
|
+
}
|
|
40
|
+
const engine = /\\VignetteEngine\{([A-Za-z][A-Za-z0-9.]*)::[^}]*\}/.exec(text);
|
|
41
|
+
if (engine) {
|
|
42
|
+
result.push(engine[1]);
|
|
43
|
+
}
|
|
44
|
+
return result;
|
|
45
|
+
}
|
|
46
|
+
/** the index of the brace closing the one opened at `open`, honoring Rd escapes, `-1` if unbalanced */
|
|
47
|
+
function closingBrace(text, open) {
|
|
48
|
+
let depth = 0;
|
|
49
|
+
for (let i = open; i < text.length; i++) {
|
|
50
|
+
const c = text[i];
|
|
51
|
+
if (c === '\\') {
|
|
52
|
+
i++;
|
|
53
|
+
}
|
|
54
|
+
else if (c === '%') {
|
|
55
|
+
/* an Rd comment runs to the end of the line */
|
|
56
|
+
const eol = text.indexOf('\n', i);
|
|
57
|
+
if (eol < 0) {
|
|
58
|
+
return -1;
|
|
59
|
+
}
|
|
60
|
+
i = eol;
|
|
61
|
+
}
|
|
62
|
+
else if (c === '{') {
|
|
63
|
+
depth++;
|
|
64
|
+
}
|
|
65
|
+
else if (c === '}' && --depth === 0) {
|
|
66
|
+
return i;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return -1;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* The code of the `\examples{}` section of an Rd page, as `R CMD check` runs it: `\dontrun{}` is dropped,
|
|
73
|
+
* `\donttest{}`, `\dontshow{}` and `\testonly{}` are kept, Rd escapes are undone. Lines keep their place.
|
|
74
|
+
* `undefined` if the page has no examples.
|
|
75
|
+
*/
|
|
76
|
+
function rdExamples(rd) {
|
|
77
|
+
const start = rd.search(/\\examples\s*\{/);
|
|
78
|
+
if (start < 0) {
|
|
79
|
+
return undefined;
|
|
80
|
+
}
|
|
81
|
+
const open = rd.indexOf('{', start);
|
|
82
|
+
const close = closingBrace(rd, open);
|
|
83
|
+
if (close < 0) {
|
|
84
|
+
return undefined;
|
|
85
|
+
}
|
|
86
|
+
let body = rd.slice(open + 1, close);
|
|
87
|
+
/* drop \dontrun{...}, keeping its line breaks */
|
|
88
|
+
for (let at = body.search(/\\dontrun\s*\{/); at >= 0; at = body.search(/\\dontrun\s*\{/)) {
|
|
89
|
+
const o = body.indexOf('{', at);
|
|
90
|
+
const c = closingBrace(body, o);
|
|
91
|
+
if (c < 0) {
|
|
92
|
+
break;
|
|
93
|
+
}
|
|
94
|
+
body = body.slice(0, at) + body.slice(at, c + 1).replace(/[^\n]/g, '') + body.slice(c + 1);
|
|
95
|
+
}
|
|
96
|
+
/* keep the content of the other wrappers, dropping the macro and its braces */
|
|
97
|
+
for (let m = /\\(donttest|dontshow|testonly|dontdiff)\s*\{/.exec(body); m !== null; m = /\\(donttest|dontshow|testonly|dontdiff)\s*\{/.exec(body)) {
|
|
98
|
+
const o = body.indexOf('{', m.index);
|
|
99
|
+
const c = closingBrace(body, o);
|
|
100
|
+
if (c < 0) {
|
|
101
|
+
break;
|
|
102
|
+
}
|
|
103
|
+
body = body.slice(0, m.index) + body.slice(o + 1, c) + body.slice(c + 1);
|
|
104
|
+
}
|
|
105
|
+
const code = body.split('\n').map(line => {
|
|
106
|
+
const comment = line.search(/(?<!\\)%/);
|
|
107
|
+
return (comment >= 0 ? line.slice(0, comment) : line).replace(/\\([%{}\\])/g, '$1');
|
|
108
|
+
}).join('\n');
|
|
109
|
+
return { code, lineOffset: rd.slice(0, open).split('\n').length };
|
|
110
|
+
}
|
|
111
|
+
/** The code of a package `R CMD check` looks at besides `R/`: the tests, the vignettes, and the examples of the manual. */
|
|
112
|
+
function packageCode(files) {
|
|
113
|
+
const result = [];
|
|
114
|
+
for (const { relative, isDirectory } of files.entries) {
|
|
115
|
+
if (isDirectory) {
|
|
116
|
+
continue;
|
|
117
|
+
}
|
|
118
|
+
if (isTestFile(relative)) {
|
|
119
|
+
const code = files.read(relative);
|
|
120
|
+
if (code !== undefined) {
|
|
121
|
+
result.push({ origin: 'tests', file: relative, code, lineOffset: 1 });
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
else if (/^vignettes\/[^/]+\.(Rmd|Rnw|Rmarkdown|qmd|R)$/i.test(relative)) {
|
|
125
|
+
const text = files.read(relative);
|
|
126
|
+
if (text !== undefined) {
|
|
127
|
+
const code = /\.R$/i.test(relative) ? text : vignetteChunks(text, /\.Rnw$/i.test(relative));
|
|
128
|
+
result.push({ origin: 'vignettes', file: relative, code, depends: vignetteDepends(text), lineOffset: 1 });
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
else if (/^man\/[^/]+\.Rd$/i.test(relative)) {
|
|
132
|
+
const text = files.read(relative);
|
|
133
|
+
const examples = text === undefined ? undefined : rdExamples(text);
|
|
134
|
+
if (examples !== undefined) {
|
|
135
|
+
result.push({ origin: 'examples', file: relative, ...examples });
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
return result;
|
|
140
|
+
}
|
|
141
|
+
//# sourceMappingURL=package-code.js.map
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { LintingRuleCertainty } from '../../linter-format';
|
|
2
|
+
import type { MergeableRecord } from '../../../util/objects';
|
|
3
|
+
import { LintingRuleTag } from '../../linter-tags';
|
|
4
|
+
import { type FileResult } from './file-checks';
|
|
5
|
+
export type PackageDataKind = 'data-directory' | 'lazydata' | 'compact-data' | 'compact-sysdata' | 'compression-depends' | 'serialization-version' | 'undocumented-data';
|
|
6
|
+
export type PackageDataResult = FileResult<PackageDataKind>;
|
|
7
|
+
export interface PackageDataConfig extends MergeableRecord {
|
|
8
|
+
/** an uncompressed or ASCII save above this many bytes is flagged */
|
|
9
|
+
readonly maxUncompressedSize: number;
|
|
10
|
+
/** report saves that a stronger compression would make much smaller */
|
|
11
|
+
readonly checkCompaction: boolean;
|
|
12
|
+
/** report data sets no Rd page documents */
|
|
13
|
+
readonly checkUndocumented: boolean;
|
|
14
|
+
}
|
|
15
|
+
export interface PackageDataMetadata extends MergeableRecord {
|
|
16
|
+
readonly inspectedDataFiles: number;
|
|
17
|
+
/** whether the package was read from the file system, which enables reading the objects a save holds */
|
|
18
|
+
readonly onDisk: boolean;
|
|
19
|
+
}
|
|
20
|
+
/** Port of the data checks of `R CMD check`: `data/`, `LazyData`, save compression and serialization version, undocumented data sets. */
|
|
21
|
+
export declare const PACKAGE_DATA: {
|
|
22
|
+
readonly createSearch: () => import("../../../search/flowr-search-builder").FlowrSearchBuilder<"from", [], import("../../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, import("../../../search/flowr-search").FlowrSearchElements<import("../../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, import("../../../search/flowr-search").FlowrSearchElement<import("../../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation>[]>>;
|
|
23
|
+
readonly processSearchResult: (_elements: import("../../../search/flowr-search").FlowrSearchElements<import("../../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, import("../../../search/flowr-search").FlowrSearchElement<import("../../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation>[]>, config: PackageDataConfig, data: import("../../..").ReadonlyFlowrAnalysisProvider<import("../../..").KnownParser>) => {
|
|
24
|
+
results: FileResult<PackageDataKind>[];
|
|
25
|
+
'.meta': {
|
|
26
|
+
inspectedDataFiles: number;
|
|
27
|
+
onDisk: boolean;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
readonly prettyPrint: {
|
|
31
|
+
query: (r: {
|
|
32
|
+
readonly message: string;
|
|
33
|
+
readonly loc: import("../../..").SourceLocation;
|
|
34
|
+
}) => string;
|
|
35
|
+
full: (r: {
|
|
36
|
+
readonly message: string;
|
|
37
|
+
readonly loc: import("../../..").SourceLocation;
|
|
38
|
+
}) => string;
|
|
39
|
+
};
|
|
40
|
+
readonly info: {
|
|
41
|
+
readonly name: "Package Data";
|
|
42
|
+
readonly tags: readonly [LintingRuleTag.CmdCheck];
|
|
43
|
+
readonly certainty: LintingRuleCertainty.BestEffort;
|
|
44
|
+
readonly description: "Finds problems in `data/` and `R/sysdata.rda`: allowed file types, LazyData, compression, the serialization version R needs, and undocumented data sets.";
|
|
45
|
+
readonly defaultConfig: () => {
|
|
46
|
+
maxUncompressedSize: number;
|
|
47
|
+
checkCompaction: true;
|
|
48
|
+
checkUndocumented: true;
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
};
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.PACKAGE_DATA = void 0;
|
|
7
|
+
const fs_1 = __importDefault(require("fs"));
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
const linter_format_1 = require("../../linter-format");
|
|
10
|
+
const flowr_search_builder_1 = require("../../../search/flowr-search-builder");
|
|
11
|
+
const linter_tags_1 = require("../../linter-tags");
|
|
12
|
+
const r_version_1 = require("../../../util/r-version");
|
|
13
|
+
const flowr_file_1 = require("../../../project/context/flowr-file");
|
|
14
|
+
const flowr_rda_file_1 = require("../../../project/plugins/file-plugins/files/flowr-rda-file");
|
|
15
|
+
const cmd_check_util_1 = require("./cmd-check-util");
|
|
16
|
+
const package_files_1 = require("./package-files");
|
|
17
|
+
const file_checks_1 = require("./file-checks");
|
|
18
|
+
const DataFile = /\.(R|r|RData|rdata|rda|TXT|CSV|(tab|txt|csv)(\.(gz|bz2|xz))?)$/;
|
|
19
|
+
const RdaFile = /\.(rda|RData)$/;
|
|
20
|
+
const DatalistLine = /^[^ :]+($|: +[A-Za-z.])/;
|
|
21
|
+
const LazyDataCompressions = ['gzip', 'bzip2', 'xz', 'none'];
|
|
22
|
+
const SysData = 'R/sysdata.rda';
|
|
23
|
+
function compressionOf(buf) {
|
|
24
|
+
const head = buf.toString('latin1', 0, 5);
|
|
25
|
+
if (buf[0] === 0x1f && buf[1] === 0x8b) {
|
|
26
|
+
return 'gzip';
|
|
27
|
+
}
|
|
28
|
+
else if (head.startsWith('BZh')) {
|
|
29
|
+
return 'bzip2';
|
|
30
|
+
}
|
|
31
|
+
else if (buf[0] === 0xfd && head.slice(1) === '7zXZ') {
|
|
32
|
+
return 'xz';
|
|
33
|
+
}
|
|
34
|
+
return /^RD[ABX][1-9]/.test(head) ? 'none' : 'unknown';
|
|
35
|
+
}
|
|
36
|
+
function rdaHeader(buf, file) {
|
|
37
|
+
const compress = compressionOf(buf);
|
|
38
|
+
let plain;
|
|
39
|
+
try {
|
|
40
|
+
const parser = new flowr_rda_file_1.RDAParser(new flowr_file_1.FlowrInlineTextFile(file, ''), false);
|
|
41
|
+
plain = compress === 'none' ? buf : compress === 'gzip' ? parser.decompress(buf, flowr_rda_file_1.CompressionType.CompGz) : compress === 'bzip2' ? parser.decompress(buf, flowr_rda_file_1.CompressionType.CompBz) : undefined;
|
|
42
|
+
}
|
|
43
|
+
catch {
|
|
44
|
+
plain = undefined;
|
|
45
|
+
}
|
|
46
|
+
const m = /^RD([ABX])([1-9])/.exec(plain?.toString('latin1', 0, 4) ?? '');
|
|
47
|
+
return m ? { compress, ascii: m[1] === 'A', version: Number(m[2]) } : { compress };
|
|
48
|
+
}
|
|
49
|
+
function objectNamesOf(file) {
|
|
50
|
+
try {
|
|
51
|
+
return new flowr_rda_file_1.RDAParser(new flowr_file_1.FlowrInlineTextFile(file, ''), true).parse()?.flatMap(o => o.name ? [o.name] : []);
|
|
52
|
+
}
|
|
53
|
+
catch {
|
|
54
|
+
return undefined;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
/** the bytes of a save on disk, `undefined` for a file only known in memory */
|
|
58
|
+
function bytesOf(entry) {
|
|
59
|
+
try {
|
|
60
|
+
return entry.stats === undefined ? undefined : fs_1.default.readFileSync(entry.absolute);
|
|
61
|
+
}
|
|
62
|
+
catch {
|
|
63
|
+
return undefined;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
/** whether the DESCRIPTION declares `R (>= minimum)` in `Depends` */
|
|
67
|
+
function dependsOnR(desc, minimum) {
|
|
68
|
+
const depends = desc?.content().get('Depends')?.join(' ') ?? '';
|
|
69
|
+
return [...depends.matchAll(/\bR\s*\(\s*(?:>=|>)\s*([0-9][0-9.-]*)\s*\)/g)].some(m => r_version_1.RRange.satisfies(m[1], `>= ${minimum}`));
|
|
70
|
+
}
|
|
71
|
+
/** Port of the data checks of `R CMD check`: `data/`, `LazyData`, save compression and serialization version, undocumented data sets. */
|
|
72
|
+
exports.PACKAGE_DATA = {
|
|
73
|
+
createSearch: () => flowr_search_builder_1.Q.from([]),
|
|
74
|
+
processSearchResult: (_elements, config, data) => {
|
|
75
|
+
const ctx = data.inspectContext();
|
|
76
|
+
const pkg = (0, cmd_check_util_1.packageInfo)(ctx);
|
|
77
|
+
const pf = (0, package_files_1.packageFiles)(ctx, pkg.name);
|
|
78
|
+
if (pf === undefined) {
|
|
79
|
+
return { results: [], '.meta': { inspectedDataFiles: 0, onDisk: false } };
|
|
80
|
+
}
|
|
81
|
+
const { results, add } = (0, file_checks_1.fileFindings)(pf);
|
|
82
|
+
const desc = pkg.description;
|
|
83
|
+
const entries = pf.entries;
|
|
84
|
+
const isDir = (rel) => entries.some(e => e.isDirectory && e.relative === rel);
|
|
85
|
+
const headers = new Map();
|
|
86
|
+
const headerOf = (e) => {
|
|
87
|
+
if (!headers.has(e)) {
|
|
88
|
+
const bytes = bytesOf(e);
|
|
89
|
+
headers.set(e, bytes && rdaHeader(bytes, e.absolute));
|
|
90
|
+
}
|
|
91
|
+
return headers.get(e);
|
|
92
|
+
};
|
|
93
|
+
const children = entries.filter(e => path_1.default.posix.dirname(e.relative) === 'data' && !path_1.default.posix.basename(e.relative).startsWith('.'));
|
|
94
|
+
const datalist = children.find(e => e.relative === 'data/datalist');
|
|
95
|
+
if (datalist?.isDirectory) {
|
|
96
|
+
add('data-directory', datalist.relative, '\'data/datalist\' is a directory, but must be a file');
|
|
97
|
+
}
|
|
98
|
+
else if (datalist !== undefined) {
|
|
99
|
+
const lines = (0, file_checks_1.linesOf)(pf, datalist.relative);
|
|
100
|
+
lines.forEach((line, i) => {
|
|
101
|
+
if (!DatalistLine.test(line) && !(line === '' && i === lines.length - 1)) {
|
|
102
|
+
add('data-directory', datalist.relative, `'data/datalist' contains a malformed line: '${line}'`, i + 1);
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
const isData = (e) => !e.isDirectory && DataFile.test(path_1.default.posix.basename(e.relative));
|
|
107
|
+
const dataSets = children.filter(e => e.relative !== 'data/datalist' && isData(e));
|
|
108
|
+
for (const e of children) {
|
|
109
|
+
if (e.relative !== 'data/datalist' && !isData(e)) {
|
|
110
|
+
add('data-directory', e.relative, `'${e.relative}' is not of a type allowed in a 'data' directory`);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
const names = new Map();
|
|
114
|
+
const namesOf = (e) => {
|
|
115
|
+
if (!names.has(e)) {
|
|
116
|
+
const base = path_1.default.posix.basename(e.relative).replace(DataFile, '');
|
|
117
|
+
const objects = ctx.files.datasetObjects(base);
|
|
118
|
+
names.set(e, (pf.onDisk && RdaFile.test(e.relative) ? objectNamesOf(e.absolute) : undefined) ?? (objects.length > 0 ? [...objects] : [base]));
|
|
119
|
+
}
|
|
120
|
+
return names.get(e);
|
|
121
|
+
};
|
|
122
|
+
const saves = dataSets.filter(e => RdaFile.test(e.relative));
|
|
123
|
+
for (const e of saves) {
|
|
124
|
+
if (pf.onDisk && namesOf(e).includes('.Random.seed')) {
|
|
125
|
+
add('data-directory', e.relative, `object '.Random.seed' found in data set '${path_1.default.posix.basename(e.relative)}', please remove it`);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
for (const e of entries.filter(e => !e.isDirectory && RdaFile.test(e.relative))) {
|
|
129
|
+
if ((headerOf(e)?.version ?? 0) >= 3 && !dependsOnR(desc, '3.5.0')) {
|
|
130
|
+
add('serialization-version', e.relative, `'${e.relative}' is saved with version 3 serialization, which only R >= 3.5.0 reads, declare it in Depends`);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
if (desc !== undefined) {
|
|
134
|
+
const lazy = ['1', 'yes', 'true'].includes(desc.content().get('LazyData')?.join(' ').toLowerCase() ?? '');
|
|
135
|
+
const compression = desc.content().get('LazyDataCompression')?.join(' ');
|
|
136
|
+
const lazyDataAt = (field, message) => add('lazydata', 'DESCRIPTION', message, (0, file_checks_1.firstLine)(pf, 'DESCRIPTION', new RegExp(`^${field}:`)));
|
|
137
|
+
if (lazy && !isDir('data')) {
|
|
138
|
+
lazyDataAt('LazyData', '\'LazyData\' is specified without a \'data\' directory');
|
|
139
|
+
if (compression !== undefined) {
|
|
140
|
+
lazyDataAt('LazyDataCompression', '\'LazyDataCompression\' is specified without a \'data\' directory');
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
else if (!lazy && compression !== undefined) {
|
|
144
|
+
lazyDataAt('LazyDataCompression', '\'LazyDataCompression\' is specified without \'LazyData\'');
|
|
145
|
+
}
|
|
146
|
+
else if (lazy && compression !== undefined && !LazyDataCompressions.includes(compression)) {
|
|
147
|
+
lazyDataAt('LazyDataCompression', `undocumented value '${compression}' of field 'LazyDataCompression'`);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
const compacted = config.checkCompaction ? [...saves, ...entries.filter(e => !e.isDirectory && e.relative === SysData)] : [];
|
|
151
|
+
for (const e of compacted) {
|
|
152
|
+
const header = headerOf(e);
|
|
153
|
+
const size = e.stats?.size ?? 0;
|
|
154
|
+
if (header !== undefined && (header.ascii === true || header.compress === 'none') && size > config.maxUncompressedSize) {
|
|
155
|
+
const reasons = [header.ascii ? 'ASCII format' : undefined, header.compress === 'none' ? 'uncompressed' : undefined].filter(r => r !== undefined);
|
|
156
|
+
add(e.relative === SysData ? 'compact-sysdata' : 'compact-data', e.relative, `large data file saved inefficiently (${reasons.join(', ')}, ${Math.round(size / 1024)}Kb)`);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
if (compacted.some(e => ['bzip2', 'xz'].includes(headerOf(e)?.compress ?? '')) && !dependsOnR(desc, '2.10')) {
|
|
160
|
+
add('compression-depends', 'DESCRIPTION', 'package needs dependence on R (>= 2.10) for data saved with bzip2 or xz compression', (0, file_checks_1.firstLine)(pf, 'DESCRIPTION', /^Depends:/));
|
|
161
|
+
}
|
|
162
|
+
if (config.checkUndocumented && isDir('man')) {
|
|
163
|
+
const index = ctx.files.documentation();
|
|
164
|
+
for (const e of dataSets) {
|
|
165
|
+
for (const name of namesOf(e).filter(n => !index.documents(n))) {
|
|
166
|
+
add('undocumented-data', e.relative, `undocumented data set '${name}'`);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
return { results, '.meta': { inspectedDataFiles: dataSets.length + entries.filter(e => e.relative === SysData).length, onDisk: pf.onDisk } };
|
|
171
|
+
},
|
|
172
|
+
prettyPrint: file_checks_1.MessageAtLocation,
|
|
173
|
+
info: {
|
|
174
|
+
name: 'Package Data',
|
|
175
|
+
tags: [linter_tags_1.LintingRuleTag.CmdCheck],
|
|
176
|
+
certainty: linter_format_1.LintingRuleCertainty.BestEffort,
|
|
177
|
+
description: 'Finds problems in `data/` and `R/sysdata.rda`: allowed file types, LazyData, compression, the serialization version R needs, and undocumented data sets.',
|
|
178
|
+
defaultConfig: () => ({ maxUncompressedSize: 100_000, checkCompaction: true, checkUndocumented: true })
|
|
179
|
+
}
|
|
180
|
+
};
|
|
181
|
+
//# sourceMappingURL=package-data.js.map
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import type { ReadOnlyFlowrAnalyzerContext } from '../../../project/context/flowr-analyzer-context';
|
|
3
|
+
import { type FlowrFileProvider } from '../../../project/context/flowr-file';
|
|
4
|
+
import { SourceLocation } from '../../../util/range';
|
|
5
|
+
/**
|
|
6
|
+
* One file or directory of the package, as `R CMD build` would put it into the tarball.
|
|
7
|
+
*/
|
|
8
|
+
export interface PackageEntry {
|
|
9
|
+
/** the path relative to the package root, with `/` as separator */
|
|
10
|
+
readonly relative: string;
|
|
11
|
+
/** the absolute path */
|
|
12
|
+
readonly absolute: string;
|
|
13
|
+
readonly isDirectory: boolean;
|
|
14
|
+
/** the file's stats, `undefined` for files flowR only knows in memory */
|
|
15
|
+
readonly stats?: fs.Stats;
|
|
16
|
+
}
|
|
17
|
+
/** The files of a package that `R CMD check` sees, and how to read them. */
|
|
18
|
+
export interface PackageFiles {
|
|
19
|
+
/** the package root (the folder of the DESCRIPTION) */
|
|
20
|
+
readonly root: string;
|
|
21
|
+
/** every file and directory that survives `R CMD build`, the root itself excluded */
|
|
22
|
+
readonly entries: readonly PackageEntry[];
|
|
23
|
+
/** whether the listing comes from the file system (and is hence complete), not just from the files flowR knows */
|
|
24
|
+
readonly onDisk: boolean;
|
|
25
|
+
/** the text of a file given relative to the root, `undefined` if it does not exist or cannot be read */
|
|
26
|
+
readonly read: (relative: string) => string | undefined;
|
|
27
|
+
/** a location naming the file (and optionally a line) for a finding */
|
|
28
|
+
readonly locate: (relative: string, line?: number, endLine?: number) => SourceLocation;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* The DESCRIPTION of the analyzed package: the one closest to the project root, as packages vendored into it or
|
|
32
|
+
* test fixtures shipped with it (`src/library/x/DESCRIPTION`, `tests/testthat/fixtures/p/DESCRIPTION`) have their own.
|
|
33
|
+
*/
|
|
34
|
+
export declare function rootDescriptionFile(ctx: ReadOnlyFlowrAnalyzerContext): FlowrFileProvider | undefined;
|
|
35
|
+
/**
|
|
36
|
+
* The files and directories of the analyzed package as `R CMD check` sees them, i.e. after `R CMD build` dropped
|
|
37
|
+
* what `.Rbuildignore` and its defaults exclude. When the package lives on disk, the whole folder is listed;
|
|
38
|
+
* otherwise (e.g. files only handed to flowR in memory) the files flowR knows below the package root are used.
|
|
39
|
+
* `undefined` without a DESCRIPTION.
|
|
40
|
+
*/
|
|
41
|
+
export declare function packageFiles(ctx: ReadOnlyFlowrAnalyzerContext, pkgName?: string): PackageFiles | undefined;
|