@eagleoutice/flowr 2.16.2 → 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 +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 +2 -3
- 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 +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 +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-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 +518 -1
- 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/naming-convention.d.ts +1 -1
- package/linter/rules/naming-convention.js +13 -14
- package/linter/rules/no-leaked-credentials.js +4 -4
- package/linter/rules/problematic-inputs.js +2 -1
- 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.js +10 -9
- 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 +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 +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-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,393 @@
|
|
|
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.DESCRIPTION_METADATA = void 0;
|
|
7
|
+
exports.toTitleCase = toTitleCase;
|
|
8
|
+
const arrays_1 = require("../../../util/collections/arrays");
|
|
9
|
+
const strings_1 = require("../../../util/text/strings");
|
|
10
|
+
const fs_1 = __importDefault(require("fs"));
|
|
11
|
+
const path_1 = __importDefault(require("path"));
|
|
12
|
+
const linter_format_1 = require("../../linter-format");
|
|
13
|
+
const flowr_search_builder_1 = require("../../../search/flowr-search-builder");
|
|
14
|
+
const linter_tags_1 = require("../../linter-tags");
|
|
15
|
+
const r_author_1 = require("../../../util/r-author");
|
|
16
|
+
const r_base_packages_1 = require("../../../util/r-base-packages");
|
|
17
|
+
const package_files_1 = require("./package-files");
|
|
18
|
+
const file_checks_1 = require("./file-checks");
|
|
19
|
+
const files_1 = require("../../../util/files");
|
|
20
|
+
const cmd_check_util_1 = require("./cmd-check-util");
|
|
21
|
+
/** the fields `R CMD check` requires to be ASCII */
|
|
22
|
+
const AsciiFields = new Set(['Package', 'Version', 'Priority', 'Depends', 'Imports', 'LinkingTo', 'Suggests', 'Enhances', 'License', 'License_is_FOSS', 'License_restricts_use', 'OS_type', 'Archs', 'MD5sum', 'NeedsCompilation', 'Encoding']);
|
|
23
|
+
const PortableEncodings = new Set(['latin1', 'latin2', 'UTF-8']);
|
|
24
|
+
const PackageName = String.raw `\p{L}[\p{L}\p{N}.]*[\p{L}\p{N}]`;
|
|
25
|
+
const PackageNameRegex = new RegExp(`^(R|${PackageName})$`, 'u');
|
|
26
|
+
const VersionRegex = /^(\d+[.-])+\d+$/;
|
|
27
|
+
const DependencyRegex = new RegExp(String.raw `^\s*(R|${PackageName})(\s*\(([^) ]+)\s+([^) ]+)\))?\s*$`, 'u');
|
|
28
|
+
const DependencyOperators = new Set(['<=', '>=', '<', '>', '==', '!=']);
|
|
29
|
+
const MaintainerRegex = /^\s*(.*<(".+"|([A-Za-z0-9!#$%*/?|^{}`~&'+=_-]+\.)*[A-Za-z0-9!#$%*/?|^{}`~&'+=_-]+)@([A-Za-z0-9-]+\.)*[A-Za-z0-9-]+>|ORPHANED)\s*$/;
|
|
30
|
+
const LicenseTemplates = new Set(['MIT License', 'MIT', 'BSD 2-clause License', 'BSD_2_clause', 'BSD 3-clause License', 'BSD_3_clause']);
|
|
31
|
+
const DeprecatedLicense = /(^Modified BSD License$|^BSD$|^CC BY.* [23][.]0)/;
|
|
32
|
+
const CanonicalLicense = new RegExp(String.raw `^(((GPL-2|GPL-3|LGPL-2|LGPL-2.1|LGPL-3|AGPL-3|Artistic-1.0|Artistic-2.0|CECILL-2.1)|(FreeBSD License|MIT License|BSD 2-clause License|BSD 3-clause License|Creative Commons Attribution 4.0 International License|Creative Commons Attribution-ShareAlike 4.0 International License|Creative Commons Attribution-NonCommercial 4.0 International License|Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License|Creative Commons Attribution-NonCommercial-NoDerivs 4.0 International License|CC0|zlib License|FreeBSD|MIT|BSD_2_clause|BSD_3_clause|CC BY 4.0|CC BY-SA 4.0|CC BY-NC 4.0|CC BY-NC-SA 4.0|CC BY-NC-ND 4.0|Zlib)|(Apache License|Artistic License|Boost Software License|CeCILL|Common Public License|Eclipse Public License|European Union Public License|GNU Affero General Public License|GNU General Public License|GNU Lesser General Public License|GNU Library General Public License|Lucent Public License|Mozilla Public License|AGPL|BSL|CPL|CeCILL|EPL|EUPL|GPL|LGPL|MPL)\s*(\((\s*(<|<=|>|>=|==|!=)\s*((\d+[.-])*\d+)\s*,)*\s*(<|<=|>|>=|==|!=)\s*((\d+[.-])*\d+)\s*\))*|(GNU General Public License\s+([Vv]ersion\s+)?2|GNU General Public License\s+([Vv]ersion\s+)?3|GNU Library General Public License\s+([Vv]ersion\s+)?2|GNU Lesser General Public License\s+([Vv]ersion\s+)?2.1|GNU Lesser General Public License\s+([Vv]ersion\s+)?3|GNU Affero General Public License\s+([Vv]ersion\s+)?3|Apache License\s+([Vv]ersion\s+)?1.1|Apache License\s+([Vv]ersion\s+)?2.0|Artistic License\s+([Vv]ersion\s+)?1.0|Artistic License\s+([Vv]ersion\s+)?2.0|CeCILL\s+([Vv]ersion\s+)?2|CeCILL\s+([Vv]ersion\s+)?2.1|Mozilla Public License\s+([Vv]ersion\s+)?1.0|Mozilla Public License\s+([Vv]ersion\s+)?1.1|Mozilla Public License\s+([Vv]ersion\s+)?2.0|Common Public License\s+([Vv]ersion\s+)?1.0|Eclipse Public License\s+([Vv]ersion\s+)?1.0|Lucent Public License\s+([Vv]ersion\s+)?1.02|European Union Public License\s+([Vv]ersion\s+)?1.1|European Union Public License\s+([Vv]ersion\s+)?1.2|Boost Software License\s+([Vv]ersion\s+)?1.0)|(GPL-2|GPL-3|LGPL-2|LGPL-2.1|LGPL-3|AGPL-3|CeCILL-2|CeCILL-2.1|MPL-1.0|MPL-1.1|MPL-2.0|CPL-1.0|EPL-1.0|EUPL-1.1|EUPL-1.2|BSL-1.0))(\s*\+\s*file LICEN[CS]E)?|file LICEN[CS]E|Unlimited)$`);
|
|
33
|
+
/** license specifications that are no canonical component but which `R CMD check` is able to standardize */
|
|
34
|
+
const StandardizableLicenses = new Set([
|
|
35
|
+
'The Artistic License, Version 2.0', 'Artistic 2.0', 'Boost Software License', 'Boost Software License 1.0', 'BSL 1.0', 'CeCILL-2.0',
|
|
36
|
+
'GNU Public License', 'Gnu GPL', 'GNU GPL', 'GNU General Public License 2.0.', 'GPL 2.0', 'GPL version 2.0', 'GPL2.0', 'GPL Version 2',
|
|
37
|
+
'GNU GPL Version 2', 'GNU GPL version 2', 'GNU GPL version 2.', 'GPL (version 2)', 'GPL 2', 'GPL 2.', 'GPL version 2', 'GPL version 2 (June, 1991)',
|
|
38
|
+
'GPL version 2.', 'GPL2', 'GPL V2', 'GPL, version 2', 'GPL Version 3', 'GPL version 3', 'GNU General Public Licence (GPLv3)', 'GPL 3', 'GPL v3',
|
|
39
|
+
'GNU GPL v2.0 or greater', 'GPL 2.0 or higher', 'GPL 2.0 or newer', 'GPL version 2.0 or later', 'GPL version 2.0 or newer',
|
|
40
|
+
'GNU GPL (version 2 or later)', 'GNU GPL (version 2 or later); see the file COPYING for details', 'GNU GPL version 2 or newer',
|
|
41
|
+
'GNU General Public License version 2 or newer', 'GPL version 2 or later', 'GPL ( version 2 or later)', 'GPL (Version 2 or above)',
|
|
42
|
+
'GPL (Version 2 or later)', 'GPL (version 2 or higher)', 'GPL (version 2 or later)', 'GPL (version 2 or later, see the included file GPL)',
|
|
43
|
+
'GPL (version 2 or newer)', 'GPL 2 or later', 'GPL 2 or newer', 'GPL version 2 or any later version', 'GPL Version 2 or later',
|
|
44
|
+
'GPL Version 2 or later.', 'GPL Version 2 or newer', 'GPL Version 2 or newer.', 'GPL version 2 (June, 1991) or later', 'GPL version 2 (or newer)',
|
|
45
|
+
'GPL version 2 or later.', 'GPL version 2 or newer', 'GPL version 2 or newer (see README).', 'GPL version 2 or newer.',
|
|
46
|
+
'GPL version 2, or, at your option, any newer version.', 'GPL Version 2 (or later)', 'GPL version 2 (or later)', 'GPL version 2 or higher',
|
|
47
|
+
'GPL2 or later', 'GPL>=2', 'GNU General Public License (version 2 or later)', 'GPL (version 3 or later)', 'GPL >=3', 'GPL or LGPL by your choice',
|
|
48
|
+
'GPL, BSD', 'use under GPL2, or see file LICENCE', 'GNU LGPL (same as wxWidgets).', 'LGPL2', 'LGPL2.0', 'LGPL version 2.1', 'LGPL-v3',
|
|
49
|
+
'LGPL >= 2.0', 'LGPL Version 2 or later.', 'LGPL version 2 or newer', 'LGPL (version 2 or later)', 'LGPL version 2 or later',
|
|
50
|
+
'LGPL version 2.1 or later', 'LGPL >=3', 'Unlimited use and distribution.'
|
|
51
|
+
]);
|
|
52
|
+
/** the DCF fields of the raw DESCRIPTION text, remembering the lines they span */
|
|
53
|
+
function readFields(text) {
|
|
54
|
+
const fields = new Map();
|
|
55
|
+
const lines = (text.charCodeAt(0) === 0xFEFF ? text.slice(1) : text).split(/\r?\n/);
|
|
56
|
+
let cur;
|
|
57
|
+
const flush = (end) => {
|
|
58
|
+
if (cur) {
|
|
59
|
+
fields.set(cur.name, { name: cur.name, value: cur.parts.join('\n').trim(), start: cur.start, end });
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
let last = 0;
|
|
63
|
+
lines.forEach((line, i) => {
|
|
64
|
+
const m = /^([^\s:][^:]*):(.*)$/.exec(line);
|
|
65
|
+
if (m && !/^\s/.test(line)) {
|
|
66
|
+
flush(last);
|
|
67
|
+
cur = { name: m[1].trim(), parts: [m[2].trim()], start: i + 1 };
|
|
68
|
+
last = i + 1;
|
|
69
|
+
}
|
|
70
|
+
else if (cur && /^\s/.test(line) && line.trim() !== '') {
|
|
71
|
+
cur.parts.push(line.trim());
|
|
72
|
+
last = i + 1;
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
flush(last);
|
|
76
|
+
return fields;
|
|
77
|
+
}
|
|
78
|
+
/** whether the parentheses outside of string literals balance */
|
|
79
|
+
function balancedParentheses(code) {
|
|
80
|
+
const bare = code.replace(/"(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*'/gs, '');
|
|
81
|
+
return [...bare].reduce((d, c) => c === '(' ? d + 1 : c === ')' ? d - 1 : d, 0) === 0;
|
|
82
|
+
}
|
|
83
|
+
const hasNonAscii = (s) => [...s].some(c => c.charCodeAt(0) > 127);
|
|
84
|
+
const flat = (s) => s.replace(/[\n\t]/g, ' ');
|
|
85
|
+
const quote = (s) => `'${s}'`;
|
|
86
|
+
/** the comma-separated entries of a dependency-like field as `strsplit` + `trimws` give them */
|
|
87
|
+
function entriesOf(value) {
|
|
88
|
+
const parts = value.split(',').map(s => s.trim());
|
|
89
|
+
if (parts.length > 0 && parts[parts.length - 1] === '') {
|
|
90
|
+
parts.pop();
|
|
91
|
+
}
|
|
92
|
+
return parts;
|
|
93
|
+
}
|
|
94
|
+
/** the package names a dependency-like field lists, malformed entries and `R` left out */
|
|
95
|
+
function packagesOf(value) {
|
|
96
|
+
return entriesOf(value).flatMap(e => {
|
|
97
|
+
const m = DependencyRegex.exec(e);
|
|
98
|
+
return m && m[1] !== 'R' ? [m[1]] : [];
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
/** `tools::toTitleCase`: the words `R CMD check` wants capitalized in a title */
|
|
102
|
+
function toTitleCase(text) {
|
|
103
|
+
const alone = new Set(['2D', '3D', 'AIC', 'BayesX', 'GoF', 'HTML', 'LaTeX', 'MonetDB', 'OpenBUGS', 'TeX', 'U.S.', 'U.S.A.', 'WinBUGS', 'aka', 'et', 'al.', 'ggplot2', 'i.e.', 'jar', 'jars', 'ncdf', 'netCDF', 'rgl', 'rpart', 'xls', 'xlsx',
|
|
104
|
+
'all', 'above', 'after', 'along', 'also', 'among', 'any', 'both', 'can', 'few', 'it', 'less', 'log', 'many', 'may', 'more', 'over', 'some', 'their', 'then', 'this', 'under', 'until', 'using', 'von', 'when', 'where', 'which', 'will', 'without', 'yet', 'you', 'your']);
|
|
105
|
+
const lpat = /^(a|an|and|are|as|at|be|but|by|en|for|if|in|is|nor|not|of|on|or|per|so|the|to|v[.]?|via|vs[.]?|from|into|than|that|with)$/i;
|
|
106
|
+
const xx = [];
|
|
107
|
+
let word = '';
|
|
108
|
+
for (const c of text) {
|
|
109
|
+
if (' -/"()\n\t,'.includes(c)) {
|
|
110
|
+
if (word) {
|
|
111
|
+
xx.push(word);
|
|
112
|
+
word = '';
|
|
113
|
+
}
|
|
114
|
+
xx.push(c);
|
|
115
|
+
}
|
|
116
|
+
else {
|
|
117
|
+
word += c;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
if (word) {
|
|
121
|
+
xx.push(word);
|
|
122
|
+
}
|
|
123
|
+
const l = xx.map((x, i) => i > 0 && lpat.test(x));
|
|
124
|
+
xx.forEach((x, i) => {
|
|
125
|
+
if (/[-:]$/.test(x) && i + 2 < xx.length && xx[i + 1] === ' ' && /^['\p{L}\p{N}]/u.test(xx[i + 2]) && !(x === '-' && lpat.test(xx[i + 2]))) {
|
|
126
|
+
l[i + 2] = false;
|
|
127
|
+
}
|
|
128
|
+
if (x === '"' && i + 1 < xx.length) {
|
|
129
|
+
l[i + 1] = false;
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
return xx.map((x, i) => {
|
|
133
|
+
if (l[i]) {
|
|
134
|
+
return x.toLowerCase();
|
|
135
|
+
}
|
|
136
|
+
if (alone.has(x) || /^'.*'$/.test(x) || /^\p{L}.*\p{Lu}/u.test(x) || [...x].length === 1) {
|
|
137
|
+
return x;
|
|
138
|
+
}
|
|
139
|
+
return x.length >= 3 && (x[0] === '\'' || x[0] === '"') ? x[0] + x[1].toUpperCase() + x.slice(2).toLowerCase() : x[0].toUpperCase() + x.slice(1).toLowerCase();
|
|
140
|
+
}).join('');
|
|
141
|
+
}
|
|
142
|
+
/** the title in title case, leaving single-quoted parts alone like `R CMD check` does */
|
|
143
|
+
function titleCased(title) {
|
|
144
|
+
let cased = toTitleCase(title);
|
|
145
|
+
for (const m of title.matchAll(/(^|(?<=[ \t!-/:-@[-`{-~]))'[^']*'($|(?=[ \t!-/:-@[-`{-~]))/g)) {
|
|
146
|
+
cased = cased.slice(0, m.index) + m[0] + cased.slice(m.index + m[0].length);
|
|
147
|
+
}
|
|
148
|
+
return cased;
|
|
149
|
+
}
|
|
150
|
+
/** whether there is a `src` folder, `undefined` if flowR has no way to know */
|
|
151
|
+
function hasSrcFolder(ctx, dir) {
|
|
152
|
+
const src = path_1.default.join(dir, 'src') + path_1.default.sep;
|
|
153
|
+
if (ctx.files.getAllFiles().some(f => path_1.default.normalize(f.path()).startsWith(src))) {
|
|
154
|
+
return true;
|
|
155
|
+
}
|
|
156
|
+
return fs_1.default.existsSync(dir) ? fs_1.default.existsSync(path_1.default.join(dir, 'src')) : undefined;
|
|
157
|
+
}
|
|
158
|
+
/** Port of the DESCRIPTION checks of `R CMD check` (meta-information, dependency fields, license, Authors\@R, and the `--as-cran` style checks), located at the field's lines. */
|
|
159
|
+
exports.DESCRIPTION_METADATA = {
|
|
160
|
+
createSearch: () => flowr_search_builder_1.Q.from([]),
|
|
161
|
+
processSearchResult: (_elements, config, data) => {
|
|
162
|
+
const ctx = data.inspectContext();
|
|
163
|
+
const file = (0, package_files_1.rootDescriptionFile)(ctx);
|
|
164
|
+
if (file === undefined) {
|
|
165
|
+
return { results: [], '.meta': { hasDescription: false } };
|
|
166
|
+
}
|
|
167
|
+
const descPath = file.path();
|
|
168
|
+
const text = file.rawText?.() ?? file.content().toString();
|
|
169
|
+
const fields = readFields(text);
|
|
170
|
+
const lines = text.replace(/^\uFEFF/, '').split(/\r?\n/);
|
|
171
|
+
const results = [];
|
|
172
|
+
const add = (kind, message, field) => {
|
|
173
|
+
const f = field === undefined ? undefined : fields.get(field);
|
|
174
|
+
const loc = f ? [f.start, 1, f.end, Math.max(1, lines[f.end - 1]?.length ?? 1), descPath] : [1, 1, 1, 1, descPath];
|
|
175
|
+
results.push({ certainty: linter_format_1.LintingResultCertainty.Certain, involvedId: undefined, loc, kind, field, message });
|
|
176
|
+
};
|
|
177
|
+
const val = (name) => fields.get(name)?.value;
|
|
178
|
+
const packageName = val('Package');
|
|
179
|
+
const isBase = val('Priority') === 'base';
|
|
180
|
+
/* checking DESCRIPTION meta-information: required fields */
|
|
181
|
+
const hasAuthorsAtR = (val('Authors@R') ?? '') !== '';
|
|
182
|
+
const required = ['Package', 'Version', 'License', 'Description', 'Title', ...hasAuthorsAtR ? [] : ['Author', 'Maintainer']];
|
|
183
|
+
for (const name of required) {
|
|
184
|
+
if ((val(name) ?? '') === '') {
|
|
185
|
+
add('missing-field', `Required field missing or empty: ${quote(name)}`);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
/* encoding and non-ASCII values */
|
|
189
|
+
for (const f of fields.values()) {
|
|
190
|
+
if (hasNonAscii(f.name)) {
|
|
191
|
+
add('non-ascii-tag', `Fields with non-ASCII tags: ${quote(f.name)}. All field tags must be ASCII.`, f.name);
|
|
192
|
+
}
|
|
193
|
+
if (AsciiFields.has(f.name) && hasNonAscii(f.value)) {
|
|
194
|
+
add('non-ascii-value', `Fields with non-ASCII values: ${quote(f.name)}. These fields must have ASCII values.`, f.name);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
const encoding = val('Encoding');
|
|
198
|
+
if (encoding === undefined) {
|
|
199
|
+
for (const f of fields.values()) {
|
|
200
|
+
if (hasNonAscii(f.value)) {
|
|
201
|
+
add('unknown-encoding', `Unknown encoding with non-ASCII data in field ${quote(f.name)}`, f.name);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
else if (!PortableEncodings.has(encoding)) {
|
|
206
|
+
add('non-portable-encoding', `Encoding ${quote(encoding)} is not portable`, 'Encoding');
|
|
207
|
+
}
|
|
208
|
+
/* package name, version, maintainer */
|
|
209
|
+
if (packageName !== undefined && packageName !== '') {
|
|
210
|
+
if (!PackageNameRegex.test(packageName)) {
|
|
211
|
+
add('bad-package-name', 'Malformed package name', 'Package');
|
|
212
|
+
}
|
|
213
|
+
else if (!isBase && (0, r_base_packages_1.isBaseRPackage)(packageName)) {
|
|
214
|
+
add('bad-package-name', 'Invalid package name. This is the name of a base package.', 'Package');
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
const version = val('Version');
|
|
218
|
+
if (version !== undefined && version !== '' && !isBase && !VersionRegex.test(version)) {
|
|
219
|
+
add('bad-version', 'Malformed package version.', 'Version');
|
|
220
|
+
}
|
|
221
|
+
const maintainer = val('Maintainer');
|
|
222
|
+
if (maintainer !== undefined && !MaintainerRegex.test(maintainer)) {
|
|
223
|
+
add('bad-maintainer', 'Malformed maintainer field.', 'Maintainer');
|
|
224
|
+
}
|
|
225
|
+
/* dependency fields */
|
|
226
|
+
const declared = new Map();
|
|
227
|
+
for (const field of cmd_check_util_1.DependencyFields) {
|
|
228
|
+
const value = val(field);
|
|
229
|
+
if (value === undefined) {
|
|
230
|
+
continue;
|
|
231
|
+
}
|
|
232
|
+
declared.set(field, packagesOf(value));
|
|
233
|
+
for (const entry of entriesOf(value)) {
|
|
234
|
+
const m = DependencyRegex.exec(entry);
|
|
235
|
+
if (!m) {
|
|
236
|
+
add('bad-dependency', `Malformed ${field} field. Offending entry: ${quote(entry)}. Entries must be names of packages optionally followed by '<=' or '>=', white space, and a valid version number in parentheses.`, field);
|
|
237
|
+
}
|
|
238
|
+
else if (m[2] !== undefined) {
|
|
239
|
+
if (!DependencyOperators.has(m[3])) {
|
|
240
|
+
add('bad-dependency', `Malformed ${field} field. Entry with infeasible comparison operator: ${quote(entry)}. Only operators '<=' and '>=' are possible.`, field);
|
|
241
|
+
}
|
|
242
|
+
else if (m[1] === 'R' ? !/^(r\d+|(\d+[.-])+\d+)$/.test(m[4]) : !VersionRegex.test(m[4])) {
|
|
243
|
+
add('bad-dependency', `Malformed ${field} field. Entry with infeasible version number: ${quote(entry)}. Version numbers must be sequences of at least two non-negative integers, separated by single '.' or '-'.`, field);
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
const builder = val('VignetteBuilder');
|
|
249
|
+
if (builder !== undefined) {
|
|
250
|
+
const parts = entriesOf(builder);
|
|
251
|
+
if (parts.length < 1 || !parts.every(p => /^[\p{L}\p{N}.]*$/u.test(p))) {
|
|
252
|
+
add('bad-vignette-builder', 'Invalid VignetteBuilder field. This field must contain one or more packages (and no version requirement).', 'VignetteBuilder');
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
/* checking Title and Description endings */
|
|
256
|
+
const title = val('Title');
|
|
257
|
+
if (title !== undefined && title.endsWith('.') && !/\s[.][.][.]|et\s+al[.]/.test(title)) {
|
|
258
|
+
add('title-period', 'Malformed Title field: should not end in a period.', 'Title');
|
|
259
|
+
}
|
|
260
|
+
const description = val('Description');
|
|
261
|
+
if (description !== undefined && !/[.!?]['")]?$/.test(description)) {
|
|
262
|
+
add('description-sentence', 'Malformed Description field: should contain one or more complete sentences.', 'Description');
|
|
263
|
+
}
|
|
264
|
+
/* .check_package_description2 and dependency hygiene */
|
|
265
|
+
const seen = new Set();
|
|
266
|
+
const duplicated = new Set();
|
|
267
|
+
for (const field of ['Depends', 'Imports', 'Suggests', 'Enhances']) {
|
|
268
|
+
for (const p of new Set(declared.get(field))) {
|
|
269
|
+
(seen.has(p) ? duplicated : seen).add(p);
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
for (const p of duplicated) {
|
|
273
|
+
const where = ['Depends', 'Imports', 'Suggests', 'Enhances'].filter(f => declared.get(f)?.includes(p));
|
|
274
|
+
add('duplicate-dependency', `Package ${quote(p)} listed in more than one of Depends, Imports, Suggests, Enhances. A package should be listed in only one of these fields.`, where[where.length - 1]);
|
|
275
|
+
}
|
|
276
|
+
if (packageName !== undefined) {
|
|
277
|
+
for (const [field, pkgs] of declared) {
|
|
278
|
+
if (pkgs.includes(packageName)) {
|
|
279
|
+
add('self-dependency', `Package ${quote(packageName)} depends on itself in the ${field} field`, field);
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
if ((declared.get('LinkingTo')?.length ?? 0) > 0 && hasSrcFolder(ctx, path_1.default.dirname(descPath)) === false) {
|
|
284
|
+
add('linking-to-without-src', "'LinkingTo' field is unused: package has no 'src' directory", 'LinkingTo');
|
|
285
|
+
}
|
|
286
|
+
const manyDepends = (0, arrays_1.uniqueArray)(declared.get('Depends') ?? []).filter(p => !r_base_packages_1.AttachedBasePackageSet.has(p));
|
|
287
|
+
if (manyDepends.length > config.maxDepends) {
|
|
288
|
+
add('many-depends', `Depends: includes the non-default packages: ${manyDepends.map(quote).join(', ')}. Adding so many packages to the search path is excessive and importing selectively is preferable.`, 'Depends');
|
|
289
|
+
}
|
|
290
|
+
const manyImports = (0, arrays_1.uniqueArray)(declared.get('Imports') ?? []).filter(p => !(0, r_base_packages_1.isBaseRPackage)(p));
|
|
291
|
+
if (config.maxImports > 0 && manyImports.length > config.maxImports) {
|
|
292
|
+
add('many-imports', `Imports includes ${manyImports.length} non-default packages. Importing from so many packages makes the package vulnerable to any of them becoming unavailable. Move as many as possible to Suggests and use conditionally.`, 'Imports');
|
|
293
|
+
}
|
|
294
|
+
/* .check_package_license */
|
|
295
|
+
const license = val('License');
|
|
296
|
+
if (license !== undefined && license !== '') {
|
|
297
|
+
const components = license.replace(/\s*\+\s*/g, ' + ').split('|').map(c => c.trim());
|
|
298
|
+
const nonCanonical = components.filter(c => !CanonicalLicense.test(c));
|
|
299
|
+
if (nonCanonical.some(c => !StandardizableLicenses.has(c))) {
|
|
300
|
+
add('license', `Non-standard license specification: ${quote(license)}. Standardizable: no`, 'License');
|
|
301
|
+
}
|
|
302
|
+
const dir = path_1.default.dirname(descPath);
|
|
303
|
+
const pointers = components.flatMap(c => [...c.matchAll(/file\s+(LICEN[CS]E)/g)].map(m => m[1]));
|
|
304
|
+
const known = new Set(ctx.files.getAllFiles().map(f => files_1.RPath.normalize(f.path())));
|
|
305
|
+
const badPointers = pointers.filter(p => !known.has(files_1.RPath.join(dir, p)) && ctx.files.exists(path_1.default.join(dir, p), false) === undefined);
|
|
306
|
+
if (badPointers.length > 0) {
|
|
307
|
+
add('license', `Invalid license file pointers: ${badPointers.join(' ')}`, 'License');
|
|
308
|
+
}
|
|
309
|
+
const deprecated = components.filter(c => DeprecatedLicense.test(c));
|
|
310
|
+
if (deprecated.length > 0) {
|
|
311
|
+
add('license', `Deprecated license: ${deprecated.join(' ')}`, 'License');
|
|
312
|
+
}
|
|
313
|
+
const templates = components.filter(c => LicenseTemplates.has(c));
|
|
314
|
+
if (templates.length > 0) {
|
|
315
|
+
add('license', `License components which are templates and need '+ file LICENSE': ${templates.join(', ')}`, 'License');
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
/* Authors@R */
|
|
319
|
+
const authorsAtR = val('Authors@R');
|
|
320
|
+
if (authorsAtR !== undefined && authorsAtR !== '' && (val('Author') === undefined || val('Maintainer') === undefined)) {
|
|
321
|
+
const balanced = balancedParentheses(authorsAtR);
|
|
322
|
+
const authors = (0, r_author_1.parseRAuthorString)(authorsAtR);
|
|
323
|
+
if (!balanced || !authorsAtR.includes('(')) {
|
|
324
|
+
add('bad-authors-at-r', `Malformed Authors@R field: ${authorsAtR}`, 'Authors@R');
|
|
325
|
+
}
|
|
326
|
+
else if (authors.length > 0 || /^(c|person)\s*\(/.test(authorsAtR)) {
|
|
327
|
+
const named = authors.filter(a => a.name.length > 0);
|
|
328
|
+
if (!named.some(a => a.roles.length > 0)) {
|
|
329
|
+
add('bad-authors-at-r', 'Authors@R field gives no person with name and roles.', 'Authors@R');
|
|
330
|
+
}
|
|
331
|
+
else {
|
|
332
|
+
const maintainers = authors.filter(a => a.roles.includes(r_author_1.AuthorRole.Creator));
|
|
333
|
+
if (maintainers.length > 1) {
|
|
334
|
+
add('no-maintainer', 'Authors@R field gives more than one person with maintainer role.', 'Authors@R');
|
|
335
|
+
}
|
|
336
|
+
if (!maintainers.some(a => a.name.length > 0 && a.email)) {
|
|
337
|
+
add('no-maintainer', 'Authors@R field gives no person with maintainer role, valid email address and non-empty name.', 'Authors@R');
|
|
338
|
+
}
|
|
339
|
+
if (config.cranIncoming && !named.some(a => a.roles.includes(r_author_1.AuthorRole.Author))) {
|
|
340
|
+
add('no-author', 'Authors@R field gives no person with name and author role', 'Authors@R');
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
/* CRAN incoming style checks */
|
|
346
|
+
if (config.cranIncoming) {
|
|
347
|
+
if (title !== undefined && packageName !== undefined) {
|
|
348
|
+
const flatTitle = flat(title);
|
|
349
|
+
if (flatTitle.toLowerCase() === packageName.toLowerCase()) {
|
|
350
|
+
add('title-is-name', 'The Title field is just the package name: provide a real title.', 'Title');
|
|
351
|
+
}
|
|
352
|
+
else {
|
|
353
|
+
const escaped = (0, strings_1.escapeRegex)(packageName);
|
|
354
|
+
if (new RegExp(`^${escaped}[ :]`, 'i').test(flatTitle) || /^(A|The) package\b/i.test(flatTitle)) {
|
|
355
|
+
add('title-starts-with-name', 'The Title field starts with the package name.', 'Title');
|
|
356
|
+
}
|
|
357
|
+
const lang = val('Language');
|
|
358
|
+
if (lang === undefined || lang === 'en' || lang.startsWith('en-')) {
|
|
359
|
+
const cased = titleCased(flatTitle);
|
|
360
|
+
if (cased !== flatTitle) {
|
|
361
|
+
add('title-case', `The Title field should be in title case. Current version is: ${quote(flatTitle)} In title case that is: ${quote(cased)}`, 'Title');
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
if (description !== undefined && packageName !== undefined) {
|
|
367
|
+
const flatDescription = flat(description);
|
|
368
|
+
const escaped = (0, strings_1.escapeRegex)(packageName);
|
|
369
|
+
const badStart = new RegExp(`^['"]?${escaped}`, 'i').test(flatDescription) || /^(The|This|A|In this|In the) package|^Functions for/.test(flatDescription);
|
|
370
|
+
if (badStart) {
|
|
371
|
+
add('description-start', "The Description field should not start with the package name, 'This package' or similar.", 'Description');
|
|
372
|
+
}
|
|
373
|
+
else if (!/^['"]?\p{Lu}/u.test(flatDescription)) {
|
|
374
|
+
add('description-initial', 'The Description field should start with a capital letter.', 'Description');
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
return { results, '.meta': { hasDescription: true } };
|
|
379
|
+
},
|
|
380
|
+
prettyPrint: file_checks_1.MessageAtLocation,
|
|
381
|
+
info: {
|
|
382
|
+
name: 'Description Metadata',
|
|
383
|
+
tags: [linter_tags_1.LintingRuleTag.CmdCheck],
|
|
384
|
+
certainty: linter_format_1.LintingRuleCertainty.BestEffort,
|
|
385
|
+
description: 'Checks the DESCRIPTION: required fields, package name, version, maintainer, dependency fields, license, Authors@R, encoding, and the Title and Description style CRAN asks for.',
|
|
386
|
+
defaultConfig: () => ({
|
|
387
|
+
cranIncoming: true,
|
|
388
|
+
maxDepends: 5,
|
|
389
|
+
maxImports: 0
|
|
390
|
+
})
|
|
391
|
+
}
|
|
392
|
+
};
|
|
393
|
+
//# sourceMappingURL=description-metadata.js.map
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { LintingRuleCertainty } from '../../linter-format';
|
|
2
|
+
import type { MergeableRecord } from '../../../util/objects';
|
|
3
|
+
import { LintingRuleTag } from '../../linter-tags';
|
|
4
|
+
import type { ParentInformation } from '../../../r-bridge/lang-4.x/ast/model/processing/decorate';
|
|
5
|
+
import { type CmdCheckResult } from './cmd-check-util';
|
|
6
|
+
/** The sub-check of `R CMD check` a finding belongs to. */
|
|
7
|
+
export type DocumentationMismatchKind = 'undocumented-object' | 'argument-mismatch' | 'default-mismatch' | 'undocumented-argument' | 'documented-argument-not-in-usage' | 'usage-without-alias';
|
|
8
|
+
export interface DocumentationMismatchResult extends CmdCheckResult {
|
|
9
|
+
readonly kind: DocumentationMismatchKind;
|
|
10
|
+
readonly name: string;
|
|
11
|
+
readonly rdFile?: string;
|
|
12
|
+
readonly function?: string;
|
|
13
|
+
}
|
|
14
|
+
export interface DocumentationMismatchConfig extends MergeableRecord {
|
|
15
|
+
readonly checkUndocumented: boolean;
|
|
16
|
+
readonly checkCodoc: boolean;
|
|
17
|
+
readonly checkDefaults: boolean;
|
|
18
|
+
readonly checkUsage: boolean;
|
|
19
|
+
readonly checkInternalUsage: boolean;
|
|
20
|
+
readonly requireDocumentation: boolean;
|
|
21
|
+
}
|
|
22
|
+
export interface DocumentationMismatchMetadata extends MergeableRecord {
|
|
23
|
+
readonly consideredObjects: number;
|
|
24
|
+
readonly consideredPages: number;
|
|
25
|
+
}
|
|
26
|
+
/** Port of the code/documentation consistency checks of `R CMD check`. */
|
|
27
|
+
export declare const DOCUMENTATION_MISMATCH: {
|
|
28
|
+
readonly createSearch: () => import("../../../search/flowr-search-builder").FlowrSearchBuilder<"from-query", [], ParentInformation, import("../../../search/flowr-search").FlowrSearchElements<ParentInformation, import("../../../search/flowr-search").FlowrSearchElement<ParentInformation>[]>>;
|
|
29
|
+
readonly processSearchResult: (_elements: import("../../../search/flowr-search").FlowrSearchElements<ParentInformation, import("../../../search/flowr-search").FlowrSearchElement<ParentInformation>[]>, config: DocumentationMismatchConfig, data: import("../../..").ReadonlyFlowrAnalysisProvider<import("../../..").KnownParser>) => Promise<{
|
|
30
|
+
results: DocumentationMismatchResult[];
|
|
31
|
+
'.meta': {
|
|
32
|
+
consideredObjects: number;
|
|
33
|
+
consideredPages: number;
|
|
34
|
+
};
|
|
35
|
+
}>;
|
|
36
|
+
readonly prettyPrint: {
|
|
37
|
+
readonly query: (result: DocumentationMismatchResult) => string;
|
|
38
|
+
readonly full: (result: DocumentationMismatchResult) => string;
|
|
39
|
+
};
|
|
40
|
+
readonly info: {
|
|
41
|
+
readonly name: "Documentation Mismatch";
|
|
42
|
+
readonly tags: readonly [LintingRuleTag.CmdCheck, LintingRuleTag.Documentation, LintingRuleTag.Bug];
|
|
43
|
+
readonly certainty: LintingRuleCertainty.BestEffort;
|
|
44
|
+
readonly description: "Finds exported objects without documentation, functions whose formals differ from their `\\usage`, and arguments missing from or extra in `\\arguments`.";
|
|
45
|
+
readonly defaultConfig: () => {
|
|
46
|
+
checkUndocumented: true;
|
|
47
|
+
checkCodoc: true;
|
|
48
|
+
checkDefaults: true;
|
|
49
|
+
checkUsage: true;
|
|
50
|
+
checkInternalUsage: false;
|
|
51
|
+
requireDocumentation: true;
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
};
|