@eagleoutice/flowr 2.10.9 → 2.10.10

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.
Files changed (256) hide show
  1. package/README.md +103 -33
  2. package/abstract-interpretation/absint-visitor.js +6 -3
  3. package/abstract-interpretation/domains/abstract-domain.d.ts +1 -1
  4. package/abstract-interpretation/domains/bounded-set-domain.d.ts +1 -1
  5. package/abstract-interpretation/domains/bounded-set-domain.js +1 -1
  6. package/abstract-interpretation/domains/interval-domain.d.ts +1 -1
  7. package/abstract-interpretation/domains/interval-domain.js +1 -1
  8. package/abstract-interpretation/domains/lattice.d.ts +1 -1
  9. package/abstract-interpretation/domains/partial-product-domain.d.ts +1 -1
  10. package/abstract-interpretation/domains/partial-product-domain.js +2 -2
  11. package/abstract-interpretation/domains/set-range-domain.d.ts +1 -1
  12. package/abstract-interpretation/domains/set-range-domain.js +1 -1
  13. package/abstract-interpretation/domains/set-upper-bound-domain.d.ts +1 -1
  14. package/abstract-interpretation/domains/set-upper-bound-domain.js +1 -1
  15. package/abstract-interpretation/domains/singleton-domain.d.ts +1 -1
  16. package/abstract-interpretation/domains/singleton-domain.js +1 -1
  17. package/abstract-interpretation/domains/state-abstract-domain.d.ts +1 -1
  18. package/abstract-interpretation/domains/state-abstract-domain.js +2 -2
  19. package/abstract-interpretation/unsupported-functions.d.ts +3 -2
  20. package/abstract-interpretation/unsupported-functions.js +38 -28
  21. package/cli/benchmark-app.js +2 -1
  22. package/cli/common/script.js +3 -2
  23. package/cli/flowr.js +47 -10
  24. package/cli/repl/commands/repl-cfg.js +9 -9
  25. package/cli/repl/commands/repl-commands.js +5 -0
  26. package/cli/repl/commands/repl-dataflow.js +31 -24
  27. package/cli/repl/commands/repl-main.d.ts +6 -0
  28. package/cli/repl/commands/repl-normalize.js +15 -12
  29. package/cli/repl/commands/repl-parse.js +1 -1
  30. package/cli/repl/commands/repl-query.js +4 -5
  31. package/cli/repl/commands/repl-quit.js +2 -1
  32. package/cli/repl/core.d.ts +11 -0
  33. package/cli/repl/core.js +101 -3
  34. package/cli/repl/execute.js +3 -2
  35. package/cli/repl/parser/slice-query-parser.d.ts +16 -0
  36. package/cli/repl/parser/slice-query-parser.js +52 -0
  37. package/cli/repl/server/connection.d.ts +1 -0
  38. package/cli/repl/server/connection.js +25 -0
  39. package/cli/repl/server/messages/message-analysis.d.ts +10 -0
  40. package/cli/repl/server/messages/message-analysis.js +6 -2
  41. package/cli/repl/server/messages/message-slice.d.ts +1 -1
  42. package/cli/script-core/statistics-core.js +2 -1
  43. package/cli/script-core/statistics-helper-core.js +2 -1
  44. package/cli/wiki.d.ts +2 -1
  45. package/cli/wiki.js +4 -1
  46. package/config.d.ts +9 -10
  47. package/config.js +25 -7
  48. package/control-flow/diff-cfg.d.ts +1 -1
  49. package/control-flow/diff-cfg.js +1 -1
  50. package/control-flow/semantic-cfg-guided-visitor.js +1 -0
  51. package/control-flow/simple-visitor.js +6 -5
  52. package/control-flow/useless-loop.js +2 -2
  53. package/core/print/dataflow-printer.d.ts +2 -2
  54. package/core/print/dataflow-printer.js +2 -2
  55. package/core/steps/all/static-slicing/00-slice.js +1 -1
  56. package/core/steps/pipeline/default-pipelines.d.ts +146 -146
  57. package/dataflow/environments/append.d.ts +2 -1
  58. package/dataflow/environments/append.js +2 -1
  59. package/dataflow/environments/built-in-proc-name.d.ts +2 -0
  60. package/dataflow/environments/built-in-proc-name.js +2 -0
  61. package/dataflow/environments/built-in.d.ts +2 -0
  62. package/dataflow/environments/built-in.js +2 -0
  63. package/dataflow/environments/default-builtin-config.d.ts +122 -66
  64. package/dataflow/environments/default-builtin-config.js +324 -145
  65. package/dataflow/environments/environment.d.ts +2 -1
  66. package/dataflow/environments/environment.js +13 -9
  67. package/dataflow/environments/identifier.d.ts +55 -2
  68. package/dataflow/environments/identifier.js +14 -2
  69. package/dataflow/environments/reference-to-maybe.d.ts +2 -0
  70. package/dataflow/environments/reference-to-maybe.js +56 -11
  71. package/dataflow/environments/resolve-by-name.js +13 -7
  72. package/dataflow/eval/values/general.js +4 -0
  73. package/dataflow/extractor.js +12 -2
  74. package/dataflow/graph/df-helper.d.ts +6 -0
  75. package/dataflow/graph/df-helper.js +33 -0
  76. package/dataflow/graph/graph.js +1 -1
  77. package/dataflow/info.d.ts +1 -1
  78. package/dataflow/internal/linker.d.ts +5 -1
  79. package/dataflow/internal/linker.js +34 -9
  80. package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +1 -1
  81. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +53 -0
  82. package/dataflow/internal/process/functions/call/built-in/built-in-namespace-access.d.ts +13 -0
  83. package/dataflow/internal/process/functions/call/built-in/built-in-namespace-access.js +58 -0
  84. package/dataflow/internal/process/functions/call/built-in/built-in-repeat-loop.js +1 -1
  85. package/dataflow/internal/process/functions/call/built-in/built-in-rm.d.ts +1 -1
  86. package/dataflow/internal/process/functions/call/built-in/built-in-rm.js +38 -14
  87. package/dataflow/internal/process/functions/call/built-in/built-in-source.js +9 -10
  88. package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.js +1 -1
  89. package/dataflow/internal/process/functions/call/known-call-handling.js +4 -3
  90. package/dataflow/internal/process/functions/call/named-call-handling.js +6 -0
  91. package/dataflow/origin/dfg-get-origin.d.ts +1 -1
  92. package/dataflow/origin/dfg-get-origin.js +1 -1
  93. package/dataflow/processor.d.ts +6 -0
  94. package/documentation/data/faq/faqs.d.ts +2 -1
  95. package/documentation/data/faq/faqs.js +75 -57
  96. package/documentation/data/server/doc-data-server-messages.d.ts +2 -1
  97. package/documentation/data/server/doc-data-server-messages.js +15 -7
  98. package/documentation/doc-readme.js +15 -15
  99. package/documentation/doc-util/doc-cfg.d.ts +3 -1
  100. package/documentation/doc-util/doc-cfg.js +3 -3
  101. package/documentation/doc-util/doc-dfg.d.ts +3 -1
  102. package/documentation/doc-util/doc-dfg.js +3 -3
  103. package/documentation/doc-util/doc-files.d.ts +3 -1
  104. package/documentation/doc-util/doc-files.js +9 -6
  105. package/documentation/doc-util/doc-normalized-ast.d.ts +3 -1
  106. package/documentation/doc-util/doc-normalized-ast.js +2 -2
  107. package/documentation/doc-util/doc-query.d.ts +2 -1
  108. package/documentation/doc-util/doc-query.js +2 -2
  109. package/documentation/doc-util/doc-repl.js +1 -0
  110. package/documentation/doc-util/doc-types.d.ts +6 -6
  111. package/documentation/doc-util/doc-types.js +11 -9
  112. package/documentation/issue-linting-rule.js +1 -2
  113. package/documentation/wiki-analyzer.js +9 -9
  114. package/documentation/wiki-cfg.js +40 -41
  115. package/documentation/wiki-core.js +119 -31
  116. package/documentation/wiki-create-linting-rules.d.ts +6 -0
  117. package/documentation/wiki-create-linting-rules.js +95 -0
  118. package/documentation/wiki-dataflow-graph.js +77 -76
  119. package/documentation/wiki-engine.js +1 -2
  120. package/documentation/wiki-faq.d.ts +2 -1
  121. package/documentation/wiki-faq.js +4 -4
  122. package/documentation/wiki-interface.js +19 -6
  123. package/documentation/wiki-linter.d.ts +1 -1
  124. package/documentation/wiki-linter.js +14 -6
  125. package/documentation/wiki-linting-and-testing.js +2 -2
  126. package/documentation/wiki-mk/doc-context.d.ts +3 -3
  127. package/documentation/wiki-mk/doc-maker.d.ts +2 -0
  128. package/documentation/wiki-mk/doc-maker.js +7 -1
  129. package/documentation/wiki-normalized-ast.js +5 -5
  130. package/documentation/wiki-onboarding.d.ts +2 -1
  131. package/documentation/wiki-onboarding.js +5 -5
  132. package/documentation/wiki-overview.js +3 -3
  133. package/documentation/wiki-query.js +85 -84
  134. package/documentation/wiki-search.js +4 -5
  135. package/documentation/wiki-setup.js +6 -7
  136. package/gas.d.ts +74 -0
  137. package/gas.js +18 -0
  138. package/linter/linter-executor.js +2 -8
  139. package/linter/linter-format.d.ts +4 -11
  140. package/linter/linter-rules.d.ts +88 -86
  141. package/linter/linter-rules.js +7 -1
  142. package/linter/rules/absolute-path.d.ts +2 -7
  143. package/linter/rules/absolute-path.js +6 -4
  144. package/linter/rules/dataframe-access-validation.d.ts +1 -6
  145. package/linter/rules/dataframe-access-validation.js +8 -6
  146. package/linter/rules/dead-code.d.ts +2 -11
  147. package/linter/rules/dead-code.js +16 -11
  148. package/linter/rules/deprecated-functions.d.ts +3 -3
  149. package/linter/rules/file-path-validity.d.ts +1 -6
  150. package/linter/rules/file-path-validity.js +5 -5
  151. package/linter/rules/function-finder-util.d.ts +7 -11
  152. package/linter/rules/function-finder-util.js +9 -6
  153. package/linter/rules/naming-convention.d.ts +2 -7
  154. package/linter/rules/naming-convention.js +3 -2
  155. package/linter/rules/network-functions.d.ts +2 -7
  156. package/linter/rules/network-functions.js +14 -12
  157. package/linter/rules/no-leaked-credentials.d.ts +36 -0
  158. package/linter/rules/no-leaked-credentials.js +75 -0
  159. package/linter/rules/problematic-inputs.d.ts +1 -8
  160. package/linter/rules/problematic-inputs.js +5 -4
  161. package/linter/rules/roxygen-arguments.d.ts +2 -7
  162. package/linter/rules/roxygen-arguments.js +13 -20
  163. package/linter/rules/seeded-randomness.d.ts +2 -7
  164. package/linter/rules/seeded-randomness.js +7 -4
  165. package/linter/rules/software-has-license.d.ts +31 -0
  166. package/linter/rules/software-has-license.js +46 -0
  167. package/linter/rules/software-has-tests.d.ts +38 -0
  168. package/linter/rules/software-has-tests.js +48 -0
  169. package/linter/rules/stop-with-call-arg.d.ts +2 -7
  170. package/linter/rules/stop-with-call-arg.js +3 -2
  171. package/linter/rules/unused-definition.d.ts +3 -8
  172. package/linter/rules/unused-definition.js +7 -5
  173. package/linter/rules/useless-loop.d.ts +2 -7
  174. package/linter/rules/useless-loop.js +5 -2
  175. package/package.json +3 -2
  176. package/project/context/flowr-analyzer-context.d.ts +13 -14
  177. package/project/context/flowr-analyzer-context.js +4 -0
  178. package/project/context/flowr-analyzer-files-context.d.ts +12 -0
  179. package/project/context/flowr-analyzer-files-context.js +12 -2
  180. package/project/context/flowr-analyzer-gas-context.d.ts +28 -0
  181. package/project/context/flowr-analyzer-gas-context.js +101 -0
  182. package/project/plugins/file-plugins/files/flowr-rmarkdown-file.d.ts +13 -7
  183. package/project/plugins/file-plugins/files/flowr-rmarkdown-file.js +56 -11
  184. package/project/plugins/file-plugins/notebooks/flowr-analyzer-qmd-file-plugin.d.ts +1 -1
  185. package/project/plugins/file-plugins/notebooks/flowr-analyzer-qmd-file-plugin.js +2 -2
  186. package/project/plugins/file-plugins/notebooks/flowr-analyzer-rmd-file-plugin.d.ts +2 -1
  187. package/project/plugins/file-plugins/notebooks/flowr-analyzer-rmd-file-plugin.js +5 -5
  188. package/project/plugins/flowr-analyzer-plugin.d.ts +15 -8
  189. package/project/plugins/flowr-analyzer-plugin.js +14 -7
  190. package/project/plugins/gas-plugins/flowr-analyzer-gas-plugin.d.ts +19 -0
  191. package/project/plugins/gas-plugins/flowr-analyzer-gas-plugin.js +35 -0
  192. package/project/plugins/plugin-registry.d.ts +2 -1
  193. package/project/plugins/plugin-registry.js +3 -1
  194. package/project/plugins/project-discovery/flowr-analyzer-gitignore-project-discovery-plugin.d.ts +22 -0
  195. package/project/plugins/project-discovery/flowr-analyzer-gitignore-project-discovery-plugin.js +47 -0
  196. package/project/plugins/project-discovery/flowr-analyzer-project-discovery-plugin.js +1 -1
  197. package/queries/catalog/call-context-query/call-context-query-executor.js +54 -8
  198. package/queries/catalog/call-context-query/call-context-query-format.d.ts +2 -2
  199. package/queries/catalog/dependencies-query/function-info/test-functions.d.ts +2 -0
  200. package/queries/catalog/dependencies-query/function-info/test-functions.js +18 -177
  201. package/queries/catalog/df-shape-query/df-shape-query-format.js +1 -1
  202. package/queries/catalog/dice-query/dice-query-executor.d.ts +8 -0
  203. package/queries/catalog/dice-query/dice-query-executor.js +52 -0
  204. package/queries/catalog/dice-query/dice-query-format.d.ts +53 -0
  205. package/queries/catalog/dice-query/dice-query-format.js +102 -0
  206. package/queries/catalog/happens-before-query/happens-before-query-executor.js +2 -2
  207. package/queries/catalog/input-sources-query/input-sources-query-format.d.ts +2 -0
  208. package/queries/catalog/input-sources-query/input-sources-query-format.js +1 -0
  209. package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.d.ts +2 -0
  210. package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.js +1 -0
  211. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.d.ts +2 -0
  212. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.js +1 -0
  213. package/queries/catalog/linter-query/linter-query-executor.js +7 -0
  214. package/queries/catalog/location-map-query/location-map-query-format.d.ts +2 -0
  215. package/queries/catalog/location-map-query/location-map-query-format.js +1 -0
  216. package/queries/catalog/origin-query/origin-query-format.d.ts +2 -0
  217. package/queries/catalog/origin-query/origin-query-format.js +1 -0
  218. package/queries/catalog/provenance-query/provenance-query-format.d.ts +2 -0
  219. package/queries/catalog/provenance-query/provenance-query-format.js +1 -0
  220. package/queries/catalog/resolve-value-query/resolve-value-query-format.d.ts +2 -0
  221. package/queries/catalog/resolve-value-query/resolve-value-query-format.js +1 -0
  222. package/queries/catalog/static-slice-query/static-slice-query-executor.js +1 -1
  223. package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +2 -0
  224. package/queries/catalog/static-slice-query/static-slice-query-format.js +1 -0
  225. package/queries/query.d.ts +18 -1
  226. package/queries/query.js +3 -1
  227. package/r-bridge/data/data.d.ts +5 -0
  228. package/r-bridge/data/data.js +6 -0
  229. package/r-bridge/lang-4.x/ast/model/nodes/r-string.d.ts +0 -1
  230. package/r-bridge/lang-4.x/ast/parser/main/internal/values/normalize-number.d.ts +1 -1
  231. package/r-bridge/lang-4.x/ast/parser/main/internal/values/normalize-number.js +1 -1
  232. package/r-bridge/lang-4.x/ast/parser/main/internal/values/normalize-string.d.ts +1 -1
  233. package/r-bridge/lang-4.x/ast/parser/main/internal/values/normalize-string.js +1 -1
  234. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +55 -44
  235. package/r-bridge/parser.js +2 -9
  236. package/r-bridge/shell.d.ts +8 -1
  237. package/r-bridge/shell.js +26 -7
  238. package/search/flowr-search-builder.d.ts +2 -2
  239. package/search/flowr-search-builder.js +1 -1
  240. package/search/flowr-search-filters.d.ts +30 -9
  241. package/search/flowr-search-filters.js +26 -21
  242. package/search/search-executor/search-enrichers.d.ts +600 -0
  243. package/search/search-executor/search-enrichers.js +23 -2
  244. package/slicing/static/static-slicer.d.ts +39 -11
  245. package/slicing/static/static-slicer.js +44 -14
  246. package/util/collections/queue.d.ts +16 -0
  247. package/util/collections/queue.js +38 -0
  248. package/util/log.d.ts +1 -1
  249. package/util/log.js +1 -1
  250. package/util/mermaid/dfg.d.ts +2 -2
  251. package/util/mermaid/dfg.js +2 -2
  252. package/util/objects.d.ts +9 -0
  253. package/util/objects.js +54 -0
  254. package/util/proc.d.ts +6 -0
  255. package/util/proc.js +20 -0
  256. package/util/version.js +1 -1
