@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,85 @@
|
|
|
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 PackageStructureKind = 'non-portable-file-name' | 'duplicate-lowercase-name' | 'not-fully-portable-name' | 'long-path' | 'unstorable-path' | 'hidden-file' | 'defunct-top-level-file' | 'configure-without-source' | 'configure-in' | 'bashism' | 'unmentioned-license-file' | 'non-standard-top-level' | 'leftover-file' | 'empty-r-directory' | 'case-variant-directory' | 'rd2pdf-directory' | 'invalid-file-name' | 'empty-data-directory' | 'empty-demo-directory' | 'demo-non-ascii' | 'empty-exec-directory' | 'empty-inst-directory' | 'empty-src-directory' | 'inst-system-subdirectory' | 'misplaced-citation' | 'empty-tests-directory' | 'build-vignette-without-output' | 'build-missing-output' | 'build-missing-source' | 'build-missing-code' | 'exe-dll-file' | 'executable-file' | 'insufficient-permissions' | 'not-executable' | 'future-timestamp' | 'installed-size' | 'large-pdf' | 'crlf-shell-script' | 'vignette-leftover' | 'vignette-source-missing' | 'vignettes-without-inst-doc' | 'vignette-newer' | 'no-vignette-builder' | 'file-already-in-r' | 'license-requires-sources' | 'leftover-mistake' | 'knitr-leftover' | 'should-not-install';
|
|
6
|
+
export type PackageStructureResult = FileResult<PackageStructureKind>;
|
|
7
|
+
export interface PackageStructureConfig extends MergeableRecord {
|
|
8
|
+
/** a path of more than this many bytes (with the package name as prefix) is noted (default `100`) */
|
|
9
|
+
readonly maxPathLength: number;
|
|
10
|
+
/** hidden files and directories (as paths relative to the package root) that are fine */
|
|
11
|
+
readonly hiddenAllowed: readonly string[];
|
|
12
|
+
/** names of hidden files and directories the CRAN package checks know about */
|
|
13
|
+
readonly cranKnownHidden: readonly string[];
|
|
14
|
+
/** whether to say for each hidden file whether the CRAN package checks know about it */
|
|
15
|
+
readonly cranPack: boolean;
|
|
16
|
+
/** whether to check for non-standard top-level files and directories (`R CMD check` does with `--as-cran`) */
|
|
17
|
+
readonly checkTopLevel: boolean;
|
|
18
|
+
/** the files and directories that may be at the top level of a package */
|
|
19
|
+
readonly standardTopLevel: readonly string[];
|
|
20
|
+
/** whether to flag `/bin/bash` and `env bash` in `configure` and `cleanup` (off in `R CMD check` by default) */
|
|
21
|
+
readonly checkBashisms: boolean;
|
|
22
|
+
/** the directories of `inst` that R uses itself */
|
|
23
|
+
readonly reservedInstDirs: readonly string[];
|
|
24
|
+
/** the installed package size in Mb above which a note is given (default `5`) */
|
|
25
|
+
readonly maxInstalledSizeMb: number;
|
|
26
|
+
/** a PDF in `inst/doc` of more bytes than this is flagged to be compacted (default 1 MiB) */
|
|
27
|
+
readonly maxPdfBytes: number;
|
|
28
|
+
/** whether to flag files and directories modified in the future (`R CMD check` does with `--as-cran`) */
|
|
29
|
+
readonly checkFutureTimestamps: boolean;
|
|
30
|
+
/** whether the package is a built tarball (so `inst/doc` is expected to hold the vignette outputs) */
|
|
31
|
+
readonly builtPackage: boolean;
|
|
32
|
+
/** the extensions (without dot) of files that are leftovers when found next to vignettes */
|
|
33
|
+
readonly leftoverExtensions: readonly string[];
|
|
34
|
+
/** the directories of `inst/doc` that should not be installed */
|
|
35
|
+
readonly docDirsNotInstalled: readonly string[];
|
|
36
|
+
}
|
|
37
|
+
export interface PackageStructureMetadata extends MergeableRecord {
|
|
38
|
+
/** the number of files and directories inspected */
|
|
39
|
+
readonly inspectedEntries: number;
|
|
40
|
+
/** whether the package was read from the file system, which enables the checks of permissions, times, sizes and executables */
|
|
41
|
+
readonly onDisk: boolean;
|
|
42
|
+
}
|
|
43
|
+
/** Port of the file and directory structure checks of `R CMD check` (portable names, hidden and top-level files, subdirectories, permissions, sizes, vignettes). */
|
|
44
|
+
export declare const PACKAGE_STRUCTURE: {
|
|
45
|
+
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>[]>>;
|
|
46
|
+
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: PackageStructureConfig, data: import("../../..").ReadonlyFlowrAnalysisProvider<import("../../..").KnownParser>) => {
|
|
47
|
+
results: FileResult<PackageStructureKind>[];
|
|
48
|
+
'.meta': {
|
|
49
|
+
inspectedEntries: number;
|
|
50
|
+
onDisk: boolean;
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
readonly prettyPrint: {
|
|
54
|
+
query: (r: {
|
|
55
|
+
readonly message: string;
|
|
56
|
+
readonly loc: import("../../..").SourceLocation;
|
|
57
|
+
}) => string;
|
|
58
|
+
full: (r: {
|
|
59
|
+
readonly message: string;
|
|
60
|
+
readonly loc: import("../../..").SourceLocation;
|
|
61
|
+
}) => string;
|
|
62
|
+
};
|
|
63
|
+
readonly info: {
|
|
64
|
+
readonly name: "Package Structure";
|
|
65
|
+
readonly tags: readonly [LintingRuleTag.CmdCheck];
|
|
66
|
+
readonly certainty: LintingRuleCertainty.BestEffort;
|
|
67
|
+
readonly description: "Finds problems in the package files: portable names, hidden files, top-level files, subdirectories, permissions, executables, timestamps, sizes, line endings of scripts, and vignette leftovers.";
|
|
68
|
+
readonly defaultConfig: () => {
|
|
69
|
+
maxPathLength: number;
|
|
70
|
+
hiddenAllowed: string[];
|
|
71
|
+
cranKnownHidden: string[];
|
|
72
|
+
cranPack: true;
|
|
73
|
+
checkTopLevel: true;
|
|
74
|
+
standardTopLevel: string[];
|
|
75
|
+
checkBashisms: false;
|
|
76
|
+
reservedInstDirs: string[];
|
|
77
|
+
maxInstalledSizeMb: number;
|
|
78
|
+
maxPdfBytes: number;
|
|
79
|
+
checkFutureTimestamps: true;
|
|
80
|
+
builtPackage: false;
|
|
81
|
+
leftoverExtensions: string[];
|
|
82
|
+
docDirsNotInstalled: string[];
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
};
|
|
@@ -0,0 +1,320 @@
|
|
|
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_STRUCTURE = 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 flowr_file_1 = require("../../../project/context/flowr-file");
|
|
13
|
+
const flowr_rda_file_1 = require("../../../project/plugins/file-plugins/files/flowr-rda-file");
|
|
14
|
+
const strings_1 = require("../../../util/text/strings");
|
|
15
|
+
const cmd_check_util_1 = require("./cmd-check-util");
|
|
16
|
+
const os_1 = require("../../../util/os");
|
|
17
|
+
const file_checks_1 = require("./file-checks");
|
|
18
|
+
const package_files_1 = require("./package-files");
|
|
19
|
+
const PortableNameChars = /[^-A-Za-z0-9._!#$%&+,;=@^(){}'[\]]/;
|
|
20
|
+
const InvalidNameChars = /["*:<>?\\|]/;
|
|
21
|
+
const ReservedNames = /^(con|prn|aux|clock[$]|nul|lpt[1-9]|com[1-9])$/;
|
|
22
|
+
const CodeExtensions = new Set(['R', 'r', 'S', 's', 'q']);
|
|
23
|
+
const DataExtensions = /\.(R|r|RData|rdata|rda|tab|txt|TXT|csv|CSV)(\.(gz|bz2|xz))?$/;
|
|
24
|
+
const SweavePattern = /\.[RrSs](nw|tex)$/;
|
|
25
|
+
const VignettePattern = /\.([RrSs](nw|tex)|Rmd|rmd|qmd|Rmarkdown|rmarkdown)$/;
|
|
26
|
+
const ValidVignetteName = /^[A-Za-z][A-Za-z0-9._-]+$/;
|
|
27
|
+
const ReusedDocExtensions = /\.(tex|lyx|png|jpg|jpeg|gif|ico|bst|cls|sty|ps|eps|img)$/i;
|
|
28
|
+
const LicenseNotice = ['%% This generated file may be distributed as long as the', '%% original source files, as listed above, are part of the', '%% same distribution.'];
|
|
29
|
+
const FosLicense = /\b(GPL|LGPL|AGPL|MIT|BSD|Apache|Artistic|MPL|Mozilla|CC0|CC BY|EUPL|CeCILL|Boost|EPL|Eclipse|CPL|zlib|GNU)/i;
|
|
30
|
+
const LimitedLicense = /non-?commercial|\bNC\b|restricts|academic/i;
|
|
31
|
+
const AlreadyInR = ['jss.cls', 'jss.bst', 'Rd.sty', 'Sweave.sty'];
|
|
32
|
+
const ShippedStyles = ['jss.cls', 'jss.drv', 'Rnews.sty', 'RJournal.sty'];
|
|
33
|
+
const CaseVariants = new Map([['r', 'R'], ['MAN', 'man'], ['DATA', 'data']]);
|
|
34
|
+
const LooseDirs = ['vignettes', 'inst/doc'];
|
|
35
|
+
const MaxTarPathLength = 256;
|
|
36
|
+
const TimeToleranceMs = 10_000;
|
|
37
|
+
const FutureLeewayMs = 300_000;
|
|
38
|
+
const Mb = 1024 * 1024;
|
|
39
|
+
const Quote = (s) => `'${s}'`;
|
|
40
|
+
const base = (p) => path_1.default.posix.basename(p);
|
|
41
|
+
const ext = (p) => path_1.default.posix.extname(p).slice(1);
|
|
42
|
+
const parent = (e) => path_1.default.posix.dirname(e.relative);
|
|
43
|
+
const under = (e, dir) => e.relative.startsWith(`${dir}/`);
|
|
44
|
+
const what = (e) => e.isDirectory ? 'directory' : 'file';
|
|
45
|
+
const isFile = (e) => !e.isDirectory;
|
|
46
|
+
const alnumStart = (name) => /^[A-Za-z0-9]/.test(base(name));
|
|
47
|
+
/** whether the leading bytes are those of a native executable (ELF, PE, Mach-O), as `file` would call it one */
|
|
48
|
+
function isNativeExecutable(file, mode) {
|
|
49
|
+
const buf = Buffer.alloc(20);
|
|
50
|
+
let n;
|
|
51
|
+
try {
|
|
52
|
+
const fd = fs_1.default.openSync(file, 'r');
|
|
53
|
+
try {
|
|
54
|
+
n = fs_1.default.readSync(fd, buf, 0, 20, 0);
|
|
55
|
+
}
|
|
56
|
+
finally {
|
|
57
|
+
fs_1.default.closeSync(fd);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
catch {
|
|
61
|
+
return false;
|
|
62
|
+
}
|
|
63
|
+
const magic = (...bytes) => bytes.every((b, i) => buf[i] === b);
|
|
64
|
+
if (magic(0x7f, 0x45, 0x4c, 0x46) && n === 20) {
|
|
65
|
+
const type = buf[5] === 2 ? buf.readUInt16BE(16) : buf.readUInt16LE(16);
|
|
66
|
+
return type === 2 || type === 3 && (mode & 0o111) !== 0 && !/\.so(\.|$)/.test(file);
|
|
67
|
+
}
|
|
68
|
+
return magic(0x4d, 0x5a) || n === 20 && (magic(0xfe, 0xed, 0xfa, 0xce) || magic(0xfe, 0xed, 0xfa, 0xcf) ? buf.readUInt32BE(12) === 2
|
|
69
|
+
: (magic(0xce, 0xfa, 0xed, 0xfe) || magic(0xcf, 0xfa, 0xed, 0xfe)) && buf.readUInt32LE(12) === 2);
|
|
70
|
+
}
|
|
71
|
+
/** the string columns of the data frame a serialized `build/vignette.rds` holds */
|
|
72
|
+
function readVignetteIndex(file) {
|
|
73
|
+
try {
|
|
74
|
+
const obj = new flowr_rda_file_1.RDAParser(new flowr_file_1.FlowrInlineTextFile(file, ''), false).parseObject();
|
|
75
|
+
let names = [];
|
|
76
|
+
for (let a = obj.attributes?.[0]; a !== undefined && typeof a === 'object'; a = a.cdr) {
|
|
77
|
+
if (typeof a.tag === 'object' && a.tag.name === 'names' && typeof a.car === 'object' && Array.isArray(a.car.value)) {
|
|
78
|
+
names = a.car.value;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return new Map(names.map((n, i) => [n, (Array.isArray(obj.value) && Array.isArray(obj.value[i]?.value) ? obj.value[i].value : [])]));
|
|
82
|
+
}
|
|
83
|
+
catch {
|
|
84
|
+
return undefined;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
const codeFiles = (env) => ['R', 'R/unix', 'R/windows'].flatMap(d => env.children(d)).filter(e => !e.isDirectory && CodeExtensions.has(ext(e.relative)) && alnumStart(e.relative));
|
|
88
|
+
const isDir = (env, rel) => env.kinds.get(rel) === true;
|
|
89
|
+
const isTop = (e) => !e.relative.includes('/');
|
|
90
|
+
const topFile = (...names) => (e) => isTop(e) && !e.isDirectory && names.includes(e.relative);
|
|
91
|
+
const generated = (env) => /Generated by GNU Autoconf/i.test(env.pf.read('configure') ?? '');
|
|
92
|
+
const bashism = (e, env) => {
|
|
93
|
+
const first = env.pf.read(e.relative)?.split(/\r?\n/, 1)[0] ?? '';
|
|
94
|
+
return /^#! *\/bin\/bash/.test(first) ? '/bin/bash is not portable' : /^#!.*env bash/.test(first) ? "'env bash' is not portable as bash need not be installed" : undefined;
|
|
95
|
+
};
|
|
96
|
+
function nonPortable(e) {
|
|
97
|
+
const b = base(e.relative);
|
|
98
|
+
return InvalidNameChars.test(b) || /\p{Cc}/u.test(b) || parent(e).endsWith('man') && /[^ -~]|%/.test(b) || ReservedNames.test(b.toLowerCase().replace(/[.].*/, ''));
|
|
99
|
+
}
|
|
100
|
+
function tarPath(e, env) {
|
|
101
|
+
const full = `${env.pkgName}/${e.relative}`;
|
|
102
|
+
const raw = Buffer.from(full);
|
|
103
|
+
const slash = raw.subarray(0, 155).lastIndexOf('/');
|
|
104
|
+
return { full, bytes: raw.length, storable: raw.length <= MaxTarPathLength && slash >= 0 && slash + 100 >= raw.length };
|
|
105
|
+
}
|
|
106
|
+
const pathNote = (e, env, lead) => {
|
|
107
|
+
const { full, bytes } = tarPath(e, env);
|
|
108
|
+
const limit = env.config.maxPathLength;
|
|
109
|
+
return `${lead}: ${Quote(full)} (${bytes} bytes). Tarballs are only required to store paths of up to ${limit} bytes and cannot store those of more than ${MaxTarPathLength} bytes, with restrictions including to ${limit} bytes for the final component.`;
|
|
110
|
+
};
|
|
111
|
+
function cranKnows(e, env) {
|
|
112
|
+
const known = env.config.cranKnownHidden.includes(base(e.relative)) || /^[.]Rbuildindex[.]/.test(e.relative) || /(inst\/doc\/\.Rinstignore|inst\/doc\/\.build\.timestamp|vignettes\/\.Rinstignore)$/.test(e.relative) || /^src.*\/[.]deps$/.test(e.relative);
|
|
113
|
+
return env.config.cranPack ? ` CRAN-pack ${known ? 'knows' : 'does not know'} about this.` : '';
|
|
114
|
+
}
|
|
115
|
+
function newerThan(e, env) {
|
|
116
|
+
const t = e.stats?.mtimeMs;
|
|
117
|
+
const same = env.docTimes.get(e.relative.slice('vignettes/'.length));
|
|
118
|
+
return t === undefined || env.docTimes.size === 0 ? undefined
|
|
119
|
+
: t > Math.max(...env.docTimes.values()) + TimeToleranceMs ? "all files in 'inst/doc'"
|
|
120
|
+
: same !== undefined && t > same + TimeToleranceMs ? "the same file in 'inst/doc'" : undefined;
|
|
121
|
+
}
|
|
122
|
+
function shouldNotInstall(e, env) {
|
|
123
|
+
const name = base(e.relative);
|
|
124
|
+
if (e.isDirectory) {
|
|
125
|
+
return env.config.docDirsNotInstalled.includes(name);
|
|
126
|
+
}
|
|
127
|
+
const matched = ReusedDocExtensions.test(name) || /(Makefile|~$)/.test(name) || env.stemPdf?.test(name) === true;
|
|
128
|
+
return !AlreadyInR.includes(name) && (matched && !env.sources.has(name) || /^fig.*[.]pdf$/.test(name));
|
|
129
|
+
}
|
|
130
|
+
function installDir(rel) {
|
|
131
|
+
const parts = rel.split('/');
|
|
132
|
+
return parts.length === 1 ? ['DESCRIPTION', 'NAMESPACE', 'NEWS', 'NEWS.md', 'INDEX', 'LICENSE', 'LICENCE'].includes(rel) ? '' : undefined
|
|
133
|
+
: ['R', 'data', 'demo', 'exec', 'po'].includes(parts[0]) ? parts[0]
|
|
134
|
+
: parts[0] === 'man' ? 'help' : parts[0] === 'inst' ? parts.length === 2 ? '' : parts[1] : undefined;
|
|
135
|
+
}
|
|
136
|
+
function installedSize(env) {
|
|
137
|
+
const sizes = new Map();
|
|
138
|
+
let total = 0;
|
|
139
|
+
for (const f of env.files) {
|
|
140
|
+
const dir = installDir(f.relative);
|
|
141
|
+
if (dir !== undefined) {
|
|
142
|
+
total += env.size(f);
|
|
143
|
+
sizes.set(dir, (sizes.get(dir) ?? 0) + env.size(f));
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
const big = [...sizes].filter(([d, s]) => d !== '' && s >= Mb).sort(([a], [b]) => a.localeCompare(b));
|
|
147
|
+
return total / Mb > env.config.maxInstalledSizeMb
|
|
148
|
+
? `Installed size is about ${(total / Mb).toFixed(1)}Mb${big.length > 0 ? `; sub-directories of 1Mb or more: ${big.map(([d, s]) => `${d} ${(s / Mb).toFixed(1)}Mb`).join(', ')}` : ''}.` : undefined;
|
|
149
|
+
}
|
|
150
|
+
/** the directories that must not be empty: the kind, the directory, whether it holds something, and the message */
|
|
151
|
+
const NonEmptyDirs = [
|
|
152
|
+
['empty-r-directory', 'R', env => codeFiles(env).length > 0 || env.kinds.has('R/sysdata.rda'), "Found directory 'R' with no source files."],
|
|
153
|
+
['empty-data-directory', 'data', env => env.children('data').some(e => !e.isDirectory && DataExtensions.test(e.relative)), "Subdirectory 'data' contains no data sets."],
|
|
154
|
+
['empty-demo-directory', 'demo', env => env.demos.length > 0, "Subdirectory 'demo' contains no demos."],
|
|
155
|
+
['empty-exec-directory', 'exec', env => env.children('exec').some(e => !base(e.relative).startsWith('.')), "Subdirectory 'exec' contains no files."],
|
|
156
|
+
['empty-inst-directory', 'inst', env => env.files.some(f => f.relative.startsWith('inst/')), "Subdirectory 'inst' contains no files."],
|
|
157
|
+
['empty-src-directory', 'src', env => ['Makefile', 'Makefile.win', 'Makefile.ucrt', 'install.libs.R'].some(m => env.kinds.has(`src/${m}`)) || env.children('src').some(e => /\.([cfmM]|cc|cpp|f90|f95|mm)/.test(base(e.relative))), "Subdirectory 'src' contains no source files."],
|
|
158
|
+
['empty-tests-directory', 'tests', env => env.children('tests').some(e => !e.isDirectory && /\.(R|r|Rin)$/.test(e.relative)), "Directory 'tests' contains no test files (.R, .r or .Rin)."]
|
|
159
|
+
];
|
|
160
|
+
/** the files each of `R`, `man`, and `demo` accepts by name */
|
|
161
|
+
const AcceptedNames = {
|
|
162
|
+
R: n => ['sysdata.rda', 'Makefile.win', 'Makefile.ucrt'].includes(n) || n.endsWith('.in') || CodeExtensions.has(ext(n)) && alnumStart(n),
|
|
163
|
+
man: n => ['Rd', 'rd'].includes(ext(n)) && alnumStart(n),
|
|
164
|
+
demo: (n, env) => n === '00Index' || env.demos.some(d => d === n || `${d.replace(/r$/, 'R')}out.save` === n)
|
|
165
|
+
};
|
|
166
|
+
const SubdirFile = /^(?:(R|man)\/(?:(?:unix|windows)\/)?|(demo)\/)[^/]+$/;
|
|
167
|
+
const invalidVignetteName = (e, env) => parent(e) === 'inst/doc' && !ValidVignetteName.test(base(e.relative))
|
|
168
|
+
&& (VignettePattern.test(e.relative) || /\.(pdf|html)$/.test(e.relative) && env.sources.has(base(e.relative).replace(/\.[^.]+$/, '')));
|
|
169
|
+
function wrongName(e, env) {
|
|
170
|
+
const dir = SubdirFile.exec(e.relative)?.slice(1).find(d => d !== undefined);
|
|
171
|
+
return e.isDirectory ? undefined : dir !== undefined && !AcceptedNames[dir](e.relative.slice(dir.length + 1), env) ? [dir, e.relative.slice(dir.length + 1)]
|
|
172
|
+
: invalidVignetteName(e, env) ? ['inst/doc', base(e.relative)] : undefined;
|
|
173
|
+
}
|
|
174
|
+
const looseFile = (e) => !e.isDirectory && LooseDirs.includes(parent(e));
|
|
175
|
+
const leftover = (e, env) => looseFile(e) && (new RegExp(`[.](${env.config.leftoverExtensions.join('|')})$`, 'i').test(e.relative) || parent(e) === 'vignettes' && ['Rplots.ps', 'Rplots.pdf'].includes(base(e.relative)));
|
|
176
|
+
const licensed = (e, env) => !e.isDirectory && LooseDirs.some(d => under(e, d)) && /[.](cls|sty|drv)$/.test(e.relative) && !ShippedStyles.includes(base(e.relative))
|
|
177
|
+
&& LicenseNotice.every(l => (env.pf.read(e.relative) ?? '').includes(l));
|
|
178
|
+
const unmentionedLicense = (e, env) => ['LICENCE', 'LICENSE'].includes(base(e.relative)) && ['.', 'inst'].includes(parent(e)) && env.license !== '' && !env.license.includes(base(e.relative));
|
|
179
|
+
const nonStandard = (e, env) => env.config.checkTopLevel && isTop(e) && !e.relative.startsWith('.') && !env.config.standardTopLevel.includes(e.relative)
|
|
180
|
+
&& !(['AUTHORS', 'COPYRIGHTS'].includes(e.relative) && env.kinds.has(`inst/${e.relative}`));
|
|
181
|
+
const executable = (e, env) => !e.isDirectory && e.stats !== undefined && !e.stats.isSymbolicLink() && !env.binary.has(e.relative) && !/\.(exe|dll)$/.test(e.relative) && isNativeExecutable(e.absolute, e.stats.mode);
|
|
182
|
+
/** like `R CMD check`, judge permissions only where the file system has them */
|
|
183
|
+
const PosixModes = (0, os_1.getPlatform)() !== 'windows';
|
|
184
|
+
const insufficient = (e, env) => {
|
|
185
|
+
const mode = e.stats?.mode;
|
|
186
|
+
return PosixModes && mode !== undefined && !e.stats?.isSymbolicLink() && (e.isDirectory ? (mode & 0o700) !== 0o700 && env.files.some(f => under(f, e.relative)) : (mode & 0o400) !== 0o400);
|
|
187
|
+
};
|
|
188
|
+
const EntryRules = [
|
|
189
|
+
{ kind: 'non-portable-file-name', applies: nonPortable, message: e => `Found the following file with a non-portable file name: ${Quote(e.relative)}. This is not a valid file name on all R platforms; please rename the file.` },
|
|
190
|
+
{ kind: 'duplicate-lowercase-name', applies: (e, env) => env.firstByLower.get(e.relative.toLowerCase()) !== e.relative, message: (e, env) => `Found the following file with a duplicate lower-cased file name: ${Quote(e.relative)} (clashing with ${Quote(env.firstByLower.get(e.relative.toLowerCase()) ?? '')}). File names must not differ just by case to be usable on all R platforms.` },
|
|
191
|
+
{ kind: 'not-fully-portable-name', applies: e => !nonPortable(e) && PortableNameChars.test(base(e.relative)), message: e => `Found the following file with a non-portable file name: ${Quote(e.relative)}. This is not a fully portable file name.` },
|
|
192
|
+
{ kind: 'long-path', applies: (e, env) => tarPath(e, env).bytes > env.config.maxPathLength && tarPath(e, env).storable, message: (e, env) => pathNote(e, env, 'Found the following non-portable file path') },
|
|
193
|
+
{ kind: 'unstorable-path', applies: (e, env) => tarPath(e, env).bytes > env.config.maxPathLength && !tarPath(e, env).storable, message: (e, env) => pathNote(e, env, 'Found the following file path that cannot be stored in a tarball') },
|
|
194
|
+
{ kind: 'hidden-file', applies: (e, env) => base(e.relative).startsWith('.') && !env.config.hiddenAllowed.includes(e.relative), message: (e, env) => `Found the following hidden ${what(e)}: ${Quote(e.relative)}. These were most likely included in error.${cranKnows(e, env)}` },
|
|
195
|
+
{ kind: 'defunct-top-level-file', applies: topFile('install.R', 'R_PROFILE.R'), message: e => `Found the defunct file ${Quote(e.relative)}. These files are defunct, see the manual 'Writing R Extensions'.` },
|
|
196
|
+
{ kind: 'configure-without-source', applies: (e, env) => e.relative === 'configure' && generated(env) && !env.kinds.has('configure.ac') && !env.kinds.has('configure.in'), message: (_, env) => `Found a 'configure' file without source file 'configure.ac' or 'configure.in'. ${env.foss ? 'An Open Source package must include its autoconf sources.' : 'It is good practice to include autoconf sources.'}` },
|
|
197
|
+
{ kind: 'configure-in', applies: (e, env) => e.relative === 'configure.in' && generated(env), message: () => "Found a 'configure.in' file: 'configure.ac' has long been preferred." },
|
|
198
|
+
{ kind: 'bashism', applies: (e, env) => env.config.checkBashisms && topFile('configure', 'cleanup')(e) && bashism(e, env) !== undefined, message: (e, env) => `${Quote(e.relative)}: ${bashism(e, env)}` },
|
|
199
|
+
{ kind: 'unmentioned-license-file', applies: unmentionedLicense, message: e => `File ${Quote(e.relative)} ${isTop(e) ? '' : 'will install at top-level and '}is not mentioned in the DESCRIPTION file.` },
|
|
200
|
+
{ kind: 'non-standard-top-level', applies: nonStandard, message: e => `Non-standard ${what(e)} found at top level: ${Quote(e.relative)}${/^copyright/i.test(e.relative) ? '. Copyright information should be in file inst/COPYRIGHTS' : e.relative === 'AUTHORS' ? '. Authors information should be in file inst/AUTHORS' : ''}` },
|
|
201
|
+
{ kind: 'leftover-file', applies: e => !e.isDirectory && (/svn-commit[.].*tmp$/.test(e.relative) || /^[^/]*[.][rR]d$/.test(e.relative)), message: (e, env) => `The file ${Quote(`${env.pkgName}/${e.relative}`)} looks like a leftover. Please remove it from your package.` },
|
|
202
|
+
...NonEmptyDirs.map(([kind, dir, nonEmpty, message]) => ({ kind, applies: (e, env) => e.isDirectory && e.relative === dir && !nonEmpty(env), message: () => message })),
|
|
203
|
+
{ kind: 'case-variant-directory', applies: e => e.isDirectory && CaseVariants.has(e.relative), message: e => `Found subdirectory ${Quote(e.relative)}. Most likely, this should be ${Quote(CaseVariants.get(e.relative) ?? '')}.` },
|
|
204
|
+
{ kind: 'rd2pdf-directory', applies: e => e.isDirectory && /^\.Rd2(dvi|pdf)/.test(base(e.relative)), message: e => `Found the following directory with the name of a Rd2pdf directory: ${Quote(e.relative)}. Most likely, this was included erroneously.` },
|
|
205
|
+
{ kind: 'invalid-file-name', applies: (e, env) => wrongName(e, env) !== undefined, message: (e, env) => `Subdirectory ${Quote(wrongName(e, env)?.[0] ?? '')} contains invalid file names: ${Quote(wrongName(e, env)?.[1] ?? '')}. Please remove or rename the files.` },
|
|
206
|
+
{ kind: 'demo-non-ascii', applies: (e, env) => parent(e) === 'demo' && env.demos.includes(base(e.relative)) && /[\u0080-]/.test(env.pf.read(e.relative) ?? ''), message: e => `Demos with non-ASCII characters: ${Quote(base(e.relative))}. Portable packages must use only ASCII characters in their demos; use \\uxxxx escapes for other characters.` },
|
|
207
|
+
{ kind: 'inst-system-subdirectory', applies: (e, env) => e.isDirectory && parent(e) === 'inst' && env.config.reservedInstDirs.includes(base(e.relative)) && env.children(e.relative).length > 0, message: e => `Found the following non-empty subdirectory of 'inst' also used by R: ${Quote(e.relative)}. It is recommended not to interfere with package subdirectories used by R.` },
|
|
208
|
+
{ kind: 'misplaced-citation', applies: e => !e.isDirectory && /^CITATION(\.[^.]*)?$/.test(base(e.relative)) && e.relative !== 'inst/CITATION', message: e => `Found the following CITATION file in a non-standard place: ${Quote(e.relative)}. Most likely 'inst/CITATION' should be used instead.` },
|
|
209
|
+
{ kind: 'exe-dll-file', applies: (e, env) => !e.isDirectory && !env.binary.has(e.relative) && /\.(exe|dll)$/.test(e.relative), message: e => `Found the following executable file: ${Quote(e.relative)}. Source packages should not contain undeclared executable files.` },
|
|
210
|
+
{ kind: 'executable-file', applies: executable, message: e => `Found the following executable file: ${Quote(e.relative)}. Source packages should not contain undeclared executable files.` },
|
|
211
|
+
{ kind: 'insufficient-permissions', applies: insufficient, message: e => `Found the following ${what(e)} with insufficient permissions: ${Quote(e.relative)}. Permissions should be at least 700 for directories and 400 for files.` },
|
|
212
|
+
{ kind: 'not-executable', applies: e => PosixModes && topFile('configure', 'cleanup')(e) && e.stats !== undefined && (e.stats.mode & 0o500) !== 0o500, message: e => `The file ${Quote(e.relative)} should most likely be executable (for the owner). Please fix its permissions.` },
|
|
213
|
+
{ kind: 'future-timestamp', applies: (e, env) => env.config.checkFutureTimestamps && (e.stats?.mtimeMs ?? 0) > Date.now() + FutureLeewayMs, message: e => `Found the following ${what(e)} with a future time stamp: ${Quote(e.relative)}` },
|
|
214
|
+
{ kind: 'crlf-shell-script', applies: (e, env) => topFile('configure', 'configure.in', 'configure.ac', 'cleanup')(e) && env.pf.read(e.relative)?.includes('\r') === true, message: e => `Found the shell script ${Quote(e.relative)} with CR or CRLF line endings. Non-Windows OSes require LF line endings.` },
|
|
215
|
+
{ kind: 'vignette-source-missing', applies: (e, env) => parent(e) === 'inst/doc' && !e.isDirectory && SweavePattern.test(e.relative) && isDir(env, 'vignettes') && !env.kinds.has(`vignettes/${base(e.relative)}`), message: e => `Vignette source ${Quote(e.relative)} in 'inst/doc' missing from the 'vignettes' directory.` },
|
|
216
|
+
{ kind: 'vignette-newer', applies: (e, env) => env.config.builtPackage && !e.isDirectory && under(e, 'vignettes') && newerThan(e, env) !== undefined, message: (e, env) => `The file ${Quote(e.relative)} in the 'vignettes' directory is newer than ${newerThan(e, env)}.` },
|
|
217
|
+
{ kind: 'file-already-in-r', applies: e => looseFile(e) && AlreadyInR.includes(base(e.relative)), message: e => `The file ${Quote(base(e.relative))} is already in R. Please remove it from your package.` },
|
|
218
|
+
{ kind: 'license-requires-sources', applies: licensed, message: e => `The file ${Quote(base(e.relative))} contains a license that requires distribution of original sources. Please ensure that you have complied with it.` },
|
|
219
|
+
{ kind: 'leftover-mistake', applies: leftover, message: e => `The file ${Quote(base(e.relative))} looks like a leftover/mistake. Please remove it from your package.` },
|
|
220
|
+
{ kind: 'knitr-leftover', applies: e => e.isDirectory && parent(e) === 'vignettes' && ['cache', 'figure'].includes(base(e.relative)), message: e => `The directory ${Quote(base(e.relative))} looks like a leftover from 'knitr'. Please remove from your package.` },
|
|
221
|
+
{ kind: 'should-not-install', applies: (e, env) => parent(e) === 'inst/doc' && shouldNotInstall(e, env), message: e => `The ${what(e)} ${Quote(base(e.relative))} should probably not be installed. Consider the use of a .Rinstignore file, or move the vignette sources from 'inst/doc' to 'vignettes'.` },
|
|
222
|
+
{ kind: 'large-pdf', applies: (e, env) => under(e, 'inst/doc') && /\.pdf/.test(base(e.relative)) && e.relative !== 'inst/doc/Rplots.pdf' && env.size(e) > env.config.maxPdfBytes, certainty: linter_format_1.LintingResultCertainty.Uncertain, message: (e, env) => `The PDF file ${Quote(e.relative)} is ${(env.size(e) / Mb).toFixed(1)}Mb, consider running tools::compactPDF() on it, or build the source package with --compact-vignettes.` }
|
|
223
|
+
];
|
|
224
|
+
const PackageRules = [
|
|
225
|
+
{ kind: 'vignettes-without-inst-doc', file: 'vignettes', check: env => env.config.builtPackage && isDir(env, 'vignettes') && env.files.some(f => f.relative.startsWith('vignettes/')) && !env.files.some(f => f.relative.startsWith('inst/doc/'))
|
|
226
|
+
? "Files in the 'vignettes' directory but no files in 'inst/doc'." : undefined },
|
|
227
|
+
{ kind: 'no-vignette-builder', file: 'DESCRIPTION', check: env => {
|
|
228
|
+
const top = env.children('vignettes').filter(e => !base(e.relative).startsWith('.'));
|
|
229
|
+
return top.length > 0 && !top.some(e => SweavePattern.test(e.relative)) && !/^VignetteBuilder:/m.test(env.pf.read('DESCRIPTION') ?? '')
|
|
230
|
+
? 'Package has no Sweave vignette sources and no VignetteBuilder field.' : undefined;
|
|
231
|
+
} },
|
|
232
|
+
...['Rplots.ps', 'Rplots.pdf'].map((name) => ({ kind: 'vignette-leftover', file: `inst/doc/${name}`, check: env => env.kinds.has(`inst/doc/${name}`) || env.pf.onDisk && fs_1.default.existsSync(path_1.default.join(env.pf.root, `inst/doc/${name}`)) ? `The file ${Quote(`inst/doc/${name}`)} will not be installed: please remove it.` : undefined })),
|
|
233
|
+
{ kind: 'installed-size', file: 'DESCRIPTION', check: env => env.pf.onDisk ? installedSize(env) : undefined, certainty: linter_format_1.LintingResultCertainty.Uncertain }
|
|
234
|
+
];
|
|
235
|
+
/** the entries of `build/vignette.rds` that name files missing from the package */
|
|
236
|
+
function buildFindings(env) {
|
|
237
|
+
const index = env.pf.onDisk && env.kinds.has('build/vignette.rds') ? readVignetteIndex(path_1.default.join(env.pf.root, 'build/vignette.rds')) : undefined;
|
|
238
|
+
const col = (n) => index?.get(n) ?? [];
|
|
239
|
+
const missing = (kind, what, name) => name !== '' && !env.kinds.has(`inst/doc/${name}`)
|
|
240
|
+
? [[kind, `${what} listed in 'build/vignette.rds' but not in package: ${Quote(`inst/doc/${name}`)}`]] : [];
|
|
241
|
+
return col('File').flatMap((file, i) => (col('PDF')[i] ?? '') === ''
|
|
242
|
+
? [['build-vignette-without-output', `Vignette without any output listed in 'build/vignette.rds': ${Quote(file)}`]]
|
|
243
|
+
: [...missing('build-missing-output', 'Output', col('PDF')[i]), ...missing('build-missing-source', 'Source', file), ...missing('build-missing-code', 'R code', col('R')[i] ?? '')]);
|
|
244
|
+
}
|
|
245
|
+
/** Port of the file and directory structure checks of `R CMD check` (portable names, hidden and top-level files, subdirectories, permissions, sizes, vignettes). */
|
|
246
|
+
exports.PACKAGE_STRUCTURE = {
|
|
247
|
+
createSearch: () => flowr_search_builder_1.Q.from([]),
|
|
248
|
+
processSearchResult: (_elements, config, data) => {
|
|
249
|
+
const ctx = data.inspectContext();
|
|
250
|
+
const pkg = (0, cmd_check_util_1.packageInfo)(ctx);
|
|
251
|
+
const pf = (0, package_files_1.packageFiles)(ctx, pkg.name);
|
|
252
|
+
if (pf === undefined) {
|
|
253
|
+
return { results: [], '.meta': { inspectedEntries: 0, onDisk: false } };
|
|
254
|
+
}
|
|
255
|
+
const found = (0, file_checks_1.fileFindings)(pf);
|
|
256
|
+
const entries = pf.entries;
|
|
257
|
+
const byParent = new Map();
|
|
258
|
+
const firstByLower = new Map();
|
|
259
|
+
for (const e of entries) {
|
|
260
|
+
byParent.set(path_1.default.posix.dirname(e.relative), [...byParent.get(path_1.default.posix.dirname(e.relative)) ?? [], e]);
|
|
261
|
+
const first = firstByLower.get(e.relative.toLowerCase());
|
|
262
|
+
if (first === undefined || e.relative < first) {
|
|
263
|
+
firstByLower.set(e.relative.toLowerCase(), e.relative);
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
const children = (dir) => byParent.get(dir) ?? [];
|
|
267
|
+
const files = entries.filter(isFile);
|
|
268
|
+
const sources = new Set(children('inst/doc').filter(e => !e.isDirectory && VignettePattern.test(e.relative)).map(e => base(e.relative)));
|
|
269
|
+
const stems = [...sources].map(s => s.replace(/\.[^.]+$/, ''));
|
|
270
|
+
const description = pkg.description?.content();
|
|
271
|
+
const license = (description?.get('License') ?? []).join(' ');
|
|
272
|
+
const flag = description?.get('License_is_FOSS')?.[0]?.trim().toLowerCase();
|
|
273
|
+
const env = {
|
|
274
|
+
pf, config, files, children, firstByLower, sources,
|
|
275
|
+
pkgName: pkg.name ?? path_1.default.basename(pf.root),
|
|
276
|
+
license,
|
|
277
|
+
foss: flag === 'yes' || flag === 'no' ? flag === 'yes' : FosLicense.test(license) && !LimitedLicense.test(license),
|
|
278
|
+
kinds: new Map(entries.map(e => [e.relative, e.isDirectory])),
|
|
279
|
+
size: e => e.stats?.size ?? Buffer.byteLength(pf.read(e.relative) ?? ''),
|
|
280
|
+
binary: new Set((pf.read('BinaryFiles') ?? '').split(/\r?\n/).filter(l => l !== '')),
|
|
281
|
+
demos: children('demo').filter(e => !e.isDirectory && ['R', 'r'].includes(ext(e.relative)) && /^[A-Za-z]/.test(base(e.relative))).map(e => base(e.relative)),
|
|
282
|
+
stemPdf: stems.length > 0 ? new RegExp(`^(${stems.map(s => (0, strings_1.escapeRegex)(s)).join('|')})-[0-9]+[.]pdf`) : undefined,
|
|
283
|
+
docTimes: new Map(files.filter(f => f.relative.startsWith('inst/doc/')).map(f => [f.relative.slice('inst/doc/'.length), f.stats?.mtimeMs ?? 0]))
|
|
284
|
+
};
|
|
285
|
+
for (const rule of EntryRules) {
|
|
286
|
+
entries.filter(e => rule.applies(e, env)).forEach(e => found.add(rule.kind, e.relative, rule.message(e, env), undefined, rule.certainty));
|
|
287
|
+
}
|
|
288
|
+
for (const rule of PackageRules) {
|
|
289
|
+
const message = rule.check(env);
|
|
290
|
+
if (message !== undefined) {
|
|
291
|
+
found.add(rule.kind, rule.file, message, undefined, rule.certainty);
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
buildFindings(env).forEach(([kind, message]) => found.add(kind, 'build/vignette.rds', message));
|
|
295
|
+
return { results: found.results, '.meta': { inspectedEntries: entries.length, onDisk: pf.onDisk } };
|
|
296
|
+
},
|
|
297
|
+
prettyPrint: file_checks_1.MessageAtLocation,
|
|
298
|
+
info: {
|
|
299
|
+
name: 'Package Structure',
|
|
300
|
+
tags: [linter_tags_1.LintingRuleTag.CmdCheck], certainty: linter_format_1.LintingRuleCertainty.BestEffort,
|
|
301
|
+
description: 'Finds problems in the package files: portable names, hidden files, top-level files, subdirectories, permissions, executables, timestamps, sizes, line endings of scripts, and vignette leftovers.',
|
|
302
|
+
defaultConfig: () => ({
|
|
303
|
+
maxPathLength: 100,
|
|
304
|
+
hiddenAllowed: ['.Rbuildignore', '.Rinstignore', 'vignettes/.install_extras', '.aspell'],
|
|
305
|
+
cranKnownHidden: ['.Renviron', '.Rprofile', '.Rproj.user', '.Rhistory', '.Rapp.history', '.tex', '.log', '.aux', '.pdf', '.png', '.backups', '.cvsignore', '.cproject', '.directory', '.dropbox', '.exrc', '.gdb.history', '.gitattributes', '.gitignore', '.gitmodules', '.hgignore', '.hgtags', '.project', '.seed', '.settings', '.tm_properties'],
|
|
306
|
+
cranPack: true,
|
|
307
|
+
checkTopLevel: true,
|
|
308
|
+
standardTopLevel: ['DESCRIPTION', 'INDEX', 'LICENCE', 'LICENSE', 'LICENCE.note', 'LICENSE.note', 'MD5', 'NAMESPACE', 'NEWS', 'PORTING', 'COPYING', 'COPYING.LIB', 'GPL-2', 'GPL-3', 'BUGS', 'Bugs', 'ChangeLog', 'Changelog', 'CHANGELOG', 'CHANGES', 'Changes', 'INSTALL', 'README', 'THANKS', 'TODO', 'ToDo', 'SHA256', 'SHA256.sig', 'INSTALL.windows', 'README.md', 'NEWS.md', 'configure', 'configure.win', 'cleanup', 'cleanup.win', 'configure.ucrt', 'cleanup.ucrt', 'configure.ac', 'configure.in', 'datafiles', 'R', 'data', 'demo', 'exec', 'inst', 'man', 'po', 'src', 'tests', 'vignettes', 'build', '.aspell', 'upstream', 'java', 'tools', 'noweb'],
|
|
309
|
+
checkBashisms: false,
|
|
310
|
+
reservedInstDirs: ['Meta', 'R', 'data', 'demo', 'exec', 'libs', 'man', 'help', 'html', 'latex', 'R-ex', 'build'],
|
|
311
|
+
maxInstalledSizeMb: 5,
|
|
312
|
+
maxPdfBytes: Mb,
|
|
313
|
+
checkFutureTimestamps: true,
|
|
314
|
+
builtPackage: false,
|
|
315
|
+
leftoverExtensions: ['log', 'aux', 'bbl', 'blg', 'dvi', 'toc', 'out', 'Rd', 'Rout', 'dbj', 'drv', 'ins'],
|
|
316
|
+
docDirsNotInstalled: ['auto', 'Bilder', 'fig', 'figs', 'figures', 'Figures', 'img', 'images', 'JSSstyle', 'jssStyle', 'screenshots2', 'src', 'tex', 'tmp']
|
|
317
|
+
})
|
|
318
|
+
}
|
|
319
|
+
};
|
|
320
|
+
//# sourceMappingURL=package-structure.js.map
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { LintingRuleCertainty } from '../../linter-format';
|
|
2
|
+
import type { MergeableRecord } from '../../../util/objects';
|
|
3
|
+
import { LintingRuleTag } from '../../linter-tags';
|
|
4
|
+
import type { ReadonlyFlowrAnalysisProvider } from '../../../project/flowr-analyzer';
|
|
5
|
+
import { type FileResult } from './file-checks';
|
|
6
|
+
/** what is wrong with an Rd page or the manual, named after the part of `R CMD check` that finds it */
|
|
7
|
+
export type RdFilesKind = 'rd-syntax' | 'rd-unknown-macro' | 'rd-structure' | 'rd-empty-section' | 'rd-encoding' | 'rd-markup' | 'rd-lost-braces' | 'rd-duplicate-name' | 'rd-duplicate-alias' | 'rd-missing-alias' | 'rd-package-alias' | 'rd-name-case' | 'rd-missing-link' | 'rd-undeclared-package' | 'rd-line-width' | 'rd-missing-description' | 'rd-undocumented-argument' | 'rd-boilerplate' | 'rd-missing-value' | 'rd-keyword' | 'rd-s3-method-name' | 'rd-bibentry' | 'rd-example-syntax' | 'rd-example-abbreviation' | 'rd-example-quit' | 'rd-example-setwd' | 'rd-example-file';
|
|
8
|
+
export type RdFilesResult = FileResult<RdFilesKind>;
|
|
9
|
+
export interface RdFilesConfig extends MergeableRecord {
|
|
10
|
+
/** report what the Rd parser of R reports: syntax errors, unknown macros, and unexpected sections */
|
|
11
|
+
readonly parse: boolean;
|
|
12
|
+
/** drop parser diagnostics below this `checkRd` level, the messages of `prepare_Rd` are always kept */
|
|
13
|
+
readonly minLevel: number;
|
|
14
|
+
/** report duplicate names and aliases, names that differ only by case, and pages without any alias */
|
|
15
|
+
readonly metadata: boolean;
|
|
16
|
+
/** report links to topics no page or package provides */
|
|
17
|
+
readonly crossReferences: boolean;
|
|
18
|
+
/** also report links whose target flowR cannot decide */
|
|
19
|
+
readonly uncertainLinks: boolean;
|
|
20
|
+
/** report lines in `\usage` and `\examples` wider than {@link RdFilesConfig#usageWidth} and {@link RdFilesConfig#examplesWidth} */
|
|
21
|
+
readonly lineWidths: boolean;
|
|
22
|
+
/** the widest line a `\usage` section may have */
|
|
23
|
+
readonly usageWidth: number;
|
|
24
|
+
/** the widest line an `\examples` section may have */
|
|
25
|
+
readonly examplesWidth: number;
|
|
26
|
+
/** report missing descriptions and values, argument items without text, and generated boilerplate */
|
|
27
|
+
readonly contents: boolean;
|
|
28
|
+
/** report functions documented without a `\value` section */
|
|
29
|
+
readonly requireValue: boolean;
|
|
30
|
+
/** report keywords that are neither standard nor in {@link RdFilesConfig#keywords} */
|
|
31
|
+
readonly standardKeywords: boolean;
|
|
32
|
+
/** the keywords besides the standard ones a page may use */
|
|
33
|
+
readonly keywords: readonly string[];
|
|
34
|
+
/** report S3 methods a `\usage` calls by their full name instead of with `\method` */
|
|
35
|
+
readonly docStyle: boolean;
|
|
36
|
+
/** report bibentries a page cites but does not show */
|
|
37
|
+
readonly bibentries: boolean;
|
|
38
|
+
/** parse the examples and report their syntax errors, undefined calls, `T` and `F`, `q()`, and the files they write */
|
|
39
|
+
readonly examples: boolean;
|
|
40
|
+
/** Rd macro files to load besides those of the package */
|
|
41
|
+
readonly extraMacros: readonly string[];
|
|
42
|
+
}
|
|
43
|
+
export interface RdFilesMetadata extends MergeableRecord {
|
|
44
|
+
readonly checkedFiles: number;
|
|
45
|
+
}
|
|
46
|
+
/** Port of the Rd checks of `R CMD check`, run on the `man/*.Rd` sources. */
|
|
47
|
+
export declare const RD_FILES: {
|
|
48
|
+
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>[]>>;
|
|
49
|
+
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: RdFilesConfig, data: ReadonlyFlowrAnalysisProvider<import("../../..").KnownParser>) => {
|
|
50
|
+
results: FileResult<RdFilesKind>[];
|
|
51
|
+
'.meta': {
|
|
52
|
+
checkedFiles: number;
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
readonly prettyPrint: {
|
|
56
|
+
readonly query: (result: RdFilesResult) => string;
|
|
57
|
+
readonly full: (result: RdFilesResult) => string;
|
|
58
|
+
};
|
|
59
|
+
readonly info: {
|
|
60
|
+
readonly name: "Rd Files";
|
|
61
|
+
readonly tags: readonly [LintingRuleTag.CmdCheck, LintingRuleTag.Robustness];
|
|
62
|
+
readonly certainty: LintingRuleCertainty.BestEffort;
|
|
63
|
+
readonly description: "Finds problems in the Rd files: syntax, unknown macros, required and duplicated sections, metadata, cross-references, line widths, contents, and the example code.";
|
|
64
|
+
readonly defaultConfig: () => {
|
|
65
|
+
parse: true;
|
|
66
|
+
minLevel: number;
|
|
67
|
+
metadata: true;
|
|
68
|
+
crossReferences: true;
|
|
69
|
+
uncertainLinks: true;
|
|
70
|
+
lineWidths: true;
|
|
71
|
+
usageWidth: number;
|
|
72
|
+
examplesWidth: number;
|
|
73
|
+
contents: true;
|
|
74
|
+
requireValue: false;
|
|
75
|
+
standardKeywords: false;
|
|
76
|
+
keywords: string[];
|
|
77
|
+
docStyle: true;
|
|
78
|
+
bibentries: true;
|
|
79
|
+
examples: true;
|
|
80
|
+
extraMacros: never[];
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
};
|