@eagleoutice/flowr 2.16.2 → 2.16.3

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 (445) hide show
  1. package/README.md +10 -10
  2. package/abstract-interpretation/data-frame/arguments.js +4 -3
  3. package/abstract-interpretation/data-frame/dataframe-semantics.js +1 -2
  4. package/abstract-interpretation/data-frame/semantics.d.ts +2 -2
  5. package/abstract-interpretation/data-frame/semantics.js +2 -6
  6. package/benchmark/slicer.js +1 -3
  7. package/benchmark/summarizer/first-phase/input.js +1 -12
  8. package/benchmark/summarizer/second-phase/process.d.ts +7 -0
  9. package/benchmark/summarizer/second-phase/process.js +15 -12
  10. package/cli/repl/commands/repl-cfg.js +18 -49
  11. package/cli/repl/commands/repl-clipboard.d.ts +2 -0
  12. package/cli/repl/commands/repl-clipboard.js +5 -0
  13. package/cli/repl/commands/repl-commands.js +2 -2
  14. package/cli/repl/commands/repl-dataflow.js +21 -55
  15. package/cli/repl/commands/repl-normalize.js +15 -28
  16. package/cli/repl/commands/repl-parse.js +2 -2
  17. package/cli/repl/commands/repl-query.js +10 -10
  18. package/cli/repl/commands/repl-signature.js +4 -4
  19. package/cli/repl/server/connection.d.ts +1 -0
  20. package/cli/repl/server/connection.js +8 -30
  21. package/cli/repl/server/messages/message-analysis.js +1 -1
  22. package/config.d.ts +6 -0
  23. package/config.js +7 -4
  24. package/control-flow/cfg-dead-code.js +5 -14
  25. package/control-flow/cfg-to-basic-blocks.js +1 -6
  26. package/control-flow/control-flow-graph.d.ts +2 -16
  27. package/control-flow/control-flow-graph.js +8 -66
  28. package/control-flow/diff-cfg.js +10 -23
  29. package/control-flow/semantic-cfg-guided-visitor.js +5 -11
  30. package/control-flow/simple-visitor.js +2 -2
  31. package/core/steps/pipeline/default-pipelines.d.ts +138 -138
  32. package/data/r-base-packages.generated.js +0 -1
  33. package/data/r-base-primitives.generated.js +0 -1
  34. package/data/r-s3-generics.generated.d.ts +5 -0
  35. package/data/r-s3-generics.generated.js +103 -0
  36. package/dataflow/cluster.js +2 -1
  37. package/dataflow/environments/append.d.ts +1 -0
  38. package/dataflow/environments/built-in-props.d.ts +10 -0
  39. package/dataflow/environments/built-in-props.js +25 -1
  40. package/dataflow/environments/built-in.js +15 -9
  41. package/dataflow/environments/clone.d.ts +1 -0
  42. package/dataflow/environments/clone.js +1 -0
  43. package/dataflow/environments/default-builtin-config.d.ts +188 -14
  44. package/dataflow/environments/default-builtin-config.js +125 -65
  45. package/dataflow/environments/define.d.ts +1 -0
  46. package/dataflow/environments/define.js +1 -0
  47. package/dataflow/environments/environment.d.ts +27 -0
  48. package/dataflow/environments/environment.js +37 -16
  49. package/dataflow/environments/frame-memory.d.ts +9 -1
  50. package/dataflow/environments/frame-memory.js +12 -1
  51. package/dataflow/environments/identifier.d.ts +0 -2
  52. package/dataflow/environments/identifier.js +5 -7
  53. package/dataflow/environments/overwrite.js +1 -0
  54. package/dataflow/environments/query-fn-props.js +2 -3
  55. package/dataflow/environments/scoping.d.ts +3 -0
  56. package/dataflow/environments/scoping.js +3 -0
  57. package/dataflow/eval/resolve/alias-tracking.js +3 -3
  58. package/dataflow/eval/resolve/resolve-argument.d.ts +7 -3
  59. package/dataflow/eval/resolve/resolve-argument.js +16 -11
  60. package/dataflow/eval/resolve/resolve-numbers.js +5 -2
  61. package/dataflow/eval/resolve/resolve-strings.d.ts +1 -1
  62. package/dataflow/eval/resolve/resolve-working-directory.js +2 -2
  63. package/dataflow/eval/resolve/resolve.js +1 -2
  64. package/dataflow/eval/values/intervals/interval-constants.js +1 -6
  65. package/dataflow/eval/values/r-value.js +1 -6
  66. package/dataflow/extractor.js +17 -17
  67. package/dataflow/fn/argument-roles.js +15 -15
  68. package/dataflow/fn/class-declaration.js +7 -7
  69. package/dataflow/fn/frame-reflection.d.ts +1 -23
  70. package/dataflow/fn/frame-reflection.js +8 -95
  71. package/dataflow/fn/function-props.d.ts +0 -3
  72. package/dataflow/fn/function-props.js +9 -11
  73. package/dataflow/fn/function-semantics.d.ts +1 -0
  74. package/dataflow/fn/strict-function.js +15 -14
  75. package/dataflow/graph/call-graph.d.ts +8 -0
  76. package/dataflow/graph/call-graph.js +40 -25
  77. package/dataflow/graph/dataflowgraph-builder.d.ts +0 -60
  78. package/dataflow/graph/dataflowgraph-builder.js +15 -135
  79. package/dataflow/graph/df-helper.d.ts +56 -4
  80. package/dataflow/graph/df-helper.js +116 -1
  81. package/dataflow/graph/diff-dataflow-graph.js +13 -15
  82. package/dataflow/graph/graph-helper.d.ts +20 -0
  83. package/dataflow/graph/graph-helper.js +18 -0
  84. package/dataflow/graph/graph.js +3 -8
  85. package/dataflow/graph/match-args.d.ts +1 -1
  86. package/dataflow/graph/match-args.js +3 -3
  87. package/dataflow/internal/linker.d.ts +4 -10
  88. package/dataflow/internal/linker.js +21 -29
  89. package/dataflow/internal/process/functions/call/built-in/built-in-access.js +2 -8
  90. package/dataflow/internal/process/functions/call/built-in/built-in-ambient-state.d.ts +5 -2
  91. package/dataflow/internal/process/functions/call/built-in/built-in-ambient-state.js +39 -22
  92. package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +19 -21
  93. package/dataflow/internal/process/functions/call/built-in/built-in-attach.js +3 -7
  94. package/dataflow/internal/process/functions/call/built-in/built-in-env-contents.js +6 -11
  95. package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.js +6 -8
  96. package/dataflow/internal/process/functions/call/built-in/built-in-eval.js +14 -13
  97. package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +27 -13
  98. package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +6 -8
  99. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +33 -35
  100. package/dataflow/internal/process/functions/call/built-in/built-in-get.js +3 -5
  101. package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.js +6 -7
  102. package/dataflow/internal/process/functions/call/built-in/built-in-library.js +12 -5
  103. package/dataflow/internal/process/functions/call/built-in/built-in-list.js +3 -4
  104. package/dataflow/internal/process/functions/call/built-in/built-in-load.js +7 -8
  105. package/dataflow/internal/process/functions/call/built-in/built-in-local.js +5 -6
  106. package/dataflow/internal/process/functions/call/built-in/built-in-new-env.js +3 -4
  107. package/dataflow/internal/process/functions/call/built-in/built-in-pipe.js +2 -3
  108. package/dataflow/internal/process/functions/call/built-in/built-in-purrr-formula.js +5 -7
  109. package/dataflow/internal/process/functions/call/built-in/built-in-quote.js +6 -5
  110. package/dataflow/internal/process/functions/call/built-in/built-in-repeat-loop.js +1 -2
  111. package/dataflow/internal/process/functions/call/built-in/built-in-replacement.js +5 -6
  112. package/dataflow/internal/process/functions/call/built-in/built-in-rm.js +4 -4
  113. package/dataflow/internal/process/functions/call/built-in/built-in-s-four.js +7 -7
  114. package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.js +1 -2
  115. package/dataflow/internal/process/functions/call/built-in/built-in-s-three-dispatch.js +2 -3
  116. package/dataflow/internal/process/functions/call/built-in/built-in-source.d.ts +1 -1
  117. package/dataflow/internal/process/functions/call/built-in/built-in-source.js +5 -7
  118. package/dataflow/internal/process/functions/call/built-in/built-in-stack-env.d.ts +1 -1
  119. package/dataflow/internal/process/functions/call/built-in/built-in-stack-env.js +4 -5
  120. package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.js +8 -9
  121. package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.js +4 -5
  122. package/dataflow/internal/process/functions/call/built-in/built-in-with.js +3 -3
  123. package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.js +36 -38
  124. package/dataflow/internal/process/functions/call/common.d.ts +3 -1
  125. package/dataflow/internal/process/functions/call/common.js +6 -7
  126. package/dataflow/internal/process/functions/call/deferred.js +8 -8
  127. package/dataflow/internal/process/functions/call/known-call-handling.d.ts +11 -4
  128. package/dataflow/internal/process/functions/call/known-call-handling.js +11 -7
  129. package/dataflow/internal/process/functions/call/named-call-handling.js +4 -3
  130. package/dataflow/internal/process/functions/call/nse.js +4 -4
  131. package/dataflow/internal/process/functions/call/quoted.js +16 -14
  132. package/dataflow/internal/process/functions/call/unnamed-call-handling.js +2 -2
  133. package/dataflow/internal/process/functions/process-parameter.js +2 -2
  134. package/dataflow/internal/process/process-named-call.js +1 -1
  135. package/dataflow/origin/dfg-get-origin.js +2 -2
  136. package/dataflow/origin/dfg-get-symbol-refs.d.ts +1 -0
  137. package/dataflow/origin/dfg-get-symbol-refs.js +3 -8
  138. package/documentation/data/faq/wiki-faq-store.js +2 -2
  139. package/documentation/doc-capabilities.js +2 -1
  140. package/documentation/doc-util/doc-functions.js +2 -2
  141. package/documentation/doc-util/doc-repl.js +4 -4
  142. package/documentation/doc-util/doc-types.js +2 -2
  143. package/documentation/wiki-absint.js +2 -1
  144. package/documentation/wiki-cfg.js +2 -1
  145. package/documentation/wiki-create-linting-rules.js +1 -1
  146. package/documentation/wiki-dataflow-graph.js +6 -6
  147. package/documentation/wiki-interface.js +3 -2
  148. package/documentation/wiki-linter.js +54 -4
  149. package/documentation/wiki-mk/doc-maker.js +1 -2
  150. package/documentation/wiki-query.js +25 -0
  151. package/documentation/wiki-search.js +2 -1
  152. package/documentation/wiki-signature-database.js +0 -2
  153. package/linter/linter-executor.js +4 -0
  154. package/linter/linter-rules.d.ts +518 -1
  155. package/linter/linter-rules.js +39 -1
  156. package/linter/linter-tags.d.ts +6 -0
  157. package/linter/linter-tags.js +6 -0
  158. package/linter/rules/absolute-path.js +4 -3
  159. package/linter/rules/cmd-check/bogus-return.d.ts +29 -0
  160. package/linter/rules/cmd-check/bogus-return.js +63 -0
  161. package/linter/rules/cmd-check/call-arguments.d.ts +63 -0
  162. package/linter/rules/cmd-check/call-arguments.js +211 -0
  163. package/linter/rules/cmd-check/class-string-comparison.d.ts +48 -0
  164. package/linter/rules/cmd-check/class-string-comparison.js +135 -0
  165. package/linter/rules/cmd-check/cmd-check-util.d.ts +67 -0
  166. package/linter/rules/cmd-check/cmd-check-util.js +169 -0
  167. package/linter/rules/cmd-check/compiled-code.d.ts +86 -0
  168. package/linter/rules/cmd-check/compiled-code.js +350 -0
  169. package/linter/rules/cmd-check/conformance.d.ts +47 -0
  170. package/linter/rules/cmd-check/conformance.js +166 -0
  171. package/linter/rules/cmd-check/dependency-declaration.d.ts +95 -0
  172. package/linter/rules/cmd-check/dependency-declaration.js +299 -0
  173. package/linter/rules/cmd-check/description-metadata.d.ts +63 -0
  174. package/linter/rules/cmd-check/description-metadata.js +393 -0
  175. package/linter/rules/cmd-check/documentation-mismatch.d.ts +54 -0
  176. package/linter/rules/cmd-check/documentation-mismatch.js +407 -0
  177. package/linter/rules/cmd-check/file-checks.d.ts +29 -0
  178. package/linter/rules/cmd-check/file-checks.js +34 -0
  179. package/linter/rules/cmd-check/foreign-function-calls.d.ts +54 -0
  180. package/linter/rules/cmd-check/foreign-function-calls.js +115 -0
  181. package/linter/rules/cmd-check/global-environment-modification.d.ts +61 -0
  182. package/linter/rules/cmd-check/global-environment-modification.js +237 -0
  183. package/linter/rules/cmd-check/namespace-tampering.d.ts +52 -0
  184. package/linter/rules/cmd-check/namespace-tampering.js +162 -0
  185. package/linter/rules/cmd-check/non-ascii-code.d.ts +51 -0
  186. package/linter/rules/cmd-check/non-ascii-code.js +112 -0
  187. package/linter/rules/cmd-check/package-code.d.ts +30 -0
  188. package/linter/rules/cmd-check/package-code.js +141 -0
  189. package/linter/rules/cmd-check/package-data.d.ts +49 -0
  190. package/linter/rules/cmd-check/package-data.js +181 -0
  191. package/linter/rules/cmd-check/package-files.d.ts +41 -0
  192. package/linter/rules/cmd-check/package-files.js +157 -0
  193. package/linter/rules/cmd-check/package-hooks.d.ts +57 -0
  194. package/linter/rules/cmd-check/package-hooks.js +165 -0
  195. package/linter/rules/cmd-check/package-metafiles.d.ts +49 -0
  196. package/linter/rules/cmd-check/package-metafiles.js +292 -0
  197. package/linter/rules/cmd-check/package-runtime.d.ts +67 -0
  198. package/linter/rules/cmd-check/package-runtime.js +284 -0
  199. package/linter/rules/cmd-check/package-structure.d.ts +85 -0
  200. package/linter/rules/cmd-check/package-structure.js +320 -0
  201. package/linter/rules/cmd-check/rd-files.d.ts +67 -0
  202. package/linter/rules/cmd-check/rd-files.js +621 -0
  203. package/linter/rules/cmd-check/s-three-method-consistency.d.ts +72 -0
  204. package/linter/rules/cmd-check/s-three-method-consistency.js +206 -0
  205. package/linter/rules/cmd-check/true-false-abbreviation.d.ts +45 -0
  206. package/linter/rules/cmd-check/true-false-abbreviation.js +121 -0
  207. package/linter/rules/deprecated-functions.js +4 -4
  208. package/linter/rules/naming-convention.d.ts +1 -1
  209. package/linter/rules/naming-convention.js +13 -14
  210. package/linter/rules/no-leaked-credentials.js +4 -4
  211. package/linter/rules/problematic-inputs.js +2 -1
  212. package/linter/rules/seeded-randomness.js +5 -5
  213. package/linter/rules/software-has-license.d.ts +1 -1
  214. package/linter/rules/software-has-license.js +1 -1
  215. package/linter/rules/unclosed-connection.js +3 -3
  216. package/linter/rules/undefined-symbol-util.js +16 -32
  217. package/linter/rules/undefined-symbol.d.ts +2 -0
  218. package/linter/rules/undefined-symbol.js +33 -3
  219. package/linter/rules/unescaped-arguments.js +10 -9
  220. package/linter/rules/unused-definition.js +13 -19
  221. package/package.json +1 -1
  222. package/project/cache/flowr-analyzer-cache.js +1 -1
  223. package/project/context/flowr-analyzer-context.js +1 -1
  224. package/project/context/flowr-analyzer-environment-context.d.ts +1 -1
  225. package/project/context/flowr-analyzer-files-context.d.ts +6 -0
  226. package/project/context/flowr-analyzer-files-context.js +3 -0
  227. package/project/context/flowr-analyzer-incremental-analysis-context.d.ts +0 -2
  228. package/project/context/flowr-analyzer-incremental-analysis-context.js +0 -4
  229. package/project/context/flowr-file.d.ts +4 -0
  230. package/project/context/flowr-file.js +4 -0
  231. package/project/flowr-analyzer-builder.js +1 -1
  232. package/project/plugins/file-plugins/files/flowr-description-file.js +2 -2
  233. package/project/plugins/file-plugins/files/flowr-jupyter-file.d.ts +2 -0
  234. package/project/plugins/file-plugins/files/flowr-jupyter-file.js +4 -0
  235. package/project/plugins/file-plugins/files/flowr-manifest-files.d.ts +2 -0
  236. package/project/plugins/file-plugins/files/flowr-manifest-files.js +11 -14
  237. package/project/plugins/file-plugins/files/flowr-namespace-file.d.ts +3 -0
  238. package/project/plugins/file-plugins/files/flowr-namespace-file.js +25 -15
  239. package/project/plugins/file-plugins/files/flowr-rd-file.d.ts +44 -0
  240. package/project/plugins/file-plugins/files/flowr-rd-file.js +130 -61
  241. package/project/plugins/file-plugins/files/flowr-rda-file.d.ts +0 -1
  242. package/project/plugins/file-plugins/files/flowr-rda-file.js +4 -16
  243. package/project/plugins/file-plugins/files/flowr-rmarkdown-file.d.ts +2 -0
  244. package/project/plugins/file-plugins/files/flowr-rmarkdown-file.js +4 -0
  245. package/project/plugins/file-plugins/files/flowr-sweave-file.d.ts +2 -0
  246. package/project/plugins/file-plugins/files/flowr-sweave-file.js +4 -0
  247. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-description-file-plugin.d.ts +0 -1
  248. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-description-file-plugin.js +1 -5
  249. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-lockfile-plugin.d.ts +2 -0
  250. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-lockfile-plugin.js +2 -0
  251. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-session-info-plugin.js +3 -7
  252. package/project/sigdb/build.js +16 -30
  253. package/project/sigdb/dict.d.ts +4 -6
  254. package/project/sigdb/dict.js +125 -31
  255. package/project/sigdb/reader.js +2 -18
  256. package/project/sigdb/sigdb-download.js +14 -23
  257. package/queries/base-query-format.d.ts +2 -0
  258. package/queries/base-query-format.js +10 -2
  259. package/queries/catalog/absint-query/absint-query-format.d.ts +1 -1
  260. package/queries/catalog/absint-query/absint-query-format.js +5 -7
  261. package/queries/catalog/call-context-query/call-context-query-executor.js +24 -32
  262. package/queries/catalog/call-context-query/call-context-query-format.d.ts +1 -1
  263. package/queries/catalog/call-context-query/call-context-query-format.js +1 -3
  264. package/queries/catalog/call-context-query/identify-link-to-last-call-relation.js +2 -4
  265. package/queries/catalog/call-context-query/identify-link-to-nested-call-relation.js +1 -4
  266. package/queries/catalog/call-graph-query/call-graph-query-format.js +2 -3
  267. package/queries/catalog/config-query/config-query-format.js +3 -3
  268. package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.js +2 -3
  269. package/queries/catalog/dataflow-query/dataflow-query-format.js +2 -3
  270. package/queries/catalog/dependencies-query/data-flow.d.ts +43 -0
  271. package/queries/catalog/dependencies-query/data-flow.js +173 -0
  272. package/queries/catalog/dependencies-query/dependencies-query-executor.d.ts +18 -0
  273. package/queries/catalog/dependencies-query/dependencies-query-executor.js +108 -12
  274. package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +17 -1
  275. package/queries/catalog/dependencies-query/dependencies-query-format.js +14 -11
  276. package/queries/catalog/dependencies-query/function-info/derived-functions.js +2 -1
  277. package/queries/catalog/dependencies-query/function-info/function-info.d.ts +2 -0
  278. package/queries/catalog/dependencies-query/function-info/library-functions.js +13 -13
  279. package/queries/catalog/dependencies-query/function-info/read-functions.js +1 -1
  280. package/queries/catalog/dependencies-query/function-info/remote-functions.js +3 -3
  281. package/queries/catalog/dependencies-query/function-info/source-functions.js +2 -2
  282. package/queries/catalog/dependencies-query/function-info/test-functions.js +8 -8
  283. package/queries/catalog/dependencies-query/function-info/transform-functions.d.ts +8 -0
  284. package/queries/catalog/dependencies-query/function-info/transform-functions.js +17 -0
  285. package/queries/catalog/dependencies-query/function-info/write-functions.js +4 -0
  286. package/queries/catalog/dependencies-query/implicit-echo.d.ts +5 -3
  287. package/queries/catalog/dependencies-query/implicit-echo.js +33 -34
  288. package/queries/catalog/dependencies-query/link-devices.d.ts +3 -2
  289. package/queries/catalog/dependencies-query/link-devices.js +9 -6
  290. package/queries/catalog/dependencies-query/plot-description.d.ts +10 -0
  291. package/queries/catalog/dependencies-query/plot-description.js +119 -0
  292. package/queries/catalog/dependencies-query/plot-objects.d.ts +13 -0
  293. package/queries/catalog/dependencies-query/plot-objects.js +61 -0
  294. package/queries/catalog/dice-query/dice-query-format.d.ts +2 -2
  295. package/queries/catalog/dice-query/dice-query-format.js +3 -40
  296. package/queries/catalog/does-call-query/does-call-query-format.d.ts +1 -1
  297. package/queries/catalog/does-call-query/does-call-query-format.js +2 -2
  298. package/queries/catalog/function-info-query/function-info-query-format.js +2 -2
  299. package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-executor.js +2 -1
  300. package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-format.js +2 -2
  301. package/queries/catalog/happens-before-query/happens-before-query-format.js +2 -2
  302. package/queries/catalog/id-map-query/id-map-query-format.js +1 -3
  303. package/queries/catalog/input-sources-query/input-sources-query-executor.js +2 -2
  304. package/queries/catalog/input-sources-query/input-sources-query-format.js +2 -3
  305. package/queries/catalog/input-sources-query/simple-input-classifier.js +28 -29
  306. package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.js +4 -7
  307. package/queries/catalog/inspect-fn-props-query/inspect-fn-props-query-executor.js +1 -1
  308. package/queries/catalog/inspect-fn-props-query/inspect-fn-props-query-format.js +3 -2
  309. package/queries/catalog/inspect-recursion-query/inspect-recursion-query-executor.js +2 -2
  310. package/queries/catalog/linter-query/linter-query-executor.js +10 -3
  311. package/queries/catalog/linter-query/linter-query-format.d.ts +4 -1
  312. package/queries/catalog/linter-query/linter-query-format.js +32 -21
  313. package/queries/catalog/location-map-query/location-map-query-format.d.ts +1 -1
  314. package/queries/catalog/location-map-query/location-map-query-format.js +1 -3
  315. package/queries/catalog/normalized-ast-query/normalized-ast-query-format.js +2 -3
  316. package/queries/catalog/origin-query/origin-query-executor.d.ts +1 -1
  317. package/queries/catalog/origin-query/origin-query-executor.js +3 -3
  318. package/queries/catalog/origin-query/origin-query-format.d.ts +1 -1
  319. package/queries/catalog/origin-query/origin-query-format.js +4 -5
  320. package/queries/catalog/project-query/project-query-format.js +2 -2
  321. package/queries/catalog/provenance-query/provenance-query-format.js +2 -3
  322. package/queries/catalog/resolve-value-query/resolve-value-query-format.d.ts +1 -1
  323. package/queries/catalog/resolve-value-query/resolve-value-query-format.js +4 -4
  324. package/queries/catalog/search-query/search-query-format.js +1 -3
  325. package/queries/catalog/signature-query/signature-query-executor.js +3 -3
  326. package/queries/catalog/signature-query/signature-query-format.js +2 -2
  327. package/queries/catalog/slice-query-options.d.ts +16 -0
  328. package/queries/catalog/slice-query-options.js +28 -0
  329. package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +2 -2
  330. package/queries/catalog/static-slice-query/static-slice-query-format.js +3 -42
  331. package/queries/query-print.d.ts +4 -0
  332. package/queries/query-print.js +17 -1
  333. package/queries/query.d.ts +3 -3
  334. package/queries/query.js +3 -4
  335. package/r-bridge/lang-4.x/ast/model/model.d.ts +27 -3
  336. package/r-bridge/lang-4.x/ast/model/model.js +28 -1
  337. package/r-bridge/lang-4.x/ast/model/nodes/info/r-delimiter.d.ts +1 -0
  338. package/r-bridge/lang-4.x/ast/model/nodes/info/r-delimiter.js +1 -0
  339. package/r-bridge/lang-4.x/ast/model/nodes/r-access.d.ts +2 -0
  340. package/r-bridge/lang-4.x/ast/model/nodes/r-access.js +1 -0
  341. package/r-bridge/lang-4.x/ast/model/nodes/r-argument.d.ts +20 -1
  342. package/r-bridge/lang-4.x/ast/model/nodes/r-argument.js +25 -1
  343. package/r-bridge/lang-4.x/ast/model/nodes/r-binary-op.d.ts +2 -0
  344. package/r-bridge/lang-4.x/ast/model/nodes/r-binary-op.js +1 -0
  345. package/r-bridge/lang-4.x/ast/model/nodes/r-break.d.ts +2 -0
  346. package/r-bridge/lang-4.x/ast/model/nodes/r-break.js +1 -0
  347. package/r-bridge/lang-4.x/ast/model/nodes/r-comment.d.ts +2 -0
  348. package/r-bridge/lang-4.x/ast/model/nodes/r-comment.js +1 -0
  349. package/r-bridge/lang-4.x/ast/model/nodes/r-expression-list.d.ts +2 -0
  350. package/r-bridge/lang-4.x/ast/model/nodes/r-expression-list.js +1 -0
  351. package/r-bridge/lang-4.x/ast/model/nodes/r-for-loop.d.ts +2 -0
  352. package/r-bridge/lang-4.x/ast/model/nodes/r-for-loop.js +1 -0
  353. package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.d.ts +18 -2
  354. package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.js +15 -6
  355. package/r-bridge/lang-4.x/ast/model/nodes/r-function-definition.d.ts +2 -0
  356. package/r-bridge/lang-4.x/ast/model/nodes/r-function-definition.js +1 -0
  357. package/r-bridge/lang-4.x/ast/model/nodes/r-if-then-else.d.ts +2 -0
  358. package/r-bridge/lang-4.x/ast/model/nodes/r-if-then-else.js +1 -0
  359. package/r-bridge/lang-4.x/ast/model/nodes/r-line-directive.d.ts +2 -0
  360. package/r-bridge/lang-4.x/ast/model/nodes/r-line-directive.js +1 -0
  361. package/r-bridge/lang-4.x/ast/model/nodes/r-logical.d.ts +2 -0
  362. package/r-bridge/lang-4.x/ast/model/nodes/r-logical.js +1 -0
  363. package/r-bridge/lang-4.x/ast/model/nodes/r-next.d.ts +2 -0
  364. package/r-bridge/lang-4.x/ast/model/nodes/r-next.js +1 -0
  365. package/r-bridge/lang-4.x/ast/model/nodes/r-number.d.ts +2 -0
  366. package/r-bridge/lang-4.x/ast/model/nodes/r-number.js +1 -0
  367. package/r-bridge/lang-4.x/ast/model/nodes/r-parameter.d.ts +2 -0
  368. package/r-bridge/lang-4.x/ast/model/nodes/r-parameter.js +1 -0
  369. package/r-bridge/lang-4.x/ast/model/nodes/r-pipe.d.ts +2 -0
  370. package/r-bridge/lang-4.x/ast/model/nodes/r-pipe.js +1 -0
  371. package/r-bridge/lang-4.x/ast/model/nodes/r-repeat-loop.d.ts +2 -0
  372. package/r-bridge/lang-4.x/ast/model/nodes/r-repeat-loop.js +1 -0
  373. package/r-bridge/lang-4.x/ast/model/nodes/r-string.d.ts +17 -0
  374. package/r-bridge/lang-4.x/ast/model/nodes/r-string.js +20 -0
  375. package/r-bridge/lang-4.x/ast/model/nodes/r-symbol.d.ts +2 -0
  376. package/r-bridge/lang-4.x/ast/model/nodes/r-symbol.js +1 -0
  377. package/r-bridge/lang-4.x/ast/model/nodes/r-unary-op.d.ts +2 -0
  378. package/r-bridge/lang-4.x/ast/model/nodes/r-unary-op.js +1 -0
  379. package/r-bridge/lang-4.x/ast/model/nodes/r-while-loop.d.ts +2 -0
  380. package/r-bridge/lang-4.x/ast/model/nodes/r-while-loop.js +1 -0
  381. package/r-bridge/lang-4.x/ast/model/operators.js +0 -2
  382. package/r-bridge/lang-4.x/ast/model/processing/decorate.js +1 -6
  383. package/r-bridge/lang-4.x/ast/model/processing/fold.js +1 -6
  384. package/r-bridge/lang-4.x/ast/model/processing/node-id.js +4 -3
  385. package/r-bridge/lang-4.x/ast/parser/json/format.js +2 -2
  386. package/r-bridge/lang-4.x/ast/parser/main/internal/control/normalize-if-then.js +1 -5
  387. package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-argument.js +2 -2
  388. package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-call.js +4 -20
  389. package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-definition.js +1 -5
  390. package/r-bridge/lang-4.x/ast/parser/main/internal/loops/normalize-next.js +1 -5
  391. package/r-bridge/lang-4.x/ast/parser/main/internal/loops/normalize-repeat.js +1 -5
  392. package/r-bridge/lang-4.x/ast/parser/main/internal/loops/normalize-while.js +2 -9
  393. package/r-bridge/lang-4.x/ast/parser/main/internal/normalize-access.js +1 -5
  394. package/r-bridge/lang-4.x/ast/parser/main/internal/operators/normalize-binary.js +2 -10
  395. package/r-bridge/lang-4.x/ast/parser/main/internal/operators/normalize-unary.js +2 -11
  396. package/r-bridge/lang-4.x/ast/parser/main/internal/structure/normalize-expressions.js +3 -11
  397. package/r-bridge/lang-4.x/ast/parser/main/internal/values/normalize-number.js +1 -5
  398. package/r-bridge/lang-4.x/ast/parser/main/internal/values/normalize-string.js +1 -5
  399. package/r-bridge/lang-4.x/ast/parser/main/internal/values/normalize-symbol.js +1 -5
  400. package/r-bridge/lang-4.x/ast/parser/main/normalize-meta.d.ts +6 -1
  401. package/r-bridge/lang-4.x/ast/parser/main/normalize-meta.js +7 -0
  402. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.d.ts +0 -10
  403. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +30 -82
  404. package/r-bridge/retriever.d.ts +0 -4
  405. package/r-bridge/retriever.js +0 -13
  406. package/r-bridge/roxygen2/documentation-provider.js +3 -7
  407. package/r-bridge/shell.js +3 -8
  408. package/reconstruct/auto-select/magic-comments.js +8 -7
  409. package/reconstruct/inline/source-inline-map.d.ts +3 -0
  410. package/reconstruct/inline/source-inline-map.js +8 -7
  411. package/reconstruct/reconstruct.d.ts +1 -1
  412. package/reconstruct/reconstruct.js +33 -109
  413. package/search/flowr-search-printer.js +4 -15
  414. package/search/search-executor/search-generators.js +1 -1
  415. package/slicing/criterion/filters/all-variables.js +1 -2
  416. package/slicing/static/fingerprint.js +11 -2
  417. package/slicing/static/slice-call.d.ts +2 -8
  418. package/slicing/static/slice-call.js +8 -18
  419. package/slicing/static/static-slicer.js +81 -6
  420. package/util/collections/arrays.js +1 -1
  421. package/util/collections/set.js +1 -1
  422. package/util/diff-graph.d.ts +4 -0
  423. package/util/diff-graph.js +12 -0
  424. package/util/files.js +2 -6
  425. package/util/json.js +1 -15
  426. package/util/mermaid/cfg.js +10 -17
  427. package/util/mermaid/dfg.js +6 -8
  428. package/util/objects.d.ts +1 -1
  429. package/util/quads.js +4 -13
  430. package/util/r-author.js +5 -5
  431. package/util/range.d.ts +9 -0
  432. package/util/range.js +11 -0
  433. package/util/schema.js +3 -3
  434. package/util/simple-df/dfg-view.js +2 -1
  435. package/util/text/ansi.js +1 -2
  436. package/util/text/playground-link.js +2 -1
  437. package/util/text/r-highlight.js +2 -1
  438. package/util/text/strings.d.ts +2 -0
  439. package/util/text/strings.js +5 -0
  440. package/util/text/time.js +1 -2
  441. package/util/version.js +4 -3
  442. package/dataflow/fn/recursive-function.d.ts +0 -6
  443. package/dataflow/fn/recursive-function.js +0 -32
  444. package/dataflow/internal/process/functions/call/argument/unpack-argument.d.ts +0 -16
  445. package/dataflow/internal/process/functions/call/argument/unpack-argument.js +0 -27