@@ -8,6 +8,7 @@ const doc_server_message_1 = require("./doc-util/doc-server-message");
8
8
  const doc_data_server_messages_1 = require("./data/server/doc-data-server-messages");
9
9
  const doc_code_1 = require("./doc-util/doc-code");
10
10
  const retriever_1 = require("../r-bridge/retriever");
11
+ const core_1 = require("../cli/repl/core");
11
12
  const doc_docker_1 = require("./doc-util/doc-docker");
12
13
  const doc_repl_1 = require("./doc-util/doc-repl");
13
14
  const doc_dfg_1 = require("./doc-util/doc-dfg");
@@ -21,10 +22,10 @@ const doc_maker_1 = require("./wiki-mk/doc-maker");
21
22
  const doc_writing_code_1 = require("./data/interface/doc-writing-code");
22
23
  const built_in_proc_name_1 = require("../dataflow/environments/built-in-proc-name");
23
24
  const flowr_analyzer_1 = require("../project/flowr-analyzer");
24
- async function explainServer(parser) {
25
- (0, doc_data_server_messages_1.documentAllServerMessages)();
25
+ async function explainServer(parser, ctx) {
26
+ (0, doc_data_server_messages_1.documentAllServerMessages)(ctx);
26
27
  return `
27
- As explained in the [Overview](${doc_files_1.FlowrWikiBaseRef}/Overview), you can simply run the [TCP](https://de.wikipedia.org/wiki/Transmission_Control_Protocol)&nbsp;server by adding the ${(0, doc_cli_option_1.getCliLongOptionOf)('flowr', 'server', true)} flag (and, due to the interactive mode, exit with the conventional <kbd>CTRL</kbd>+<kbd>C</kbd>).
28
+ As explained in the ${ctx.linkPage('wiki/Overview', 'Overview')}, you can simply run the [TCP](https://de.wikipedia.org/wiki/Transmission_Control_Protocol)&nbsp;server by adding the ${(0, doc_cli_option_1.getCliLongOptionOf)('flowr', 'server', true)} flag (and, due to the interactive mode, exit with the conventional <kbd>CTRL</kbd>+<kbd>C</kbd>).
28
29
  Currently, every connection is handled by the same underlying \`${shell_1.RShell.name}\` - so the server is not designed to handle many clients at a time.
29
30
  Additionally, the server is not well guarded against attacks (e.g., you can theoretically spawn an arbitrary number of&nbsp;${shell_1.RShell.name} sessions on the target machine).
30
31
 
@@ -168,6 +169,11 @@ Many commands that allow for an R-expression (like ${ctx.replCmd('dataflow*')})
168
169
  if the argument starts with \`${retriever_1.fileProtocol}\`.
169
170
  If you are working from the root directory of the _flowR_ repository, the following gives you the parsed AST of the example file using the ${ctx.replCmd('parse')} command:
170
171
 
172
+ > **Watch mode**: Replace \`${retriever_1.fileProtocol}\` with \`${core_1.watchProtocol}\` to enter watch mode.
173
+ > flowR runs the command immediately and then re-runs it every time the file (or any file inside the folder) changes.
174
+ > Enter any other command to leave watch mode.
175
+ > For example: \`:df ${core_1.watchProtocol}analysis.R\`
176
+
171
177
  ${await (0, doc_repl_1.documentReplSession)(parser, [{
172
178
  command: `:parse ${retriever_1.fileProtocol}test/testfiles/example.R`,
173
179
  description: `Retrieve the parsed AST of the example file.
@@ -207,7 +213,7 @@ function explainConfigFile(ctx) {
207
213
  When running _flowR_, you may want to specify some behaviors with a dedicated configuration file.
208
214
  By default, flowR looks for a file named \`${flowr_main_options_1.defaultConfigFile}\` in the current working directory (or any higher directory).
209
215
  You can also specify a different file with ${(0, doc_cli_option_1.getCliLongOptionOf)('flowr', 'config-file')} or pass the configuration inline using ${(0, doc_cli_option_1.getCliLongOptionOf)('flowr', 'config-json')}.
210
- To inspect the current configuration, you can run flowr with the ${(0, doc_cli_option_1.getCliLongOptionOf)('flowr', 'verbose')} flag, or use the \`config\` [Query](${doc_files_1.FlowrWikiBaseRef}/Query%20API).
216
+ To inspect the current configuration, you can run flowr with the ${(0, doc_cli_option_1.getCliLongOptionOf)('flowr', 'verbose')} flag, or use the \`config\` ${ctx.linkPage('wiki/Query API', 'Query')}.
211
217
  Within the REPL this works by running the following:
212
218
 
213
219
  ${(0, doc_code_1.codeBlock)('shell', ':query @config')}
@@ -221,7 +227,7 @@ The following summarizes the configuration options:
221
227
  You may use this to overwrite _flowR_'s handling of built-in function and even completely clear the preset definitions shipped with flowR.
222
228
  See [Configure BuiltIn Semantics](#configure-builtin-semantics) for more information.
223
229
  - \`solver\`: allows to configure how _flowR_ resolves variables and their values (currently we support: ${Object.values(config_1.VariableResolve).map(v => `\`${v}\``).join(', ')}), as well as if pointer analysis should be active.
