@eagleoutice/flowr 2.13.15 → 2.14.0
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 +31 -37
- package/abstract-interpretation/absint-visitor.js +1 -1
- package/abstract-interpretation/data-frame/mappers/access-mapper.js +4 -4
- package/abstract-interpretation/data-frame/mappers/arguments.js +7 -4
- package/abstract-interpretation/data-frame/mappers/function-mapper.js +18 -17
- package/abstract-interpretation/data-frame/mappers/replacement-mapper.js +6 -6
- package/abstract-interpretation/data-frame/resolve-args.d.ts +9 -4
- package/abstract-interpretation/data-frame/resolve-args.js +10 -5
- package/abstract-interpretation/unsupported-functions.d.ts +1 -0
- package/abstract-interpretation/unsupported-functions.js +1 -0
- package/benchmark/calibration.d.ts +12 -5
- package/benchmark/calibration.js +42 -14
- package/benchmark/slicer.d.ts +1 -1
- package/benchmark/slicer.js +5 -4
- package/benchmark/stats/size-of.js +1 -1
- package/benchmark/summarizer/first-phase/process.d.ts +2 -0
- package/benchmark/summarizer/first-phase/process.js +2 -0
- package/cli/common/options.d.ts +0 -31
- package/cli/common/options.js +1 -8
- package/cli/common/scripts-info.d.ts +0 -38
- package/cli/common/scripts-info.js +0 -8
- package/cli/repl/commands/repl-query.js +37 -2
- package/cli/repl/core.js +6 -3
- package/cli/repl/parser/slice-query-parser.js +1 -1
- package/cli/repl/print-version.js +2 -2
- package/config.d.ts +16 -0
- package/config.js +79 -0
- package/control-flow/control-flow-graph.d.ts +2 -0
- package/control-flow/control-flow-graph.js +2 -0
- package/control-flow/extract-cfg.js +1 -1
- package/control-flow/semantic-cfg-guided-visitor.d.ts +1 -1
- package/control-flow/semantic-cfg-guided-visitor.js +1 -1
- package/control-flow/useless-loop.js +1 -1
- package/core/print/slice-diff-ansi.js +1 -1
- package/core/steps/pipeline/create-pipeline.js +1 -1
- package/dataflow/cluster.js +2 -2
- package/dataflow/environments/built-in-props.d.ts +8 -1
- package/dataflow/environments/built-in-props.js +18 -0
- package/dataflow/environments/built-in.d.ts +7 -1
- package/dataflow/environments/built-in.js +42 -3
- package/dataflow/environments/default-builtin-config.d.ts +442 -10
- package/dataflow/environments/default-builtin-config.js +188 -18
- package/dataflow/environments/environment.d.ts +1 -1
- package/dataflow/environments/identifier.d.ts +7 -2
- package/dataflow/environments/identifier.js +6 -1
- package/dataflow/environments/query-fn-props.js +2 -2
- package/dataflow/environments/reference-to-maybe.js +5 -5
- package/dataflow/environments/resolve-by-name.d.ts +3 -0
- package/dataflow/environments/resolve-by-name.js +30 -5
- package/dataflow/environments/resolve-helper.d.ts +6 -0
- package/dataflow/environments/resolve-helper.js +6 -0
- package/dataflow/eval/resolve/alias-tracking.d.ts +5 -0
- package/dataflow/eval/resolve/alias-tracking.js +21 -14
- package/dataflow/eval/resolve/node-value.d.ts +6 -0
- package/dataflow/eval/resolve/node-value.js +15 -9
- package/dataflow/eval/resolve/resolve-argument.js +2 -2
- package/dataflow/eval/resolve/resolve-numbers.js +2 -2
- package/dataflow/eval/resolve/resolve-operators.js +4 -3
- package/dataflow/eval/resolve/resolve-strings.js +3 -3
- package/dataflow/eval/resolve/resolve-working-directory.js +2 -1
- package/dataflow/eval/resolve/resolve.d.ts +5 -5
- package/dataflow/eval/resolve/resolve.js +10 -11
- package/dataflow/eval/values/general.d.ts +4 -1
- package/dataflow/eval/values/general.js +4 -1
- package/dataflow/extractor.js +2 -1
- package/dataflow/fn/exceptions-of-function.js +5 -4
- package/dataflow/fn/higher-order-function.d.ts +1 -1
- package/dataflow/fn/higher-order-function.js +22 -2
- package/dataflow/graph/call-graph.d.ts +1 -1
- package/dataflow/graph/call-graph.js +15 -15
- package/dataflow/graph/df-helper.d.ts +17 -2
- package/dataflow/graph/df-helper.js +11 -5
- package/dataflow/graph/diff-dataflow-graph.js +6 -6
- package/dataflow/graph/edge.d.ts +27 -0
- package/dataflow/graph/edge.js +33 -0
- package/dataflow/graph/graph-helper.d.ts +4 -4
- package/dataflow/graph/graph-helper.js +5 -5
- package/dataflow/graph/graph.d.ts +11 -1
- package/dataflow/graph/graph.js +16 -5
- package/dataflow/graph/vertex.d.ts +47 -6
- package/dataflow/graph/vertex.js +47 -6
- package/dataflow/internal/linker.d.ts +1 -0
- package/dataflow/internal/linker.js +11 -9
- package/dataflow/internal/process/functions/call/built-in/built-in-access.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +6 -5
- package/dataflow/internal/process/functions/call/built-in/built-in-class-generator.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.js +6 -7
- package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +7 -6
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.d.ts +1 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +19 -18
- package/dataflow/internal/process/functions/call/built-in/built-in-library.js +6 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-list.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-local.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-pipe.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-purrr-formula.js +5 -5
- package/dataflow/internal/process/functions/call/built-in/built-in-quote.js +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-register-hook.js +3 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-replacement.js +3 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-rm.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.js +3 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-source.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-source.js +8 -2
- 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.js +3 -3
- package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.d.ts +3 -1
- package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.js +15 -12
- package/dataflow/internal/process/functions/call/common.d.ts +9 -1
- package/dataflow/internal/process/functions/call/common.js +17 -6
- package/dataflow/internal/process/functions/call/deferred.d.ts +7 -0
- package/dataflow/internal/process/functions/call/deferred.js +24 -1
- package/dataflow/internal/process/functions/call/known-call-handling.d.ts +3 -1
- package/dataflow/internal/process/functions/call/known-call-handling.js +6 -3
- package/dataflow/internal/process/functions/call/named-call-handling.js +44 -12
- package/dataflow/internal/process/functions/call/nse.d.ts +34 -5
- package/dataflow/internal/process/functions/call/nse.js +114 -6
- package/dataflow/internal/process/functions/call/quoted.d.ts +6 -0
- package/dataflow/internal/process/functions/call/quoted.js +26 -11
- package/dataflow/origin/dfg-get-origin.d.ts +1 -0
- package/dataflow/origin/dfg-get-origin.js +9 -6
- package/documentation/data/faq/faqs.js +88 -88
- package/documentation/data/faq/recommended-configs.js +1 -1
- package/documentation/data/faq/wiki-faq-store.js +1 -1
- package/documentation/doc-capabilities.js +1 -1
- package/documentation/doc-readme.js +1 -1
- package/documentation/doc-util/doc-auto-gen.js +6 -2
- package/documentation/doc-util/doc-functions.js +1 -1
- package/documentation/wiki-cfg.js +2 -2
- package/documentation/wiki-create-linting-rules.js +45 -45
- package/documentation/wiki-dataflow-graph.js +25 -18
- package/documentation/wiki-linting-and-testing.js +93 -5
- package/documentation/wiki-mk/doc-maker.js +1 -1
- package/documentation/wiki-overview.js +12 -1
- package/documentation/wiki-signature-database.js +3 -0
- package/linter/linter-format.d.ts +1 -0
- package/linter/linter-format.js +1 -0
- package/linter/rules/file-path-validity.js +1 -1
- package/linter/rules/function-finder-util.js +1 -1
- package/linter/rules/naming-convention.js +1 -1
- package/linter/rules/no-leaked-credentials.js +2 -1
- package/linter/rules/stop-with-call-arg.js +4 -4
- package/linter/rules/undefined-symbol-util.d.ts +1 -1
- package/linter/rules/undefined-symbol-util.js +5 -4
- package/linter/rules/undefined-symbol.js +3 -3
- package/linter/rules/unused-definition.js +2 -1
- package/package.json +35 -45
- package/project/context/flowr-analyzer-environment-context.d.ts +23 -0
- package/project/context/flowr-analyzer-environment-context.js +25 -0
- package/project/dependency-version-space.js +1 -2
- package/project/flowr-analyzer.js +1 -1
- package/project/plugins/file-plugins/files/flowr-rda-file.js +3 -3
- package/project/plugins/file-plugins/files/flowr-rmarkdown-file.js +2 -2
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.js +3 -1
- package/project/sigdb/build.js +16 -16
- package/project/sigdb/codec.d.ts +1 -1
- package/project/sigdb/codec.js +13 -13
- package/project/sigdb/decompress.d.ts +1 -1
- package/project/sigdb/decompress.js +33 -33
- package/project/sigdb/index-format.js +2 -2
- package/project/sigdb/manifest.js +21 -21
- package/project/sigdb/memory-source.d.ts +64 -0
- package/project/sigdb/memory-source.js +133 -0
- package/project/sigdb/reader.js +13 -13
- package/queries/catalog/absint-query/absint-query-format.js +1 -1
- package/queries/catalog/call-context-query/call-context-query-executor.js +1 -1
- package/queries/catalog/call-context-query/identify-link-to-last-call-relation.js +2 -2
- package/queries/catalog/dependencies-query/dependencies-query-executor.js +2 -2
- package/queries/catalog/dependencies-query/dependencies-query-format.js +1 -1
- package/queries/catalog/dependencies-query/link-devices.js +2 -2
- package/queries/catalog/does-call-query/does-call-query-executor.js +2 -1
- package/queries/catalog/does-call-query/does-call-query-format.js +2 -1
- package/queries/catalog/input-sources-query/input-sources-query-format.js +1 -1
- package/queries/catalog/input-sources-query/simple-input-classifier.js +4 -4
- package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.js +1 -1
- package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.js +1 -1
- package/queries/catalog/inspect-recursion-query/inspect-recursion-query-format.js +1 -1
- package/queries/catalog/location-map-query/location-map-query-format.js +2 -2
- package/queries/catalog/origin-query/origin-query-format.js +1 -1
- package/queries/catalog/provenance-query/provenance-query-format.js +1 -1
- package/queries/catalog/resolve-value-query/resolve-value-query-executor.js +2 -2
- package/queries/catalog/resolve-value-query/resolve-value-query-format.js +1 -1
- package/queries/catalog/signature-query/signature-query-executor.d.ts +2 -0
- package/queries/catalog/signature-query/signature-query-executor.js +3 -2
- package/r-bridge/lang-4.x/ast/model/nodes/info/r-delimiter.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/info/r-delimiter.js +1 -0
- package/r-bridge/lang-4.x/ast/model/processing/node-id.js +3 -3
- package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-call.js +1 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-definition.js +1 -1
- package/r-bridge/retriever.d.ts +2 -1
- package/r-bridge/retriever.js +3 -2
- package/r-bridge/roxygen2/documentation-provider.d.ts +1 -0
- package/r-bridge/roxygen2/documentation-provider.js +1 -0
- package/r-bridge/roxygen2/roxygen-parse.d.ts +1 -1
- package/r-bridge/roxygen2/roxygen-parse.js +1 -1
- package/search/flowr-search-filters.d.ts +1 -1
- package/search/flowr-search-filters.js +2 -2
- package/search/search-executor/search-enrichers.js +4 -4
- package/search/search-executor/search-generators.js +1 -1
- package/slicing/criterion/parse.d.ts +1 -0
- package/slicing/criterion/parse.js +4 -3
- package/slicing/static/slice-call.d.ts +1 -1
- package/slicing/static/slice-call.js +2 -2
- package/slicing/static/static-slicer.js +4 -3
- package/util/assert.js +1 -1
- package/util/log.d.ts +4 -1
- package/util/log.js +15 -2
- package/util/logic.js +2 -2
- package/util/mermaid/cfg.js +1 -1
- package/util/mermaid/dfg.js +6 -6
- package/util/mermaid/mermaid.js +3 -1
- package/util/quads.js +19 -6
- package/util/r-version.d.ts +2 -0
- package/util/r-version.js +2 -0
- package/util/record.d.ts +1 -0
- package/util/record.js +1 -0
- package/util/schema.js +2 -2
- package/util/text/ansi.d.ts +2 -0
- package/util/text/ansi.js +8 -0
- package/util/text/name-rank.d.ts +29 -0
- package/util/text/name-rank.js +39 -0
- package/util/text/url-encoding.d.ts +15 -0
- package/util/text/url-encoding.js +59 -0
- package/util/version.js +1 -1
- package/cli/export-quads-app.d.ts +0 -7
- package/cli/export-quads-app.js +0 -44
|
@@ -15,119 +15,119 @@ const log_2 = require("../../../util/log");
|
|
|
15
15
|
function registerFaqs(ctx) {
|
|
16
16
|
const wikiFaq = new wiki_faq_store_1.FaqStore();
|
|
17
17
|
wikiFaq.withTopic('flowr.development')
|
|
18
|
-
.addFaq('What are *test labels*?', `
|
|
19
|
-
Tests are labeled based on the *flowR* capabilities that they test for.
|
|
20
|
-
The list of supported capabilities can be found on the ${ctx.linkPage('wiki/Capabilities', 'Capabilities')} wiki page.
|
|
21
|
-
For more extensive information on test labels, see the ${ctx.linkPage('wiki/Linting and Testing', 'test labels wiki section', 'test-labels')}.
|
|
18
|
+
.addFaq('What are *test labels*?', `
|
|
19
|
+
Tests are labeled based on the *flowR* capabilities that they test for.
|
|
20
|
+
The list of supported capabilities can be found on the ${ctx.linkPage('wiki/Capabilities', 'Capabilities')} wiki page.
|
|
21
|
+
For more extensive information on test labels, see the ${ctx.linkPage('wiki/Linting and Testing', 'test labels wiki section', 'test-labels')}.
|
|
22
22
|
`)
|
|
23
|
-
.addFaq('How do I run *all checks* before pushing?', `
|
|
24
|
-
Run \`npm run checkup\`: it runs the linter, the functionality and system tests, the wiki generation, and the docker image build + smoke test concurrently, then prints one pass/fail summary.
|
|
25
|
-
Run a subset with the job ids (e.g. \`npm run checkup -- lint tests\`) or skip the container build with \`npm run checkup -- --no-docker\`.
|
|
23
|
+
.addFaq('How do I run *all checks* before pushing?', `
|
|
24
|
+
Run \`npm run checkup\`: it runs the linter, the functionality and system tests, the wiki generation, and the docker image build + smoke test concurrently, then prints one pass/fail summary.
|
|
25
|
+
Run a subset with the job ids (e.g. \`npm run checkup -- lint tests\`) or skip the container build with \`npm run checkup -- --no-docker\`.
|
|
26
26
|
`)
|
|
27
|
-
.addFaq('How to get a REPL with debug-info/*hot-reload*?', `
|
|
28
|
-
To enter the development repl, execute \`npm run main-dev\` in contrast to \`npm run flowr\`
|
|
29
|
-
this will use an unminified build (keeping debug info) and also watches the source files for changes.
|
|
30
|
-
In case of a change, this mode automatically recompiles.
|
|
31
|
-
Please note, that this may have negative performance implications (so do not use this for e.g., benchmarking).
|
|
27
|
+
.addFaq('How to get a REPL with debug-info/*hot-reload*?', `
|
|
28
|
+
To enter the development repl, execute \`npm run main-dev\` in contrast to \`npm run flowr\`
|
|
29
|
+
this will use an unminified build (keeping debug info) and also watches the source files for changes.
|
|
30
|
+
In case of a change, this mode automatically recompiles.
|
|
31
|
+
Please note, that this may have negative performance implications (so do not use this for e.g., benchmarking).
|
|
32
32
|
`)
|
|
33
|
-
.addFaq('How to generate *mermaid diagrams*?', `
|
|
34
|
-
There are several ways to generate mermaid diagrams based on the input data that you want to use.
|
|
35
|
-
- From the AST (abstract syntax tree): ${(0, doc_files_1.getFilePathMd)('../util/mermaid/ast.ts')}
|
|
36
|
-
- From the CFG (control flow graph): ${(0, doc_files_1.getFilePathMd)('../util/mermaid/cfg.ts')}
|
|
37
|
-
- From the DFG (dataflow graph): ${(0, doc_files_1.getFilePathMd)('../util/mermaid/dfg.ts')}
|
|
33
|
+
.addFaq('How to generate *mermaid diagrams*?', `
|
|
34
|
+
There are several ways to generate mermaid diagrams based on the input data that you want to use.
|
|
35
|
+
- From the AST (abstract syntax tree): ${(0, doc_files_1.getFilePathMd)('../util/mermaid/ast.ts')}
|
|
36
|
+
- From the CFG (control flow graph): ${(0, doc_files_1.getFilePathMd)('../util/mermaid/cfg.ts')}
|
|
37
|
+
- From the DFG (dataflow graph): ${(0, doc_files_1.getFilePathMd)('../util/mermaid/dfg.ts')}
|
|
38
38
|
`)
|
|
39
|
-
.addFaq('How to create *new wiki* pages?', `
|
|
40
|
-
To create an automatically generated wiki page, you can follow these steps:
|
|
41
|
-
- Create a new file in \`src/documentation\` with a name like \`wiki-thename.ts\`.
|
|
42
|
-
- Register your new wiki page in the \`src/cli/wiki.ts\` file to have it executed by the wiki generation tool.
|
|
43
|
-
|
|
44
|
-
You can test your page by piping the wiki generation script to a file. For example, you can run the following command:
|
|
45
|
-
${(0, doc_code_1.codeBlock)('shell', 'npm run wiki')}
|
|
46
|
-
Alternatively use the following to generate a specific wiki page:
|
|
47
|
-
${(0, doc_code_1.codeBlock)('shell', 'npm run wiki -- --filter=Dataflow')}
|
|
48
|
-
Or, activate the watch mode to automatically regenerate the wiki on changes:
|
|
49
|
-
${(0, doc_code_1.codeBlock)('shell', 'npm run wiki:watch')}
|
|
50
|
-
|
|
39
|
+
.addFaq('How to create *new wiki* pages?', `
|
|
40
|
+
To create an automatically generated wiki page, you can follow these steps:
|
|
41
|
+
- Create a new file in \`src/documentation\` with a name like \`wiki-thename.ts\`.
|
|
42
|
+
- Register your new wiki page in the \`src/cli/wiki.ts\` file to have it executed by the wiki generation tool.
|
|
43
|
+
|
|
44
|
+
You can test your page by piping the wiki generation script to a file. For example, you can run the following command:
|
|
45
|
+
${(0, doc_code_1.codeBlock)('shell', 'npm run wiki')}
|
|
46
|
+
Alternatively use the following to generate a specific wiki page:
|
|
47
|
+
${(0, doc_code_1.codeBlock)('shell', 'npm run wiki -- --filter=Dataflow')}
|
|
48
|
+
Or, activate the watch mode to automatically regenerate the wiki on changes:
|
|
49
|
+
${(0, doc_code_1.codeBlock)('shell', 'npm run wiki:watch')}
|
|
50
|
+
|
|
51
51
|
`)
|
|
52
|
-
.addFaq('Why can\'t I pass *arguments* when running flowR *with npm*?', `
|
|
53
|
-
With \`npm\` you have to pass arguments in a specific way. The \`--\` operator is used to separate the \`npm\` arguments from the script arguments. For example, if you want to run \`flowR\` with the \`--help\` argument, you can use the following command:
|
|
54
|
-
${(0, doc_code_1.codeBlock)('shell', 'npm run flowr -- --help')}
|
|
52
|
+
.addFaq('Why can\'t I pass *arguments* when running flowR *with npm*?', `
|
|
53
|
+
With \`npm\` you have to pass arguments in a specific way. The \`--\` operator is used to separate the \`npm\` arguments from the script arguments. For example, if you want to run \`flowR\` with the \`--help\` argument, you can use the following command:
|
|
54
|
+
${(0, doc_code_1.codeBlock)('shell', 'npm run flowr -- --help')}
|
|
55
55
|
`)
|
|
56
|
-
.addFaq('How to do *logging* in flowR?', `
|
|
57
|
-
Check out the ${ctx.linkPage('wiki/Linting and Testing', 'Logging Section in the Linting and Testing wiki page', 'logging')} for more information on how to do logging in *flowR*.
|
|
56
|
+
.addFaq('How to do *logging* in flowR?', `
|
|
57
|
+
Check out the ${ctx.linkPage('wiki/Linting and Testing', 'Logging Section in the Linting and Testing wiki page', 'logging')} for more information on how to do logging in *flowR*.
|
|
58
58
|
`)
|
|
59
|
-
.addFaq('How to get flowR to *talk*?', `
|
|
60
|
-
When using flowR from the CLI, you can use the ${(0, doc_cli_option_1.getCliLongOptionOf)('flowr', 'verbose')} option to get more information about what flowR is doing.
|
|
61
|
-
While coding, however, you can use the ${ctx.link(log_1.setMinLevelOfAllLogs)} function to set the minimum level of logs to be displayed (this works with the ${ctx.link(log_2.FlowrLogger)} abstraction).
|
|
62
|
-
In general, you can configure the levels of individual logs, such as the general \`log\` (obtained with ${ctx.link('getActiveLog')}) or the ${ctx.link('parseLog')}.
|
|
63
|
-
Please note that flowR makes no guarantees that log outputs are persistent across versions, and it is up to the implementors to provide sensible logging.
|
|
64
|
-
If you are an implementor and want to add logging, please make sure there are no larger runtime implications when logging is disabled.
|
|
65
|
-
Have a look at the ${ctx.link(log_2.expensiveTrace)} function for example, which uses a function to generate the log message only when the log level is reached.
|
|
59
|
+
.addFaq('How to get flowR to *talk*?', `
|
|
60
|
+
When using flowR from the CLI, you can use the ${(0, doc_cli_option_1.getCliLongOptionOf)('flowr', 'verbose')} option to get more information about what flowR is doing.
|
|
61
|
+
While coding, however, you can use the ${ctx.link(log_1.setMinLevelOfAllLogs)} function to set the minimum level of logs to be displayed (this works with the ${ctx.link(log_2.FlowrLogger)} abstraction).
|
|
62
|
+
In general, you can configure the levels of individual logs, such as the general \`log\` (obtained with ${ctx.link('getActiveLog')}) or the ${ctx.link('parseLog')}.
|
|
63
|
+
Please note that flowR makes no guarantees that log outputs are persistent across versions, and it is up to the implementors to provide sensible logging.
|
|
64
|
+
If you are an implementor and want to add logging, please make sure there are no larger runtime implications when logging is disabled.
|
|
65
|
+
Have a look at the ${ctx.link(log_2.expensiveTrace)} function for example, which uses a function to generate the log message only when the log level is reached.
|
|
66
66
|
`)
|
|
67
|
-
.addFaq('How to run *tests* with *verbose* logging?', `
|
|
68
|
-
Use the dedicated npm script to run all tests with trace-level log output:
|
|
69
|
-
${(0, doc_code_1.codeBlock)('shell', 'npm run test:verbose')}
|
|
70
|
-
Alternatively, set the \`FLOWR_VERBOSE\` environment variable directly:
|
|
71
|
-
${(0, doc_code_1.codeBlock)('shell', 'FLOWR_VERBOSE=true npm run test')}
|
|
72
|
-
Both forms accept the usual vitest filters (e.g. \`npm run test:verbose -- cli/server\`).
|
|
67
|
+
.addFaq('How to run *tests* with *verbose* logging?', `
|
|
68
|
+
Use the dedicated npm script to run all tests with trace-level log output:
|
|
69
|
+
${(0, doc_code_1.codeBlock)('shell', 'npm run test:verbose')}
|
|
70
|
+
Alternatively, set the \`FLOWR_VERBOSE\` environment variable directly:
|
|
71
|
+
${(0, doc_code_1.codeBlock)('shell', 'FLOWR_VERBOSE=true npm run test')}
|
|
72
|
+
Both forms accept the usual vitest filters (e.g. \`npm run test:verbose -- cli/server\`).
|
|
73
73
|
`)
|
|
74
|
-
.addFaq('How to add a *linting rule*?', `
|
|
75
|
-
To add a new linting rule, see ${ctx.linkPage('wiki/Create Linting Rules')}.
|
|
74
|
+
.addFaq('How to add a *linting rule*?', `
|
|
75
|
+
To add a new linting rule, see ${ctx.linkPage('wiki/Create Linting Rules')}.
|
|
76
76
|
`);
|
|
77
77
|
wikiFaq.withTopic('flowr.use')
|
|
78
|
-
.addFaq('How to *watch* a file for changes in the REPL?', `
|
|
79
|
-
Replace the \`file://\` prefix with \`watch://\` when passing a path to any REPL command.
|
|
80
|
-
flowR will run the command immediately and then re-run it every time the file (or any file inside the specified folder) changes.
|
|
81
|
-
Press Ctrl+C or enter any other command to leave watch mode.
|
|
82
|
-
${(0, doc_code_1.codeBlock)('shell', ':df watch://path/to/analysis.R')}
|
|
83
|
-
For a folder, flowR uses the same project discovery as with \`file://\`:
|
|
84
|
-
${(0, doc_code_1.codeBlock)('shell', ':query @linter watch://path/to/project')}
|
|
78
|
+
.addFaq('How to *watch* a file for changes in the REPL?', `
|
|
79
|
+
Replace the \`file://\` prefix with \`watch://\` when passing a path to any REPL command.
|
|
80
|
+
flowR will run the command immediately and then re-run it every time the file (or any file inside the specified folder) changes.
|
|
81
|
+
Press Ctrl+C or enter any other command to leave watch mode.
|
|
82
|
+
${(0, doc_code_1.codeBlock)('shell', ':df watch://path/to/analysis.R')}
|
|
83
|
+
For a folder, flowR uses the same project discovery as with \`file://\`:
|
|
84
|
+
${(0, doc_code_1.codeBlock)('shell', ':query @linter watch://path/to/project')}
|
|
85
85
|
`)
|
|
86
|
-
.addFaq('How to *query* an R project?', `
|
|
87
|
-
For this you can use flowR's ${ctx.linkPage('wiki/Query API', 'Query API')}.
|
|
88
|
-
If you want to create your own project using flowR as a library, check out the
|
|
89
|
-
[${doc_files_1.FlowrGithubGroupName}/sample-analyzer-project-query](${doc_files_1.FlowrGithubBaseRef}/sample-analyzer-project-query) repository for an example project setup.
|
|
86
|
+
.addFaq('How to *query* an R project?', `
|
|
87
|
+
For this you can use flowR's ${ctx.linkPage('wiki/Query API', 'Query API')}.
|
|
88
|
+
If you want to create your own project using flowR as a library, check out the
|
|
89
|
+
[${doc_files_1.FlowrGithubGroupName}/sample-analyzer-project-query](${doc_files_1.FlowrGithubBaseRef}/sample-analyzer-project-query) repository for an example project setup.
|
|
90
90
|
`)
|
|
91
|
-
.addFaq('How to configure flowR *per kind of project*?', `
|
|
92
|
-
Use ${ctx.linkConfig('specializeConfig')}: it overwrites (parts of) the configuration depending on the kind of project flowR detects (e.g. \`${project_kind_1.ProjectKind.ShinyApp}\`).
|
|
93
|
-
This is how a shiny app gets its ${ctx.linkConfig('project.implicitSources')} out of the box, as shiny loads these files without any \`source()\` call:
|
|
91
|
+
.addFaq('How to configure flowR *per kind of project*?', `
|
|
92
|
+
Use ${ctx.linkConfig('specializeConfig')}: it overwrites (parts of) the configuration depending on the kind of project flowR detects (e.g. \`${project_kind_1.ProjectKind.ShinyApp}\`).
|
|
93
|
+
This is how a shiny app gets its ${ctx.linkConfig('project.implicitSources')} out of the box, as shiny loads these files without any \`source()\` call:
|
|
94
94
|
${(0, doc_code_1.codeBlock)('json', JSON.stringify({
|
|
95
95
|
specializeConfig: {
|
|
96
96
|
[project_kind_1.ProjectKind.ShinyApp]: { project: { implicitSources: ['global.R', 'ui.R', 'server.R', 'app.R'] } }
|
|
97
97
|
}
|
|
98
|
-
}, null, 2))}
|
|
99
|
-
Anything you configure directly wins over the value the project kind defaults to, so setting \`project.implicitSources\` yourself overrides the list above.
|
|
98
|
+
}, null, 2))}
|
|
99
|
+
Anything you configure directly wins over the value the project kind defaults to, so setting \`project.implicitSources\` yourself overrides the list above.
|
|
100
100
|
`);
|
|
101
101
|
wikiFaq.withTopic('r.packages')
|
|
102
|
-
.addFaq('What is the R *prelude* and R *base* package?', `
|
|
103
|
-
The base package contains lots of base functions like \`source\` for example.
|
|
104
|
-
The R prelude includes the base package along with several other packages.
|
|
105
|
-
Packages that were loaded by the prelude can be called without prefixing the
|
|
106
|
-
function call with the package name and the \`::\` operator.
|
|
107
|
-
|
|
108
|
-
The packages loaded by the R prelude can be seen in the \`attached base packages\`
|
|
109
|
-
sections in the output of \`sessionInfo()\`.
|
|
102
|
+
.addFaq('What is the R *prelude* and R *base* package?', `
|
|
103
|
+
The base package contains lots of base functions like \`source\` for example.
|
|
104
|
+
The R prelude includes the base package along with several other packages.
|
|
105
|
+
Packages that were loaded by the prelude can be called without prefixing the
|
|
106
|
+
function call with the package name and the \`::\` operator.
|
|
107
|
+
|
|
108
|
+
The packages loaded by the R prelude can be seen in the \`attached base packages\`
|
|
109
|
+
sections in the output of \`sessionInfo()\`.
|
|
110
110
|
`)
|
|
111
|
-
.addFaq('How to get *documentation* for a function or package?', `
|
|
112
|
-
There are a couple of ways to get documentation for a function or package.
|
|
113
|
-
|
|
114
|
-
🖥️ Firstly, if you have already installed the package the function originated from you can simply run \`?<package name>::<function name>\` in an R session to print the
|
|
115
|
-
relevant documentation. If you don't know the origin of the package, you can use
|
|
116
|
-
\`??<function name>\` in an R shell to fuzzy find all documentations containing
|
|
117
|
-
\`<function name>\` or something similar.
|
|
118
|
-
|
|
119
|
-
🌐 Secondly, if you don't have or don't want to install the package you can simply google the fully qualified name of the function. Good sources include [rdrr.io](https://rdrr.io/)
|
|
120
|
-
or [rdocumentation.org](https://rdocumentation.org/). Additionally, the package documentation PDF can also
|
|
121
|
-
be downloaded directly from [cran](https://cran.r-project.org/).
|
|
111
|
+
.addFaq('How to get *documentation* for a function or package?', `
|
|
112
|
+
There are a couple of ways to get documentation for a function or package.
|
|
113
|
+
|
|
114
|
+
🖥️ Firstly, if you have already installed the package the function originated from you can simply run \`?<package name>::<function name>\` in an R session to print the
|
|
115
|
+
relevant documentation. If you don't know the origin of the package, you can use
|
|
116
|
+
\`??<function name>\` in an R shell to fuzzy find all documentations containing
|
|
117
|
+
\`<function name>\` or something similar.
|
|
118
|
+
|
|
119
|
+
🌐 Secondly, if you don't have or don't want to install the package you can simply google the fully qualified name of the function. Good sources include [rdrr.io](https://rdrr.io/)
|
|
120
|
+
or [rdocumentation.org](https://rdocumentation.org/). Additionally, the package documentation PDF can also
|
|
121
|
+
be downloaded directly from [cran](https://cran.r-project.org/).
|
|
122
122
|
`)
|
|
123
|
-
.addFaq('How does flowR know a *package\'s exports*?', `
|
|
124
|
-
See the ${ctx.linkPage('wiki/Signature Database', 'Signature Database')} wiki page.
|
|
123
|
+
.addFaq('How does flowR know a *package\'s exports*?', `
|
|
124
|
+
See the ${ctx.linkPage('wiki/Signature Database', 'Signature Database')} wiki page.
|
|
125
125
|
`);
|
|
126
126
|
wikiFaq.withTopic('editor.configs')
|
|
127
|
-
.addFaq('How can I make eslint and ZED work together?', `Use this project config (\`.zed/settings.json\`) to disable all formatters except eslint:
|
|
127
|
+
.addFaq('How can I make eslint and ZED work together?', `Use this project config (\`.zed/settings.json\`) to disable all formatters except eslint:
|
|
128
128
|
${(0, doc_code_1.codeBlock)('json', JSON.stringify(recommended_configs_1.recommendedZedConfig, null, 2))}`);
|
|
129
129
|
wikiFaq.withTopic('editor.configs')
|
|
130
|
-
.addFaq('How can I launch the flowr repl form vs code?', `You can use the following launch task (\`.vscode/launch.json\`):
|
|
130
|
+
.addFaq('How can I launch the flowr repl form vs code?', `You can use the following launch task (\`.vscode/launch.json\`):
|
|
131
131
|
${(0, doc_code_1.codeBlock)('json', JSON.stringify(recommended_configs_1.recommendedVsCodeTask, null, 2))}`);
|
|
132
132
|
return wikiFaq;
|
|
133
133
|
}
|
|
@@ -25,7 +25,7 @@ class FaqStore {
|
|
|
25
25
|
(0, assert_1.guard)(this.currTopic !== undefined, 'Current topic is not set use withTopic first');
|
|
26
26
|
question = question.replace(/\*([^*]+)\*/g, '<b>$1</b>');
|
|
27
27
|
const store = this.faqs.get(this.currTopic);
|
|
28
|
-
if (store.
|
|
28
|
+
if (store.some(([q]) => q === question)) {
|
|
29
29
|
throw new Error(`FAQ for question "${question}" in topic "${this.currTopic}" already exists`);
|
|
30
30
|
}
|
|
31
31
|
store.push([question, answer]);
|
|
@@ -162,7 +162,7 @@ class DocCapabilities extends doc_maker_1.DocMaker {
|
|
|
162
162
|
async text({ treeSitter }) {
|
|
163
163
|
/* check if the detailed test data is available */
|
|
164
164
|
if (!fs_1.default.existsSync(detailedInfoFile)) {
|
|
165
|
-
console.warn('\x1b[31mNo detailed test data available. Run the full tests (npm run test
|
|
165
|
+
console.warn('\x1b[31mNo detailed test data available. Run the full tests (npm run test:full) to generate it.\x1b[m');
|
|
166
166
|
}
|
|
167
167
|
return getPreamble() + await printAsMarkdown({ parser: treeSitter, info: obtainDetailedInfos() }, data_1.flowrCapabilities.capabilities);
|
|
168
168
|
}
|
|
@@ -133,7 +133,7 @@ class DocReadme extends doc_maker_1.DocMaker {
|
|
|
133
133
|
async text({ treeSitter, ctx }) {
|
|
134
134
|
const dateOptions = { year: 'numeric', month: 'short', day: 'numeric' };
|
|
135
135
|
return `
|
|
136
|
-
[](${doc_files_1.
|
|
136
|
+
[](${doc_files_1.FlowrSiteBaseRef}/)\\
|
|
137
137
|
[](${doc_files_1.FlowrGithubBaseRef}/flowr/actions/workflows/qa.yaml)
|
|
138
138
|
[](https://codecov.io/gh/flowr-analysis/flowr)
|
|
139
139
|
[](${doc_files_1.FlowrDockerRef})
|
|
@@ -8,13 +8,17 @@ const doc_files_1 = require("./doc-files");
|
|
|
8
8
|
*
|
|
9
9
|
*/
|
|
10
10
|
function autoGenHeader({ rVersion, filename, purpose, currentDateAndTime = new Date().toISOString().replace('T', ', ').replace(/\.\d+Z$/, ' UTC') }) {
|
|
11
|
-
|
|
11
|
+
/* what the page is about only shows on hover: the line above every page should be short */
|
|
12
|
+
return `_<span title="an overview of flowR's ${purpose}">Generated</span> from`
|
|
13
|
+
+ ` '${fileNameForGenHeader(filename)}' on ${currentDateAndTime} (v${(0, version_1.flowrVersion)().format()}${rVersion ? ', R v' + rVersion : ''}),`
|
|
14
|
+
+ ' please do not edit directly._';
|
|
12
15
|
}
|
|
13
16
|
/**
|
|
14
17
|
*
|
|
15
18
|
*/
|
|
16
19
|
function fileNameForGenHeader(filename) {
|
|
17
20
|
const shortenFilename = filename.replace(/^.*src\//, 'src/');
|
|
18
|
-
|
|
21
|
+
/* the line above every page stays short: only the file name shows, the path waits in the tooltip */
|
|
22
|
+
return `[${shortenFilename.split('/').pop() ?? shortenFilename}](${(0, doc_files_1.flowrSourceFileUrl)(shortenFilename)} "${shortenFilename}")`;
|
|
19
23
|
}
|
|
20
24
|
//# sourceMappingURL=doc-auto-gen.js.map
|
|
@@ -19,7 +19,7 @@ function collectHierarchyInformation(sourceFiles, options, fname) {
|
|
|
19
19
|
const name = node.expression.getText(sourceFile);
|
|
20
20
|
if (!fname || fname.test(name)) {
|
|
21
21
|
const comments = typescript_1.default.getLeadingCommentRanges(sourceFile.getText(sourceFile), node.getFullStart())?.map(c => {
|
|
22
|
-
return (0, doc_types_1.removeCommentSymbolsFromTypeScriptComment)(sourceFile.getText(sourceFile).
|
|
22
|
+
return (0, doc_types_1.removeCommentSymbolsFromTypeScriptComment)(sourceFile.getText(sourceFile).slice(c.pos, c.end).trim());
|
|
23
23
|
});
|
|
24
24
|
hierarchyList.push({
|
|
25
25
|
name: (0, doc_types_1.dropGenericsFromTypeName)(name),
|
|
@@ -18,7 +18,6 @@ const basic_cfg_guided_visitor_1 = require("../control-flow/basic-cfg-guided-vis
|
|
|
18
18
|
const syntax_cfg_guided_visitor_1 = require("../control-flow/syntax-cfg-guided-visitor");
|
|
19
19
|
const diff_cfg_1 = require("../control-flow/diff-cfg");
|
|
20
20
|
const node_id_1 = require("../r-bridge/lang-4.x/ast/model/processing/node-id");
|
|
21
|
-
const dfg_get_origin_1 = require("../dataflow/origin/dfg-get-origin");
|
|
22
21
|
const dfg_cfg_guided_visitor_1 = require("../control-flow/dfg-cfg-guided-visitor");
|
|
23
22
|
const semantic_cfg_guided_visitor_1 = require("../control-flow/semantic-cfg-guided-visitor");
|
|
24
23
|
const doc_issue_1 = require("./doc-util/doc-issue");
|
|
@@ -28,6 +27,7 @@ const flowr_analyzer_context_1 = require("../project/context/flowr-analyzer-cont
|
|
|
28
27
|
const doc_maker_1 = require("./wiki-mk/doc-maker");
|
|
29
28
|
const doc_general_1 = require("./doc-util/doc-general");
|
|
30
29
|
const doc_code_1 = require("./doc-util/doc-code");
|
|
30
|
+
const df_helper_1 = require("../dataflow/graph/df-helper");
|
|
31
31
|
const CfgLongExample = `f <- function(a, b = 3) {
|
|
32
32
|
if(a > b) {
|
|
33
33
|
return(a * b);
|
|
@@ -466,7 +466,7 @@ ${(0, doc_structure_1.section)('Dataflow-Aware CFG Visitor', 4, 'cfg-traversal-d
|
|
|
466
466
|
|
|
467
467
|
There is a lot of benefit in incorporating the ${ctx.linkPage('wiki/Dataflow Graph', 'dataflow information')} into the CFG traversal, as it contains
|
|
468
468
|
information about overwritten function calls, definition targets, and so on.
|
|
469
|
-
Our best friend is the ${ctx.link(
|
|
469
|
+
Our best friend is the ${ctx.link(df_helper_1.Dataflow.origin)} function which provides the important information about the origin of a vertex in the dataflow graph.
|
|
470
470
|
The ${ctx.link(dfg_cfg_guided_visitor_1.DataflowAwareCfgGuidedVisitor)} class does some of the basic lifting for us.
|
|
471
471
|
While it is not ideal for our goal of collecting all numbers, it shines in other areas such as collecting all used variables, ...
|
|
472
472
|
|
|
@@ -43,51 +43,51 @@ class WikiCreateLintingRules extends doc_maker_1.DocMaker {
|
|
|
43
43
|
super('wiki/Create Linting Rules.md', module.filename, 'creating linting rules');
|
|
44
44
|
}
|
|
45
45
|
text({ ctx }) {
|
|
46
|
-
return `
|
|
47
|
-
# Create Linting Rules
|
|
48
|
-
|
|
49
|
-
This page explains how to add a new linting rule to flowR. For an overview of the linter and the existing linting rules, see ${ctx.linkPage('wiki/Linter')}.
|
|
50
|
-
|
|
51
|
-
## Step 1: Create the new rule file
|
|
52
|
-
|
|
53
|
-
To add a new linting rule, create a dedicated rule file next to the existing rule implementations. The file name should correspond to the exported linting rule object, for example \`my-new-rule.ts\` for a rule object named \`MY_NEW_RULE\`.
|
|
54
|
-
Existing rules such as ${ctx.link('DEPRECATED_FUNCTIONS')} can be used as references.
|
|
55
|
-
Before implementing a new linting rule, open a corresponding [linting rule issue](${doc_files_1.FlowrGithubRef}/issues/new?template=linting-rule.yaml) using the accompanying issue template.
|
|
56
|
-
|
|
57
|
-
## Step 2: Define the types for the rule
|
|
58
|
-
|
|
59
|
-
For new rules, the central interface is ${ctx.link('LintingRule')}. Its type parameters are documented directly as part of the interface.
|
|
60
|
-
|
|
61
|
-
## Step 3: Define the rule itself
|
|
62
|
-
|
|
63
|
-
A new linting rule must implement the ${ctx.link('LintingRule')} interface. It consists of the following main parts:
|
|
64
|
-
|
|
65
|
-
${lintingRuleFields(ctx)}
|
|
66
|
-
|
|
67
|
-
The ${ctx.link('LintingRule::info')} field has type ${ctx.link('LinterRuleInformation')} and contains:
|
|
68
|
-
|
|
69
|
-
${lintingRuleInfoFields(ctx)}
|
|
70
|
-
|
|
71
|
-
The following example shows the basic structure of a linting rule:
|
|
72
|
-
|
|
73
|
-
${ctx.code(defineRule, { dropLinesStart: 8, dropLinesEnd: 2 })}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
## Step 4: Register the rule
|
|
77
|
-
|
|
78
|
-
After implementing the rule, register it by adding it to ${ctx.link('LintingRules')}.
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
## Step 5: Add the rule to the linter wiki generation
|
|
82
|
-
|
|
83
|
-
After registering the rule, add a corresponding \`rule\` entry to the linter wiki generation in ${ctx.link('WikiLinter')}. These entries are used to generate the linter overview and the individual wiki pages for linting rules, which can then be inspected through ${ctx.linkPage('wiki/Linter')}.
|
|
84
|
-
|
|
85
|
-
## Step 6: Add tests for the rule
|
|
86
|
-
|
|
87
|
-
New linting rules should be covered by tests following the existing linter test pattern. The test file should be named \`lint-<my-new-rule>.test.ts\`. Existing linter tests can be used as references for the expected structure.
|
|
88
|
-
|
|
89
|
-
The linter wiki automatically extracts additional examples from these tests by reading \`assertLinter\` calls. If a test should not appear as a generated wiki example, add \`/* @ignore-in-wiki */\` to the test.
|
|
90
|
-
For general information on creating and regenerating wiki pages, see ${ctx.linkPage('wiki/FAQ')}, especially the FAQ entry on creating new wiki pages. The linter overview and the generated rule documentation can then be inspected through ${ctx.linkPage('wiki/Linter')}.
|
|
46
|
+
return `
|
|
47
|
+
# Create Linting Rules
|
|
48
|
+
|
|
49
|
+
This page explains how to add a new linting rule to flowR. For an overview of the linter and the existing linting rules, see ${ctx.linkPage('wiki/Linter')}.
|
|
50
|
+
|
|
51
|
+
## Step 1: Create the new rule file
|
|
52
|
+
|
|
53
|
+
To add a new linting rule, create a dedicated rule file next to the existing rule implementations. The file name should correspond to the exported linting rule object, for example \`my-new-rule.ts\` for a rule object named \`MY_NEW_RULE\`.
|
|
54
|
+
Existing rules such as ${ctx.link('DEPRECATED_FUNCTIONS')} can be used as references.
|
|
55
|
+
Before implementing a new linting rule, open a corresponding [linting rule issue](${doc_files_1.FlowrGithubRef}/issues/new?template=linting-rule.yaml) using the accompanying issue template.
|
|
56
|
+
|
|
57
|
+
## Step 2: Define the types for the rule
|
|
58
|
+
|
|
59
|
+
For new rules, the central interface is ${ctx.link('LintingRule')}. Its type parameters are documented directly as part of the interface.
|
|
60
|
+
|
|
61
|
+
## Step 3: Define the rule itself
|
|
62
|
+
|
|
63
|
+
A new linting rule must implement the ${ctx.link('LintingRule')} interface. It consists of the following main parts:
|
|
64
|
+
|
|
65
|
+
${lintingRuleFields(ctx)}
|
|
66
|
+
|
|
67
|
+
The ${ctx.link('LintingRule::info')} field has type ${ctx.link('LinterRuleInformation')} and contains:
|
|
68
|
+
|
|
69
|
+
${lintingRuleInfoFields(ctx)}
|
|
70
|
+
|
|
71
|
+
The following example shows the basic structure of a linting rule:
|
|
72
|
+
|
|
73
|
+
${ctx.code(defineRule, { dropLinesStart: 8, dropLinesEnd: 2 })}
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
## Step 4: Register the rule
|
|
77
|
+
|
|
78
|
+
After implementing the rule, register it by adding it to ${ctx.link('LintingRules')}.
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
## Step 5: Add the rule to the linter wiki generation
|
|
82
|
+
|
|
83
|
+
After registering the rule, add a corresponding \`rule\` entry to the linter wiki generation in ${ctx.link('WikiLinter')}. These entries are used to generate the linter overview and the individual wiki pages for linting rules, which can then be inspected through ${ctx.linkPage('wiki/Linter')}.
|
|
84
|
+
|
|
85
|
+
## Step 6: Add tests for the rule
|
|
86
|
+
|
|
87
|
+
New linting rules should be covered by tests following the existing linter test pattern. The test file should be named \`lint-<my-new-rule>.test.ts\`. Existing linter tests can be used as references for the expected structure.
|
|
88
|
+
|
|
89
|
+
The linter wiki automatically extracts additional examples from these tests by reading \`assertLinter\` calls. If a test should not appear as a generated wiki example, add \`/* @ignore-in-wiki */\` to the test.
|
|
90
|
+
For general information on creating and regenerating wiki pages, see ${ctx.linkPage('wiki/FAQ')}, especially the FAQ entry on creating new wiki pages. The linter overview and the generated rule documentation can then be inspected through ${ctx.linkPage('wiki/Linter')}.
|
|
91
91
|
`;
|
|
92
92
|
}
|
|
93
93
|
}
|
|
@@ -5,6 +5,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.WikiDataflowGraph = void 0;
|
|
7
7
|
const graph_1 = require("../dataflow/graph/graph");
|
|
8
|
+
const quoted_1 = require("../dataflow/internal/process/functions/call/quoted");
|
|
9
|
+
const nse_1 = require("../dataflow/internal/process/functions/call/nse");
|
|
10
|
+
const deferred_1 = require("../dataflow/internal/process/functions/call/deferred");
|
|
8
11
|
const doc_query_1 = require("./doc-util/doc-query");
|
|
9
12
|
const vertex_1 = require("../dataflow/graph/vertex");
|
|
10
13
|
const edge_1 = require("../dataflow/graph/edge");
|
|
@@ -24,13 +27,11 @@ const doc_general_1 = require("./doc-util/doc-general");
|
|
|
24
27
|
const node_id_1 = require("../r-bridge/lang-4.x/ast/model/processing/node-id");
|
|
25
28
|
const identifier_1 = require("../dataflow/environments/identifier");
|
|
26
29
|
const r_function_call_1 = require("../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
|
|
27
|
-
const resolve_by_name_1 = require("../dataflow/environments/resolve-by-name");
|
|
28
30
|
const default_pipelines_1 = require("../core/steps/pipeline/default-pipelines");
|
|
29
31
|
const text_1 = require("../util/text/text");
|
|
30
32
|
const linker_1 = require("../dataflow/internal/linker");
|
|
31
33
|
const apply_kill_1 = require("../dataflow/environments/apply-kill");
|
|
32
34
|
const doc_normalized_ast_1 = require("./doc-util/doc-normalized-ast");
|
|
33
|
-
const dfg_get_origin_1 = require("../dataflow/origin/dfg-get-origin");
|
|
34
35
|
const identify_link_to_last_call_relation_1 = require("../queries/catalog/call-context-query/identify-link-to-last-call-relation");
|
|
35
36
|
const alias_tracking_1 = require("../dataflow/eval/resolve/alias-tracking");
|
|
36
37
|
const doc_issue_1 = require("./doc-util/doc-issue");
|
|
@@ -48,6 +49,7 @@ const range_1 = require("../util/range");
|
|
|
48
49
|
const df_helper_1 = require("../dataflow/graph/df-helper");
|
|
49
50
|
const resolve_helper_1 = require("../dataflow/environments/resolve-helper");
|
|
50
51
|
const built_in_proc_name_1 = require("../dataflow/environments/built-in-proc-name");
|
|
52
|
+
const vertex_2 = require("../dataflow/graph/vertex");
|
|
51
53
|
async function subExplanation(parser, ctx, { description, code, expectedSubgraph }) {
|
|
52
54
|
expectedSubgraph = await (0, doc_dfg_1.verifyExpectedSubgraph)(parser, code, expectedSubgraph);
|
|
53
55
|
const marks = [];
|
|
@@ -175,7 +177,7 @@ ${(0, doc_structure_1.block)({
|
|
|
175
177
|
content: `
|
|
176
178
|
If you want to obtain the locations where a variable is defined, or read, or re-defined, refrain from tracking these details manually in the dataflow graph
|
|
177
179
|
as there are some edge-cases that require special attention.
|
|
178
|
-
In general, the ${ctx.link(
|
|
180
|
+
In general, the ${ctx.link(df_helper_1.Dataflow.origin)} (which is also available as ${ctx.linkO(df_helper_1.Dataflow, 'origin')}) function explained below in ${ctx.linkPage('wiki/Dataflow Graph', 'working with the dataflow graph', 'dfg-working')} will help you to get the information you need.
|
|
179
181
|
`
|
|
180
182
|
})}
|
|
181
183
|
|
|
@@ -209,7 +211,7 @@ However, in general, flowR may use any fitting handler as an origin (see the ${c
|
|
|
209
211
|
${(0, doc_structure_1.details)('Example: Simple Function Call (unresolved)', await (async () => {
|
|
210
212
|
const code = 'foo(x,3,y=3,)';
|
|
211
213
|
const [text, info] = await (0, doc_dfg_1.printDfGraphForCode)(parser, code, { mark: new Set([8]), exposeResult: true, ctx });
|
|
212
|
-
const callInfo = info.dataflow.graph.vertices(true).find(([, vertex]) =>
|
|
214
|
+
const callInfo = info.dataflow.graph.vertices(true).find(([, vertex]) => vertex_2.FunctionCallVertex.is(vertex) && identifier_1.Identifier.getName(vertex.name) === 'foo');
|
|
213
215
|
(0, assert_1.guard)(callInfo !== undefined, () => `Could not find call vertex for ${code}`);
|
|
214
216
|
const [callId, callVert] = callInfo;
|
|
215
217
|
const inverseMapReferenceTypes = Object.fromEntries(Object.entries(identifier_1.ReferenceType).map(([k, v]) => [v, k]));
|
|
@@ -265,7 +267,7 @@ In this case, the call does not have a single ${linkEdgeName(edge_1.EdgeType.Cal
|
|
|
265
267
|
global beyond the scope of the given script. _flowR_ generally (theoretically at least) does not know if the call really refers to a built-in variable or function,
|
|
266
268
|
as any code that is not part of the analysis could cause the semantics to change.
|
|
267
269
|
However, it is (in most cases) safe to assume we call a builtin if there is a builtin function with the given name and if there is no ${linkEdgeName(edge_1.EdgeType.Calls)} edge attached to a call.
|
|
268
|
-
If you want to check the resolve targets, refer to ${ctx.link(
|
|
270
|
+
If you want to check the resolve targets, refer to ${ctx.link(resolve_helper_1.Resolve.byNameAndType)}.
|
|
269
271
|
`)}
|
|
270
272
|
|
|
271
273
|
${(0, doc_structure_1.details)('2) the function only resolves to definitions that are present in the program', `
|
|
@@ -276,7 +278,7 @@ ${await (async () => {
|
|
|
276
278
|
const code = 'foo <- function() 3\nfoo()';
|
|
277
279
|
const [text, info] = await (0, doc_dfg_1.printDfGraphForCode)(parser, code, { exposeResult: true, mark: new Set([6, '6->0', '6->1', '6->3']), ctx });
|
|
278
280
|
const numberOfEdges = [...info.dataflow.graph.edges()].flatMap(e => [...e[1].keys()]).length;
|
|
279
|
-
const callVertex = info.dataflow.graph.vertices(true).find(([, vertex]) =>
|
|
281
|
+
const callVertex = info.dataflow.graph.vertices(true).find(([, vertex]) => vertex_2.FunctionCallVertex.is(vertex) && identifier_1.Identifier.getName(vertex.name) === 'foo');
|
|
280
282
|
(0, assert_1.guard)(callVertex !== undefined, () => `Could not find call vertex for ${code}`);
|
|
281
283
|
const [callId] = callVertex;
|
|
282
284
|
return `
|
|
@@ -346,8 +348,8 @@ Great, you should see a definition of \`<-\` which is constraint by the [control
|
|
|
346
348
|
Hence, trying to re-resolve the call using ${ctx.link(linker_1.getAllFunctionCallTargets)} (defined in ${(0, doc_files_1.getFilePathMd)('../dataflow/internal/linker.ts')}) with the id \`${id}\` of the call as starting point will present you with
|
|
347
349
|
the following target ids: { \`${[...(0, linker_1.getAllFunctionCallTargets)(id, info.dataflow.graph)].join('`, `')}\` }.
|
|
348
350
|
This way we know that the call may refer to the built-in assignment operator or to the multiplication.
|
|
349
|
-
Similarly, trying to resolve the name with ${ctx.link(
|
|
350
|
-
{ \`${
|
|
351
|
+
Similarly, trying to resolve the name with ${ctx.link(resolve_helper_1.Resolve.byNameAndType)}\` using the environment attached to the call vertex (filtering for any reference type) returns (in a similar fashion):
|
|
352
|
+
{ \`${resolve_helper_1.Resolve.byName(identifier_1.Identifier.make(name), env)?.map(d => d.nodeId).join('`, `')}\` } (however, the latter will not trace aliases).
|
|
351
353
|
|
|
352
354
|
`;
|
|
353
355
|
})()}
|
|
@@ -486,7 +488,7 @@ ${(0, doc_structure_1.details)('Example: Parameters of a Function', await (async
|
|
|
486
488
|
const code = 'f <- function(x, y = 3) x + y';
|
|
487
489
|
const [text, info] = await (0, doc_dfg_1.printDfGraphForCode)(parser, code, { mark: new Set([10, 1, 3]), exposeResult: true, ctx });
|
|
488
490
|
const ast = await (0, doc_normalized_ast_1.printNormalizedAstForCode)(parser, code, { prefix: 'flowchart LR\n', showCode: false, ctx });
|
|
489
|
-
const functionDefinition = info.dataflow.graph.vertices(true).find(([, vertex]) =>
|
|
491
|
+
const functionDefinition = info.dataflow.graph.vertices(true).find(([, vertex]) => vertex_2.FunctionDefinitionVertex.is(vertex));
|
|
490
492
|
(0, assert_1.guard)(functionDefinition !== undefined, () => `Could not find function definition for ${code}`);
|
|
491
493
|
const [id] = functionDefinition;
|
|
492
494
|
const normalized = info.normalize.idMap.get(id);
|
|
@@ -538,8 +540,8 @@ ${(0, doc_structure_1.block)({
|
|
|
538
540
|
A ${linkEdgeName(edge_1.EdgeType.Reads)} edge is not a transitive closure and only links the "directly read" definition(s).
|
|
539
541
|
Our abstract domains resolving transitive ${linkEdgeName(edge_1.EdgeType.Reads)} edges (and for that matter, following ${linkEdgeName(edge_1.EdgeType.Returns)} as well)
|
|
540
542
|
are currently tailored to what we need in _flowR_. Hence, we offer a function like ${ctx.link(linker_1.getAllFunctionCallTargets)},
|
|
541
|
-
as well as ${ctx.link(
|
|
542
|
-
Refer to ${ctx.link(
|
|
543
|
+
as well as ${ctx.link(resolve_helper_1.Resolve.toBuiltIn)} which do this for specific cases.
|
|
544
|
+
Refer to ${ctx.link(df_helper_1.Dataflow.origin)} for a more general solution, as explained in ${ctx.linkPage('wiki/Dataflow Graph', 'working with the dataflow graph', 'dfg-working')}.
|
|
543
545
|
|
|
544
546
|
${(0, doc_structure_1.details)('Example: Multi-Level Reads', await (0, doc_dfg_1.printDfGraphForCode)(parser, 'x <- 3\ny <- x\nprint(y)', { mark: new Set(['9->7', '7->3', '4->0']), ctx }))}
|
|
545
547
|
|
|
@@ -595,7 +597,7 @@ However, nested definitions can carry it (in the nested case, \`x\` is defined b
|
|
|
595
597
|
name: 'Calls Edge',
|
|
596
598
|
type: edge_1.EdgeType.Calls,
|
|
597
599
|
description: `Link the [function call](#function-call-vertex) to the [function definition](#function-definition-vertex) that is called. To find all called definitions,
|
|
598
|
-
please use the ${ctx.link(
|
|
600
|
+
please use the ${ctx.link(df_helper_1.Dataflow.origin.name)} function, as explained in ${ctx.linkPage('wiki/Dataflow Graph', 'working with the dataflow graph', 'dfg-working')}.
|
|
599
601
|
If you are interested in the call graph, refer to ${ctx.linkM(flowr_analyzer_1.FlowrAnalyzer, 'callGraph')} and consult the ${ctx.linkPage('wiki/Dataflow Graph', 'call graph wiki', 'perspectives-cg')} for more information.
|
|
600
602
|
`,
|
|
601
603
|
code: 'foo <- function() {}\nfoo()',
|
|
@@ -714,6 +716,11 @@ some that may appear to be counter-intuitive. For example, a for-loop body, as i
|
|
|
714
716
|
|
|
715
717
|
${(0, doc_structure_1.details)('Example: For-Loop Body', await (0, doc_dfg_1.printDfGraphForCode)(parser, 'for(i in v) b', { mark: new Set([2, '4->2']), ctx }))}
|
|
716
718
|
${(0, doc_structure_1.details)('Example: While-Loop Body', await (0, doc_dfg_1.printDfGraphForCode)(parser, 'while(TRUE) b', { mark: new Set([1, '3->1']), ctx }))}
|
|
719
|
+
|
|
720
|
+
Three helpers decide what such a mark means once the graph is complete:
|
|
721
|
+
${ctx.link(quoted_1.Quoted.name, undefined, { type: 'variable' })} settles what a capture reaches when it is handed to \`eval\` (see ${ctx.linkO(quoted_1.Quoted, 'finalize')}),
|
|
722
|
+
${ctx.link(nse_1.Nse.name, undefined, { type: 'variable' })} models the escapes a quoting function offers (rlang's \`!!\` and \`bquote\`'s \`.(x)\`), and
|
|
723
|
+
${ctx.link(deferred_1.Deferred.name, undefined, { type: 'variable' })} links an expression R evaluates at a moment we cannot pin down, as \`delayedAssign\` binds one.
|
|
717
724
|
`
|
|
718
725
|
})}
|
|
719
726
|
`,
|
|
@@ -1088,10 +1095,10 @@ Generally, we recommend you check out the ${ctx.link(df_helper_1.Dataflow, undef
|
|
|
1088
1095
|
* The **${ctx.linkPage('wiki/Query API')}** provides many functions to query the dataflow graph for specific information (dependencies, calls, slices, clusters, ...)
|
|
1089
1096
|
* The **${ctx.linkPage('wiki/Search API')}** allows you to search for specific vertices or edges in the dataflow graph or the original program
|
|
1090
1097
|
* ${ctx.link(node_id_1.recoverName)} and ${ctx.link(node_id_1.recoverContent)} to get the name or content of a vertex in the dataflow graph
|
|
1091
|
-
* ${ctx.link(
|
|
1098
|
+
* ${ctx.link(resolve_helper_1.Resolve.toValue)} to resolve the value of a variable or id (if possible, see [below](#dfg-resolving-values))
|
|
1092
1099
|
* ${ctx.link(alias_tracking_1.getAliases)} to get all (potentially currently) aliases of a given definition
|
|
1093
1100
|
* ${ctx.link(identify_link_to_last_call_relation_1.getValueOfArgument)} to get the (syntactical) value of an argument in a function call
|
|
1094
|
-
* ${ctx.link(
|
|
1101
|
+
* ${ctx.link(df_helper_1.Dataflow.origin)} to get information about where a read, call, ... comes from (see [below](#dfg-resolving-values))
|
|
1095
1102
|
|
|
1096
1103
|
FlowR also provides various helper objects (with the same name as the corresponding type) to help you work with the dataflow graph:
|
|
1097
1104
|
|
|
@@ -1110,12 +1117,12 @@ ${(0, doc_structure_1.section)('Resolving Values', 3, 'dfg-resolving-values')}
|
|
|
1110
1117
|
FlowR supports a ${ctx.linkPage('wiki/Interface', 'configurable', 'configuring-flowr')} level of value tracking—all with the goal of knowing the static value domain of a variable.
|
|
1111
1118
|
These capabilities are exposed by the ${(0, doc_query_1.linkToQueryOfName)('resolve-value', 'resolve value Query')} and backed by two important functions:
|
|
1112
1119
|
|
|
1113
|
-
${ctx.link(
|
|
1120
|
+
${ctx.link(resolve_helper_1.Resolve.toValue)} provides an environment-sensitive (see ${ctx.link('REnvironmentInformation')})
|
|
1114
1121
|
value resolution depending on if the environment is provided.
|
|
1115
|
-
The idea of ${ctx.link(
|
|
1122
|
+
The idea of ${ctx.link(resolve_helper_1.Resolve.toValue)} is to provide a compromise between precision and performance, to
|
|
1116
1123
|
be used _during_ and _after_ the core analysis. After the dataflow analysis completes, there are much more expensive queries possible (such as the resolution of the data frame shape, see the ${ctx.linkPage('wiki/Query API', 'Query API')}).
|
|
1117
1124
|
|
|
1118
|
-
Additionally, to ${ctx.link(
|
|
1125
|
+
Additionally, to ${ctx.link(resolve_helper_1.Resolve.toValue)}, we offer the aforementioned ${ctx.link(identify_link_to_last_call_relation_1.getValueOfArgument)} to retrieve the value of an argument in a function call.
|
|
1119
1126
|
Be aware, that this function is currently not optimized for speed, so if you frequently require the values of multiple arguments of the same function call, you may want to open [an issue](${doc_issue_1.NewIssueUrl}) to request support for resolving
|
|
1120
1127
|
multiple arguments at once.
|
|
1121
1128
|
|
|
@@ -1148,7 +1155,7 @@ ${(0, doc_structure_1.section)('Handling Origins', 3, 'dfg-handling-origins')}
|
|
|
1148
1155
|
|
|
1149
1156
|
If you are writing another analysis on top of the dataflow graph, you probably want to know all definitions that serve as the source of a read, all functions
|
|
1150
1157
|
that are called by an invocation, and more.
|
|
1151
|
-
For this, the ${ctx.link(
|
|
1158
|
+
For this, the ${ctx.link(df_helper_1.Dataflow.origin)} (this is also accessible with ${ctx.linkO(df_helper_1.Dataflow, 'origin')}) function provides you with a collection of ${ctx.link('Origin')} objects:
|
|
1152
1159
|
|
|
1153
1160
|
${ctx.hierarchy('Origin', { openTop: true })}
|
|
1154
1161
|
|