@@ -0,0 +1,72 @@
1
+ import { LintingRuleCertainty } from '../../linter-format';
2
+ import type { MergeableRecord } from '../../../util/objects';
3
+ import { LintingRuleTag } from '../../linter-tags';
4
+ import type { ParentInformation } from '../../../r-bridge/lang-4.x/ast/model/processing/decorate';
5
+ import { type CmdCheckResult } from './cmd-check-util';
6
+ /** what is wrong with the function */
7
+ export type S3MethodIssue =
8
+ /** the method does not take the arguments of its generic */
9
+ 'argument-mismatch'
10
+ /** an exported method of an exported generic that is no registered S3 method */
11
+ | 'unregistered-method'
12
+ /** a replacement function without `value` as its last argument */
13
+ | 'replacement-value';
14
+ export interface S3MethodConsistencyResult extends CmdCheckResult {
15
+ readonly kind: S3MethodIssue;
16
+ /** the offending function, e.g. `print.foo` or `foo<-` */
17
+ readonly function: string;
18
+ /** the generic the function is a method of, absent for a replacement function that is no method */
19
+ readonly generic?: string;
20
+ }
21
+ export interface S3MethodConsistencyConfig extends MergeableRecord {
22
+ /** check that methods take the arguments of their generic (default `true`) */
23
+ readonly checkMethods: boolean;
24
+ /** also check functions named like a method but not registered in the `NAMESPACE`, which `R CMD check` only does on request (default `true`) */
25
+ readonly checkApparentMethods: boolean;
26
+ /** report apparent methods of an exported generic that the `NAMESPACE` does not register (default `true`) */
27
+ readonly checkUnregistered: boolean;
28
+ /** check that replacement functions end in `value` (default `true`) */
29
+ readonly checkReplacementValues: boolean;
30
+ }
31
+ export interface S3MethodConsistencyMetadata extends MergeableRecord {
32
+ /** the methods compared with their generic */
33
+ readonly consideredMethods: number;
34
+ /** the replacement functions inspected */
35
+ readonly consideredReplacements: number;
36
+ }
37
+ /**
38
+ * Port of the `R CMD check` checks `checking S3 generic/method consistency` (`tools::checkS3methods`) and
39
+ * `checking replacement functions` (`tools::checkReplaceFuns`).
40
+ * A method must take all the arguments of its generic in the same order (and `...` if the generic does); a replacement
41
+ * function must end in `value`. The methods are the `S3method()` registrations of the `NAMESPACE` (certain) and the
42
+ * functions named `generic.class` for a generic (uncertain, `R CMD check` merely lists these on request). The generics are
43
+ * the package's own functions calling `UseMethod`, the group generics, and the functions flowR knows as generic
44
+ * with their formals; a function flowR knows as an ordinary function (`t.test`) is no method of `t`.
45
+ * Additionally, apparent methods that are exported but not registered are reported.
46
+ */
47
+ export declare const S3_METHOD_CONSISTENCY: {
48
+ readonly createSearch: () => import("../../../search/flowr-search-builder").FlowrSearchBuilder<"from-query", [], ParentInformation, import("../../../search/flowr-search").FlowrSearchElements<ParentInformation, import("../../../search/flowr-search").FlowrSearchElement<ParentInformation>[]>>;
49
+ readonly processSearchResult: (_elements: import("../../../search/flowr-search").FlowrSearchElements<ParentInformation, import("../../../search/flowr-search").FlowrSearchElement<ParentInformation>[]>, config: S3MethodConsistencyConfig, data: import("../../..").ReadonlyFlowrAnalysisProvider<import("../../..").KnownParser>) => Promise<{
50
+ results: S3MethodConsistencyResult[];
51
+ '.meta': {
52
+ consideredMethods: number;
53
+ consideredReplacements: number;
54
+ };
55
+ }>;
56
+ readonly prettyPrint: {
57
+ query: (r: S3MethodConsistencyResult) => string;
58
+ full: (r: S3MethodConsistencyResult) => string;
59
+ };
60
+ readonly info: {
61
+ readonly name: "S3 Method Consistency";
62
+ readonly tags: readonly [LintingRuleTag.CmdCheck, LintingRuleTag.Bug, LintingRuleTag.Robustness];
63
+ readonly certainty: LintingRuleCertainty.BestEffort;
64
+ readonly description: "Finds S3 methods whose formals do not match their generic, methods not registered in the NAMESPACE, and replacement functions whose last formal is not `value`.";
65
+ readonly defaultConfig: () => {
66
+ checkMethods: true;
67
+ checkApparentMethods: true;
68
+ checkUnregistered: true;
69
+ checkReplacementValues: true;
70
+ };
71
+ };
72
+ };
@@ -0,0 +1,206 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.S3_METHOD_CONSISTENCY = void 0;
4
+ const r_s3_generics_generated_1 = require("../../../data/r-s3-generics.generated");
5
+ const linter_format_1 = require("../../linter-format");
6
+ const flowr_search_builder_1 = require("../../../search/flowr-search-builder");
7
+ const linter_tags_1 = require("../../linter-tags");
8
+ const identifier_1 = require("../../../dataflow/environments/identifier");
9
+ const query_fn_props_1 = require("../../../dataflow/environments/query-fn-props");
10
+ const built_in_props_1 = require("../../../dataflow/environments/built-in-props");
11
+ const df_helper_1 = require("../../../dataflow/graph/df-helper");
12
+ const model_1 = require("../../../r-bridge/lang-4.x/ast/model/model");
13
+ const r_binary_op_1 = require("../../../r-bridge/lang-4.x/ast/model/nodes/r-binary-op");
14
+ const r_unary_op_1 = require("../../../r-bridge/lang-4.x/ast/model/nodes/r-unary-op");
15
+ const r_function_call_1 = require("../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
16
+ const group_generics_1 = require("../../../dataflow/environments/group-generics");
17
+ const flowr_namespace_file_1 = require("../../../project/plugins/file-plugins/files/flowr-namespace-file");
18
+ const cmd_check_util_1 = require("./cmd-check-util");
19
+ /** the formals of a definition, without the backticks of non-syntactic names */
20
+ function formalNames(def) {
21
+ return (0, cmd_check_util_1.formalNames)(def).map(n => n.replace(/^`(.*)`$/, '$1'));
22
+ }
23
+ /** the subsetting generics dispatch internally on an argument list that varies by method, so a method may take any */
24
+ const SubsetGenerics = new Set(['[', '[[', '$']);
25
+ /** the operators for which a method with as many arguments as the generic is fine whatever their names */
26
+ const OperatorGenerics = new Set(['+', '-', '*', '/', '^', '%%', '%/%', '&', '|', '!', '==', '!=', '<', '<=', '>=', '>']);
27
+ /** whether a method with the formals `mArgs` is consistent with the generic `gName` of formals `gArgs` (`tools::checkS3methods`) */
28
+ function consistent(gName, gArgs, mName, mArgs) {
29
+ if (gName === 'round' && mArgs[0] === 'x') {
30
+ return true;
31
+ }
32
+ /* the second argument of `plot` is not one the methods have to take */
33
+ const generic = gName === 'plot' ? gArgs.filter((_, i) => i !== 1) : gArgs;
34
+ let g = generic;
35
+ let m = mArgs;
36
+ if (mName.endsWith('.formula')) {
37
+ g = g[0] !== '...' ? g.slice(1) : g;
38
+ m = m[0] !== '...' ? m.slice(1) : m;
39
+ }
40
+ const gDots = g.indexOf('...');
41
+ const mDots = m.indexOf('...');
42
+ /* only the arguments before the dots are matched by position */
43
+ const positional = Math.min(gDots < 0 ? g.length : gDots, mDots < 0 ? Infinity : mDots);
44
+ let positionalOk = true;
45
+ for (let i = 0; i < positional; i++) {
46
+ positionalOk &&= g[i] === m[i];
47
+ }
48
+ const takesAll = g.every(a => m.includes(a)) || mDots >= 0;
49
+ const onlyKnown = m.every(a => a === '...' || g.includes(a)) || generic.includes('...');
50
+ return (positionalOk && takesAll && onlyKnown) || (OperatorGenerics.has(gName) && generic.length === mArgs.length);
51
+ }
52
+ function formatFormals(name, formals) {
53
+ return `${name}:\n function(${formals.join(', ')})`;
54
+ }
55
+ /** the node naming the function a definition is bound to, the definition itself when it is anonymous */
56
+ function nameNodeOf(def, idMap) {
57
+ const parent = def.info.parent === undefined ? undefined : idMap.get(def.info.parent);
58
+ return parent !== undefined && r_binary_op_1.RBinaryOp.is(parent) && parent.rhs === def ? parent.lhs : def;
59
+ }
60
+ /** the package functions that call `UseMethod` on their own account, i.e. the generics the package defines */
61
+ function localGenerics(defs, ast, graph) {
62
+ const idMap = ast.idMap;
63
+ const byId = new Map(defs.map(d => [d.def.info.id, d]));
64
+ const generics = new Map();
65
+ const seen = new Set();
66
+ for (const node of (0, cmd_check_util_1.projectNodes)(ast)) {
67
+ if (seen.has(node.info.id) || !r_function_call_1.RFunctionCall.isNamed(node) || identifier_1.Identifier.getName(node.functionName.content) !== 'UseMethod') {
68
+ continue;
69
+ }
70
+ seen.add(node.info.id);
71
+ const origins = df_helper_1.Dataflow.origin(graph, node.info.id);
72
+ const owner = model_1.RNode.strictlyEnclosingFunction(node.info.id, idMap);
73
+ const def = owner === undefined ? undefined : byId.get(owner);
74
+ if (def !== undefined && (origins === undefined || origins.every(o => o.type === 3 /* OriginType.BuiltInFunctionOrigin */))) {
75
+ generics.set(def.name, { formals: formalNames(def.def), local: true });
76
+ }
77
+ }
78
+ return generics;
79
+ }
80
+ /** the functions and operators the package code calls, by name */
81
+ function calledNames(ast) {
82
+ const called = new Set();
83
+ for (const node of (0, cmd_check_util_1.projectNodes)(ast)) {
84
+ if (r_function_call_1.RFunctionCall.isNamed(node)) {
85
+ called.add(identifier_1.Identifier.getName(node.functionName.content));
86
+ }
87
+ else if (r_binary_op_1.RBinaryOp.is(node) || r_unary_op_1.RUnaryOp.is(node)) {
88
+ called.add(node.operator);
89
+ }
90
+ }
91
+ return called;
92
+ }
93
+ /**
94
+ * Port of the `R CMD check` checks `checking S3 generic/method consistency` (`tools::checkS3methods`) and
95
+ * `checking replacement functions` (`tools::checkReplaceFuns`).
96
+ * A method must take all the arguments of its generic in the same order (and `...` if the generic does); a replacement
97
+ * function must end in `value`. The methods are the `S3method()` registrations of the `NAMESPACE` (certain) and the
98
+ * functions named `generic.class` for a generic (uncertain, `R CMD check` merely lists these on request). The generics are
99
+ * the package's own functions calling `UseMethod`, the group generics, and the functions flowR knows as generic
100
+ * with their formals; a function flowR knows as an ordinary function (`t.test`) is no method of `t`.
101
+ * Additionally, apparent methods that are exported but not registered are reported.
102
+ */
103
+ exports.S3_METHOD_CONSISTENCY = {
104
+ createSearch: () => flowr_search_builder_1.Q.fromQuery({ type: 'dependencies', enabledCategories: [] }),
105
+ processSearchResult: async (_elements, config, data) => {
106
+ const ctx = data.inspectContext();
107
+ const { graph } = await data.dataflow();
108
+ const ast = await data.normalize();
109
+ const idMap = ast.idMap;
110
+ const pkg = (0, cmd_check_util_1.packageInfo)(ctx);
111
+ const ns = pkg.namespace;
112
+ const notMethods = new Set(r_s3_generics_generated_1.RS3Generics.nonS3Methods[pkg.name ?? ''] ?? []);
113
+ const defs = (0, cmd_check_util_1.topLevelDefinitions)(ast, () => true).filter(d => pkg.isPackageCode(d.def.info.file));
114
+ const defined = new Set(defs.map(d => d.name));
115
+ const local = localGenerics(defs, ast, graph);
116
+ const generics = new Map(local);
117
+ /* a function of the package named like a generic of base hides it, unless it is a generic itself */
118
+ const genericNames = new Set(ctx.env.deriveFromIndex(index => index.with(built_in_props_1.CallProp.Generic).map(g => identifier_1.Identifier.getName(g))));
119
+ for (const name of genericNames) {
120
+ const formals = r_s3_generics_generated_1.RS3Generics.genericFormals[name] ?? (0, query_fn_props_1.fnInfo)(identifier_1.Identifier.make(name), ctx)?.entry?.signature?.map(p => p.name) ?? [];
121
+ if (!generics.has(name) && !defined.has(name) && !SubsetGenerics.has(name) && formals.length > 0) {
122
+ generics.set(name, { formals, local: false });
123
+ }
124
+ }
125
+ for (const [name, formals] of Object.entries(r_s3_generics_generated_1.RS3Generics.groupGenericFormals)) {
126
+ if (!local.has(name) && !defined.has(name)) {
127
+ generics.set(name, { formals, local: false });
128
+ }
129
+ }
130
+ const called = calledNames(ast);
131
+ /* like `R CMD check`, an unregistered method of a generic from base R only matters if the package calls the generic */
132
+ const dispatched = (generic) => called.has(generic) || ((0, group_generics_1.s3GroupGenericMembers)(generic)?.some(m => called.has(m)) ?? false);
133
+ const byLength = [...generics.keys()].sort((a, b) => b.length - a.length);
134
+ const results = [];
135
+ let methods = 0;
136
+ let replacements = 0;
137
+ const report = (def, kind, name, generic, certain, message) => {
138
+ results.push({
139
+ ...(0, cmd_check_util_1.at)(nameNodeOf(def, idMap), certain),
140
+ kind,
141
+ function: name,
142
+ ...(generic === undefined ? {} : { generic }),
143
+ message
144
+ });
145
+ };
146
+ const registered = (generic, name) => ns?.exportS3Generics.get(generic)?.includes(name.slice(generic.length + 1)) ?? false;
147
+ /* a function flowR knows as ordinary function of a package (`t.test`) is no method of the generic it starts with */
148
+ const ordinary = (name) => {
149
+ const known = (0, query_fn_props_1.fnInfo)(identifier_1.Identifier.make(name), ctx);
150
+ return known !== undefined && known.entry?.props.includes('s3-method') !== true;
151
+ };
152
+ const replacementCheck = (def, name, generic, certain) => {
153
+ replacements++;
154
+ const formals = formalNames(def);
155
+ if (formals.length > 0 && formals[formals.length - 1] !== 'value') {
156
+ report(def, 'replacement-value', name, generic, certain, `Replacement function ${name} should have 'value' as its last argument`);
157
+ }
158
+ };
159
+ for (const { name, def } of defs) {
160
+ /* the longest generic wins: `t.test.default` is a method of `t.test`, not of `t` */
161
+ const generic = notMethods.has(name) ? undefined : byLength.find(g => name.length > g.length + 1 && name.startsWith(g + '.'));
162
+ const info = generic === undefined ? undefined : generics.get(generic);
163
+ const isRegistered = generic !== undefined && registered(generic, name);
164
+ if (generic !== undefined && info !== undefined && (isRegistered || info.local || !ordinary(name))) {
165
+ if (config.checkMethods && (isRegistered || (config.checkApparentMethods && (info.local || dispatched(generic))))) {
166
+ methods++;
167
+ const formals = formalNames(def);
168
+ if (!consistent(generic, info.formals, name, formals)) {
169
+ report(def, 'argument-mismatch', name, generic, isRegistered, `S3 generic/method inconsistency:\n${formatFormals(generic, info.formals)}\n${formatFormals(name, formals)}`);
170
+ }
171
+ }
172
+ if (config.checkUnregistered && ns !== undefined && !isRegistered && (0, flowr_namespace_file_1.isExportedInInfo)(info.local ? generic : name, ns) === true) {
173
+ report(def, 'unregistered-method', name, generic, false, `Apparent S3 method ${name} for ${info.local ? 'exported generic' : 'generic'} ${generic} is not registered in the NAMESPACE`);
174
+ }
175
+ }
176
+ if (!config.checkReplacementValues) {
177
+ continue;
178
+ }
179
+ if (name.endsWith('<-') && !(name.startsWith('%') && name.endsWith('%'))) {
180
+ replacementCheck(def, name, undefined, true);
181
+ continue;
182
+ }
183
+ /* a method of a replacement generic (`[<-.cls`) is a replacement function as well, even though its name does not end in `<-` */
184
+ const split = name.indexOf('<-.');
185
+ const replacementGeneric = split > 0 ? name.slice(0, split + 2) : undefined;
186
+ if (replacementGeneric !== undefined && (registered(replacementGeneric, name) || local.has(replacementGeneric) || genericNames.has(replacementGeneric.slice(0, -2)))) {
187
+ replacementCheck(def, name, replacementGeneric, registered(replacementGeneric, name));
188
+ }
189
+ }
190
+ return { results, '.meta': { consideredMethods: methods, consideredReplacements: replacements } };
191
+ },
192
+ prettyPrint: (0, cmd_check_util_1.printer)(r => `${r.function}: ${r.kind}`),
193
+ info: {
194
+ name: 'S3 Method Consistency',
195
+ tags: [linter_tags_1.LintingRuleTag.CmdCheck, linter_tags_1.LintingRuleTag.Bug, linter_tags_1.LintingRuleTag.Robustness],
196
+ certainty: linter_format_1.LintingRuleCertainty.BestEffort,
197
+ description: 'Finds S3 methods whose formals do not match their generic, methods not registered in the NAMESPACE, and replacement functions whose last formal is not `value`.',
198
+ defaultConfig: () => ({
199
+ checkMethods: true,
200
+ checkApparentMethods: true,
201
+ checkUnregistered: true,
202
+ checkReplacementValues: true
203
+ })
204
+ }
205
+ };
206
+ //# sourceMappingURL=s-three-method-consistency.js.map
@@ -0,0 +1,45 @@
1
+ import { LintingRuleCertainty } from '../../linter-format';
2
+ import type { MergeableRecord } from '../../../util/objects';
3
+ import { LintingRuleTag } from '../../linter-tags';
4
+ import { type CmdCheckResult } from './cmd-check-util';
5
+ export interface TrueFalseAbbreviationResult extends CmdCheckResult {
6
+ /** the abbreviation used */
7
+ readonly name: 'T' | 'F';
8
+ /** a read of the abbreviation, or a definition masking it */
9
+ readonly kind: 'use' | 'redefinition';
10
+ }
11
+ export interface TrueFalseAbbreviationConfig extends MergeableRecord {
12
+ /** report definitions of `T` or `F`, which change what every later abbreviation means (default `true`) */
13
+ readonly reportRedefinitions: boolean;
14
+ }
15
+ export interface TrueFalseAbbreviationMetadata extends MergeableRecord {
16
+ /** uses of `T`/`F` that resolve to a definition of the analyzed code and are hence left alone */
17
+ readonly locallyDefined: number;
18
+ }
19
+ /**
20
+ * Port of the `R CMD check` note "found T/F in" (`checking R code for possible problems`, `tools::checkTnF`).
21
+ * `T` and `F` are ordinary variables that merely default to `TRUE` and `FALSE`, so any code (or user) may rebind them.
22
+ */
23
+ export declare const TRUE_FALSE_ABBREVIATION: {
24
+ readonly createSearch: () => import("../../../search/flowr-search-builder").FlowrSearchBuilder<"all", ["filter"], import("../../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, Promise<import("../../../search/flowr-search").FlowrSearchElements<import("../../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, [] | import("../../../search/flowr-search").FlowrSearchElement<import("../../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation>[]>>>;
25
+ readonly processSearchResult: (elements: import("../../../search/flowr-search").FlowrSearchElements<import("../../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, import("../../../search/flowr-search").FlowrSearchElement<import("../../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation>[]>, config: TrueFalseAbbreviationConfig, data: import("../../..").ReadonlyFlowrAnalysisProvider<import("../../..").KnownParser>) => Promise<{
26
+ results: TrueFalseAbbreviationResult[];
27
+ '.meta': {
28
+ locallyDefined: number;
29
+ };
30
+ }>;
31
+ readonly prettyPrint: {
32
+ query: (r: TrueFalseAbbreviationResult) => string;
33
+ full: (r: TrueFalseAbbreviationResult) => string;
34
+ };
35
+ readonly info: {
36
+ readonly name: "TRUE/FALSE Abbreviation";
37
+ readonly tags: readonly [LintingRuleTag.CmdCheck, LintingRuleTag.Robustness, LintingRuleTag.Readability, LintingRuleTag.QuickFix];
38
+ readonly certainty: LintingRuleCertainty.Exact;
39
+ readonly activeByDefault: false;
40
+ readonly description: "Finds `T` and `F` used for `TRUE` and `FALSE`, and top-level definitions of `T` or `F`. Off by default, as R only checks this for packages without a NAMESPACE.";
41
+ readonly defaultConfig: () => {
42
+ reportRedefinitions: true;
43
+ };
44
+ };
45
+ };
@@ -0,0 +1,121 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TRUE_FALSE_ABBREVIATION = void 0;
4
+ const linter_format_1 = require("../../linter-format");
5
+ const r_symbol_1 = require("../../../r-bridge/lang-4.x/ast/model/nodes/r-symbol");
6
+ const r_expression_list_1 = require("../../../r-bridge/lang-4.x/ast/model/nodes/r-expression-list");
7
+ const r_binary_op_1 = require("../../../r-bridge/lang-4.x/ast/model/nodes/r-binary-op");
8
+ const flowr_search_builder_1 = require("../../../search/flowr-search-builder");
9
+ const type_1 = require("../../../r-bridge/lang-4.x/ast/model/type");
10
+ const linter_tags_1 = require("../../linter-tags");
11
+ const range_1 = require("../../../util/range");
12
+ const identifier_1 = require("../../../dataflow/environments/identifier");
13
+ const vertex_1 = require("../../../dataflow/graph/vertex");
14
+ const edge_1 = require("../../../dataflow/graph/edge");
15
+ const node_id_1 = require("../../../r-bridge/lang-4.x/ast/model/processing/node-id");
16
+ const model_1 = require("../../../r-bridge/lang-4.x/ast/model/model");
17
+ const r_parameter_1 = require("../../../r-bridge/lang-4.x/ast/model/nodes/r-parameter");
18
+ const r_function_definition_1 = require("../../../r-bridge/lang-4.x/ast/model/nodes/r-function-definition");
19
+ const cmd_check_util_1 = require("./cmd-check-util");
20
+ const Abbreviations = { T: 'TRUE', F: 'FALSE' };
21
+ /**
22
+ * Whether a read of `id` may reach the built-in constant and whether it may reach a definition of the code. As the
23
+ * functions of a package only run once all of its top-level code has, a function reading an unconditional top-level
24
+ * definition never sees the built-in.
25
+ */
26
+ function reachedDefinitions(graph, id, idMap) {
27
+ let builtIn = false;
28
+ let local = false;
29
+ let shadowed = false;
30
+ const inFunction = model_1.RNode.findEnclosing(id, idMap, r_function_definition_1.RFunctionDefinition.is) !== undefined;
31
+ for (const [target, edge] of graph.edgesFrom(id)) {
32
+ if (edge_1.DfEdge.doesNotIncludeType(edge, edge_1.EdgeType.Reads)) {
33
+ continue;
34
+ }
35
+ if (node_id_1.NodeId.isBuiltIn(target)) {
36
+ builtIn = true;
37
+ }
38
+ else {
39
+ local = true;
40
+ shadowed ||= inFunction && isUnconditionalTopLevel(target, idMap);
41
+ }
42
+ }
43
+ return { builtIn: builtIn && !shadowed, local };
44
+ }
45
+ /** whether the node is evaluated by the top level of its file whenever the file is, i.e. not within a function or a branch */
46
+ function isUnconditionalTopLevel(id, idMap) {
47
+ for (let cur = idMap.get(id); cur?.info.parent !== undefined; cur = idMap.get(cur.info.parent)) {
48
+ const parent = idMap.get(cur.info.parent);
49
+ if (parent !== undefined && !r_expression_list_1.RExpressionList.is(parent) && !(r_binary_op_1.RBinaryOp.is(parent) && parent.lhs === cur)) {
50
+ return false;
51
+ }
52
+ }
53
+ return true;
54
+ }
55
+ /**
56
+ * Port of the `R CMD check` note "found T/F in" (`checking R code for possible problems`, `tools::checkTnF`).
57
+ * `T` and `F` are ordinary variables that merely default to `TRUE` and `FALSE`, so any code (or user) may rebind them.
58
+ */
59
+ exports.TRUE_FALSE_ABBREVIATION = {
60
+ createSearch: () => flowr_search_builder_1.Q.all().filter(type_1.RType.Symbol),
61
+ processSearchResult: async (elements, config, data) => {
62
+ const { graph } = await data.dataflow();
63
+ const idMap = (await data.normalize()).idMap;
64
+ const pkg = (0, cmd_check_util_1.packageInfo)(data.inspectContext());
65
+ const results = [];
66
+ let locallyDefined = 0;
67
+ for (const { node } of elements.getElements()) {
68
+ if (!r_symbol_1.RSymbol.is(node)) {
69
+ continue;
70
+ }
71
+ const name = identifier_1.Identifier.getName(node.content);
72
+ const replacement = Abbreviations[name];
73
+ const loc = range_1.SourceLocation.fromNode(node);
74
+ if (replacement === undefined || identifier_1.Identifier.getNamespace(node.content) !== undefined || loc === undefined || !pkg.isPackageCode(node.info.file)) {
75
+ continue;
76
+ }
77
+ const vertex = graph.getVertex(node.info.id);
78
+ if (vertex_1.DfgVertex.isVariableDefinition(vertex)) {
79
+ /* a local `T` (a parameter, a variable of a function) only shadows within that function */
80
+ if (config.reportRedefinitions && model_1.RNode.strictlyEnclosingFunction(node.info.id, idMap) === undefined && !r_parameter_1.RParameter.is(idMap.get(node.info.parent ?? ''))) {
81
+ results.push({
82
+ ...(0, cmd_check_util_1.at)(node),
83
+ name: name,
84
+ kind: 'redefinition',
85
+ message: `${name} is redefined, which changes the meaning of every ${name} used as an abbreviation of ${replacement}`
86
+ });
87
+ }
88
+ continue;
89
+ }
90
+ if (!vertex_1.DfgVertex.isUse(vertex)) {
91
+ continue;
92
+ }
93
+ const { builtIn, local } = reachedDefinitions(graph, node.info.id, idMap);
94
+ if (local && !builtIn) {
95
+ locallyDefined++;
96
+ continue;
97
+ }
98
+ results.push({
99
+ ...(0, cmd_check_util_1.at)(node, !local),
100
+ name: name,
101
+ kind: 'use',
102
+ message: `${name} is used as an abbreviation of ${replacement}`,
103
+ quickFix: [{ type: 'replace', description: `Replace \`${name}\` with \`${replacement}\``, replacement, loc }]
104
+ });
105
+ }
106
+ return { results, '.meta': { locallyDefined } };
107
+ },
108
+ prettyPrint: (0, cmd_check_util_1.printer)(r => `${r.kind === 'use' ? 'Use' : 'Redefinition'} of \`${r.name}\``),
109
+ info: {
110
+ name: 'TRUE/FALSE Abbreviation',
111
+ tags: [linter_tags_1.LintingRuleTag.CmdCheck, linter_tags_1.LintingRuleTag.Robustness, linter_tags_1.LintingRuleTag.Readability, linter_tags_1.LintingRuleTag.QuickFix],
112
+ certainty: linter_format_1.LintingRuleCertainty.Exact,
113
+ /* R CMD check only runs `checkTnF` for a package without a NAMESPACE, which no current package is */
114
+ activeByDefault: false,
115
+ description: 'Finds `T` and `F` used for `TRUE` and `FALSE`, and top-level definitions of `T` or `F`. Off by default, as R only checks this for packages without a NAMESPACE.',
116
+ defaultConfig: () => ({
117
+ reportRedefinitions: true
118
+ })
119
+ }
120
+ };
121
+ //# sourceMappingURL=true-false-abbreviation.js.map
@@ -62,7 +62,7 @@ function indexAlways(always) {
62
62
  return index;
63
63
  }
64
64
  /** The packages the code attaches; `undefined` when one of them cannot be named, so nothing is ruled out. */
65
- async function attachedPackages(analyzer) {
65
+ async function librariesAttachedBy(analyzer) {
66
66
  const attached = new Set();
67
67
  for (const lib of (await analyzer.query([{ type: 'dependencies', enabledCategories: ['library'] }]))['dependencies'].library) {
68
68
  if (lib.value === undefined || lib.value === dependencies_query_format_1.Unknown) {
@@ -126,7 +126,7 @@ exports.DEPRECATED_FUNCTIONS = {
126
126
  owners: always.get(identifier_1.Identifier.getName(candidate.target))
127
127
  })).filter(m => m.conditional !== undefined || m.owners !== undefined);
128
128
  /* only asked once something matched, so a clean file queries nothing */
129
- const attached = matched.length === 0 ? undefined : await attachedPackages(data);
129
+ const attached = matched.length === 0 ? undefined : await librariesAttachedBy(data);
130
130
  const packageVersions = await inferPackageVersions(data, matched.map(m => m.conditional));
131
131
  const results = matched.map(({ candidate, conditional, owners }) => {
132
132
  if (conditional !== undefined) {
@@ -283,7 +283,7 @@ function renameFix(node, replacedBy, what) {
283
283
  return [{ type: 'replace', description: `Replace ${what} with \`${replacedBy}\``, replacement: replacedBy, loc }];
284
284
  }
285
285
  /** The name to rename, `undefined` for `pkg::fn` as the replacement states no package to put back. */
286
- function calledName(node) {
286
+ function renamableCallee(node) {
287
287
  return r_function_call_1.RFunctionCall.isNamed(node) && identifier_1.Identifier.getNamespace(node.functionName.content) === undefined
288
288
  ? node.functionName : undefined;
289
289
  }
@@ -347,7 +347,7 @@ function deprecateFunctionConditionally(candidate, dataflow, idMap, analyzer, en
347
347
  state: info.state,
348
348
  replacedBy: info.replacedBy,
349
349
  sinceVersion: fnSinceVersion,
350
- quickFix: renameFix(calledName(candidate.node), info.replacedBy, 'the call')
350
+ quickFix: renameFix(renamableCallee(candidate.node), info.replacedBy, 'the call')
351
351
  });
352
352
  }
353
353
  }
@@ -1,5 +1,5 @@
1
+ import { NodeId } from '../../r-bridge/lang-4.x/ast/model/processing/node-id';
1
2
  import type { DataflowGraph } from '../../dataflow/graph/graph';
2
- import type { NodeId } from '../../r-bridge/lang-4.x/ast/model/processing/node-id';
3
3
  import type { MergeableRecord } from '../../util/objects';
4
4
  import { type LintingResult, type LintQuickFixReplacement, LintingRuleCertainty } from '../linter-format';
5
5
  import { LintingRuleTag } from '../linter-tags';
@@ -6,14 +6,16 @@ exports.detectCasing = detectCasing;
6
6
  exports.getMostUsedCasing = getMostUsedCasing;
7
7
  exports.fixCasing = fixCasing;
8
8
  exports.createNamingConventionQuickFixes = createNamingConventionQuickFixes;
9
+ const node_id_1 = require("../../r-bridge/lang-4.x/ast/model/processing/node-id");
10
+ const r_string_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-string");
9
11
  const vertex_1 = require("../../dataflow/graph/vertex");
10
- const dfg_get_symbol_refs_1 = require("../../dataflow/origin/dfg-get-symbol-refs");
11
12
  const flowr_search_builder_1 = require("../../search/flowr-search-builder");
12
13
  const assert_1 = require("../../util/assert");
13
14
  const range_1 = require("../../util/range");
14
15
  const linter_format_1 = require("../linter-format");
15
16
  const linter_tags_1 = require("../linter-tags");
16
17
  const unused_definition_1 = require("./unused-definition");
18
+ const df_helper_1 = require("../../dataflow/graph/df-helper");
17
19
  var CasingConvention;
18
20
  (function (CasingConvention) {
19
21
  CasingConvention["CamelCase"] = "camelCase";
@@ -122,22 +124,18 @@ function fixCasing(identifier, convention, ignorePrefix) {
122
124
  (0, assert_1.assertUnreachable)(convention);
123
125
  }
124
126
  }
125
- function unquoteName(lexeme) {
126
- const quoted = /^(["'`])(.*)\1$/s.exec(lexeme);
127
- return quoted ? { quote: quoted[1], name: quoted[2] } : { quote: '', name: lexeme };
128
- }
129
127
  /**
130
128
  * Creates quick fixes for renaming all references to the given node to match the provided replacement.
131
129
  */
132
130
  function createNamingConventionQuickFixes(graph, nodeId, replacement, conv) {
133
- const refs = (0, dfg_get_symbol_refs_1.getAllRefsToSymbol)(graph, nodeId);
131
+ const refs = df_helper_1.Dataflow.refsToSymbol(graph, nodeId);
134
132
  const idMap = graph.idMap;
135
133
  if (refs === undefined || idMap === undefined) {
136
134
  return undefined;
137
135
  }
138
136
  /* the name as it is written, which is the only text a rename may overwrite */
139
- const lexeme = idMap.get(nodeId)?.lexeme;
140
- const original = lexeme === undefined ? undefined : unquoteName(lexeme).name;
137
+ const lexeme = node_id_1.NodeId.recoverName(nodeId, idMap);
138
+ const original = lexeme === undefined ? undefined : r_string_1.RString.splitQuotes(lexeme).content;
141
139
  if (original === undefined || original === replacement) {
142
140
  /* a replacement equal to what is already there is no fix at all */
143
141
  return undefined;
@@ -145,19 +143,20 @@ function createNamingConventionQuickFixes(graph, nodeId, replacement, conv) {
145
143
  const result = [];
146
144
  for (const ref of refs) {
147
145
  const node = idMap.get(ref);
148
- const written = node?.lexeme === undefined ? undefined : unquoteName(node.lexeme);
149
- if (node?.lexeme === undefined || written?.name !== original) {
146
+ const written = node?.lexeme === undefined ? undefined : r_string_1.RString.splitQuotes(node.lexeme);
147
+ if (node?.lexeme === undefined || written?.content !== original) {
150
148
  /* a reference reached through something else, as `myfield(x) <- v` reaches `x` through the call it
151
149
  names, sits at a place holding another name, and writing over it would rename that one instead */
152
150
  continue;
153
151
  }
152
+ const quote = written.quote ?? '';
154
153
  const loc = range_1.SourceLocation.fromNode(node);
155
154
  if (loc) {
156
155
  // In case of a function call we only need to include the name, not the '()'
157
156
  loc[3] = loc[1] + node.lexeme.length - 1;
158
157
  result.push({
159
158
  type: 'replace',
160
- replacement: `${written.quote}${replacement}${written.quote}`,
159
+ replacement: `${quote}${replacement}${quote}`,
161
160
  description: `Rename to match naming convention ${conv}`,
162
161
  loc
163
162
  });
@@ -173,7 +172,7 @@ exports.NAMING_CONVENTION = {
173
172
  const called = (0, unused_definition_1.collectCalledNames)(dataflow.graph);
174
173
  const symbols = elements.getElements()
175
174
  .map(m => {
176
- const name = unquoteName(m.node.lexeme).name;
175
+ const name = r_string_1.RString.splitQuotes(m.node.lexeme).content;
177
176
  return {
178
177
  certainty: linter_format_1.LintingResultCertainty.Certain,
179
178
  detectedCasing: detectCasing(name, config.ignorePrefix),
@@ -188,8 +187,8 @@ exports.NAMING_CONVENTION = {
188
187
  const unambiguous = symbols.filter(s => detectPotentialCasings(s.name, config.ignorePrefix).length === 1);
189
188
  const casing = config.caseing === 'auto' ? getMostUsedCasing(unambiguous) : config.caseing;
190
189
  const taken = new Set(dataflow.graph.vertices(true).map(([id]) => {
191
- const lexeme = dataflow.graph.idMap?.get(id)?.lexeme;
192
- return lexeme === undefined ? undefined : unquoteName(lexeme).name;
190
+ const lexeme = node_id_1.NodeId.recoverName(id, dataflow.graph.idMap);
191
+ return lexeme === undefined ? undefined : r_string_1.RString.splitQuotes(lexeme).content;
193
192
  }));
194
193
  const results = casing === CasingConvention.Unknown ? [] : symbols
195
194
  /* a name that already reads as the wanted convention is no violation, whatever else it could also be
@@ -12,9 +12,9 @@ const r_access_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-access");
12
12
  const r_argument_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-argument");
13
13
  const r_function_call_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
14
14
  const r_function_definition_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-function-definition");
15
- const frame_reflection_1 = require("../../dataflow/fn/frame-reflection");
16
15
  const identifier_1 = require("../../dataflow/environments/identifier");
17
16
  const r_string_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-string");
17
+ const df_helper_1 = require("../../dataflow/graph/df-helper");
18
18
  const defaultCredentialNamePattern = '(?:passw(?:or)?d|authorization|passphrase|(?:^|[_.])pass(?:$|[_.])|pwd|secret|api[_.]?key|access[_.]?key|(?:^|[_.])token$|api[_.]?token|access[_.]?token|auth[_.]?token|bearer[_.]?token|private[_.]?key|credential|(?:^|[_.])pat$)';
19
19
  const defaultCredentialCallPattern = '(?:auth|login|signin|credential|password|secret|token|key_?set)';
20
20
  const defaultCredentialValuePattern = '(?:(?<![A-Za-z0-9_])|(?<=\\\\[nrt]))(?:' +
@@ -80,11 +80,11 @@ class CredentialContexts {
80
80
  if (r_function_definition_1.RFunctionDefinition.is(current)) {
81
81
  break;
82
82
  }
83
- const fn = r_function_call_1.RFunctionCall.isNamed(current) ? current.functionName.content : '';
83
+ const fn = r_function_call_1.RFunctionCall.calledName(current) ?? '';
84
84
  const name = identifier_1.Identifier.getName(fn);
85
85
  /* only a value built from its arguments carries a literal on to where it is assigned, `assign` assigns its own */
86
86
  const opaque = r_function_call_1.RFunctionCall.is(current) && r_argument_1.RArgument.is(child) && !this.pure.has(identifier_1.Identifier.getNamespace(fn) === undefined ? name : identifier_1.Identifier.toString(fn));
87
- for (const def of (0, frame_reflection_1.edgeSources)(this.dfg, current.info.id, edge_1.EdgeType.DefinedBy)) {
87
+ for (const def of df_helper_1.Dataflow.sourcesOf(this.dfg, current.info.id, edge_1.EdgeType.DefinedBy)) {
88
88
  const defNode = this.idMap.get(def);
89
89
  if (defNode !== undefined && vertex_1.DfgVertex.isVariableDefinition(this.dfg.getVertex(def)) && !seen.has(def) && (!opaque || model_1.RNode.iterateParents(defNode, this.idMap).some(p => p === current))) {
90
90
  seen.add(def);
@@ -108,7 +108,7 @@ class CredentialContexts {
108
108
  return found;
109
109
  }
110
110
  usesOf(def, hops, seen) {
111
- return hops >= MaxCredentialHops ? [] : (0, frame_reflection_1.edgeSources)(this.dfg, def, edge_1.EdgeType.Reads).flatMap(r => {
111
+ return hops >= MaxCredentialHops ? [] : df_helper_1.Dataflow.sourcesOf(this.dfg, def, edge_1.EdgeType.Reads).flatMap(r => {
112
112
  const reader = this.idMap.get(r);
113
113
  return reader === undefined ? [] : this.of(reader, hops + 1, seen);
114
114
  });
@@ -14,12 +14,13 @@ const df_helper_1 = require("../../dataflow/graph/df-helper");
14
14
  const search_enrichers_1 = require("../../search/search-executor/search-enrichers");
15
15
  const built_in_props_1 = require("../../dataflow/environments/built-in-props");
16
16
  const identifier_1 = require("../../dataflow/environments/identifier");
17
+ const strings_1 = require("../../util/text/strings");
17
18
  const query_fn_props_1 = require("../../dataflow/environments/query-fn-props");
18
19
  const resolve_argument_1 = require("../../dataflow/eval/resolve/resolve-argument");
19
20
  /** what runs a command, and what evaluates code beyond looking up a name (`get`) or calling a function it is handed (`do.call`) */
20
21
  function defaultConsider(index) {
21
22
  const evaluates = index.with(built_in_props_1.SemanticCallTag.Eval).filter(n => ((index.propsOf(n) ?? 0) & built_in_props_1.CallProp.Pure) === 0 && !index.get(n)?.sig?.some(([, p]) => (p & built_in_props_1.ArgProp.Callee) !== 0));
22
- return [...index.with(built_in_props_1.SemanticCallTag.Process), ...evaluates].map(n => `^${identifier_1.Identifier.quote(identifier_1.Identifier.getName(n))}$`).concat('^fread$');
23
+ return [...index.with(built_in_props_1.SemanticCallTag.Process), ...evaluates].map(n => `^${(0, strings_1.escapeRegex)(identifier_1.Identifier.getName(n))}$`).concat('^fread$');
23
24
  }
24
25
  const defaultPipeCommandFunctions = [
25
26
  { pattern: '^pdf$', argIdx: 0, argName: 'file' },