224
- - \`engines\`: allows to configure the engines used by _flowR_ to interact with R code. See the [Engines wiki page](${doc_files_1.FlowrWikiBaseRef}/Engines) for more information.
230
+ - \`engines\`: allows to configure the engines used by _flowR_ to interact with R code. See the ${ctx.linkPage('wiki/Engines', 'Engines wiki page')} for more information.
225
231
  - \`defaultEngine\`: allows to specify the default engine to use for interacting with R code. If not set, an arbitrary engine from the specified list will be used.
226
232
  - \`abstractInterpretation\`: allows to configure how _flowR_ performs abstract interpretation, although we currently only support data frame shape inference through abstract interpretation.
227
233
  - \`defaultPlugins\`: allows to configure which plugins to load by default when creating a new ${ctx.link(flowr_analyzer_1.FlowrAnalyzer)} instance.
@@ -278,6 +284,13 @@ ${(0, doc_code_1.codeBlock)('json', JSON.stringify({
278
284
  maxReadLines: 1_000_000
279
285
  }
280
286
  }
287
+ },
288
+ gas: {
289
+ thresholds: {
290
+ memory: { problematic: 0.7, critical: 0.9 },
291
+ timeMs: { problematic: 100_000, critical: 120_000 }
292
+ },
293
+ features: {}
281
294
  }
282
295
  }, null, 2))}
283
296
 
@@ -349,7 +362,7 @@ ${(0, doc_writing_code_1.explainWritingCode)(shell, ctx)}
349
362
  <a id='communicating-with-the-server'></a>
350
363
  ## 💬 Communicating with the Server
351
364
 
352
- ${await explainServer(shell)}
365
+ ${await explainServer(shell, ctx)}
353
366
  `;
