@eagleoutice/flowr 2.16.5 → 2.16.7
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 +21 -15
- package/abstract-interpretation/data-frame/dataframe-semantics.d.ts +2 -0
- package/abstract-interpretation/data-frame/dataframe-semantics.js +3 -1
- package/abstract-interpretation/data-frame/resolve-args.d.ts +1 -7
- package/abstract-interpretation/data-frame/resolve-args.js +2 -11
- package/cli/repl/commands/repl-cfg.js +5 -19
- package/cli/repl/commands/repl-code-command.d.ts +10 -0
- package/cli/repl/commands/repl-code-command.js +18 -0
- package/cli/repl/commands/repl-dataflow.js +34 -59
- package/cli/repl/commands/repl-normalize.js +24 -41
- package/cli/repl/commands/repl-query.js +10 -17
- package/config.js +3 -3
- package/control-flow/cfg-dead-code.js +15 -2
- package/control-flow/useless-loop.js +1 -2
- package/data/r-base-packages.generated.d.ts +1 -1
- package/data/r-base-packages.generated.js +3 -3
- package/dataflow/environments/ambient-state-name.d.ts +80 -0
- package/dataflow/environments/ambient-state-name.js +113 -0
- package/dataflow/environments/built-in-eval-name.d.ts +3 -1
- package/dataflow/environments/built-in-eval-name.js +2 -0
- package/dataflow/environments/built-in-props.d.ts +27 -7
- package/dataflow/environments/built-in-props.js +59 -44
- package/dataflow/environments/built-in.d.ts +5 -2
- package/dataflow/environments/built-in.js +22 -5
- package/dataflow/environments/default-builtin-config.d.ts +538 -14
- package/dataflow/environments/default-builtin-config.js +189 -123
- package/dataflow/environments/environment.d.ts +7 -1
- package/dataflow/environments/environment.js +19 -1
- package/dataflow/environments/identifier.d.ts +11 -0
- package/dataflow/eval/resolve/alias-tracking.d.ts +13 -3
- package/dataflow/eval/resolve/alias-tracking.js +66 -37
- package/dataflow/eval/resolve/resolve-argument.d.ts +4 -2
- package/dataflow/eval/resolve/resolve-argument.js +23 -11
- package/dataflow/eval/resolve/resolve.d.ts +5 -0
- package/dataflow/eval/resolve/resolve.js +25 -3
- package/dataflow/eval/values/r-value.d.ts +4 -2
- package/dataflow/eval/values/r-value.js +3 -1
- package/dataflow/eval/values/string/string-constants.d.ts +7 -1
- package/dataflow/eval/values/string/string-constants.js +38 -36
- package/dataflow/extractor.js +105 -2
- package/dataflow/fn/argument-roles.js +22 -8
- package/dataflow/fn/function-semantics.d.ts +3 -2
- package/dataflow/fn/strict-function.js +13 -2
- package/dataflow/graph/df-helper.d.ts +14 -1
- package/dataflow/graph/df-helper.js +37 -4
- package/dataflow/graph/graph.d.ts +6 -0
- package/dataflow/graph/graph.js +6 -0
- package/dataflow/internal/linker.d.ts +4 -1
- package/dataflow/internal/linker.js +11 -7
- package/dataflow/internal/process/functions/call/built-in/built-in-ambient-keys.d.ts +41 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-ambient-keys.js +88 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-ambient-state.d.ts +19 -44
- package/dataflow/internal/process/functions/call/built-in/built-in-ambient-state.js +125 -158
- package/dataflow/internal/process/functions/call/built-in/built-in-apply.d.ts +6 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +35 -9
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +10 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-attach.d.ts +4 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-attach.js +6 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-eval.js +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +3 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.d.ts +7 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +21 -12
- package/dataflow/internal/process/functions/call/built-in/built-in-get.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-get.js +8 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-library.d.ts +3 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-library.js +5 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-local.js +5 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-pipe.js +11 -12
- package/dataflow/internal/process/functions/call/built-in/built-in-s-three-dispatch.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-s-three-dispatch.js +6 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-string-template.js +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.d.ts +7 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.js +42 -0
- package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.d.ts +11 -0
- package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.js +29 -4
- package/dataflow/internal/process/functions/call/common.js +3 -4
- package/dataflow/internal/process/functions/call/deferred.d.ts +3 -2
- package/dataflow/internal/process/functions/call/deferred.js +17 -9
- package/dataflow/internal/process/functions/call/quoted.js +1 -1
- package/documentation/doc-capabilities.js +3 -2
- package/documentation/doc-readme.js +1 -2
- package/documentation/doc-util/doc-dfg.js +2 -2
- package/documentation/doc-util/doc-query.d.ts +3 -1
- package/documentation/doc-util/doc-query.js +4 -4
- package/documentation/wiki-create-linting-rules.js +1 -1
- package/documentation/wiki-linter.js +16 -206
- package/documentation/wiki-linting-and-testing.js +31 -64
- package/documentation/wiki-query.js +41 -0
- package/index.d.ts +1 -0
- package/index.js +5 -1
- package/linter/linter-format.d.ts +6 -0
- package/linter/linter-format.js +10 -0
- package/linter/linter-rules.d.ts +155 -103
- package/linter/linter-rules.js +2 -0
- package/linter/linter-util.d.ts +23 -0
- package/linter/linter-util.js +58 -0
- package/linter/rules/absolute-path.d.ts +2 -2
- package/linter/rules/absolute-path.js +1 -4
- package/linter/rules/cmd-check/bogus-return.d.ts +2 -2
- package/linter/rules/cmd-check/bogus-return.js +3 -7
- package/linter/rules/cmd-check/call-arguments.d.ts +2 -2
- package/linter/rules/cmd-check/class-string-comparison.d.ts +2 -2
- package/linter/rules/cmd-check/class-string-comparison.js +3 -7
- package/linter/rules/cmd-check/cmd-check-util.d.ts +8 -9
- package/linter/rules/cmd-check/cmd-check-util.js +14 -26
- package/linter/rules/cmd-check/compiled-code.d.ts +8 -3
- package/linter/rules/cmd-check/compiled-code.js +3 -13
- package/linter/rules/cmd-check/dependency-declaration.d.ts +2 -2
- package/linter/rules/cmd-check/dependency-declaration.js +6 -7
- package/linter/rules/cmd-check/description-metadata.d.ts +4 -4
- package/linter/rules/cmd-check/documentation-mismatch.d.ts +2 -2
- package/linter/rules/cmd-check/documentation-mismatch.js +4 -11
- package/linter/rules/cmd-check/file-checks.d.ts +19 -6
- package/linter/rules/cmd-check/file-checks.js +13 -5
- package/linter/rules/cmd-check/foreign-function-calls.d.ts +2 -2
- package/linter/rules/cmd-check/global-environment-modification.d.ts +2 -2
- package/linter/rules/cmd-check/global-environment-modification.js +3 -2
- package/linter/rules/cmd-check/namespace-tampering.d.ts +2 -2
- package/linter/rules/cmd-check/namespace-tampering.js +9 -9
- package/linter/rules/cmd-check/non-ascii-code.d.ts +2 -2
- package/linter/rules/cmd-check/package-data.d.ts +11 -5
- package/linter/rules/cmd-check/package-data.js +5 -12
- package/linter/rules/cmd-check/package-files.js +4 -10
- package/linter/rules/cmd-check/package-hooks.d.ts +2 -2
- package/linter/rules/cmd-check/package-hooks.js +10 -8
- package/linter/rules/cmd-check/package-metafiles.d.ts +8 -3
- package/linter/rules/cmd-check/package-metafiles.js +3 -12
- package/linter/rules/cmd-check/package-runtime.d.ts +18 -5
- package/linter/rules/cmd-check/package-runtime.js +64 -20
- package/linter/rules/cmd-check/package-structure.d.ts +11 -5
- package/linter/rules/cmd-check/package-structure.js +4 -12
- package/linter/rules/cmd-check/rd-files.d.ts +8 -3
- package/linter/rules/cmd-check/rd-files.js +4 -14
- package/linter/rules/cmd-check/s-three-method-consistency.d.ts +2 -2
- package/linter/rules/cmd-check/s-three-method-consistency.js +3 -4
- package/linter/rules/cmd-check/true-false-abbreviation.d.ts +2 -2
- package/linter/rules/dataframe-access-validation.d.ts +2 -2
- package/linter/rules/dataframe-access-validation.js +5 -8
- package/linter/rules/dead-code.d.ts +5 -4
- package/linter/rules/dead-code.js +25 -14
- package/linter/rules/deprecated-functions.d.ts +3 -3
- package/linter/rules/deprecated-functions.js +16 -23
- package/linter/rules/file-path-validity.d.ts +2 -2
- package/linter/rules/file-path-validity.js +3 -6
- package/linter/rules/function-finder-util.d.ts +3 -3
- package/linter/rules/function-finder-util.js +7 -14
- package/linter/rules/namespace-access.d.ts +2 -2
- package/linter/rules/namespace-access.js +6 -9
- package/linter/rules/naming-convention.d.ts +2 -2
- package/linter/rules/naming-convention.js +1 -4
- package/linter/rules/network-functions.d.ts +3 -3
- package/linter/rules/no-leaked-credentials.d.ts +2 -2
- package/linter/rules/no-leaked-credentials.js +1 -4
- package/linter/rules/overwritten-file.d.ts +38 -0
- package/linter/rules/overwritten-file.js +102 -0
- package/linter/rules/problematic-inputs.d.ts +16 -6
- package/linter/rules/problematic-inputs.js +78 -34
- package/linter/rules/roxygen-arguments.d.ts +2 -2
- package/linter/rules/roxygen-arguments.js +1 -4
- package/linter/rules/seeded-randomness.d.ts +3 -3
- package/linter/rules/seeded-randomness.js +6 -23
- package/linter/rules/software-has-license.d.ts +2 -2
- package/linter/rules/software-has-license.js +1 -4
- package/linter/rules/software-has-tests.d.ts +2 -2
- package/linter/rules/software-has-tests.js +1 -4
- package/linter/rules/stop-with-call-arg.d.ts +2 -2
- package/linter/rules/stop-with-call-arg.js +4 -11
- package/linter/rules/syntactically-valid.d.ts +4 -2
- package/linter/rules/syntactically-valid.js +29 -10
- package/linter/rules/unclosed-connection.d.ts +2 -2
- package/linter/rules/unclosed-connection.js +1 -4
- package/linter/rules/undefined-symbol.d.ts +2 -2
- package/linter/rules/undefined-symbol.js +25 -22
- package/linter/rules/unescaped-arguments.d.ts +2 -2
- package/linter/rules/unescaped-arguments.js +1 -4
- package/linter/rules/unused-definition.d.ts +2 -2
- package/linter/rules/unused-definition.js +37 -25
- package/linter/rules/unused-import.d.ts +2 -2
- package/linter/rules/unused-import.js +9 -14
- package/linter/rules/useless-loop.d.ts +7 -6
- package/linter/rules/useless-loop.js +4 -8
- package/package.json +5 -3
- package/project/cache/flowr-analyzer-cache.d.ts +2 -0
- package/project/cache/flowr-analyzer-cache.js +15 -11
- package/project/context/flowr-analyzer-files-context.d.ts +3 -0
- package/project/context/flowr-analyzer-files-context.js +6 -0
- package/project/plugins/file-plugins/files/flowr-jupyter-file.d.ts +6 -1
- package/project/plugins/file-plugins/files/flowr-jupyter-file.js +35 -0
- package/project/plugins/file-plugins/files/flowr-namespace-file.js +2 -1
- package/project/plugins/file-plugins/files/flowr-rsession-file.d.ts +26 -0
- package/project/plugins/file-plugins/files/flowr-rsession-file.js +44 -0
- package/project/plugins/file-plugins/files/r-session.d.ts +20 -0
- package/project/plugins/file-plugins/files/r-session.js +58 -0
- package/project/plugins/file-plugins/files/recorded-runs.d.ts +18 -0
- package/project/plugins/file-plugins/files/recorded-runs.js +8 -0
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-rsession-file-plugin.d.ts +20 -0
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-rsession-file-plugin.js +28 -0
- package/project/plugins/plugin-registry.d.ts +2 -1
- package/project/plugins/plugin-registry.js +2 -0
- package/project/sigdb/spec-query.d.ts +73 -0
- package/project/sigdb/spec-query.js +339 -0
- package/queries/base-query-format.d.ts +1 -1
- package/queries/base-query-format.js +2 -2
- package/queries/catalog/absint-query/absint-query-executor.js +3 -6
- package/queries/catalog/call-context-query/call-context-query-executor.d.ts +1 -0
- package/queries/catalog/call-context-query/call-context-query-executor.js +113 -73
- package/queries/catalog/call-graph-query/call-graph-query-executor.js +2 -3
- package/queries/catalog/cluster-query/cluster-query-executor.js +2 -3
- package/queries/catalog/config-query/config-query-format.d.ts +0 -1
- package/queries/catalog/config-query/config-query-format.js +1 -2
- package/queries/catalog/control-flow-query/control-flow-query-executor.js +2 -3
- package/queries/catalog/dataflow-lens-query/dataflow-lens-query-executor.js +2 -4
- package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.d.ts +0 -1
- package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.js +1 -2
- package/queries/catalog/dataflow-query/dataflow-query-executor.js +2 -3
- package/queries/catalog/dependencies-query/dependencies-query-executor.d.ts +7 -0
- package/queries/catalog/dependencies-query/dependencies-query-executor.js +72 -42
- package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +24 -6
- package/queries/catalog/dependencies-query/dependencies-query-format.js +108 -3
- package/queries/catalog/dependencies-query/function-info/function-info.d.ts +6 -1
- package/queries/catalog/dependencies-query/function-info/read-functions.js +6 -6
- package/queries/catalog/dependencies-query/function-info/write-functions.js +13 -7
- package/queries/catalog/dependencies-query/implicit-echo.js +21 -7
- package/queries/catalog/dice-query/dice-query-executor.js +2 -3
- package/queries/catalog/does-call-query/does-call-query-executor.js +2 -3
- package/queries/catalog/files-query/files-query-executor.js +2 -3
- package/queries/catalog/function-info-query/function-info-query-executor.js +2 -1
- package/queries/catalog/function-info-query/function-info-query-format.d.ts +0 -2
- package/queries/catalog/function-info-query/function-info-query-format.js +1 -2
- package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-executor.js +3 -2
- package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-format.d.ts +0 -2
- package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-format.js +1 -2
- package/queries/catalog/happens-before-query/happens-before-query-executor.js +2 -3
- package/queries/catalog/happens-before-query/happens-before-query-format.d.ts +0 -1
- package/queries/catalog/happens-before-query/happens-before-query-format.js +1 -2
- package/queries/catalog/id-map-query/id-map-query-executor.js +2 -3
- package/queries/catalog/id-map-query/id-map-query-format.d.ts +0 -1
- package/queries/catalog/id-map-query/id-map-query-format.js +1 -2
- package/queries/catalog/input-sources-query/input-sources-query-executor.js +3 -4
- package/queries/catalog/input-sources-query/simple-input-classifier.d.ts +2 -1
- package/queries/catalog/input-sources-query/simple-input-classifier.js +60 -13
- package/queries/catalog/inspect-exceptions-query/inspect-exception-query-executor.js +2 -3
- package/queries/catalog/inspect-fn-props-query/inspect-fn-props-query-executor.js +2 -3
- package/queries/catalog/inspect-fn-props-query/inspect-fn-props-query-format.js +2 -1
- package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-executor.d.ts +3 -2
- package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-executor.js +1 -7
- package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.d.ts +6 -9
- package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.js +8 -33
- package/queries/catalog/inspect-recursion-query/inspect-recursion-query-executor.d.ts +3 -2
- package/queries/catalog/inspect-recursion-query/inspect-recursion-query-executor.js +1 -7
- package/queries/catalog/inspect-recursion-query/inspect-recursion-query-format.d.ts +6 -7
- package/queries/catalog/inspect-recursion-query/inspect-recursion-query-format.js +8 -31
- package/queries/catalog/linter-query/linter-query-executor.js +2 -3
- package/queries/catalog/location-map-query/location-map-query-executor.js +2 -3
- package/queries/catalog/location-map-query/location-map-query-format.d.ts +0 -1
- package/queries/catalog/location-map-query/location-map-query-format.js +1 -2
- package/queries/catalog/normalized-ast-query/normalized-ast-query-executor.js +2 -3
- package/queries/catalog/normalized-ast-query/normalized-ast-query-format.d.ts +0 -1
- package/queries/catalog/normalized-ast-query/normalized-ast-query-format.js +1 -2
- package/queries/catalog/origin-query/origin-query-executor.d.ts +0 -5
- package/queries/catalog/origin-query/origin-query-executor.js +3 -11
- package/queries/catalog/project-query/project-query-executor.js +23 -7
- package/queries/catalog/project-query/project-query-format.d.ts +5 -0
- package/queries/catalog/project-query/project-query-format.js +20 -2
- package/queries/catalog/provenance-query/provenance-query-executor.js +2 -3
- package/queries/catalog/resolve-value-query/resolve-value-query-executor.js +2 -3
- package/queries/catalog/resolve-value-query/resolve-value-query-format.d.ts +0 -1
- package/queries/catalog/resolve-value-query/resolve-value-query-format.js +1 -2
- package/queries/catalog/search-query/search-query-executor.js +2 -3
- package/queries/catalog/signature-query/signature-query-executor.js +39 -0
- package/queries/catalog/signature-query/signature-query-format.d.ts +7 -1
- package/queries/catalog/signature-query/signature-query-format.js +15 -1
- package/queries/catalog/signature-query/signature-query-render.js +2 -1
- package/queries/catalog/static-slice-query/static-slice-query-executor.js +2 -3
- package/queries/query-function-property.d.ts +28 -0
- package/queries/query-function-property.js +48 -0
- package/queries/query-meta.d.ts +3 -0
- package/queries/query-meta.js +8 -0
- package/queries/query.d.ts +13 -18
- package/r-bridge/lang-4.x/ast/model/processing/decorate.d.ts +2 -2
- package/r-bridge/lang-4.x/ast/model/processing/decorate.js +4 -3
- package/r-bridge/lang-4.x/ast/model/processing/node-id.d.ts +6 -0
- package/r-bridge/lang-4.x/ast/model/processing/node-id.js +9 -0
- package/r-bridge/lang-4.x/ast/model/syntax-version.d.ts +8 -0
- package/r-bridge/lang-4.x/ast/model/syntax-version.js +49 -0
- package/r-bridge/lang-4.x/ast/model/type.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/type.js +3 -0
- package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-parameter.js +4 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/structure/normalize-single-node.js +1 -0
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +1 -1
- package/reconstruct/reconstruct.js +35 -1
- package/search/search-executor/search-generators.js +1 -1
- package/slicing/static/fingerprint.js +7 -3
- package/slicing/static/removal-slice.js +4 -2
- package/slicing/static/static-slicer.js +6 -0
- package/util/assert.js +2 -2
- package/util/collections/arrays.d.ts +4 -0
- package/util/collections/arrays.js +11 -0
- package/util/collections/defaultmap.d.ts +5 -1
- package/util/collections/defaultmap.js +6 -1
- package/util/files.js +26 -5
- package/util/flowr-version.d.ts +10 -0
- package/util/flowr-version.js +20 -0
- package/util/glob.js +6 -4
- package/util/r-regex.d.ts +6 -0
- package/util/r-regex.js +17 -0
- package/util/text/args.d.ts +5 -0
- package/util/text/args.js +28 -22
- package/util/text/name-rank.d.ts +2 -0
- package/util/text/name-rank.js +3 -1
- package/util/text/regex.d.ts +10 -0
- package/util/text/regex.js +29 -0
- package/util/version.d.ts +1 -6
- package/util/version.js +6 -14
- package/documentation/doc-util/doc-functions.d.ts +0 -24
- package/documentation/doc-util/doc-functions.js +0 -65
|
@@ -2,10 +2,13 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.MessageAtLocation = void 0;
|
|
4
4
|
exports.fileFindings = fileFindings;
|
|
5
|
+
exports.onPackageFiles = onPackageFiles;
|
|
5
6
|
exports.linesOf = linesOf;
|
|
6
7
|
exports.firstLine = firstLine;
|
|
7
8
|
const linter_format_1 = require("../../linter-format");
|
|
8
9
|
const range_1 = require("../../../util/range");
|
|
10
|
+
const cmd_check_util_1 = require("./cmd-check-util");
|
|
11
|
+
const package_files_1 = require("./package-files");
|
|
9
12
|
/** Collects findings located at package files; findings of the kinds in `skip` are dropped. */
|
|
10
13
|
function fileFindings(pf, skip = []) {
|
|
11
14
|
const results = [];
|
|
@@ -16,6 +19,15 @@ function fileFindings(pf, skip = []) {
|
|
|
16
19
|
};
|
|
17
20
|
return { results, add };
|
|
18
21
|
}
|
|
22
|
+
/** Runs `run` on the files of the package, yielding no results and the `zeroed` metadata if they are not available. */
|
|
23
|
+
function onPackageFiles(zeroed, run) {
|
|
24
|
+
return (_elements, config, data) => {
|
|
25
|
+
const ctx = data.inspectContext();
|
|
26
|
+
const pkg = (0, cmd_check_util_1.packageInfo)(ctx);
|
|
27
|
+
const pf = (0, package_files_1.packageFiles)(ctx, pkg.name);
|
|
28
|
+
return pf === undefined ? { results: [], '.meta': zeroed } : run(pf, pkg, config, data);
|
|
29
|
+
};
|
|
30
|
+
}
|
|
19
31
|
/** The lines of a package file, empty if it cannot be read. */
|
|
20
32
|
function linesOf(pf, file) {
|
|
21
33
|
return (pf.read(file) ?? '').split(/\r?\n/);
|
|
@@ -25,10 +37,6 @@ function firstLine(pf, file, pattern) {
|
|
|
25
37
|
const i = linesOf(pf, file).findIndex(l => pattern.test(l));
|
|
26
38
|
return i < 0 ? undefined : i + 1;
|
|
27
39
|
}
|
|
28
|
-
const atLocation = (r) => `${r.message} at ${range_1.SourceLocation.format(r.loc)}`;
|
|
29
40
|
/** Pretty printing of a finding as its message and location. */
|
|
30
|
-
exports.MessageAtLocation = {
|
|
31
|
-
[linter_format_1.LintingPrettyPrintContext.Query]: atLocation,
|
|
32
|
-
[linter_format_1.LintingPrettyPrintContext.Full]: atLocation
|
|
33
|
-
};
|
|
41
|
+
exports.MessageAtLocation = (0, linter_format_1.prettyPrint)((r) => `${r.message} at ${range_1.SourceLocation.format(r.loc)}`);
|
|
34
42
|
//# sourceMappingURL=file-checks.js.map
|
|
@@ -39,8 +39,8 @@ export declare const FOREIGN_FUNCTION_CALLS: {
|
|
|
39
39
|
};
|
|
40
40
|
}>;
|
|
41
41
|
readonly prettyPrint: {
|
|
42
|
-
query: (r: ForeignFunctionCallsResult) => string;
|
|
43
|
-
full: (r: ForeignFunctionCallsResult) => string;
|
|
42
|
+
readonly query: (r: ForeignFunctionCallsResult, metadata: unknown) => string;
|
|
43
|
+
readonly full: (r: ForeignFunctionCallsResult, metadata: unknown) => string;
|
|
44
44
|
};
|
|
45
45
|
readonly info: {
|
|
46
46
|
readonly name: "Foreign Function Calls";
|
|
@@ -45,8 +45,8 @@ export declare const GLOBAL_ENVIRONMENT_MODIFICATION: {
|
|
|
45
45
|
};
|
|
46
46
|
}>;
|
|
47
47
|
readonly prettyPrint: {
|
|
48
|
-
query: (r: GlobalEnvironmentModificationResult) => string;
|
|
49
|
-
full: (r: GlobalEnvironmentModificationResult) => string;
|
|
48
|
+
readonly query: (r: GlobalEnvironmentModificationResult, metadata: unknown) => string;
|
|
49
|
+
readonly full: (r: GlobalEnvironmentModificationResult, metadata: unknown) => string;
|
|
50
50
|
};
|
|
51
51
|
readonly info: {
|
|
52
52
|
readonly name: "Global Environment Modification";
|
|
@@ -19,6 +19,7 @@ const node_id_1 = require("../../../r-bridge/lang-4.x/ast/model/processing/node-
|
|
|
19
19
|
const type_1 = require("../../../r-bridge/lang-4.x/ast/model/type");
|
|
20
20
|
const r_function_definition_1 = require("../../../r-bridge/lang-4.x/ast/model/nodes/r-function-definition");
|
|
21
21
|
const r_function_call_1 = require("../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
|
|
22
|
+
const linter_util_1 = require("../../linter-util");
|
|
22
23
|
const cmd_check_util_1 = require("./cmd-check-util");
|
|
23
24
|
const r_for_loop_1 = require("../../../r-bridge/lang-4.x/ast/model/nodes/r-for-loop");
|
|
24
25
|
const model_1 = require("../../../r-bridge/lang-4.x/ast/model/model");
|
|
@@ -38,7 +39,7 @@ function denotesGlobalEnv(node, environment, df, idMap, ctx, depth = 0) {
|
|
|
38
39
|
return true;
|
|
39
40
|
}
|
|
40
41
|
/* `as.environment(1)`, `as.environment(".GlobalEnv")` */
|
|
41
|
-
if (r_function_call_1.RFunctionCall.
|
|
42
|
+
if (r_function_call_1.RFunctionCall.is(node) && (0, linter_util_1.callsBuiltIn)(df.graph, node.info.id, 'as.environment') && node.arguments.length === 1 && node.arguments[0] !== r_function_call_1.EmptyArgument) {
|
|
42
43
|
return denotesGlobalPos(node.arguments[0].value);
|
|
43
44
|
}
|
|
44
45
|
if (!r_symbol_1.RSymbol.is(node)) {
|
|
@@ -166,7 +167,7 @@ exports.GLOBAL_ENVIRONMENT_MODIFICATION = {
|
|
|
166
167
|
const results = [];
|
|
167
168
|
let consideredCalls = 0;
|
|
168
169
|
const add = (node, kind, message, variable) => results.push({ ...(0, cmd_check_util_1.at)(node), kind, ...(variable !== undefined ? { variable } : {}), message });
|
|
169
|
-
for (const { name, node, vertex: call } of (0, cmd_check_util_1.packageCalls)(df.graph, idMap, pkg, WriterNames
|
|
170
|
+
for (const { name, node, vertex: call } of (0, cmd_check_util_1.packageCalls)(df.graph, idMap, pkg, WriterNames)) {
|
|
170
171
|
consideredCalls++;
|
|
171
172
|
const args = function_semantics_1.FunctionSemantics.call.match.toSpec(call.args, EnvironmentWriters[name]);
|
|
172
173
|
const arg = (formal) => {
|
|
@@ -37,8 +37,8 @@ export declare const NAMESPACE_TAMPERING: {
|
|
|
37
37
|
'.meta': {};
|
|
38
38
|
}>;
|
|
39
39
|
readonly prettyPrint: {
|
|
40
|
-
query: (r: NamespaceTamperingResult) => string;
|
|
41
|
-
full: (r: NamespaceTamperingResult) => string;
|
|
40
|
+
readonly query: (r: NamespaceTamperingResult, metadata: unknown) => string;
|
|
41
|
+
readonly full: (r: NamespaceTamperingResult, metadata: unknown) => string;
|
|
42
42
|
};
|
|
43
43
|
readonly info: {
|
|
44
44
|
readonly name: "Namespace Tampering";
|
|
@@ -14,9 +14,8 @@ const function_semantics_1 = require("../../../dataflow/fn/function-semantics");
|
|
|
14
14
|
const node_value_1 = require("../../../dataflow/eval/resolve/node-value");
|
|
15
15
|
const resolve_helper_1 = require("../../../dataflow/environments/resolve-helper");
|
|
16
16
|
const r_function_call_1 = require("../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
|
|
17
|
+
const linter_util_1 = require("../../linter-util");
|
|
17
18
|
const cmd_check_util_1 = require("./cmd-check-util");
|
|
18
|
-
/** the calls this rule is about, which spares resolving every other call */
|
|
19
|
-
const TamperingCalls = new Set(['unlockBinding', 'assignInNamespace', '.Internal', 'library.dynam', 'library.dynam.unload']);
|
|
20
19
|
/** the calls that name a namespace by the package name they are handed */
|
|
21
20
|
const NamespaceGetters = new Set(['asNamespace', 'getNamespace', 'loadNamespace']);
|
|
22
21
|
/** the package a namespace argument names, `'own'` for the package's own one, `undefined` if unknown */
|
|
@@ -28,12 +27,13 @@ function namespaceOf(node, info, own, depth = 0) {
|
|
|
28
27
|
return namespaceOf(node.value, info, own, depth);
|
|
29
28
|
}
|
|
30
29
|
let name;
|
|
31
|
-
if (r_function_call_1.RFunctionCall.
|
|
32
|
-
const
|
|
30
|
+
if (r_function_call_1.RFunctionCall.is(node)) {
|
|
31
|
+
const called = info.graph === undefined ? undefined : (0, linter_util_1.builtInOf)(info.graph, node.info.id);
|
|
32
|
+
const fn = called === undefined ? undefined : identifier_1.Identifier.getName(called);
|
|
33
33
|
if (fn === 'topenv' || fn === 'environment') {
|
|
34
34
|
return 'own';
|
|
35
35
|
}
|
|
36
|
-
if (!NamespaceGetters.has(fn) || node.arguments.length < 1 || node.arguments[0] === r_function_call_1.EmptyArgument) {
|
|
36
|
+
if (fn === undefined || !NamespaceGetters.has(fn) || node.arguments.length < 1 || node.arguments[0] === r_function_call_1.EmptyArgument) {
|
|
37
37
|
return undefined;
|
|
38
38
|
}
|
|
39
39
|
name = node_value_1.NodeValue.singleStringOf(node.arguments[0].value?.info.id, info);
|
|
@@ -64,10 +64,10 @@ function namespaceOfVariable(node, info, own, depth) {
|
|
|
64
64
|
return answers.size === 1 ? [...answers][0] : undefined;
|
|
65
65
|
}
|
|
66
66
|
/** whether the call is the one a `.Internal` call is handed, which is reported with the `.Internal` */
|
|
67
|
-
function isInternalArgument(node, idMap) {
|
|
67
|
+
function isInternalArgument(node, idMap, graph) {
|
|
68
68
|
const arg = node.info.parent === undefined ? undefined : idMap.get(node.info.parent);
|
|
69
69
|
const call = arg?.info.parent === undefined ? undefined : idMap.get(arg.info.parent);
|
|
70
|
-
return
|
|
70
|
+
return call !== undefined && (0, linter_util_1.callsBuiltIn)(graph, call.info.id, '.Internal');
|
|
71
71
|
}
|
|
72
72
|
/**
|
|
73
73
|
* Port of the `R CMD check` notes on calls that tamper with R or other packages
|
|
@@ -85,14 +85,14 @@ exports.NAMESPACE_TAMPERING = {
|
|
|
85
85
|
const info = resolve_helper_1.Resolve.info(df.graph, ctx);
|
|
86
86
|
const results = [];
|
|
87
87
|
const add = (node, result, certain = true) => results.push({ ...(0, cmd_check_util_1.at)(node, certain), ...result });
|
|
88
|
-
for (const { name, node, vertex: call } of (0, cmd_check_util_1.packageCalls)(df.graph, idMap, pkg
|
|
88
|
+
for (const { name, node, vertex: call } of (0, cmd_check_util_1.packageCalls)(df.graph, idMap, pkg)) {
|
|
89
89
|
const arg = (formals, formal) => {
|
|
90
90
|
const ids = function_semantics_1.FunctionSemantics.call.match.toSpec(call.args, formals).get(formal);
|
|
91
91
|
return ids?.length === 1 ? idMap.get(ids[0]) : undefined;
|
|
92
92
|
};
|
|
93
93
|
switch (name) {
|
|
94
94
|
case 'unlockBinding': {
|
|
95
|
-
if (isInternalArgument(node, idMap)) {
|
|
95
|
+
if (isInternalArgument(node, idMap, df.graph)) {
|
|
96
96
|
break;
|
|
97
97
|
}
|
|
98
98
|
const ns = namespaceOf(arg({ sym: 'sym', env: 'env' }, 'env'), info, pkg.name);
|
|
@@ -35,8 +35,8 @@ export declare const NON_ASCII_CODE: {
|
|
|
35
35
|
};
|
|
36
36
|
};
|
|
37
37
|
readonly prettyPrint: {
|
|
38
|
-
query: (r: NonAsciiCodeResult) => string;
|
|
39
|
-
full: (r: NonAsciiCodeResult) => string;
|
|
38
|
+
readonly query: (r: NonAsciiCodeResult, metadata: unknown) => string;
|
|
39
|
+
readonly full: (r: NonAsciiCodeResult, metadata: unknown) => string;
|
|
40
40
|
};
|
|
41
41
|
readonly info: {
|
|
42
42
|
readonly name: "Non-ASCII Code";
|
|
@@ -20,7 +20,13 @@ export interface PackageDataMetadata extends MergeableRecord {
|
|
|
20
20
|
/** Port of the data checks of `R CMD check`: `data/`, `LazyData`, save compression and serialization version, undocumented data sets. */
|
|
21
21
|
export declare const PACKAGE_DATA: {
|
|
22
22
|
readonly createSearch: () => import("../../../search/flowr-search-builder").FlowrSearchBuilder<"from", [], import("../../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, import("../../../search/flowr-search").FlowrSearchElements<import("../../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, import("../../../search/flowr-search").FlowrSearchElement<import("../../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation>[]>>;
|
|
23
|
-
readonly processSearchResult: (_elements:
|
|
23
|
+
readonly processSearchResult: (_elements: unknown, config: PackageDataConfig, data: import("../../..").ReadonlyFlowrAnalysisProvider) => PromiseLike<{
|
|
24
|
+
results: FileResult<PackageDataKind>[];
|
|
25
|
+
'.meta': {
|
|
26
|
+
inspectedDataFiles: number;
|
|
27
|
+
onDisk: boolean;
|
|
28
|
+
};
|
|
29
|
+
}> | {
|
|
24
30
|
results: FileResult<PackageDataKind>[];
|
|
25
31
|
'.meta': {
|
|
26
32
|
inspectedDataFiles: number;
|
|
@@ -28,14 +34,14 @@ export declare const PACKAGE_DATA: {
|
|
|
28
34
|
};
|
|
29
35
|
};
|
|
30
36
|
readonly prettyPrint: {
|
|
31
|
-
query: (r: {
|
|
37
|
+
readonly query: (r: {
|
|
32
38
|
readonly message: string;
|
|
33
39
|
readonly loc: import("../../..").SourceLocation;
|
|
34
|
-
}) => string;
|
|
35
|
-
full: (r: {
|
|
40
|
+
}, metadata: unknown) => string;
|
|
41
|
+
readonly full: (r: {
|
|
36
42
|
readonly message: string;
|
|
37
43
|
readonly loc: import("../../..").SourceLocation;
|
|
38
|
-
}) => string;
|
|
44
|
+
}, metadata: unknown) => string;
|
|
39
45
|
};
|
|
40
46
|
readonly info: {
|
|
41
47
|
readonly name: "Package Data";
|
|
@@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.PACKAGE_DATA = void 0;
|
|
7
|
+
const cmd_check_util_1 = require("./cmd-check-util");
|
|
7
8
|
const fs_1 = __importDefault(require("fs"));
|
|
8
9
|
const path_1 = __importDefault(require("path"));
|
|
9
10
|
const linter_format_1 = require("../../linter-format");
|
|
@@ -12,10 +13,7 @@ const linter_tags_1 = require("../../linter-tags");
|
|
|
12
13
|
const r_version_1 = require("../../../util/r-version");
|
|
13
14
|
const flowr_file_1 = require("../../../project/context/flowr-file");
|
|
14
15
|
const flowr_rda_file_1 = require("../../../project/plugins/file-plugins/files/flowr-rda-file");
|
|
15
|
-
const cmd_check_util_1 = require("./cmd-check-util");
|
|
16
|
-
const package_files_1 = require("./package-files");
|
|
17
16
|
const file_checks_1 = require("./file-checks");
|
|
18
|
-
const DataFile = /\.(R|r|RData|rdata|rda|TXT|CSV|(tab|txt|csv)(\.(gz|bz2|xz))?)$/;
|
|
19
17
|
const RdaFile = /\.(rda|RData)$/;
|
|
20
18
|
const DatalistLine = /^[^ :]+($|: +[A-Za-z.])/;
|
|
21
19
|
const LazyDataCompressions = ['gzip', 'bzip2', 'xz', 'none'];
|
|
@@ -71,13 +69,8 @@ function dependsOnR(desc, minimum) {
|
|
|
71
69
|
/** Port of the data checks of `R CMD check`: `data/`, `LazyData`, save compression and serialization version, undocumented data sets. */
|
|
72
70
|
exports.PACKAGE_DATA = {
|
|
73
71
|
createSearch: () => flowr_search_builder_1.Q.from([]),
|
|
74
|
-
processSearchResult: (
|
|
72
|
+
processSearchResult: (0, file_checks_1.onPackageFiles)({ inspectedDataFiles: 0, onDisk: false }, (pf, pkg, config, data) => {
|
|
75
73
|
const ctx = data.inspectContext();
|
|
76
|
-
const pkg = (0, cmd_check_util_1.packageInfo)(ctx);
|
|
77
|
-
const pf = (0, package_files_1.packageFiles)(ctx, pkg.name);
|
|
78
|
-
if (pf === undefined) {
|
|
79
|
-
return { results: [], '.meta': { inspectedDataFiles: 0, onDisk: false } };
|
|
80
|
-
}
|
|
81
74
|
const { results, add } = (0, file_checks_1.fileFindings)(pf);
|
|
82
75
|
const desc = pkg.description;
|
|
83
76
|
const entries = pf.entries;
|
|
@@ -103,7 +96,7 @@ exports.PACKAGE_DATA = {
|
|
|
103
96
|
}
|
|
104
97
|
});
|
|
105
98
|
}
|
|
106
|
-
const isData = (e) => !e.isDirectory && DataFile.test(path_1.default.posix.basename(e.relative));
|
|
99
|
+
const isData = (e) => !e.isDirectory && cmd_check_util_1.DataFile.test(path_1.default.posix.basename(e.relative));
|
|
107
100
|
const dataSets = children.filter(e => e.relative !== 'data/datalist' && isData(e));
|
|
108
101
|
for (const e of children) {
|
|
109
102
|
if (e.relative !== 'data/datalist' && !isData(e)) {
|
|
@@ -113,7 +106,7 @@ exports.PACKAGE_DATA = {
|
|
|
113
106
|
const names = new Map();
|
|
114
107
|
const namesOf = (e) => {
|
|
115
108
|
if (!names.has(e)) {
|
|
116
|
-
const base = path_1.default.posix.basename(e.relative).replace(DataFile, '');
|
|
109
|
+
const base = path_1.default.posix.basename(e.relative).replace(cmd_check_util_1.DataFile, '');
|
|
117
110
|
const objects = ctx.files.datasetObjects(base);
|
|
118
111
|
names.set(e, (pf.onDisk && RdaFile.test(e.relative) ? objectNamesOf(e.absolute) : undefined) ?? (objects.length > 0 ? [...objects] : [base]));
|
|
119
112
|
}
|
|
@@ -168,7 +161,7 @@ exports.PACKAGE_DATA = {
|
|
|
168
161
|
}
|
|
169
162
|
}
|
|
170
163
|
return { results, '.meta': { inspectedDataFiles: dataSets.length + entries.filter(e => e.relative === SysData).length, onDisk: pf.onDisk } };
|
|
171
|
-
},
|
|
164
|
+
}),
|
|
172
165
|
prettyPrint: file_checks_1.MessageAtLocation,
|
|
173
166
|
info: {
|
|
174
167
|
name: 'Package Data',
|
|
@@ -7,6 +7,8 @@ exports.rootDescriptionFile = rootDescriptionFile;
|
|
|
7
7
|
exports.packageFiles = packageFiles;
|
|
8
8
|
const fs_1 = __importDefault(require("fs"));
|
|
9
9
|
const path_1 = __importDefault(require("path"));
|
|
10
|
+
const regex_1 = require("../../../util/text/regex");
|
|
11
|
+
const assert_1 = require("../../../util/assert");
|
|
10
12
|
const flowr_file_1 = require("../../../project/context/flowr-file");
|
|
11
13
|
const range_1 = require("../../../util/range");
|
|
12
14
|
const files_1 = require("../../../util/files");
|
|
@@ -38,16 +40,8 @@ const MaxEntries = 50_000;
|
|
|
38
40
|
/** the `.Rbuildignore` patterns plus the defaults, compiled; a pattern that is no valid regular expression is skipped */
|
|
39
41
|
function excludePatterns(rbuildignore) {
|
|
40
42
|
const lines = [...DefaultExcludePatterns, ...(rbuildignore?.split(/\r?\n/) ?? [])].filter(l => l.trim() !== '');
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
try {
|
|
44
|
-
result.push(new RegExp(line, 'i'));
|
|
45
|
-
}
|
|
46
|
-
catch {
|
|
47
|
-
/* R would fail on it as well, but that is not this listing's finding to make */
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
return result;
|
|
43
|
+
/* R would fail on an invalid one as well, but that is not this listing's finding to make */
|
|
44
|
+
return lines.map(line => (0, regex_1.compileRegex)(line, 'i')).filter(assert_1.isNotUndefined);
|
|
51
45
|
}
|
|
52
46
|
/** whether `R CMD build` drops the entry (and, for a directory, everything below it) */
|
|
53
47
|
function isExcludedByBuild(relative, isDirectory, pkgName, patterns) {
|
|
@@ -39,8 +39,8 @@ export declare const PACKAGE_HOOKS: {
|
|
|
39
39
|
};
|
|
40
40
|
}>;
|
|
41
41
|
readonly prettyPrint: {
|
|
42
|
-
query: (r: PackageHooksResult) => string;
|
|
43
|
-
full: (r: PackageHooksResult) => string;
|
|
42
|
+
readonly query: (r: PackageHooksResult, metadata: unknown) => string;
|
|
43
|
+
readonly full: (r: PackageHooksResult, metadata: unknown) => string;
|
|
44
44
|
};
|
|
45
45
|
readonly info: {
|
|
46
46
|
readonly name: "Package Hooks";
|
|
@@ -18,6 +18,7 @@ const r_repeat_loop_1 = require("../../../r-bridge/lang-4.x/ast/model/nodes/r-re
|
|
|
18
18
|
const model_1 = require("../../../r-bridge/lang-4.x/ast/model/model");
|
|
19
19
|
const function_semantics_1 = require("../../../dataflow/fn/function-semantics");
|
|
20
20
|
const flowr_namespace_file_1 = require("../../../project/plugins/file-plugins/files/flowr-namespace-file");
|
|
21
|
+
const linter_util_1 = require("../../linter-util");
|
|
21
22
|
const cmd_check_util_1 = require("./cmd-check-util");
|
|
22
23
|
/** the hooks R calls as the package is loaded or attached */
|
|
23
24
|
const StartupHooks = new Set(['.onLoad', '.onAttach', '.First.lib']);
|
|
@@ -28,9 +29,10 @@ const MisplacedCalls = {
|
|
|
28
29
|
'library.dynam': { in: ['.onAttach'], instead: '.onLoad' },
|
|
29
30
|
'library.dynam.unload': { in: ['.onDetach', '.Last.lib'], instead: '.onUnload' }
|
|
30
31
|
};
|
|
32
|
+
const BranchingCalls = new Set(['switch', 'tryCatch']);
|
|
31
33
|
/** the constructs whose body may or may not run */
|
|
32
|
-
function isConditional(node) {
|
|
33
|
-
return r_if_then_else_1.RIfThenElse.is(node) || r_while_loop_1.RWhileLoop.is(node) || r_for_loop_1.RForLoop.is(node) || r_repeat_loop_1.RRepeatLoop.is(node) || r_function_call_1.RFunctionCall.
|
|
34
|
+
function isConditional(node, graph) {
|
|
35
|
+
return r_if_then_else_1.RIfThenElse.is(node) || r_while_loop_1.RWhileLoop.is(node) || r_for_loop_1.RForLoop.is(node) || r_repeat_loop_1.RRepeatLoop.is(node) || r_function_call_1.RFunctionCall.is(node) && (0, linter_util_1.callsBuiltIn)(graph, node.info.id, BranchingCalls);
|
|
34
36
|
}
|
|
35
37
|
/**
|
|
36
38
|
* Every call made within the given definition and, if asked, within the package functions it calls (transitively).
|
|
@@ -45,14 +47,14 @@ function reachedCalls(def, df, idMap, follow) {
|
|
|
45
47
|
const { via } = item;
|
|
46
48
|
let conditional = 0;
|
|
47
49
|
model_1.RNode.visitAst(item.def.body, node => {
|
|
48
|
-
if (via !== undefined && (isConditional(node) || r_function_definition_1.RFunctionDefinition.is(node))) {
|
|
50
|
+
if (via !== undefined && (isConditional(node, df.graph) || r_function_definition_1.RFunctionDefinition.is(node))) {
|
|
49
51
|
conditional++;
|
|
50
52
|
}
|
|
51
53
|
const vertex = df.graph.getVertex(node.info.id);
|
|
52
54
|
if (!vertex_1.DfgVertex.isFunctionCall(vertex) || conditional > 0) {
|
|
53
55
|
return false;
|
|
54
56
|
}
|
|
55
|
-
result.push({ id: node.info.id, name: identifier_1.Identifier.getName(vertex.name), via });
|
|
57
|
+
result.push({ id: node.info.id, name: identifier_1.Identifier.getName((0, linter_util_1.builtInOf)(df.graph, node.info.id) ?? vertex.name), via });
|
|
56
58
|
for (const callee of follow ? (0, cmd_check_util_1.calledDefinitions)(df.graph, node.info.id, idMap) : []) {
|
|
57
59
|
if (!visited.has(callee.info.id)) {
|
|
58
60
|
visited.add(callee.info.id);
|
|
@@ -61,7 +63,7 @@ function reachedCalls(def, df, idMap, follow) {
|
|
|
61
63
|
}
|
|
62
64
|
return false;
|
|
63
65
|
}, node => {
|
|
64
|
-
if (via !== undefined && (isConditional(node) || r_function_definition_1.RFunctionDefinition.is(node))) {
|
|
66
|
+
if (via !== undefined && (isConditional(node, df.graph) || r_function_definition_1.RFunctionDefinition.is(node))) {
|
|
65
67
|
conditional--;
|
|
66
68
|
}
|
|
67
69
|
});
|
|
@@ -84,10 +86,10 @@ function hasNamedArgument(id, df, name) {
|
|
|
84
86
|
return vertex_1.DfgVertex.isFunctionCall(vertex) && vertex.args.some(a => a !== r_function_call_1.EmptyArgument && a.name === name);
|
|
85
87
|
}
|
|
86
88
|
/** `message()` called in a hook as the startup message function, which takes the same arguments */
|
|
87
|
-
function asStartupMessage(call, startup) {
|
|
89
|
+
function asStartupMessage(call, startup, graph) {
|
|
88
90
|
const own = r_function_call_1.RFunctionCall.isNamed(call) ? range_1.SourceRange.ownFromNode(call.functionName) : undefined;
|
|
89
91
|
const loc = own === undefined ? undefined : range_1.SourceLocation.from(own, call?.info.file);
|
|
90
|
-
return startup === undefined || loc === undefined ||
|
|
92
|
+
return startup === undefined || loc === undefined || call === undefined || !(0, linter_util_1.callsBuiltIn)(graph, call.info.id, 'message')
|
|
91
93
|
? undefined : [{ type: 'replace', loc, description: `Use \`${startup}\``, replacement: startup }];
|
|
92
94
|
}
|
|
93
95
|
/**
|
|
@@ -150,7 +152,7 @@ exports.PACKAGE_HOOKS = {
|
|
|
150
152
|
else if (startupMessages.has(name) ? hook === '.onLoad' : built_in_props_1.CallProps.hasAny(props, built_in_props_1.SemanticCallTag.Prints) && !allowedOutput.has(name) && !writesToResource(id, df, props?.sig)) {
|
|
151
153
|
report('output', hook === '.onLoad' && startupMessages.has(name)
|
|
152
154
|
? `.onLoad should not print startup messages with ${name}, use .onAttach instead${through}`
|
|
153
|
-
: `Package startup functions should use ${config.startupMessageFunctions[0] ?? 'packageStartupMessage'} to generate messages, but ${hook} calls ${name}${through}`, at, name, via === undefined, via === undefined && hook !== '.onLoad' ? asStartupMessage(idMap.get(id), config.startupMessageFunctions[0]) : undefined);
|
|
155
|
+
: `Package startup functions should use ${config.startupMessageFunctions[0] ?? 'packageStartupMessage'} to generate messages, but ${hook} calls ${name}${through}`, at, name, via === undefined, via === undefined && hook !== '.onLoad' ? asStartupMessage(idMap.get(id), config.startupMessageFunctions[0], df.graph) : undefined);
|
|
154
156
|
}
|
|
155
157
|
}
|
|
156
158
|
}
|
|
@@ -24,15 +24,20 @@ export interface PackageMetafilesMetadata extends MergeableRecord {
|
|
|
24
24
|
/** Port of the `R CMD check` notes on `INDEX`, `demo/00Index`, `inst/CITATION`, CITATION locations, and relative links of README, NEWS and vignettes. */
|
|
25
25
|
export declare const PACKAGE_METAFILES: {
|
|
26
26
|
readonly createSearch: () => import("../../../search/flowr-search-builder").FlowrSearchBuilder<"from", [], ParentInformation, import("../../../search/flowr-search").FlowrSearchElements<ParentInformation, import("../../../search/flowr-search").FlowrSearchElement<ParentInformation>[]>>;
|
|
27
|
-
readonly processSearchResult: (_elements:
|
|
27
|
+
readonly processSearchResult: (_elements: unknown, config: PackageMetafilesConfig, data: ReadonlyFlowrAnalysisProvider) => PromiseLike<{
|
|
28
|
+
results: FileResult<PackageMetafilesKind>[];
|
|
29
|
+
'.meta': {
|
|
30
|
+
checkedFiles: number;
|
|
31
|
+
};
|
|
32
|
+
}> | {
|
|
28
33
|
results: FileResult<PackageMetafilesKind>[];
|
|
29
34
|
'.meta': {
|
|
30
35
|
checkedFiles: number;
|
|
31
36
|
};
|
|
32
37
|
};
|
|
33
38
|
readonly prettyPrint: {
|
|
34
|
-
readonly query: (
|
|
35
|
-
readonly full: (
|
|
39
|
+
readonly query: (r: PackageMetafilesResult, metadata: unknown) => string;
|
|
40
|
+
readonly full: (r: PackageMetafilesResult, metadata: unknown) => string;
|
|
36
41
|
};
|
|
37
42
|
readonly info: {
|
|
38
43
|
readonly name: "Package Metafiles";
|
|
@@ -16,7 +16,6 @@ const model_1 = require("../../../r-bridge/lang-4.x/ast/model/model");
|
|
|
16
16
|
const identifier_1 = require("../../../dataflow/environments/identifier");
|
|
17
17
|
const cmd_check_util_1 = require("./cmd-check-util");
|
|
18
18
|
const file_checks_1 = require("./file-checks");
|
|
19
|
-
const package_files_1 = require("./package-files");
|
|
20
19
|
/** the `BibTeX` entry types `R CMD check` knows, with their required fields (alternatives joined by `|`) */
|
|
21
20
|
const BibTeXRequiredFields = new Map(Object.entries({
|
|
22
21
|
article: ['author', 'title', 'journal', 'year'],
|
|
@@ -249,12 +248,7 @@ function checkRelativeLinks(files, report) {
|
|
|
249
248
|
/** Port of the `R CMD check` notes on `INDEX`, `demo/00Index`, `inst/CITATION`, CITATION locations, and relative links of README, NEWS and vignettes. */
|
|
250
249
|
exports.PACKAGE_METAFILES = {
|
|
251
250
|
createSearch: () => flowr_search_builder_1.Q.from([]),
|
|
252
|
-
processSearchResult: (
|
|
253
|
-
const ctx = data.inspectContext();
|
|
254
|
-
const files = (0, package_files_1.packageFiles)(ctx, (0, cmd_check_util_1.packageInfo)(ctx).name);
|
|
255
|
-
if (files === undefined) {
|
|
256
|
-
return { results: [], '.meta': { checkedFiles: 0 } };
|
|
257
|
-
}
|
|
251
|
+
processSearchResult: (0, file_checks_1.onPackageFiles)({ checkedFiles: 0 }, (files, _pkg, config, data) => {
|
|
258
252
|
const { results, add } = (0, file_checks_1.fileFindings)(files);
|
|
259
253
|
const report = (kind, file, line, message) => add(kind, file, message, line);
|
|
260
254
|
let checked = 0;
|
|
@@ -271,11 +265,8 @@ exports.PACKAGE_METAFILES = {
|
|
|
271
265
|
checked += checkRelativeLinks(files, report);
|
|
272
266
|
}
|
|
273
267
|
return { results, '.meta': { checkedFiles: checked } };
|
|
274
|
-
},
|
|
275
|
-
prettyPrint: {
|
|
276
|
-
[linter_format_1.LintingPrettyPrintContext.Query]: result => `${result.kind} in ${result.file} at ${range_1.SourceLocation.format(result.loc)}`,
|
|
277
|
-
[linter_format_1.LintingPrettyPrintContext.Full]: result => `${result.message} (at ${range_1.SourceLocation.format(result.loc)})`
|
|
278
|
-
},
|
|
268
|
+
}),
|
|
269
|
+
prettyPrint: (0, linter_format_1.prettyPrint)(result => `${result.kind} in ${result.file} at ${range_1.SourceLocation.format(result.loc)}`, result => `${result.message} (at ${range_1.SourceLocation.format(result.loc)})`),
|
|
279
270
|
info: {
|
|
280
271
|
name: 'Package Metafiles',
|
|
281
272
|
tags: [linter_tags_1.LintingRuleTag.CmdCheck, linter_tags_1.LintingRuleTag.Robustness],
|
|
@@ -29,6 +29,10 @@ export type PackageRuntimeKind =
|
|
|
29
29
|
| 'rust-requirements'
|
|
30
30
|
/** a package without a NAMESPACE file, which no package may be since R 3.0.0 */
|
|
31
31
|
| 'missing-namespace'
|
|
32
|
+
/** an `exportPattern` that matches nothing the package defines, so it exports nothing */
|
|
33
|
+
| 'empty-export-pattern'
|
|
34
|
+
/** a NAMESPACE that exports nothing at all, so attaching the package gives access to nothing */
|
|
35
|
+
| 'no-exports'
|
|
32
36
|
/** a DESCRIPTION `Type` other than `Package` */
|
|
33
37
|
| 'extension-type'
|
|
34
38
|
/** an installed package (or a build left inside the sources) handed to the check instead of a source package */
|
|
@@ -39,6 +43,10 @@ export interface PackageRuntimeResult extends CmdCheckResult {
|
|
|
39
43
|
export interface PackageRuntimeConfig extends MergeableRecord {
|
|
40
44
|
/** report writes of tests and vignettes into the working directory (default `true`) */
|
|
41
45
|
readonly checkWrites: boolean;
|
|
46
|
+
/** report exports of undefined names and export patterns matching nothing (default `true`) */
|
|
47
|
+
readonly checkExports: boolean;
|
|
48
|
+
/** report a NAMESPACE that exports nothing, unless the package ships data (default `true`) */
|
|
49
|
+
readonly requireExports: boolean;
|
|
42
50
|
}
|
|
43
51
|
export type PackageRuntimeMetadata = MergeableRecord;
|
|
44
52
|
/**
|
|
@@ -47,21 +55,26 @@ export type PackageRuntimeMetadata = MergeableRecord;
|
|
|
47
55
|
*/
|
|
48
56
|
export declare const PACKAGE_RUNTIME: {
|
|
49
57
|
readonly createSearch: () => import("../../../search/flowr-search-builder").FlowrSearchBuilder<"from", [], ParentInformation, import("../../../search/flowr-search").FlowrSearchElements<ParentInformation, import("../../../search/flowr-search").FlowrSearchElement<ParentInformation>[]>>;
|
|
50
|
-
readonly processSearchResult: (_elements:
|
|
58
|
+
readonly processSearchResult: (_elements: unknown, config: PackageRuntimeConfig, data: ReadonlyFlowrAnalysisProvider) => PromiseLike<{
|
|
51
59
|
results: PackageRuntimeResult[];
|
|
52
60
|
'.meta': {};
|
|
53
|
-
}
|
|
61
|
+
}> | {
|
|
62
|
+
results: PackageRuntimeResult[];
|
|
63
|
+
'.meta': {};
|
|
64
|
+
};
|
|
54
65
|
readonly prettyPrint: {
|
|
55
|
-
query: (r: PackageRuntimeResult) => string;
|
|
56
|
-
full: (r: PackageRuntimeResult) => string;
|
|
66
|
+
readonly query: (r: PackageRuntimeResult, metadata: unknown) => string;
|
|
67
|
+
readonly full: (r: PackageRuntimeResult, metadata: unknown) => string;
|
|
57
68
|
};
|
|
58
69
|
readonly info: {
|
|
59
70
|
readonly name: "Package Runtime";
|
|
60
71
|
readonly tags: readonly [LintingRuleTag.CmdCheck, LintingRuleTag.Bug, LintingRuleTag.Robustness];
|
|
61
72
|
readonly certainty: LintingRuleCertainty.BestEffort;
|
|
62
|
-
readonly description: "Finds what makes installing, loading, or running the package fail without doing so: undefined exports, S3 methods without a function, bad NAMESPACE imports, a package attaching itself, tests that never run, test or vignette code that does not parse, missing vignette metadata, and files written into the working directory.";
|
|
73
|
+
readonly description: "Finds what makes installing, loading, or running the package fail without doing so: undefined exports, export patterns matching nothing, a NAMESPACE exporting nothing, S3 methods without a function, bad NAMESPACE imports, a package attaching itself, tests that never run, test or vignette code that does not parse, missing vignette metadata, and files written into the working directory.";
|
|
63
74
|
readonly defaultConfig: () => {
|
|
64
75
|
checkWrites: true;
|
|
76
|
+
checkExports: true;
|
|
77
|
+
requireExports: true;
|
|
65
78
|
};
|
|
66
79
|
};
|
|
67
80
|
};
|