@eagleoutice/flowr 2.16.6 → 2.16.8
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 +12 -1
- package/dataflow/environments/reference-to-maybe.js +1 -6
- 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/dataflowgraph-builder.d.ts +4 -4
- 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 +9 -10
- package/dataflow/graph/vertex.d.ts +1 -1
- package/dataflow/hooks.d.ts +1 -1
- package/dataflow/info.d.ts +3 -3
- package/dataflow/internal/linker.d.ts +4 -1
- package/dataflow/internal/linker.js +12 -8
- 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 +21 -46
- 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 +4 -1
- 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 +43 -7
- 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/dataflow/processor.d.ts +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/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
package/linter/linter-rules.js
CHANGED
|
@@ -21,6 +21,7 @@ const undefined_symbol_1 = require("./rules/undefined-symbol");
|
|
|
21
21
|
const unused_import_1 = require("./rules/unused-import");
|
|
22
22
|
const syntactically_valid_1 = require("./rules/syntactically-valid");
|
|
23
23
|
const unclosed_connection_1 = require("./rules/unclosed-connection");
|
|
24
|
+
const overwritten_file_1 = require("./rules/overwritten-file");
|
|
24
25
|
const unescaped_arguments_1 = require("./rules/unescaped-arguments");
|
|
25
26
|
const namespace_access_1 = require("./rules/namespace-access");
|
|
26
27
|
const class_string_comparison_1 = require("./rules/cmd-check/class-string-comparison");
|
|
@@ -67,6 +68,7 @@ exports.LintingRules = {
|
|
|
67
68
|
'unused-import': unused_import_1.UNUSED_IMPORT,
|
|
68
69
|
'syntactically-valid': syntactically_valid_1.SYNTACTICALLY_VALID,
|
|
69
70
|
'unclosed-connection': unclosed_connection_1.UNCLOSED_CONNECTION,
|
|
71
|
+
'overwritten-file': overwritten_file_1.OVERWRITTEN_FILE,
|
|
70
72
|
'unescaped-arguments': unescaped_arguments_1.UNESCAPED_ARGUMENTS,
|
|
71
73
|
'namespace-access': namespace_access_1.NAMESPACE_ACCESS,
|
|
72
74
|
'class-string-comparison': class_string_comparison_1.CLASS_STRING_COMPARISON,
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { SourceLocation } from '../util/range';
|
|
2
|
+
import { type LintingResult } from './linter-format';
|
|
3
|
+
import type { RNode } from '../r-bridge/lang-4.x/ast/model/model';
|
|
4
|
+
import type { ParentInformation } from '../r-bridge/lang-4.x/ast/model/processing/decorate';
|
|
5
|
+
import type { DataflowGraph } from '../dataflow/graph/graph';
|
|
6
|
+
import { Identifier } from '../dataflow/environments/identifier';
|
|
7
|
+
import type { BuiltInIndex } from '../dataflow/environments/query-fn-props';
|
|
8
|
+
import type { PropSelector } from '../dataflow/environments/built-in-props';
|
|
9
|
+
import { NodeId } from '../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
10
|
+
/** The certainty, involved node, and location of a finding at a node or location. */
|
|
11
|
+
export declare function at(where: RNode<ParentInformation> | SourceLocation | undefined, certain?: boolean): Pick<LintingResult, 'certainty' | 'involvedId' | 'loc'>;
|
|
12
|
+
/**
|
|
13
|
+
* The function the call `id` calls, found through the dataflow origins so shadowing, aliasing, and `pkg::fn` are
|
|
14
|
+
* accounted for: the built-in it resolves to, or the name it is called by if no code of the analyzed program
|
|
15
|
+
* defines it. `undefined` if it may reach code of the program.
|
|
16
|
+
*/
|
|
17
|
+
export declare function builtInOf(graph: DataflowGraph, id: NodeId): Identifier | undefined;
|
|
18
|
+
/** Whether the call `id` resolves to a built-in of one of the plain `names`, wherever it was imported from. */
|
|
19
|
+
export declare function callsBuiltIn(graph: DataflowGraph, id: NodeId, names: string | ReadonlySet<string>): boolean;
|
|
20
|
+
/** Whether the built-in the call `id` resolves to states one of the `props` (a {@link CallProp} or {@link SemanticCallTag}). */
|
|
21
|
+
export declare function callHas(graph: DataflowGraph, id: NodeId, index: BuiltInIndex, props: PropSelector): boolean;
|
|
22
|
+
/** The plain names of the built-ins carrying one of the `props`, to filter AST-only code (no dataflow) by what flowR states. */
|
|
23
|
+
export declare function namesWith(index: BuiltInIndex, props: PropSelector): ReadonlySet<string>;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.at = at;
|
|
4
|
+
exports.builtInOf = builtInOf;
|
|
5
|
+
exports.callsBuiltIn = callsBuiltIn;
|
|
6
|
+
exports.callHas = callHas;
|
|
7
|
+
exports.namesWith = namesWith;
|
|
8
|
+
const range_1 = require("../util/range");
|
|
9
|
+
const linter_format_1 = require("./linter-format");
|
|
10
|
+
const df_helper_1 = require("../dataflow/graph/df-helper");
|
|
11
|
+
const vertex_1 = require("../dataflow/graph/vertex");
|
|
12
|
+
const identifier_1 = require("../dataflow/environments/identifier");
|
|
13
|
+
const function_semantics_1 = require("../dataflow/fn/function-semantics");
|
|
14
|
+
const node_id_1 = require("../r-bridge/lang-4.x/ast/model/processing/node-id");
|
|
15
|
+
/** The certainty, involved node, and location of a finding at a node or location. */
|
|
16
|
+
function at(where, certain = true) {
|
|
17
|
+
const node = Array.isArray(where) ? undefined : where;
|
|
18
|
+
return {
|
|
19
|
+
certainty: certain ? linter_format_1.LintingResultCertainty.Certain : linter_format_1.LintingResultCertainty.Uncertain,
|
|
20
|
+
involvedId: node?.info.id,
|
|
21
|
+
loc: (node ? range_1.SourceLocation.fromNode(node) : where) ?? range_1.SourceLocation.invalid()
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* The function the call `id` calls, found through the dataflow origins so shadowing, aliasing, and `pkg::fn` are
|
|
26
|
+
* accounted for: the built-in it resolves to, or the name it is called by if no code of the analyzed program
|
|
27
|
+
* defines it. `undefined` if it may reach code of the program.
|
|
28
|
+
*/
|
|
29
|
+
function builtInOf(graph, id) {
|
|
30
|
+
const origins = df_helper_1.Dataflow.origin(graph, id) ?? [];
|
|
31
|
+
if (origins.length === 0) {
|
|
32
|
+
const vertex = graph.getVertex(id);
|
|
33
|
+
return vertex_1.DfgVertex.isFunctionCall(vertex) ? vertex.name : undefined;
|
|
34
|
+
}
|
|
35
|
+
const names = new Set(origins.map(o => o.type === 3 /* OriginType.BuiltInFunctionOrigin */ ? o.fn.name : undefined));
|
|
36
|
+
if (names.size !== 1 || names.has(undefined)) {
|
|
37
|
+
return undefined;
|
|
38
|
+
}
|
|
39
|
+
const [name] = names;
|
|
40
|
+
const pkgFn = node_id_1.NodeId.toPkgFn(node_id_1.NodeId.toBuiltIn(name));
|
|
41
|
+
return pkgFn === undefined ? name : identifier_1.Identifier.make(pkgFn[1], pkgFn[0]);
|
|
42
|
+
}
|
|
43
|
+
/** Whether the call `id` resolves to a built-in of one of the plain `names`, wherever it was imported from. */
|
|
44
|
+
function callsBuiltIn(graph, id, names) {
|
|
45
|
+
const builtIn = builtInOf(graph, id);
|
|
46
|
+
return builtIn !== undefined && (typeof names === 'string' ? names === identifier_1.Identifier.getName(builtIn) : names.has(identifier_1.Identifier.getName(builtIn)));
|
|
47
|
+
}
|
|
48
|
+
/** Whether the built-in the call `id` resolves to states one of the `props` (a {@link CallProp} or {@link SemanticCallTag}). */
|
|
49
|
+
function callHas(graph, id, index, props) {
|
|
50
|
+
const builtIn = builtInOf(graph, id);
|
|
51
|
+
const entry = builtIn === undefined ? undefined : index.get(builtIn);
|
|
52
|
+
return entry !== undefined && function_semantics_1.FunctionSemantics.call.props.hasAny(entry, props);
|
|
53
|
+
}
|
|
54
|
+
/** The plain names of the built-ins carrying one of the `props`, to filter AST-only code (no dataflow) by what flowR states. */
|
|
55
|
+
function namesWith(index, props) {
|
|
56
|
+
return new Set(index.with(props).map(n => identifier_1.Identifier.getName(n)));
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=linter-util.js.map
|
|
@@ -40,8 +40,8 @@ export declare const ABSOLUTE_PATH: {
|
|
|
40
40
|
".meta": AbsoluteFilePathMetadata;
|
|
41
41
|
}>;
|
|
42
42
|
readonly prettyPrint: {
|
|
43
|
-
readonly query: (
|
|
44
|
-
readonly full: (
|
|
43
|
+
readonly query: (r: AbsoluteFilePathResult, metadata: unknown) => string;
|
|
44
|
+
readonly full: (r: AbsoluteFilePathResult, metadata: unknown) => string;
|
|
45
45
|
};
|
|
46
46
|
readonly info: {
|
|
47
47
|
readonly name: "Absolute Paths";
|
|
@@ -163,10 +163,7 @@ exports.ABSOLUTE_PATH = {
|
|
|
163
163
|
'.meta': metadata
|
|
164
164
|
};
|
|
165
165
|
},
|
|
166
|
-
prettyPrint: {
|
|
167
|
-
[linter_format_1.LintingPrettyPrintContext.Query]: result => `Path \`${result.filePath}\` at ${range_1.SourceLocation.format(result.loc)}`,
|
|
168
|
-
[linter_format_1.LintingPrettyPrintContext.Full]: result => `Path \`${result.filePath}\` at ${range_1.SourceLocation.format(result.loc)} is absolute`
|
|
169
|
-
},
|
|
166
|
+
prettyPrint: (0, linter_format_1.prettyPrint)(result => `Path \`${result.filePath}\` at ${range_1.SourceLocation.format(result.loc)}`, result => `Path \`${result.filePath}\` at ${range_1.SourceLocation.format(result.loc)} is absolute`),
|
|
170
167
|
info: {
|
|
171
168
|
name: 'Absolute Paths',
|
|
172
169
|
description: 'Finds absolute file paths.',
|
|
@@ -16,8 +16,8 @@ export declare const BOGUS_RETURN: {
|
|
|
16
16
|
'.meta': {};
|
|
17
17
|
}>;
|
|
18
18
|
readonly prettyPrint: {
|
|
19
|
-
query: (r: BogusReturnResult) => string;
|
|
20
|
-
full: (r: BogusReturnResult) => string;
|
|
19
|
+
readonly query: (r: BogusReturnResult, metadata: unknown) => string;
|
|
20
|
+
readonly full: (r: BogusReturnResult, metadata: unknown) => string;
|
|
21
21
|
};
|
|
22
22
|
readonly info: {
|
|
23
23
|
readonly name: "Bogus Return";
|
|
@@ -7,7 +7,6 @@ const flowr_search_builder_1 = require("../../../search/flowr-search-builder");
|
|
|
7
7
|
const type_1 = require("../../../r-bridge/lang-4.x/ast/model/type");
|
|
8
8
|
const linter_tags_1 = require("../../linter-tags");
|
|
9
9
|
const range_1 = require("../../../util/range");
|
|
10
|
-
const identifier_1 = require("../../../dataflow/environments/identifier");
|
|
11
10
|
const vertex_1 = require("../../../dataflow/graph/vertex");
|
|
12
11
|
const edge_1 = require("../../../dataflow/graph/edge");
|
|
13
12
|
const df_helper_1 = require("../../../dataflow/graph/df-helper");
|
|
@@ -24,17 +23,14 @@ exports.BOGUS_RETURN = {
|
|
|
24
23
|
const pkg = (0, cmd_check_util_1.packageInfo)(data.inspectContext());
|
|
25
24
|
const results = [];
|
|
26
25
|
for (const { node } of elements.getElements()) {
|
|
27
|
-
if (!r_symbol_1.RSymbol.is(node) ||
|
|
26
|
+
if (!r_symbol_1.RSymbol.is(node) || !pkg.isPackageCode(node.info.file)) {
|
|
28
27
|
continue;
|
|
29
28
|
}
|
|
30
29
|
/* a call of `return` has a call vertex, a bare read is a use that resolves to the built-in */
|
|
31
30
|
const vertex = graph.getVertex(node.info.id);
|
|
32
31
|
const loc = range_1.SourceLocation.fromNode(node);
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
const targets = df_helper_1.Dataflow.targetsOf(graph, node.info.id, edge_1.EdgeType.Reads);
|
|
37
|
-
if (targets.some(t => !node_id_1.NodeId.isBuiltIn(t))) {
|
|
32
|
+
const targets = vertex_1.DfgVertex.isUse(vertex) ? df_helper_1.Dataflow.targetsOf(graph, node.info.id, edge_1.EdgeType.Reads) : [];
|
|
33
|
+
if (loc === undefined || targets.length === 0 || !targets.every(t => node_id_1.NodeId.isBuiltIn(t) && node_id_1.NodeId.fromBuiltIn(t) === 'return') || (0, cmd_check_util_1.isQuoted)(graph, node.info.id, idMap)) {
|
|
38
34
|
continue;
|
|
39
35
|
}
|
|
40
36
|
const fn = idMap.get(model_1.RNode.findEnclosing(node.info.id, idMap, r_function_definition_1.RFunctionDefinition.is) ?? '');
|
|
@@ -47,8 +47,8 @@ export declare const CALL_ARGUMENTS: {
|
|
|
47
47
|
};
|
|
48
48
|
}>;
|
|
49
49
|
readonly prettyPrint: {
|
|
50
|
-
query: (r: CallArgumentsResult) => string;
|
|
51
|
-
full: (r: CallArgumentsResult) => string;
|
|
50
|
+
readonly query: (r: CallArgumentsResult, metadata: unknown) => string;
|
|
51
|
+
readonly full: (r: CallArgumentsResult, metadata: unknown) => string;
|
|
52
52
|
};
|
|
53
53
|
readonly info: {
|
|
54
54
|
readonly name: "Call Arguments";
|
|
@@ -32,8 +32,8 @@ export declare const CLASS_STRING_COMPARISON: {
|
|
|
32
32
|
};
|
|
33
33
|
}>;
|
|
34
34
|
readonly prettyPrint: {
|
|
35
|
-
query: (r: ClassStringComparisonResult) => string;
|
|
36
|
-
full: (r: ClassStringComparisonResult) => string;
|
|
35
|
+
readonly query: (r: ClassStringComparisonResult, metadata: unknown) => string;
|
|
36
|
+
readonly full: (r: ClassStringComparisonResult, metadata: unknown) => string;
|
|
37
37
|
};
|
|
38
38
|
readonly info: {
|
|
39
39
|
readonly name: "Class String Comparison";
|
|
@@ -13,18 +13,14 @@ const linter_tags_1 = require("../../linter-tags");
|
|
|
13
13
|
const range_1 = require("../../../util/range");
|
|
14
14
|
const model_1 = require("../../../r-bridge/lang-4.x/ast/model/model");
|
|
15
15
|
const r_function_call_1 = require("../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
|
|
16
|
-
const
|
|
16
|
+
const linter_util_1 = require("../../linter-util");
|
|
17
17
|
const resolve_helper_1 = require("../../../dataflow/environments/resolve-helper");
|
|
18
18
|
const node_value_1 = require("../../../dataflow/eval/resolve/node-value");
|
|
19
19
|
const cmd_check_util_1 = require("./cmd-check-util");
|
|
20
20
|
const LogicalOps = new Set(['&&', '||', '&', '|']);
|
|
21
|
-
/** whether the node is a call of the built-in `class`,
|
|
21
|
+
/** whether the node is a call of the built-in `class`, however it is reached */
|
|
22
22
|
function isBuiltinClassCall(node, graph) {
|
|
23
|
-
|
|
24
|
-
return false;
|
|
25
|
-
}
|
|
26
|
-
const origins = df_helper_1.Dataflow.origin(graph, node.info.id);
|
|
27
|
-
return origins === undefined || origins.every(o => o.type === 3 /* OriginType.BuiltInFunctionOrigin */);
|
|
23
|
+
return r_function_call_1.RFunctionCall.is(node) && node.arguments.length === 1 && node.arguments[0] !== r_function_call_1.EmptyArgument && (0, linter_util_1.callsBuiltIn)(graph, node.info.id, 'class');
|
|
28
24
|
}
|
|
29
25
|
/** the class names `node` stands for: a string literal, or (if allowed) what flowR resolves it to */
|
|
30
26
|
function stringsOf(node, graph, ctx, resolve) {
|
|
@@ -7,7 +7,7 @@ import type { DataflowGraph } from '../../../dataflow/graph/graph';
|
|
|
7
7
|
import { RNode } from '../../../r-bridge/lang-4.x/ast/model/model';
|
|
8
8
|
import type { NodeId } from '../../../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
9
9
|
import { type LintingResult } from '../../linter-format';
|
|
10
|
-
|
|
10
|
+
export { at } from '../../linter-util';
|
|
11
11
|
import { type DataflowGraphVertexFunctionCall } from '../../../dataflow/graph/vertex';
|
|
12
12
|
/** The DESCRIPTION fields declaring a package dependency. */
|
|
13
13
|
export declare const DependencyFields: readonly ["Depends", "Imports", "Suggests", "Enhances", "LinkingTo"];
|
|
@@ -45,23 +45,22 @@ export declare function formalNames(def: RFunctionDefinition<ParentInformation>)
|
|
|
45
45
|
export declare function isWithin(id: NodeId, def: NodeId, idMap: AstIdMap): boolean;
|
|
46
46
|
/** The function definitions a call reaches by its `Calls` edges. */
|
|
47
47
|
export declare function calledDefinitions(graph: DataflowGraph, call: NodeId, idMap: AstIdMap): RFunctionDefinition<ParentInformation>[];
|
|
48
|
-
/** Whether the call reaches the built-in function only, and no definition of the code. */
|
|
49
|
-
export declare function isBuiltInCall(graph: DataflowGraph, id: NodeId): boolean;
|
|
50
48
|
/** Whether the node or an ancestor is quoted or otherwise evaluated elsewhere (`quote(...)`, a data mask). */
|
|
51
49
|
export declare function isQuoted(graph: DataflowGraph, id: NodeId, idMap: AstIdMap): boolean;
|
|
52
50
|
/** The packages `R CMD check` takes as declared without a DESCRIPTION entry: the base packages but `methods` and `stats4`. */
|
|
53
51
|
export declare function isStandardPackage(pkg: string): boolean;
|
|
54
|
-
/** The certainty, involved node, and location of a finding at a node or location. */
|
|
55
|
-
export declare function at(where: RNode<ParentInformation> | SourceLocation | undefined, certain?: boolean): Pick<LintingResult, 'certainty' | 'involvedId' | 'loc'>;
|
|
56
52
|
/** The pretty printers of a rule: `query` describes a result, the full one is its message and location. */
|
|
57
53
|
export declare function printer<R extends CmdCheckResult>(query: (r: R) => string): {
|
|
58
|
-
query: (r: R) => string;
|
|
59
|
-
full: (r: R) => string;
|
|
54
|
+
readonly query: (r: R, metadata: unknown) => string;
|
|
55
|
+
readonly full: (r: R, metadata: unknown) => string;
|
|
60
56
|
};
|
|
61
|
-
/** The calls (by name, if given) of package code, with the node and vertex of each;
|
|
62
|
-
export declare function packageCalls(graph: DataflowGraph, idMap: AstIdMap, pkg: PackageInfo, names?: ReadonlySet<string
|
|
57
|
+
/** The calls (by name, if given) of package code, with the node and vertex of each; those resolving to a built-in, named by it. */
|
|
58
|
+
export declare function packageCalls(graph: DataflowGraph, idMap: AstIdMap, pkg: PackageInfo, names?: ReadonlySet<string>): Generator<{
|
|
63
59
|
id: NodeId;
|
|
64
60
|
name: string;
|
|
65
61
|
node: RNode<ParentInformation>;
|
|
66
62
|
vertex: DataflowGraphVertexFunctionCall;
|
|
67
63
|
}>;
|
|
64
|
+
/** the extensions R reads as data sets from a package's `data` directory, including the compressed forms */
|
|
65
|
+
export declare const DataSetExtensions: readonly string[];
|
|
66
|
+
export declare const DataFile: RegExp;
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.DependencyFields = void 0;
|
|
6
|
+
exports.DataFile = exports.DataSetExtensions = exports.DependencyFields = exports.at = void 0;
|
|
7
7
|
exports.packageInfo = packageInfo;
|
|
8
8
|
exports.allDeclared = allDeclared;
|
|
9
9
|
exports.boundName = boundName;
|
|
@@ -12,10 +12,8 @@ exports.topLevelDefinitions = topLevelDefinitions;
|
|
|
12
12
|
exports.formalNames = formalNames;
|
|
13
13
|
exports.isWithin = isWithin;
|
|
14
14
|
exports.calledDefinitions = calledDefinitions;
|
|
15
|
-
exports.isBuiltInCall = isBuiltInCall;
|
|
16
15
|
exports.isQuoted = isQuoted;
|
|
17
16
|
exports.isStandardPackage = isStandardPackage;
|
|
18
|
-
exports.at = at;
|
|
19
17
|
exports.printer = printer;
|
|
20
18
|
exports.packageCalls = packageCalls;
|
|
21
19
|
const path_1 = __importDefault(require("path"));
|
|
@@ -27,12 +25,14 @@ const package_files_1 = require("./package-files");
|
|
|
27
25
|
const flowr_description_file_1 = require("../../../project/plugins/file-plugins/files/flowr-description-file");
|
|
28
26
|
const r_function_definition_1 = require("../../../r-bridge/lang-4.x/ast/model/nodes/r-function-definition");
|
|
29
27
|
const edge_1 = require("../../../dataflow/graph/edge");
|
|
30
|
-
const df_helper_1 = require("../../../dataflow/graph/df-helper");
|
|
31
28
|
const r_base_packages_1 = require("../../../util/r-base-packages");
|
|
32
29
|
const r_project_1 = require("../../../r-bridge/lang-4.x/ast/model/nodes/r-project");
|
|
33
30
|
const model_1 = require("../../../r-bridge/lang-4.x/ast/model/model");
|
|
34
31
|
const identifier_1 = require("../../../dataflow/environments/identifier");
|
|
35
32
|
const linter_format_1 = require("../../linter-format");
|
|
33
|
+
var linter_util_1 = require("../../linter-util");
|
|
34
|
+
Object.defineProperty(exports, "at", { enumerable: true, get: function () { return linter_util_1.at; } });
|
|
35
|
+
const linter_util_2 = require("../../linter-util");
|
|
36
36
|
const range_1 = require("../../../util/range");
|
|
37
37
|
const vertex_1 = require("../../../dataflow/graph/vertex");
|
|
38
38
|
/** The DESCRIPTION fields declaring a package dependency. */
|
|
@@ -122,11 +122,6 @@ function calledDefinitions(graph, call, idMap) {
|
|
|
122
122
|
}
|
|
123
123
|
return defs;
|
|
124
124
|
}
|
|
125
|
-
/** Whether the call reaches the built-in function only, and no definition of the code. */
|
|
126
|
-
function isBuiltInCall(graph, id) {
|
|
127
|
-
const origins = df_helper_1.Dataflow.origin(graph, id);
|
|
128
|
-
return origins === undefined || origins.every(o => o.type === 3 /* OriginType.BuiltInFunctionOrigin */);
|
|
129
|
-
}
|
|
130
125
|
/** Whether the node or an ancestor is quoted or otherwise evaluated elsewhere (`quote(...)`, a data mask). */
|
|
131
126
|
function isQuoted(graph, id, idMap) {
|
|
132
127
|
for (let cur = idMap.get(id); cur !== undefined; cur = cur.info.parent === undefined ? undefined : idMap.get(cur.info.parent)) {
|
|
@@ -140,30 +135,23 @@ function isQuoted(graph, id, idMap) {
|
|
|
140
135
|
function isStandardPackage(pkg) {
|
|
141
136
|
return (0, r_base_packages_1.isBaseRPackage)(pkg) && pkg !== 'methods' && pkg !== 'stats4';
|
|
142
137
|
}
|
|
143
|
-
/** The certainty, involved node, and location of a finding at a node or location. */
|
|
144
|
-
function at(where, certain = true) {
|
|
145
|
-
const node = Array.isArray(where) ? undefined : where;
|
|
146
|
-
return {
|
|
147
|
-
certainty: certain ? linter_format_1.LintingResultCertainty.Certain : linter_format_1.LintingResultCertainty.Uncertain,
|
|
148
|
-
involvedId: node?.info.id,
|
|
149
|
-
loc: (node ? range_1.SourceLocation.fromNode(node) : where) ?? range_1.SourceLocation.invalid()
|
|
150
|
-
};
|
|
151
|
-
}
|
|
152
138
|
/** The pretty printers of a rule: `query` describes a result, the full one is its message and location. */
|
|
153
139
|
function printer(query) {
|
|
154
|
-
return {
|
|
155
|
-
[linter_format_1.LintingPrettyPrintContext.Query]: (r) => `${query(r)} at ${range_1.SourceLocation.format(r.loc)}`,
|
|
156
|
-
[linter_format_1.LintingPrettyPrintContext.Full]: (r) => `${r.message} at ${range_1.SourceLocation.format(r.loc)}`
|
|
157
|
-
};
|
|
140
|
+
return (0, linter_format_1.prettyPrint)(r => `${query(r)} at ${range_1.SourceLocation.format(r.loc)}`, r => `${r.message} at ${range_1.SourceLocation.format(r.loc)}`);
|
|
158
141
|
}
|
|
159
|
-
/** The calls (by name, if given) of package code, with the node and vertex of each;
|
|
160
|
-
function* packageCalls(graph, idMap, pkg, names
|
|
142
|
+
/** The calls (by name, if given) of package code, with the node and vertex of each; those resolving to a built-in, named by it. */
|
|
143
|
+
function* packageCalls(graph, idMap, pkg, names) {
|
|
161
144
|
for (const [id, vertex] of graph.verticesOfType(vertex_1.VertexType.FunctionCall)) {
|
|
162
|
-
const name = identifier_1.Identifier.getName(vertex.name);
|
|
163
145
|
const node = idMap.get(id);
|
|
164
|
-
|
|
146
|
+
const resolved = (0, linter_util_2.builtInOf)(graph, id);
|
|
147
|
+
const name = resolved === undefined ? undefined : identifier_1.Identifier.getName(resolved);
|
|
148
|
+
if (node !== undefined && name !== undefined && (names === undefined || names.has(name)) && pkg.isPackageCode(node.info.file)) {
|
|
165
149
|
yield { id, name, node, vertex };
|
|
166
150
|
}
|
|
167
151
|
}
|
|
168
152
|
}
|
|
153
|
+
/** the extensions R reads as data sets from a package's `data` directory, including the compressed forms */
|
|
154
|
+
exports.DataSetExtensions = ['R', 'r', 'RData', 'rdata', 'rda', 'TXT', 'CSV',
|
|
155
|
+
...['tab', 'txt', 'csv'].flatMap(e => [e, ...['gz', 'bz2', 'xz'].map(c => `${e}.${c}`)])];
|
|
156
|
+
exports.DataFile = new RegExp(`\\.(${exports.DataSetExtensions.map(e => e.replaceAll('.', '\\.')).join('|')})$`);
|
|
169
157
|
//# sourceMappingURL=cmd-check-util.js.map
|
|
@@ -40,15 +40,20 @@ export interface CompiledCodeMetadata extends MergeableRecord {
|
|
|
40
40
|
/** Port of the static `R CMD check` checks on compiled code and build files (Rust compilation and the binary part of the compiled code check are not ported). */
|
|
41
41
|
export declare const COMPILED_CODE: {
|
|
42
42
|
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>[]>>;
|
|
43
|
-
readonly processSearchResult: (_elements:
|
|
43
|
+
readonly processSearchResult: (_elements: unknown, config: CompiledCodeConfig, data: import("../../..").ReadonlyFlowrAnalysisProvider) => PromiseLike<{
|
|
44
|
+
results: FileResult<CompiledCodeKind>[];
|
|
45
|
+
'.meta': {
|
|
46
|
+
consideredFiles: number;
|
|
47
|
+
};
|
|
48
|
+
}> | {
|
|
44
49
|
results: FileResult<CompiledCodeKind>[];
|
|
45
50
|
'.meta': {
|
|
46
51
|
consideredFiles: number;
|
|
47
52
|
};
|
|
48
53
|
};
|
|
49
54
|
readonly prettyPrint: {
|
|
50
|
-
readonly query: (
|
|
51
|
-
readonly full: (
|
|
55
|
+
readonly query: (r: CompiledCodeResult, metadata: unknown) => string;
|
|
56
|
+
readonly full: (r: CompiledCodeResult, metadata: unknown) => string;
|
|
52
57
|
};
|
|
53
58
|
readonly info: {
|
|
54
59
|
readonly name: "Compiled Code";
|
|
@@ -5,10 +5,8 @@ const linter_format_1 = require("../../linter-format");
|
|
|
5
5
|
const flowr_search_builder_1 = require("../../../search/flowr-search-builder");
|
|
6
6
|
const linter_tags_1 = require("../../linter-tags");
|
|
7
7
|
const range_1 = require("../../../util/range");
|
|
8
|
-
const cmd_check_util_1 = require("./cmd-check-util");
|
|
9
8
|
const file_checks_1 = require("./file-checks");
|
|
10
9
|
const flowr_file_1 = require("../../../project/context/flowr-file");
|
|
11
|
-
const package_files_1 = require("./package-files");
|
|
12
10
|
/** the warnings whose pragmas `R CMD check` calls non-portable */
|
|
13
11
|
const NonPortableWarnings = `
|
|
14
12
|
abi-tag aggressive-loop-optimizations aliasing align-commons aligned-new alloc-size-larger-than alloc-zero alloca alloca-larger-than ampersand argument-mismatch array-temporaries assign-intercept attribute-alias bool-compare bool-operation builtin-declaration-mismatch c-binding-type c90-c99-compat c99-c11-compat
|
|
@@ -283,13 +281,8 @@ function rulesFor(files, config, sysReq, linkingTo, anyFile, have, isBad) {
|
|
|
283
281
|
/** Port of the static `R CMD check` checks on compiled code and build files (Rust compilation and the binary part of the compiled code check are not ported). */
|
|
284
282
|
exports.COMPILED_CODE = {
|
|
285
283
|
createSearch: () => flowr_search_builder_1.Q.from([]),
|
|
286
|
-
processSearchResult: (
|
|
284
|
+
processSearchResult: (0, file_checks_1.onPackageFiles)({ consideredFiles: 0 }, (files, pkg, config, data) => {
|
|
287
285
|
const ctx = data.inspectContext();
|
|
288
|
-
const pkg = (0, cmd_check_util_1.packageInfo)(ctx);
|
|
289
|
-
const files = (0, package_files_1.packageFiles)(ctx, pkg.name);
|
|
290
|
-
if (files === undefined) {
|
|
291
|
-
return { results: [], '.meta': { consideredFiles: 0 } };
|
|
292
|
-
}
|
|
293
286
|
const found = (0, file_checks_1.fileFindings)(files, config.skip);
|
|
294
287
|
const add = (kind, file, line, message, uncertain) => found.add(kind, file, message, line, uncertain ? linter_format_1.LintingResultCertainty.Uncertain : undefined);
|
|
295
288
|
const sysReq = pkg.description?.content().get('SystemRequirements')?.join(' ') ?? '';
|
|
@@ -317,11 +310,8 @@ exports.COMPILED_CODE = {
|
|
|
317
310
|
add('whether package can be installed', 'NAMESPACE', 1, installProblem);
|
|
318
311
|
}
|
|
319
312
|
return { results: found.results, '.meta': { consideredFiles: files.entries.filter(e => !e.isDirectory).length } };
|
|
320
|
-
},
|
|
321
|
-
prettyPrint: {
|
|
322
|
-
[linter_format_1.LintingPrettyPrintContext.Query]: result => `${result.message} at ${range_1.SourceLocation.format(result.loc)}`,
|
|
323
|
-
[linter_format_1.LintingPrettyPrintContext.Full]: result => `checking ${result.kind}: ${result.message} (at ${range_1.SourceLocation.format(result.loc)})`
|
|
324
|
-
},
|
|
313
|
+
}),
|
|
314
|
+
prettyPrint: (0, linter_format_1.prettyPrint)(result => `${result.message} at ${range_1.SourceLocation.format(result.loc)}`, result => `checking ${result.kind}: ${result.message} (at ${range_1.SourceLocation.format(result.loc)})`),
|
|
325
315
|
info: {
|
|
326
316
|
name: 'Compiled Code',
|
|
327
317
|
tags: [linter_tags_1.LintingRuleTag.CmdCheck],
|
|
@@ -75,8 +75,8 @@ export declare const DEPENDENCY_DECLARATION: {
|
|
|
75
75
|
};
|
|
76
76
|
}>;
|
|
77
77
|
readonly prettyPrint: {
|
|
78
|
-
query: (r: DependencyDeclarationResult) => string;
|
|
79
|
-
full: (r: DependencyDeclarationResult) => string;
|
|
78
|
+
readonly query: (r: DependencyDeclarationResult, metadata: unknown) => string;
|
|
79
|
+
readonly full: (r: DependencyDeclarationResult, metadata: unknown) => string;
|
|
80
80
|
};
|
|
81
81
|
readonly info: {
|
|
82
82
|
readonly name: "Dependency Declaration";
|
|
@@ -8,6 +8,7 @@ const flowr_search_builder_1 = require("../../../search/flowr-search-builder");
|
|
|
8
8
|
const linter_tags_1 = require("../../linter-tags");
|
|
9
9
|
const range_1 = require("../../../util/range");
|
|
10
10
|
const identifier_1 = require("../../../dataflow/environments/identifier");
|
|
11
|
+
const linter_util_1 = require("../../linter-util");
|
|
11
12
|
const search_enrichers_1 = require("../../../search/search-executor/search-enrichers");
|
|
12
13
|
const df_helper_1 = require("../../../dataflow/graph/df-helper");
|
|
13
14
|
const query_fn_props_1 = require("../../../dataflow/environments/query-fn-props");
|
|
@@ -20,16 +21,13 @@ const package_files_1 = require("./package-files");
|
|
|
20
21
|
const package_code_1 = require("./package-code");
|
|
21
22
|
const r_logical_1 = require("../../../r-bridge/lang-4.x/ast/model/nodes/r-logical");
|
|
22
23
|
const r_string_1 = require("../../../r-bridge/lang-4.x/ast/model/nodes/r-string");
|
|
23
|
-
/** the S4 functions marking code to need `methods` */
|
|
24
|
-
const S4Definers = new Set(['setClass', 'setMethod', 'setGeneric', 'setRefClass', 'setValidity', 'setClassUnion']);
|
|
25
24
|
const PackageName = /^[A-Za-z][A-Za-z0-9.]*[A-Za-z0-9]$/;
|
|
26
25
|
/** the packages R attaches by default, which `library` calls may name without a DESCRIPTION entry */
|
|
27
26
|
function isDefaultPackage(pkg) {
|
|
28
27
|
return r_base_packages_1.AttachedBasePackageSet.has(pkg) && pkg !== 'methods';
|
|
29
28
|
}
|
|
30
|
-
const LoadFunctions = new Set(['library', 'require', 'loadNamespace', 'requireNamespace']);
|
|
31
29
|
/** the packages a piece of code loads or accesses, read off its syntax as `tools:::.check_packages_used_helper` does */
|
|
32
|
-
function packagesUsedIn(ast) {
|
|
30
|
+
function packagesUsedIn(ast, loaders) {
|
|
33
31
|
const result = [];
|
|
34
32
|
for (const node of (0, cmd_check_util_1.projectNodes)(ast)) {
|
|
35
33
|
if (r_symbol_1.RSymbol.is(node)) {
|
|
@@ -45,7 +43,7 @@ function packagesUsedIn(ast) {
|
|
|
45
43
|
const fn = identifier_1.Identifier.getName(node.functionName.content);
|
|
46
44
|
const args = node.arguments.filter(a => a !== r_function_call_1.EmptyArgument);
|
|
47
45
|
const named = (n) => args.find(a => a.name !== undefined && identifier_1.Identifier.getName(a.name.content) === n)?.value;
|
|
48
|
-
if (
|
|
46
|
+
if (loaders.has(fn)) {
|
|
49
47
|
const value = named('package') ?? args.find(a => a.name === undefined)?.value;
|
|
50
48
|
const characterOnly = named('character.only');
|
|
51
49
|
if (r_string_1.RString.is(value)) {
|
|
@@ -78,7 +76,7 @@ function otherCodeFindings(files, declared, data) {
|
|
|
78
76
|
}
|
|
79
77
|
const reported = new Set();
|
|
80
78
|
const isDeclared = (pkg) => declared.has(pkg) || (0, r_base_packages_1.isBaseRPackage)(pkg);
|
|
81
|
-
for (const { pkg, node, how } of packagesUsedIn(ast)) {
|
|
79
|
+
for (const { pkg, node, how } of packagesUsedIn(ast, (0, linter_util_1.namesWith)(data.inspectContext().env.builtInIndex, built_in_props_1.SemanticCallTag.LoadsPackage))) {
|
|
82
80
|
if (isDeclared(pkg) || reported.has(pkg) || !PackageName.test(pkg)) {
|
|
83
81
|
continue;
|
|
84
82
|
}
|
|
@@ -182,12 +180,13 @@ exports.DEPENDENCY_DECLARATION = {
|
|
|
182
180
|
}
|
|
183
181
|
}
|
|
184
182
|
/* pkg::f and pkg:::f */
|
|
183
|
+
const s4Definers = new Set(ctx.env.builtInIndex.with(built_in_props_1.SemanticCallTag.Declares).filter(n => identifier_1.Identifier.getNamespace(n) === "methods" /* PkgName.Methods */).map(n => identifier_1.Identifier.getName(n)));
|
|
185
184
|
let usesS4 = false;
|
|
186
185
|
for (const node of (0, cmd_check_util_1.projectNodes)(ast)) {
|
|
187
186
|
if (!pkg.isPackageCode(node.info.file)) {
|
|
188
187
|
continue;
|
|
189
188
|
}
|
|
190
|
-
if (r_function_call_1.RFunctionCall.
|
|
189
|
+
if (r_function_call_1.RFunctionCall.is(node) && (0, linter_util_1.callsBuiltIn)(df.graph, node.info.id, s4Definers)) {
|
|
191
190
|
usesS4 = true;
|
|
192
191
|
}
|
|
193
192
|
if (!r_symbol_1.RSymbol.is(node)) {
|
|
@@ -40,14 +40,14 @@ export declare const DESCRIPTION_METADATA: {
|
|
|
40
40
|
};
|
|
41
41
|
};
|
|
42
42
|
readonly prettyPrint: {
|
|
43
|
-
query: (r: {
|
|
43
|
+
readonly query: (r: {
|
|
44
44
|
readonly message: string;
|
|
45
45
|
readonly loc: SourceLocation;
|
|
46
|
-
}) => string;
|
|
47
|
-
full: (r: {
|
|
46
|
+
}, metadata: unknown) => string;
|
|
47
|
+
readonly full: (r: {
|
|
48
48
|
readonly message: string;
|
|
49
49
|
readonly loc: SourceLocation;
|
|
50
|
-
}) => string;
|
|
50
|
+
}, metadata: unknown) => string;
|
|
51
51
|
};
|
|
52
52
|
readonly info: {
|
|
53
53
|
readonly name: "Description Metadata";
|
|
@@ -40,8 +40,8 @@ export declare const DOCUMENTATION_MISMATCH: {
|
|
|
40
40
|
};
|
|
41
41
|
}>;
|
|
42
42
|
readonly prettyPrint: {
|
|
43
|
-
readonly query: (
|
|
44
|
-
readonly full: (
|
|
43
|
+
readonly query: (r: DocumentationMismatchResult, metadata: unknown) => string;
|
|
44
|
+
readonly full: (r: DocumentationMismatchResult, metadata: unknown) => string;
|
|
45
45
|
};
|
|
46
46
|
readonly info: {
|
|
47
47
|
readonly name: "Documentation Mismatch";
|
|
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.DOCUMENTATION_MISMATCH = void 0;
|
|
7
7
|
const strings_1 = require("../../../util/text/strings");
|
|
8
|
+
const string_constants_1 = require("../../../dataflow/eval/values/string/string-constants");
|
|
8
9
|
const linter_format_1 = require("../../linter-format");
|
|
9
10
|
const flowr_search_builder_1 = require("../../../search/flowr-search-builder");
|
|
10
11
|
const linter_tags_1 = require("../../linter-tags");
|
|
@@ -136,18 +137,13 @@ function parseUsageEntry(entry) {
|
|
|
136
137
|
}
|
|
137
138
|
return { name: value === undefined ? name : name + '<-', args, entry: text, replace: value !== undefined };
|
|
138
139
|
}
|
|
139
|
-
const Escapes = { n: '\n', t: '\t', r: '\r', '0': '\0', a: '\x07', b: '\b', f: '\f', v: '\v' };
|
|
140
|
-
/** the value of the content of a string literal, i.e. with its escape sequences resolved */
|
|
141
|
-
function unescape(str, raw = false) {
|
|
142
|
-
return raw ? str : str.replace(/\\(.)/gs, (_, c) => Escapes[c] ?? c);
|
|
143
|
-
}
|
|
144
140
|
/** infinite numbers are written `Inf` and `-Inf` in R */
|
|
145
141
|
function infinite(num) {
|
|
146
142
|
return num === Infinity ? 'k:Inf' : num === -Infinity ? 'k:-Inf' : undefined;
|
|
147
143
|
}
|
|
148
144
|
function literalOfCode(node) {
|
|
149
145
|
switch (node?.type) {
|
|
150
|
-
case type_1.RType.String: return `s:${
|
|
146
|
+
case type_1.RType.String: return `s:${(0, string_constants_1.contentOf)(node.content) ?? node.content.str}`;
|
|
151
147
|
case type_1.RType.Logical: return `l:${node.content}`;
|
|
152
148
|
case type_1.RType.Number: return infinite(node.content.num) ?? `n:${node.content.num}`;
|
|
153
149
|
case type_1.RType.UnaryOp: {
|
|
@@ -165,7 +161,7 @@ function literalOfDocs(text) {
|
|
|
165
161
|
if (/^(["'])[\s\S]*\1$/.test(text)) {
|
|
166
162
|
try {
|
|
167
163
|
const value = convert_values_1.RStringValue.fromRLexeme(text);
|
|
168
|
-
return `s:${
|
|
164
|
+
return `s:${(0, string_constants_1.contentOf)(value) ?? value.str}`;
|
|
169
165
|
}
|
|
170
166
|
catch {
|
|
171
167
|
return undefined;
|
|
@@ -299,10 +295,7 @@ exports.DOCUMENTATION_MISMATCH = {
|
|
|
299
295
|
}
|
|
300
296
|
return { results, '.meta': { consideredObjects, consideredPages: pages.length } };
|
|
301
297
|
},
|
|
302
|
-
prettyPrint: {
|
|
303
|
-
[linter_format_1.LintingPrettyPrintContext.Query]: result => `${result.message} at ${range_1.SourceLocation.format(result.loc)}`,
|
|
304
|
-
[linter_format_1.LintingPrettyPrintContext.Full]: result => `${result.message} at ${range_1.SourceLocation.format(result.loc)}`
|
|
305
|
-
},
|
|
298
|
+
prettyPrint: (0, linter_format_1.prettyPrint)(result => `${result.message} at ${range_1.SourceLocation.format(result.loc)}`),
|
|
306
299
|
info: {
|
|
307
300
|
name: 'Documentation Mismatch',
|
|
308
301
|
tags: [linter_tags_1.LintingRuleTag.CmdCheck, linter_tags_1.LintingRuleTag.Documentation, linter_tags_1.LintingRuleTag.Bug],
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { LintingResultCertainty } from '../../linter-format';
|
|
2
2
|
import { SourceLocation } from '../../../util/range';
|
|
3
|
-
import type
|
|
4
|
-
import type
|
|
3
|
+
import { type CmdCheckResult, type PackageInfo } from './cmd-check-util';
|
|
4
|
+
import { type PackageFiles } from './package-files';
|
|
5
|
+
import type { ReadonlyFlowrAnalysisProvider } from '../../../project/flowr-analyzer';
|
|
6
|
+
import type { AsyncOrSync } from 'ts-essentials';
|
|
5
7
|
/** A finding of a check kind at a file (and line) of the package. */
|
|
6
8
|
export interface FileResult<K extends string> extends CmdCheckResult {
|
|
7
9
|
readonly kind: K;
|
|
@@ -12,18 +14,29 @@ export declare function fileFindings<K extends string>(pf: PackageFiles, skip?:
|
|
|
12
14
|
results: FileResult<K>[];
|
|
13
15
|
add: (kind: K, file: string, message: string, line?: number, certainty?: LintingResultCertainty) => void;
|
|
14
16
|
};
|
|
17
|
+
/** Runs `run` on the files of the package, yielding no results and the `zeroed` metadata if they are not available. */
|
|
18
|
+
export declare function onPackageFiles<C, R, M>(zeroed: M, run: (pf: PackageFiles, pkg: PackageInfo, config: C, data: ReadonlyFlowrAnalysisProvider) => AsyncOrSync<{
|
|
19
|
+
results: R[];
|
|
20
|
+
'.meta': M;
|
|
21
|
+
}>): (_elements: unknown, config: C, data: ReadonlyFlowrAnalysisProvider) => PromiseLike<{
|
|
22
|
+
results: R[];
|
|
23
|
+
'.meta': M;
|
|
24
|
+
}> | {
|
|
25
|
+
results: R[];
|
|
26
|
+
'.meta': M;
|
|
27
|
+
};
|
|
15
28
|
/** The lines of a package file, empty if it cannot be read. */
|
|
16
29
|
export declare function linesOf(pf: PackageFiles, file: string): string[];
|
|
17
30
|
/** The 1-based number of the first line of `file` matching `pattern`, `undefined` if none does. */
|
|
18
31
|
export declare function firstLine(pf: PackageFiles, file: string, pattern: RegExp): number | undefined;
|
|
19
32
|
/** Pretty printing of a finding as its message and location. */
|
|
20
33
|
export declare const MessageAtLocation: {
|
|
21
|
-
query: (r: {
|
|
34
|
+
readonly query: (r: {
|
|
22
35
|
readonly message: string;
|
|
23
36
|
readonly loc: SourceLocation;
|
|
24
|
-
}) => string;
|
|
25
|
-
full: (r: {
|
|
37
|
+
}, metadata: unknown) => string;
|
|
38
|
+
readonly full: (r: {
|
|
26
39
|
readonly message: string;
|
|
27
40
|
readonly loc: SourceLocation;
|
|
28
|
-
}) => string;
|
|
41
|
+
}, metadata: unknown) => string;
|
|
29
42
|
};
|