354
367
  }
355
368
  }
@@ -5,5 +5,5 @@ import { DocMaker } from './wiki-mk/doc-maker';
5
5
  */
6
6
  export declare class WikiLinter extends DocMaker<'wiki/Linter.md'> {
7
7
  constructor();
8
- protected text({ treeSitter }: DocMakerArgs): Promise<string>;
8
+ protected text({ treeSitter, ctx }: DocMakerArgs): Promise<string>;
9
9
  }
@@ -129,6 +129,9 @@ function(x) {
129
129
  eval(x)
130
130
  }
131
131
  `, tagTypes);
132
+ rule(knownParser, 'software-has-license', 'SoftwareHasLicenseConfig', 'SOFTWARE_HAS_LICENSE', 'lint-software-has-license', 'cat("a project without a license")', tagTypes);
133
+ rule(knownParser, 'software-has-tests', 'SoftwareHasTestsConfig', 'SOFTWARE_HAS_TESTS', 'lint-software-has-tests', 'cat("hello")', tagTypes);
134
+ rule(knownParser, 'no-leaked-credentials', 'NoLeakedCredentialsConfig', 'NO_LEAKED_CREDENTIALS', 'lint-no-leaked-credentials', 'password <- "s3cr3t"', tagTypes);
132
135
  function rule(parser, name, configType, ruleType, testfile, example, types) {
133
136
  const rule = linter_rules_1.LintingRules[name];
134
137
  const tags = rule.info.tags.toSorted((a, b) => {
@@ -202,10 +205,10 @@ function getAllLintingRulesWitCertainty(certainty) {
202
205
  function linkToRule(name) {
203
206
  return `[${name}](${doc_files_1.FlowrWikiBaseRef}/${encodeURIComponent(getPageNameForLintingRule(name).replaceAll(' ', '-'))})`;
204
207
  }
205
- async function getTextMainPage(knownParser, tagTypes) {
208
+ async function getTextMainPage(knownParser, tagTypes, ctx) {
206
209
  const rules = registerRules(knownParser, tagTypes.info);
207
210
  return `
208
- This page describes the flowR linter, which is a tool that utilizes flowR's dataflow analysis to find common issues in R scripts. The linter can currently be used through the linter [query](${doc_files_1.FlowrWikiBaseRef}/Query%20API).
211
+ This page describes the flowR linter, which is a tool that utilizes flowR's dataflow analysis to find common issues in R scripts. The linter can currently be used through the linter ${ctx.linkPage('wiki/Query API', 'query')}.
209
212
  For example:
210
213
 
211
214
  ${await (async () => {
@@ -224,6 +227,11 @@ ${res}
224
227
 
225
228
  ${(0, doc_structure_1.section)('Linting Rules', 2, 'linting-rules')}
226
229
 
230
+ ${(0, doc_structure_1.block)({
231
+ type: 'NOTE',
232
+ content: `If you want to add a new linting rule, see ${ctx.linkPage('wiki/Create Linting Rules')}.`
233
+ })}
234
+
227
235
  The following linting rules are available:
228
236
 
229
237
  ${await (async () => {
@@ -276,13 +284,13 @@ async function getRulesPages(knownParser, tagTypes) {
276
284
  return result;
277
285
  }
278
286
  /** Maps file-names to their content, the 'main' file is named 'main' */
279
- async function getTexts(parser) {
287
+ async function getTexts(parser, ctx) {
280
288
  const tagTypes = (0, doc_types_1.getTypesFromFolder)({
281
289
  rootFolder: path_1.default.resolve('./src/linter/'),
282
290
  inlineTypes: doc_types_1.mermaidHide
283
291
  });
284
292
  return {
285
- 'main': await getTextMainPage(parser, tagTypes),
293
+ 'main': await getTextMainPage(parser, tagTypes, ctx),
286
294
  ...await getRulesPages(parser, tagTypes)
287
295
  };
288
296
  }
@@ -293,8 +301,8 @@ class WikiLinter extends doc_maker_1.DocMaker {
293
301
  constructor() {
294
302
  super('wiki/Linter.md', module.filename, 'linter');
295
303
  }
296
- async text({ treeSitter }) {
297
- const texts = await getTexts(treeSitter);
304
+ async text({ treeSitter, ctx }) {
305
+ const texts = await getTexts(treeSitter, ctx);
298
306
  for (const [file, content] of Object.entries(texts)) {
299
307
  if (file === 'main') {
300
308
  continue; // main is printed below
@@ -104,7 +104,7 @@ The set of currently supported capabilities and their IDs can be found in ${(0,
104
104
 
105
105
  The resulting labels are used in the test report that is generated as part of the test output.
106
106
  They group tests by the capabilities they test and allow the report to display how many tests ensure that any given capability is properly supported.
107
- The report can be found on the wiki's [capabilities page](${doc_files_1.FlowrWikiBaseRef}/Capabilities).
107
+ The report can be found on the wiki's ${ctx.linkPage('wiki/Capabilities', 'capabilities page')}.
108
108
 
109
109
  To add new labels, simply add them to the relevant section in ${(0, doc_files_1.getFilePathMd)('../r-bridge/data/data.ts')} as part of a pull request.
110
110
 
@@ -214,7 +214,7 @@ We explain the most important workflows in the following:
214
214
  - reporting code coverage
215
215
  - running the [linter](#linting) and reporting its results
216
216
  - deploying the documentation to [GitHub Pages](${doc_files_1.FlowrSiteBaseRef}/doc/)
217
- - [release.yaml](${doc_files_1.RemoteFlowrFilePathBaseRef}/.github/workflows/release.yaml) is responsible for creating a new release, only to be run by repository owners. Furthermore, it adds the new docker image to [docker hub](${doc_files_1.FlowrDockerRef}).
217
+ - [release.yaml](${doc_files_1.RemoteFlowrFilePathBaseRef}/.github/workflows/release.yaml) is responsible for creating a new release, only to be run by repository owners. Furthermore, it adds the new docker image to ${ctx.linkPage('flowr:docker', 'docker hub')}.
218
218
  - [broken-links-and-wiki.yaml](${doc_files_1.RemoteFlowrFilePathBaseRef}/.github/workflows/broken-links-and-wiki.yaml) repeatedly tests that all links are not dead!
219
219
 
220
220
  <a id='linting'></a>
@@ -130,8 +130,8 @@ export interface GeneralDocContext {
130
130
  * ```
131
131
  *
132
132
  * Creates a (markdown) link to the `myMethod` member of the `MyClass` class in the code base.
133
- * @see {@link GeneralWikiContext#link|link} - for the underlying impl.
134
- * @see {@link GeneralWikiContext#linkO|linkO} - to link using an object reference instead of a class and member name (e.g. for helper objects).
133
+ * @see {@link GeneralDocContext#link|link} - for the underlying impl.
134
+ * @see {@link GeneralDocContext#linkO|linkO} - to link using an object reference instead of a class and member name (e.g. for helper objects).
135
135
  */
136
136
  linkM<T extends NamedPrototype>(cls: T, element: ProtoKeys<T> | StaticKeys<T>, fmt?: LinkFormat & {
137
137
  hideClass?: boolean;
@@ -152,7 +152,7 @@ export interface GeneralDocContext {
152
152
  * ```
153
153
  * Creates a (markdown) link to the `registerPluginMaker` function in the code base
154
154
  * using the file path as link name.
155
- * @see {@link GeneralWikiContext#link|link} - to create a link with a custom name/using the type name by default.
155
+ * @see {@link GeneralDocContext#link|link} - to create a link with a custom name/using the type name by default.
156
156
  * @see {@link linkFile} - for the underlying impl.
157
157
  */
158
158
  linkFile(element: ElementIdOrRef): string;
@@ -28,6 +28,8 @@ export declare enum WikiChangeType {
28
28
  UnimportantChange = 1,
29
29
  Identical = 2
30
30
  }
31
+ /** Strips `\r` so generated files stay consistent regardless of OS/checkout settings. */
32
+ export declare function normalizeLineEndings(text: string): string;
31
33
  export interface DocMakerLike<Target extends string = string> {
32
34
  make(args: DocMakerArgs & DocMakerOutputArgs): Promise<boolean>;
33
35
  getTarget(): Target;
@@ -1,12 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DocMaker = exports.WikiChangeType = void 0;
4
+ exports.normalizeLineEndings = normalizeLineEndings;
4
5
  var WikiChangeType;
5
6
  (function (WikiChangeType) {
6
7
  WikiChangeType[WikiChangeType["Changed"] = 0] = "Changed";
7
8
  WikiChangeType[WikiChangeType["UnimportantChange"] = 1] = "UnimportantChange";
8
9
  WikiChangeType[WikiChangeType["Identical"] = 2] = "Identical";
9
10
  })(WikiChangeType || (exports.WikiChangeType = WikiChangeType = {}));
11
+ /** Strips `\r` so generated files stay consistent regardless of OS/checkout settings. */
12
+ function normalizeLineEndings(text) {
13
+ return text.replace(/\r\n/g, '\n');
14
+ }
10
15
  const DefaultReplacementPatterns = [
11
16
  // eslint-disable-next-line no-irregular-whitespace -- we may produce it in output
12
17
  [/\d+(\.\d+)?( |\s*)?ms/g, ''],
@@ -77,7 +82,7 @@ class DocMaker {
77
82
  async make(args) {
78
83
  this.currentArgs = args;
79
84
  this.writtenSubfiles = new Set();
80
- const newText = (this.printHeader ? (await args.ctx.header(this.filename, this.purpose)) + '\n' : '') + await this.text(args);
85
+ const newText = normalizeLineEndings((this.printHeader ? (await args.ctx.header(this.filename, this.purpose)) + '\n' : '') + await this.text(args));
81
86
  if (args.force || this.didUpdate(this.target, newText, args.readFileSync(this.target)?.toString()) === WikiChangeType.Changed) {
82
87
  args.writeFileSync(this.target, newText);
83
88
  return true;
@@ -91,6 +96,7 @@ class DocMaker {
91
96
  if (!this.currentArgs) {
92
97
  throw new Error('DocMaker: writeSubFile called outside of make()');
93
98
  }
99
+ data = normalizeLineEndings(data);
94
100
  if (this.currentArgs.force || this.didUpdate(path, data, this.currentArgs.readFileSync(path)?.toString()) === WikiChangeType.Changed) {
95
101
  this.currentArgs.writeFileSync(path.toString(), data);
96
102
  this.writtenSubfiles.add(path.toString());
@@ -60,12 +60,12 @@ ${(0, doc_code_1.codeBlock)('r', 'x <- 2 * 3 + 1')}
60
60
  Each node in the AST contains the type, the id, and the lexeme (if applicable).
61
61
  Each edge is labeled with the type of the parent-child relationship (the "role").
62
62
 
63
- ${await (0, doc_normalized_ast_1.printNormalizedAstForCode)(treeSitter, 'x <- 2 * 3 + 1', { showCode: false, prefix: 'flowchart LR\n' })}
63
+ ${await (0, doc_normalized_ast_1.printNormalizedAstForCode)(treeSitter, 'x <- 2 * 3 + 1', { showCode: false, prefix: 'flowchart LR\n', ctx })}
64
64
 
65
65
  > [!TIP]
66
66
  > If you want to investigate the normalized AST,
67
- > you can either use the [Visual Studio Code extension](${doc_files_1.FlowrGithubBaseRef}/vscode-flowr) or the ${(0, doc_cli_option_1.getReplCommand)('normalize*')}
68
- > command in the REPL (see the [Interface wiki page](${doc_files_1.FlowrWikiBaseRef}/Interface) for more information).
67
+ > you can either use the [Visual Studio Code extension](${doc_files_1.FlowrGithubBaseRef}/vscode-flowr) or the ${(0, doc_cli_option_1.getReplCommand)('normalize*')}
68
+ > command in the REPL (see the ${ctx.linkPage('wiki/Interface', 'Interface wiki page')} for more information).
69
69
 
70
70
  Indicative of the normalization is the root ${ctx.link(r_project_1.RProject)} node, which is present in every normalized AST
71
71
  and provides the ${ctx.link(r_expression_list_1.RExpressionList)} nodes for each file in the project.
@@ -91,7 +91,7 @@ ${(0, doc_code_1.codeBlock)('mermaid', ctx.mermaid(model_1.RNode))}
91
91
  Node types are controlled by the ${ctx.link('RType')} enum (see ${(0, doc_files_1.getFilePathMd)('../r-bridge/lang-4.x/ast/model/type.ts')}),
92
92
  which is used to distinguish between different types of nodes.
93
93
  Additionally, every AST node is generic with respect to the \`Info\` type which allows for arbitrary decorations (e.g., parent inforamtion or dataflow constraints).
94
- Most notably, the \`info\` field holds the \`id\` of the node, which is used to reference the node in the [dataflow graph](${doc_files_1.FlowrWikiBaseRef}/Dataflow%20Graph).
94
+ Most notably, the \`info\` field holds the \`id\` of the node, which is used to reference the node in the ${ctx.linkPage('wiki/Dataflow Graph', 'dataflow graph')}.
95
95
 
96
96
  In summary, we have the following types:
97
97
 
@@ -109,7 +109,7 @@ The following segments intend to give you an overview of how to work with the no
109
109
 
110
110
  ## How to Get a Normalized AST
111
111
 
112
- As explained alongside the [Interface](${doc_files_1.FlowrWikiBaseRef}/Interface#creating-flowr-analyses) wiki page, you can use an instance of
112
+ As explained alongside the ${ctx.linkPage('wiki/Interface', 'Interface', 'creating-flowr-analyses')} wiki page, you can use an instance of
113
113
  ${ctx.link(flowr_analyzer_1.FlowrAnalyzer)} to get the ${ctx.link('NormalizedAst')}:
114
114
 
115
115
  ${ctx.code(simpleNormalizedAst, { dropLinesStart: 1, dropLinesEnd: 2, hideDefinedAt: true })}
@@ -1,8 +1,9 @@
1
+ import type { DocMakerArgs } from './wiki-mk/doc-maker';
1
2
  import { DocMaker } from './wiki-mk/doc-maker';
2
3
  /**
3
4
  * https://github.com/flowr-analysis/flowr/wiki/Onboarding
4
5
  */
5
6
  export declare class WikiOnboarding extends DocMaker<'wiki/Onboarding.md'> {
6
7
  constructor();
7
- text(): string;
8
+ text({ ctx }: DocMakerArgs): string;
8
9
  }
@@ -11,16 +11,16 @@ class WikiOnboarding extends doc_maker_1.DocMaker {
11
11
  constructor() {
12
12
  super('wiki/Onboarding.md', module.filename, 'developer onboarding process');
13
13
  }
14
- text() {
14
+ text({ ctx }) {
15
15
  return `To get started developing on *flowR*, we recommend carefully reading the following pages:
16
- - 💻 [Setting up the *flowR* development environment](${doc_files_1.FlowrWikiBaseRef}/Setup#%EF%B8%8F-building-from-scratch).\\
17
- This page explains how to install **R** and **Node.js**.
16
+ - 💻 ${ctx.linkPage('wiki/Setup', 'Setting up the *flowR* development environment', '-building-from-scratch')}.\\
17
+ This page explains how to install **R** and **Node.js**.
18
18
  - 💖 [Contributing guidelines](${doc_files_1.FlowrGithubBaseRef}/flowr/tree/main/.github/CONTRIBUTING.md).\\
19
19
  This page also includes information about how to set up **git-lfs** and several **git hooks**.
20
20
 
21
- If you have any questions, please check out the [FAQ](${doc_files_1.FlowrWikiBaseRef}/FAQ) first, but if the question
21
+ If you have any questions, please check out the ${ctx.linkPage('wiki/FAQ')} first, but if the question
22
22
  is not answered there (or in the wiki in general), feel free to ask a question.
23
- The [FAQ](${doc_files_1.FlowrWikiBaseRef}/FAQ) also includes information about how you can configure your editor.
23
+ The ${ctx.linkPage('wiki/FAQ')} also includes information about how you can configure your editor.
24
24
 
25
25
  ## ⌛ TL;DR
26
26
 
@@ -38,7 +38,7 @@ for instructions on how to install _flowR_.
38
38
  Primarily, _flowR_ provides a dataflow analysis framework for the [*R*](https://www.r-project.org/) programming language.
39
39
  Its subcomponents (like the custom ${ctx.link(shell_1.RShell)}) or the internals of the static ${ctx.link(graph_1.DataflowGraph)})
40
40
  are not important if you simply wish to use _flowR_.
41
- If you wish to use _flowR_, check out one of its extensions (e.g., the [VS Code extension](${doc_files_1.FlowrVsCode})),
41
+ If you wish to use _flowR_, check out one of its extensions (e.g., the ${ctx.linkPage('flowr:vscode', 'VS Code extension')}),
42
42
  the [REPL and server interfaces](#using-_flowr_-from-the-outside) or its coding API with the
43
43
  ${ctx.link(flowr_analyzer_1.FlowrAnalyzer)}.
44
44
 
@@ -61,8 +61,8 @@ _flowR_ itself has two main ways to operate:
61
61
  - as a [**server**](#the-server) which processes analysis and slicing requests (${ctx.cliOption('flowr', 'server')} option)
62
62
  - as a [**read-eval-print loop** (REPL)](#the-read-eval-print-loop-repl) that can be accessed directly from the command line (default option)
63
63
 
64
- Besides these two ways, there is a [Visual Studio Code extension](${doc_files_1.FlowrVsCode}) that allows you to use _flowR_ directly from within the editor (it is available on [open-vsx](${doc_files_1.FlowrPositron}) as well).
65
- Similarly, we offer an [Addin for RStudio](${doc_files_1.FlowrRStudioAddin}), as well as an [R package](${doc_files_1.FlowrRAdapter}).
64
+ Besides these two ways, there is a ${ctx.linkPage('flowr:vscode', 'Visual Studio Code extension')} that allows you to use _flowR_ directly from within the editor (it is available on ${ctx.linkPage('flowr:positron', 'open-vsx')} as well).
65
+ Similarly, we offer an ${ctx.linkPage('flowr:rstudio-addin', 'Addin for RStudio')}, as well as an ${ctx.linkPage('flowr:radapter', 'R package')}.
66
66
 
67
67
  🐳️ If you use the docker-version, simply starting the docker container in interactive mode drops you right into the REPL (\`docker run -it --rm eagleoutice/flowr:latest\`), while launching with the ${ctx.cliOption('flowr', 'server')} argument starts the server (\`docker run -it --rm eagleoutice/flowr:latest --server\`).\\
68
68
  ⚒️ If you compile the _flowR_ sources yourself, you can access _flowR_ by the main script \`npm run flowr\` or in the development mode \`npm run main-dev\`.