@eagleoutice/flowr 2.16.2 → 2.16.4

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 (482) hide show
  1. package/README.md +15 -15
  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 +4 -4
  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 +3 -8
  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-query.d.ts +1 -1
  142. package/documentation/doc-util/doc-query.js +3 -1
  143. package/documentation/doc-util/doc-repl.js +4 -4
  144. package/documentation/doc-util/doc-timings.js +3 -2
  145. package/documentation/doc-util/doc-types.js +2 -2
  146. package/documentation/wiki-absint.js +2 -1
  147. package/documentation/wiki-cfg.js +2 -1
  148. package/documentation/wiki-create-linting-rules.js +2 -2
  149. package/documentation/wiki-dataflow-graph.js +6 -6
  150. package/documentation/wiki-interface.js +3 -2
  151. package/documentation/wiki-linter.d.ts +14 -0
  152. package/documentation/wiki-linter.js +353 -88
  153. package/documentation/wiki-mk/doc-maker.js +1 -2
  154. package/documentation/wiki-query.js +25 -0
  155. package/documentation/wiki-search.js +2 -1
  156. package/documentation/wiki-signature-database.js +0 -2
  157. package/linter/linter-executor.js +4 -0
  158. package/linter/linter-rules.d.ts +552 -35
  159. package/linter/linter-rules.js +39 -1
  160. package/linter/linter-tags.d.ts +6 -0
  161. package/linter/linter-tags.js +6 -0
  162. package/linter/rules/absolute-path.d.ts +1 -1
  163. package/linter/rules/absolute-path.js +9 -6
  164. package/linter/rules/cmd-check/bogus-return.d.ts +29 -0
  165. package/linter/rules/cmd-check/bogus-return.js +63 -0
  166. package/linter/rules/cmd-check/call-arguments.d.ts +63 -0
  167. package/linter/rules/cmd-check/call-arguments.js +216 -0
  168. package/linter/rules/cmd-check/class-string-comparison.d.ts +48 -0
  169. package/linter/rules/cmd-check/class-string-comparison.js +135 -0
  170. package/linter/rules/cmd-check/cmd-check-util.d.ts +67 -0
  171. package/linter/rules/cmd-check/cmd-check-util.js +169 -0
  172. package/linter/rules/cmd-check/compiled-code.d.ts +86 -0
  173. package/linter/rules/cmd-check/compiled-code.js +350 -0
  174. package/linter/rules/cmd-check/conformance.d.ts +51 -0
  175. package/linter/rules/cmd-check/conformance.js +166 -0
  176. package/linter/rules/cmd-check/dependency-declaration.d.ts +95 -0
  177. package/linter/rules/cmd-check/dependency-declaration.js +299 -0
  178. package/linter/rules/cmd-check/description-metadata.d.ts +63 -0
  179. package/linter/rules/cmd-check/description-metadata.js +393 -0
  180. package/linter/rules/cmd-check/documentation-mismatch.d.ts +60 -0
  181. package/linter/rules/cmd-check/documentation-mismatch.js +407 -0
  182. package/linter/rules/cmd-check/file-checks.d.ts +29 -0
  183. package/linter/rules/cmd-check/file-checks.js +34 -0
  184. package/linter/rules/cmd-check/foreign-function-calls.d.ts +54 -0
  185. package/linter/rules/cmd-check/foreign-function-calls.js +115 -0
  186. package/linter/rules/cmd-check/global-environment-modification.d.ts +61 -0
  187. package/linter/rules/cmd-check/global-environment-modification.js +237 -0
  188. package/linter/rules/cmd-check/namespace-tampering.d.ts +52 -0
  189. package/linter/rules/cmd-check/namespace-tampering.js +162 -0
  190. package/linter/rules/cmd-check/non-ascii-code.d.ts +51 -0
  191. package/linter/rules/cmd-check/non-ascii-code.js +112 -0
  192. package/linter/rules/cmd-check/package-code.d.ts +30 -0
  193. package/linter/rules/cmd-check/package-code.js +141 -0
  194. package/linter/rules/cmd-check/package-data.d.ts +51 -0
  195. package/linter/rules/cmd-check/package-data.js +181 -0
  196. package/linter/rules/cmd-check/package-files.d.ts +41 -0
  197. package/linter/rules/cmd-check/package-files.js +157 -0
  198. package/linter/rules/cmd-check/package-hooks.d.ts +57 -0
  199. package/linter/rules/cmd-check/package-hooks.js +173 -0
  200. package/linter/rules/cmd-check/package-metafiles.d.ts +49 -0
  201. package/linter/rules/cmd-check/package-metafiles.js +292 -0
  202. package/linter/rules/cmd-check/package-runtime.d.ts +67 -0
  203. package/linter/rules/cmd-check/package-runtime.js +284 -0
  204. package/linter/rules/cmd-check/package-structure.d.ts +85 -0
  205. package/linter/rules/cmd-check/package-structure.js +320 -0
  206. package/linter/rules/cmd-check/rd-files.d.ts +83 -0
  207. package/linter/rules/cmd-check/rd-files.js +621 -0
  208. package/linter/rules/cmd-check/s-three-method-consistency.d.ts +72 -0
  209. package/linter/rules/cmd-check/s-three-method-consistency.js +206 -0
  210. package/linter/rules/cmd-check/true-false-abbreviation.d.ts +45 -0
  211. package/linter/rules/cmd-check/true-false-abbreviation.js +121 -0
  212. package/linter/rules/dataframe-access-validation.d.ts +1 -1
  213. package/linter/rules/dataframe-access-validation.js +1 -1
  214. package/linter/rules/dead-code.d.ts +4 -4
  215. package/linter/rules/dead-code.js +19 -4
  216. package/linter/rules/deprecated-functions.d.ts +1 -1
  217. package/linter/rules/deprecated-functions.js +5 -5
  218. package/linter/rules/file-path-validity.d.ts +6 -2
  219. package/linter/rules/file-path-validity.js +7 -3
  220. package/linter/rules/namespace-access.d.ts +3 -3
  221. package/linter/rules/namespace-access.js +12 -3
  222. package/linter/rules/naming-convention.d.ts +2 -2
  223. package/linter/rules/naming-convention.js +14 -15
  224. package/linter/rules/network-functions.d.ts +1 -1
  225. package/linter/rules/network-functions.js +1 -1
  226. package/linter/rules/no-leaked-credentials.d.ts +1 -1
  227. package/linter/rules/no-leaked-credentials.js +5 -5
  228. package/linter/rules/problematic-inputs.d.ts +2 -2
  229. package/linter/rules/problematic-inputs.js +4 -3
  230. package/linter/rules/roxygen-arguments.d.ts +2 -2
  231. package/linter/rules/roxygen-arguments.js +2 -2
  232. package/linter/rules/seeded-randomness.d.ts +2 -2
  233. package/linter/rules/seeded-randomness.js +7 -7
  234. package/linter/rules/software-has-license.d.ts +3 -3
  235. package/linter/rules/software-has-license.js +3 -3
  236. package/linter/rules/software-has-tests.d.ts +2 -2
  237. package/linter/rules/software-has-tests.js +2 -2
  238. package/linter/rules/stop-with-call-arg.d.ts +3 -3
  239. package/linter/rules/stop-with-call-arg.js +21 -4
  240. package/linter/rules/syntactically-valid.d.ts +1 -1
  241. package/linter/rules/syntactically-valid.js +1 -1
  242. package/linter/rules/unclosed-connection.d.ts +2 -2
  243. package/linter/rules/unclosed-connection.js +5 -5
  244. package/linter/rules/undefined-symbol-util.js +16 -32
  245. package/linter/rules/undefined-symbol.d.ts +3 -1
  246. package/linter/rules/undefined-symbol.js +34 -4
  247. package/linter/rules/unescaped-arguments.d.ts +1 -1
  248. package/linter/rules/unescaped-arguments.js +11 -10
  249. package/linter/rules/unused-definition.d.ts +1 -1
  250. package/linter/rules/unused-definition.js +14 -20
  251. package/linter/rules/unused-import.d.ts +1 -1
  252. package/linter/rules/unused-import.js +1 -1
  253. package/linter/rules/useless-loop.d.ts +1 -1
  254. package/linter/rules/useless-loop.js +1 -1
  255. package/package.json +1 -1
  256. package/project/cache/flowr-analyzer-cache.js +1 -1
  257. package/project/context/flowr-analyzer-context.js +1 -1
  258. package/project/context/flowr-analyzer-environment-context.d.ts +2 -2
  259. package/project/context/flowr-analyzer-environment-context.js +2 -1
  260. package/project/context/flowr-analyzer-files-context.d.ts +6 -0
  261. package/project/context/flowr-analyzer-files-context.js +15 -11
  262. package/project/context/flowr-analyzer-incremental-analysis-context.d.ts +0 -2
  263. package/project/context/flowr-analyzer-incremental-analysis-context.js +0 -4
  264. package/project/context/flowr-file.d.ts +4 -0
  265. package/project/context/flowr-file.js +4 -0
  266. package/project/flowr-analyzer-builder.js +1 -1
  267. package/project/plugins/file-plugins/files/flowr-description-file.js +2 -2
  268. package/project/plugins/file-plugins/files/flowr-jupyter-file.d.ts +2 -0
  269. package/project/plugins/file-plugins/files/flowr-jupyter-file.js +4 -0
  270. package/project/plugins/file-plugins/files/flowr-manifest-files.d.ts +2 -0
  271. package/project/plugins/file-plugins/files/flowr-manifest-files.js +11 -14
  272. package/project/plugins/file-plugins/files/flowr-namespace-file.d.ts +3 -0
  273. package/project/plugins/file-plugins/files/flowr-namespace-file.js +25 -15
  274. package/project/plugins/file-plugins/files/flowr-rd-file.d.ts +44 -0
  275. package/project/plugins/file-plugins/files/flowr-rd-file.js +130 -61
  276. package/project/plugins/file-plugins/files/flowr-rda-file.d.ts +0 -1
  277. package/project/plugins/file-plugins/files/flowr-rda-file.js +4 -16
  278. package/project/plugins/file-plugins/files/flowr-rmarkdown-file.d.ts +2 -0
  279. package/project/plugins/file-plugins/files/flowr-rmarkdown-file.js +4 -0
  280. package/project/plugins/file-plugins/files/flowr-sweave-file.d.ts +2 -0
  281. package/project/plugins/file-plugins/files/flowr-sweave-file.js +4 -0
  282. package/project/plugins/file-plugins/flowr-analyzer-test-file-plugin.js +1 -1
  283. package/project/plugins/file-plugins/flowr-analyzer-vignette-file-plugin.js +1 -1
  284. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-description-file-plugin.d.ts +0 -1
  285. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-description-file-plugin.js +1 -5
  286. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-lockfile-plugin.d.ts +2 -0
  287. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-lockfile-plugin.js +2 -0
  288. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-session-info-plugin.js +3 -7
  289. package/project/sigdb/build.js +16 -30
  290. package/project/sigdb/dict.d.ts +4 -6
  291. package/project/sigdb/dict.js +125 -31
  292. package/project/sigdb/reader.js +2 -18
  293. package/project/sigdb/sigdb-download.js +14 -23
  294. package/queries/base-query-format.d.ts +2 -0
  295. package/queries/base-query-format.js +10 -2
  296. package/queries/catalog/absint-query/absint-query-format.d.ts +1 -1
  297. package/queries/catalog/absint-query/absint-query-format.js +5 -7
  298. package/queries/catalog/call-context-query/call-context-query-executor.js +24 -32
  299. package/queries/catalog/call-context-query/call-context-query-format.d.ts +1 -1
  300. package/queries/catalog/call-context-query/call-context-query-format.js +1 -3
  301. package/queries/catalog/call-context-query/identify-link-to-last-call-relation.js +2 -4
  302. package/queries/catalog/call-context-query/identify-link-to-nested-call-relation.js +1 -4
  303. package/queries/catalog/call-graph-query/call-graph-query-format.js +2 -3
  304. package/queries/catalog/config-query/config-query-format.js +3 -3
  305. package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.js +2 -3
  306. package/queries/catalog/dataflow-query/dataflow-query-format.js +2 -3
  307. package/queries/catalog/dependencies-query/data-flow.d.ts +45 -0
  308. package/queries/catalog/dependencies-query/data-flow.js +179 -0
  309. package/queries/catalog/dependencies-query/dependencies-query-executor.d.ts +18 -0
  310. package/queries/catalog/dependencies-query/dependencies-query-executor.js +108 -12
  311. package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +17 -1
  312. package/queries/catalog/dependencies-query/dependencies-query-format.js +14 -11
  313. package/queries/catalog/dependencies-query/function-info/derived-functions.js +2 -1
  314. package/queries/catalog/dependencies-query/function-info/function-info.d.ts +2 -0
  315. package/queries/catalog/dependencies-query/function-info/library-functions.js +13 -13
  316. package/queries/catalog/dependencies-query/function-info/read-functions.js +1 -1
  317. package/queries/catalog/dependencies-query/function-info/remote-functions.js +3 -3
  318. package/queries/catalog/dependencies-query/function-info/source-functions.js +2 -2
  319. package/queries/catalog/dependencies-query/function-info/test-functions.js +8 -8
  320. package/queries/catalog/dependencies-query/function-info/transform-functions.d.ts +8 -0
  321. package/queries/catalog/dependencies-query/function-info/transform-functions.js +17 -0
  322. package/queries/catalog/dependencies-query/function-info/write-functions.js +4 -0
  323. package/queries/catalog/dependencies-query/implicit-echo.d.ts +5 -3
  324. package/queries/catalog/dependencies-query/implicit-echo.js +36 -35
  325. package/queries/catalog/dependencies-query/link-devices.d.ts +3 -2
  326. package/queries/catalog/dependencies-query/link-devices.js +9 -6
  327. package/queries/catalog/dependencies-query/plot-description.d.ts +10 -0
  328. package/queries/catalog/dependencies-query/plot-description.js +119 -0
  329. package/queries/catalog/dependencies-query/plot-objects.d.ts +13 -0
  330. package/queries/catalog/dependencies-query/plot-objects.js +61 -0
  331. package/queries/catalog/dice-query/dice-query-format.d.ts +2 -2
  332. package/queries/catalog/dice-query/dice-query-format.js +3 -40
  333. package/queries/catalog/does-call-query/does-call-query-format.d.ts +1 -1
  334. package/queries/catalog/does-call-query/does-call-query-format.js +2 -2
  335. package/queries/catalog/function-info-query/function-info-query-format.js +2 -2
  336. package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-executor.js +2 -1
  337. package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-format.js +2 -2
  338. package/queries/catalog/happens-before-query/happens-before-query-format.js +2 -2
  339. package/queries/catalog/id-map-query/id-map-query-format.js +1 -3
  340. package/queries/catalog/input-sources-query/input-sources-query-executor.js +2 -2
  341. package/queries/catalog/input-sources-query/input-sources-query-format.js +2 -3
  342. package/queries/catalog/input-sources-query/simple-input-classifier.js +28 -29
  343. package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.js +4 -7
  344. package/queries/catalog/inspect-fn-props-query/inspect-fn-props-query-executor.js +1 -1
  345. package/queries/catalog/inspect-fn-props-query/inspect-fn-props-query-format.js +3 -2
  346. package/queries/catalog/inspect-recursion-query/inspect-recursion-query-executor.js +2 -2
  347. package/queries/catalog/linter-query/linter-query-executor.js +10 -3
  348. package/queries/catalog/linter-query/linter-query-format.d.ts +4 -1
  349. package/queries/catalog/linter-query/linter-query-format.js +32 -21
  350. package/queries/catalog/location-map-query/location-map-query-format.d.ts +1 -1
  351. package/queries/catalog/location-map-query/location-map-query-format.js +1 -3
  352. package/queries/catalog/normalized-ast-query/normalized-ast-query-format.js +2 -3
  353. package/queries/catalog/origin-query/origin-query-executor.d.ts +1 -1
  354. package/queries/catalog/origin-query/origin-query-executor.js +3 -3
  355. package/queries/catalog/origin-query/origin-query-format.d.ts +1 -1
  356. package/queries/catalog/origin-query/origin-query-format.js +4 -5
  357. package/queries/catalog/project-query/project-query-format.js +2 -2
  358. package/queries/catalog/provenance-query/provenance-query-format.js +2 -3
  359. package/queries/catalog/resolve-value-query/resolve-value-query-format.d.ts +1 -1
  360. package/queries/catalog/resolve-value-query/resolve-value-query-format.js +4 -4
  361. package/queries/catalog/search-query/search-query-format.js +1 -3
  362. package/queries/catalog/signature-query/signature-query-executor.js +3 -3
  363. package/queries/catalog/signature-query/signature-query-format.js +2 -2
  364. package/queries/catalog/slice-query-options.d.ts +16 -0
  365. package/queries/catalog/slice-query-options.js +28 -0
  366. package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +2 -2
  367. package/queries/catalog/static-slice-query/static-slice-query-format.js +3 -42
  368. package/queries/query-print.d.ts +4 -0
  369. package/queries/query-print.js +17 -1
  370. package/queries/query.d.ts +3 -3
  371. package/queries/query.js +3 -4
  372. package/r-bridge/lang-4.x/ast/model/model.d.ts +27 -3
  373. package/r-bridge/lang-4.x/ast/model/model.js +28 -1
  374. package/r-bridge/lang-4.x/ast/model/nodes/info/r-delimiter.d.ts +1 -0
  375. package/r-bridge/lang-4.x/ast/model/nodes/info/r-delimiter.js +1 -0
  376. package/r-bridge/lang-4.x/ast/model/nodes/r-access.d.ts +2 -0
  377. package/r-bridge/lang-4.x/ast/model/nodes/r-access.js +1 -0
  378. package/r-bridge/lang-4.x/ast/model/nodes/r-argument.d.ts +20 -1
  379. package/r-bridge/lang-4.x/ast/model/nodes/r-argument.js +25 -1
  380. package/r-bridge/lang-4.x/ast/model/nodes/r-binary-op.d.ts +2 -0
  381. package/r-bridge/lang-4.x/ast/model/nodes/r-binary-op.js +1 -0
  382. package/r-bridge/lang-4.x/ast/model/nodes/r-break.d.ts +2 -0
  383. package/r-bridge/lang-4.x/ast/model/nodes/r-break.js +1 -0
  384. package/r-bridge/lang-4.x/ast/model/nodes/r-comment.d.ts +2 -0
  385. package/r-bridge/lang-4.x/ast/model/nodes/r-comment.js +1 -0
  386. package/r-bridge/lang-4.x/ast/model/nodes/r-expression-list.d.ts +2 -0
  387. package/r-bridge/lang-4.x/ast/model/nodes/r-expression-list.js +1 -0
  388. package/r-bridge/lang-4.x/ast/model/nodes/r-for-loop.d.ts +2 -0
  389. package/r-bridge/lang-4.x/ast/model/nodes/r-for-loop.js +1 -0
  390. package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.d.ts +18 -2
  391. package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.js +15 -6
  392. package/r-bridge/lang-4.x/ast/model/nodes/r-function-definition.d.ts +2 -0
  393. package/r-bridge/lang-4.x/ast/model/nodes/r-function-definition.js +1 -0
  394. package/r-bridge/lang-4.x/ast/model/nodes/r-if-then-else.d.ts +2 -0
  395. package/r-bridge/lang-4.x/ast/model/nodes/r-if-then-else.js +1 -0
  396. package/r-bridge/lang-4.x/ast/model/nodes/r-line-directive.d.ts +2 -0
  397. package/r-bridge/lang-4.x/ast/model/nodes/r-line-directive.js +1 -0
  398. package/r-bridge/lang-4.x/ast/model/nodes/r-logical.d.ts +2 -0
  399. package/r-bridge/lang-4.x/ast/model/nodes/r-logical.js +1 -0
  400. package/r-bridge/lang-4.x/ast/model/nodes/r-next.d.ts +2 -0
  401. package/r-bridge/lang-4.x/ast/model/nodes/r-next.js +1 -0
  402. package/r-bridge/lang-4.x/ast/model/nodes/r-number.d.ts +2 -0
  403. package/r-bridge/lang-4.x/ast/model/nodes/r-number.js +1 -0
  404. package/r-bridge/lang-4.x/ast/model/nodes/r-parameter.d.ts +2 -0
  405. package/r-bridge/lang-4.x/ast/model/nodes/r-parameter.js +1 -0
  406. package/r-bridge/lang-4.x/ast/model/nodes/r-pipe.d.ts +2 -0
  407. package/r-bridge/lang-4.x/ast/model/nodes/r-pipe.js +1 -0
  408. package/r-bridge/lang-4.x/ast/model/nodes/r-repeat-loop.d.ts +2 -0
  409. package/r-bridge/lang-4.x/ast/model/nodes/r-repeat-loop.js +1 -0
  410. package/r-bridge/lang-4.x/ast/model/nodes/r-string.d.ts +17 -0
  411. package/r-bridge/lang-4.x/ast/model/nodes/r-string.js +20 -0
  412. package/r-bridge/lang-4.x/ast/model/nodes/r-symbol.d.ts +2 -0
  413. package/r-bridge/lang-4.x/ast/model/nodes/r-symbol.js +1 -0
  414. package/r-bridge/lang-4.x/ast/model/nodes/r-unary-op.d.ts +2 -0
  415. package/r-bridge/lang-4.x/ast/model/nodes/r-unary-op.js +1 -0
  416. package/r-bridge/lang-4.x/ast/model/nodes/r-while-loop.d.ts +2 -0
  417. package/r-bridge/lang-4.x/ast/model/nodes/r-while-loop.js +1 -0
  418. package/r-bridge/lang-4.x/ast/model/operators.js +0 -2
  419. package/r-bridge/lang-4.x/ast/model/processing/decorate.js +1 -6
  420. package/r-bridge/lang-4.x/ast/model/processing/fold.js +1 -6
  421. package/r-bridge/lang-4.x/ast/model/processing/node-id.js +4 -3
  422. package/r-bridge/lang-4.x/ast/parser/json/format.js +2 -2
  423. package/r-bridge/lang-4.x/ast/parser/main/internal/control/normalize-if-then.js +1 -5
  424. package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-argument.js +2 -2
  425. package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-call.js +4 -20
  426. package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-definition.js +1 -5
  427. package/r-bridge/lang-4.x/ast/parser/main/internal/loops/normalize-next.js +1 -5
  428. package/r-bridge/lang-4.x/ast/parser/main/internal/loops/normalize-repeat.js +1 -5
  429. package/r-bridge/lang-4.x/ast/parser/main/internal/loops/normalize-while.js +2 -9
  430. package/r-bridge/lang-4.x/ast/parser/main/internal/normalize-access.js +1 -5
  431. package/r-bridge/lang-4.x/ast/parser/main/internal/operators/normalize-binary.js +2 -10
  432. package/r-bridge/lang-4.x/ast/parser/main/internal/operators/normalize-unary.js +2 -11
  433. package/r-bridge/lang-4.x/ast/parser/main/internal/structure/normalize-expressions.js +3 -11
  434. package/r-bridge/lang-4.x/ast/parser/main/internal/values/normalize-number.js +1 -5
  435. package/r-bridge/lang-4.x/ast/parser/main/internal/values/normalize-string.js +1 -5
  436. package/r-bridge/lang-4.x/ast/parser/main/internal/values/normalize-symbol.js +1 -5
  437. package/r-bridge/lang-4.x/ast/parser/main/normalize-meta.d.ts +6 -1
  438. package/r-bridge/lang-4.x/ast/parser/main/normalize-meta.js +7 -0
  439. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.d.ts +0 -10
  440. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +30 -82
  441. package/r-bridge/retriever.d.ts +0 -4
  442. package/r-bridge/retriever.js +0 -13
  443. package/r-bridge/roxygen2/documentation-provider.js +3 -7
  444. package/r-bridge/shell.js +3 -8
  445. package/reconstruct/auto-select/magic-comments.js +8 -7
  446. package/reconstruct/inline/source-inline-map.d.ts +3 -0
  447. package/reconstruct/inline/source-inline-map.js +8 -7
  448. package/reconstruct/reconstruct.d.ts +1 -1
  449. package/reconstruct/reconstruct.js +33 -109
  450. package/search/flowr-search-printer.js +4 -15
  451. package/search/search-executor/search-generators.js +1 -1
  452. package/slicing/criterion/filters/all-variables.js +1 -2
  453. package/slicing/static/fingerprint.js +11 -2
  454. package/slicing/static/slice-call.d.ts +2 -8
  455. package/slicing/static/slice-call.js +8 -18
  456. package/slicing/static/static-slicer.js +81 -6
  457. package/util/collections/arrays.js +1 -1
  458. package/util/collections/set.js +1 -1
  459. package/util/diff-graph.d.ts +4 -0
  460. package/util/diff-graph.js +12 -0
  461. package/util/files.js +2 -6
  462. package/util/json.js +1 -15
  463. package/util/mermaid/cfg.js +10 -17
  464. package/util/mermaid/dfg.js +6 -8
  465. package/util/objects.d.ts +1 -1
  466. package/util/quads.js +4 -13
  467. package/util/r-author.js +5 -5
  468. package/util/range.d.ts +9 -0
  469. package/util/range.js +11 -0
  470. package/util/schema.js +3 -3
  471. package/util/simple-df/dfg-view.js +2 -1
  472. package/util/text/ansi.js +1 -2
  473. package/util/text/playground-link.js +2 -1
  474. package/util/text/r-highlight.js +2 -1
  475. package/util/text/strings.d.ts +2 -0
  476. package/util/text/strings.js +5 -0
  477. package/util/text/time.js +1 -2
  478. package/util/version.js +4 -3
  479. package/dataflow/fn/recursive-function.d.ts +0 -6
  480. package/dataflow/fn/recursive-function.js +0 -32
  481. package/dataflow/internal/process/functions/call/argument/unpack-argument.d.ts +0 -16
  482. package/dataflow/internal/process/functions/call/argument/unpack-argument.js +0 -27
@@ -0,0 +1,135 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CLASS_STRING_COMPARISON = void 0;
4
+ const linter_format_1 = require("../../linter-format");
5
+ const r_while_loop_1 = require("../../../r-bridge/lang-4.x/ast/model/nodes/r-while-loop");
6
+ const r_if_then_else_1 = require("../../../r-bridge/lang-4.x/ast/model/nodes/r-if-then-else");
7
+ const r_symbol_1 = require("../../../r-bridge/lang-4.x/ast/model/nodes/r-symbol");
8
+ const r_string_1 = require("../../../r-bridge/lang-4.x/ast/model/nodes/r-string");
9
+ const flowr_search_builder_1 = require("../../../search/flowr-search-builder");
10
+ const flowr_search_filters_1 = require("../../../search/flowr-search-filters");
11
+ const type_1 = require("../../../r-bridge/lang-4.x/ast/model/type");
12
+ const linter_tags_1 = require("../../linter-tags");
13
+ const range_1 = require("../../../util/range");
14
+ const model_1 = require("../../../r-bridge/lang-4.x/ast/model/model");
15
+ const r_function_call_1 = require("../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
16
+ const df_helper_1 = require("../../../dataflow/graph/df-helper");
17
+ const resolve_helper_1 = require("../../../dataflow/environments/resolve-helper");
18
+ const node_value_1 = require("../../../dataflow/eval/resolve/node-value");
19
+ const cmd_check_util_1 = require("./cmd-check-util");
20
+ const LogicalOps = new Set(['&&', '||', '&', '|']);
21
+ /** whether the node is a call of the built-in `class`, not of a redefinition */
22
+ function isBuiltinClassCall(node, graph) {
23
+ if (!r_function_call_1.RFunctionCall.isNamed(node, 'class') || node.arguments.length !== 1 || node.arguments[0] === r_function_call_1.EmptyArgument) {
24
+ return false;
25
+ }
26
+ const origins = df_helper_1.Dataflow.origin(graph, node.info.id);
27
+ return origins === undefined || origins.every(o => o.type === 3 /* OriginType.BuiltInFunctionOrigin */);
28
+ }
29
+ /** the class names `node` stands for: a string literal, or (if allowed) what flowR resolves it to */
30
+ function stringsOf(node, graph, ctx, resolve) {
31
+ if (r_string_1.RString.is(node)) {
32
+ return [node.content.str];
33
+ }
34
+ if (!resolve || !r_symbol_1.RSymbol.is(node)) {
35
+ return undefined;
36
+ }
37
+ const strs = node_value_1.NodeValue.stringsOf(node.info.id, resolve_helper_1.Resolve.info(graph, ctx));
38
+ return strs !== undefined && strs.length > 0 ? strs : undefined;
39
+ }
40
+ /** the class-to-string comparisons a condition is made of, looking through `(`, `!` and the logical operators like `R CMD check` does */
41
+ function comparisonsIn(cond, graph, ctx, resolve) {
42
+ switch (cond.type) {
43
+ case type_1.RType.ExpressionList:
44
+ return cond.grouping !== undefined && cond.children.length === 1 ? comparisonsIn(cond.children[0], graph, ctx, resolve) : [];
45
+ case type_1.RType.UnaryOp:
46
+ return cond.operator === '!' ? comparisonsIn(cond.operand, graph, ctx, resolve) : [];
47
+ case type_1.RType.BinaryOp: {
48
+ if (LogicalOps.has(cond.operator)) {
49
+ return [...comparisonsIn(cond.lhs, graph, ctx, resolve), ...comparisonsIn(cond.rhs, graph, ctx, resolve)];
50
+ }
51
+ if (cond.operator !== '==' && cond.operator !== '!=') {
52
+ return [];
53
+ }
54
+ /* `R CMD check` only spots `class(x) == "a"`, flowR the mirrored `"a" == class(x)` as well */
55
+ for (const [call, other] of [[cond.lhs, cond.rhs], [cond.rhs, cond.lhs]]) {
56
+ if (!isBuiltinClassCall(call, graph)) {
57
+ continue;
58
+ }
59
+ const classes = stringsOf(other, graph, ctx, resolve);
60
+ const arg = call.arguments[0];
61
+ if (classes !== undefined && arg !== r_function_call_1.EmptyArgument && arg.value !== undefined) {
62
+ return [{ node: cond, negated: cond.operator === '!=', object: arg.value, against: other, classes, literal: r_string_1.RString.is(other) }];
63
+ }
64
+ }
65
+ return [];
66
+ }
67
+ default:
68
+ return [];
69
+ }
70
+ }
71
+ function quickFixFor(c) {
72
+ const object = model_1.RNode.lexeme(c.object);
73
+ const against = model_1.RNode.lexeme(c.against);
74
+ const loc = range_1.SourceLocation.fromNode(c.node);
75
+ if (object === undefined || against === undefined || loc === undefined) {
76
+ return undefined;
77
+ }
78
+ return [{
79
+ type: 'replace',
80
+ description: `Replace with \`${c.negated ? '!' : ''}inherits(${object}, ${against})\``,
81
+ replacement: `${c.negated ? '!' : ''}inherits(${object}, ${against})`,
82
+ loc
83
+ }];
84
+ }
85
+ /**
86
+ * Port of the `R CMD check` note "Found if() conditions comparing class() to string"
87
+ * (`checking R code for possible problems`, `_R_CHECK_CODE_CLASS_IS_STRING_`).
88
+ * As an object may have more than one class, `class(x) == "a"` gives a condition longer than one (an error since
89
+ * R 4.2) or misses a subclass; `inherits(x, "a")` is what is meant.
90
+ */
91
+ exports.CLASS_STRING_COMPARISON = {
92
+ createSearch: () => flowr_search_builder_1.Q.all().filter(flowr_search_filters_1.FlowrFilterCombinator.or(type_1.RType.IfThenElse, type_1.RType.WhileLoop)),
93
+ processSearchResult: async (elements, config, data) => {
94
+ const ctx = data.inspectContext();
95
+ const { graph } = await data.dataflow();
96
+ const pkg = (0, cmd_check_util_1.packageInfo)(ctx);
97
+ let considered = 0;
98
+ const results = [];
99
+ for (const { node } of elements.getElements()) {
100
+ if (!pkg.isPackageCode(node.info.file) || (r_while_loop_1.RWhileLoop.is(node) && !config.checkWhile)) {
101
+ continue;
102
+ }
103
+ const cond = r_if_then_else_1.RIfThenElse.is(node) ? node.condition : r_while_loop_1.RWhileLoop.is(node) ? node.condition : undefined;
104
+ if (cond === undefined) {
105
+ continue;
106
+ }
107
+ considered++;
108
+ for (const c of comparisonsIn(cond, graph, ctx, config.resolveStrings)) {
109
+ const loc = range_1.SourceLocation.fromNode(c.node);
110
+ if (loc === undefined) {
111
+ continue;
112
+ }
113
+ results.push({
114
+ ...(0, cmd_check_util_1.at)(c.node),
115
+ classes: c.classes,
116
+ message: `${r_if_then_else_1.RIfThenElse.is(node) ? 'if' : 'while'}() condition compares class() to ${c.literal ? 'a string' : 'a string variable'}, use ${c.negated ? '!' : ''}inherits() instead`,
117
+ quickFix: quickFixFor(c)
118
+ });
119
+ }
120
+ }
121
+ return { results, '.meta': { consideredConditions: considered } };
122
+ },
123
+ prettyPrint: (0, cmd_check_util_1.printer)(r => `class() compared to ${r.classes.map(c => JSON.stringify(c)).join(', ')}`),
124
+ info: {
125
+ name: 'Class String Comparison',
126
+ tags: [linter_tags_1.LintingRuleTag.CmdCheck, linter_tags_1.LintingRuleTag.Bug, linter_tags_1.LintingRuleTag.Robustness, linter_tags_1.LintingRuleTag.QuickFix],
127
+ certainty: linter_format_1.LintingRuleCertainty.BestEffort,
128
+ description: 'Finds `if`/`while` conditions comparing `class(x)` with a string, which fail for objects with several classes. Offers `inherits(x, ...)` as a quick fix.',
129
+ defaultConfig: () => ({
130
+ checkWhile: true,
131
+ resolveStrings: true
132
+ })
133
+ }
134
+ };
135
+ //# sourceMappingURL=class-string-comparison.js.map
@@ -0,0 +1,67 @@
1
+ import type { ReadOnlyFlowrAnalyzerContext } from '../../../project/context/flowr-analyzer-context';
2
+ import { FlowrDescriptionFile } from '../../../project/plugins/file-plugins/files/flowr-description-file';
3
+ import type { NamespaceInfo } from '../../../project/plugins/file-plugins/files/flowr-namespace-file';
4
+ import type { ParentInformation, AstIdMap, NormalizedAst } from '../../../r-bridge/lang-4.x/ast/model/processing/decorate';
5
+ import { RFunctionDefinition } from '../../../r-bridge/lang-4.x/ast/model/nodes/r-function-definition';
6
+ import type { DataflowGraph } from '../../../dataflow/graph/graph';
7
+ import { RNode } from '../../../r-bridge/lang-4.x/ast/model/model';
8
+ import type { NodeId } from '../../../r-bridge/lang-4.x/ast/model/processing/node-id';
9
+ import { type LintingResult } from '../../linter-format';
10
+ import { SourceLocation } from '../../../util/range';
11
+ import { type DataflowGraphVertexFunctionCall } from '../../../dataflow/graph/vertex';
12
+ /** The DESCRIPTION fields declaring a package dependency. */
13
+ export declare const DependencyFields: readonly ["Depends", "Imports", "Suggests", "Enhances", "LinkingTo"];
14
+ export type DependencyField = typeof DependencyFields[number];
15
+ /** A linting result of a `cmd-check` rule. */
16
+ export interface CmdCheckResult extends LintingResult {
17
+ readonly message: string;
18
+ }
19
+ /** What the `cmd-check` rules need to know about the analyzed package. */
20
+ export interface PackageInfo {
21
+ readonly name?: string;
22
+ readonly description: FlowrDescriptionFile | undefined;
23
+ /** the package names each dependency field declares (without `R` itself) */
24
+ readonly declared: ReadonlyMap<DependencyField, readonly string[]>;
25
+ readonly namespace: NamespaceInfo | undefined;
26
+ /** whether `file` (as a node's `info.file` gives it) lives in the `R/` folder */
27
+ readonly isPackageCode: (file: string | undefined) => boolean;
28
+ }
29
+ /** Collects the {@link PackageInfo} of the analyzed project; code without a file or DESCRIPTION counts as package code. */
30
+ export declare function packageInfo(ctx: ReadOnlyFlowrAnalyzerContext): PackageInfo;
31
+ /** All packages the DESCRIPTION declares in any dependency field. */
32
+ export declare function allDeclared(info: PackageInfo): Set<string>;
33
+ /** The name a function definition is bound to by a plain assignment (`f <- function() ...`). */
34
+ export declare function boundName(def: RNode<ParentInformation>, idMap: AstIdMap): string | undefined;
35
+ /** Every node of the normalized project, each once (unlike the values of the id map). */
36
+ export declare function projectNodes(ast: NormalizedAst): RNode<ParentInformation>[];
37
+ /** The function definitions bound to `name` at the top level of the analyzed code. */
38
+ export declare function topLevelDefinitions(ast: NormalizedAst, name: (n: string) => boolean): {
39
+ name: string;
40
+ def: RFunctionDefinition<ParentInformation>;
41
+ }[];
42
+ /** The formal parameter names of a function definition, in order. */
43
+ export declare function formalNames(def: RFunctionDefinition<ParentInformation>): string[];
44
+ /** Whether the node with the given id is (nested) within the given definition. */
45
+ export declare function isWithin(id: NodeId, def: NodeId, idMap: AstIdMap): boolean;
46
+ /** The function definitions a call reaches by its `Calls` edges. */
47
+ export declare function calledDefinitions(graph: DataflowGraph, call: NodeId, idMap: AstIdMap): RFunctionDefinition<ParentInformation>[];
48
+ /** Whether the call reaches the built-in function only, and no definition of the code. */
49
+ export declare function isBuiltInCall(graph: DataflowGraph, id: NodeId): boolean;
50
+ /** Whether the node or an ancestor is quoted or otherwise evaluated elsewhere (`quote(...)`, a data mask). */
51
+ export declare function isQuoted(graph: DataflowGraph, id: NodeId, idMap: AstIdMap): boolean;
52
+ /** The packages `R CMD check` takes as declared without a DESCRIPTION entry: the base packages but `methods` and `stats4`. */
53
+ export declare function isStandardPackage(pkg: string): boolean;
54
+ /** The certainty, involved node, and location of a finding at a node or location. */
55
+ export declare function at(where: RNode<ParentInformation> | SourceLocation | undefined, certain?: boolean): Pick<LintingResult, 'certainty' | 'involvedId' | 'loc'>;
56
+ /** The pretty printers of a rule: `query` describes a result, the full one is its message and location. */
57
+ export declare function printer<R extends CmdCheckResult>(query: (r: R) => string): {
58
+ query: (r: R) => string;
59
+ full: (r: R) => string;
60
+ };
61
+ /** The calls (by name, if given) of package code, with the node and vertex of each; `builtIn` drops redefined ones. */
62
+ export declare function packageCalls(graph: DataflowGraph, idMap: AstIdMap, pkg: PackageInfo, names?: ReadonlySet<string>, builtIn?: boolean): Generator<{
63
+ id: NodeId;
64
+ name: string;
65
+ node: RNode<ParentInformation>;
66
+ vertex: DataflowGraphVertexFunctionCall;
67
+ }>;
@@ -0,0 +1,169 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.DependencyFields = void 0;
7
+ exports.packageInfo = packageInfo;
8
+ exports.allDeclared = allDeclared;
9
+ exports.boundName = boundName;
10
+ exports.projectNodes = projectNodes;
11
+ exports.topLevelDefinitions = topLevelDefinitions;
12
+ exports.formalNames = formalNames;
13
+ exports.isWithin = isWithin;
14
+ exports.calledDefinitions = calledDefinitions;
15
+ exports.isBuiltInCall = isBuiltInCall;
16
+ exports.isQuoted = isQuoted;
17
+ exports.isStandardPackage = isStandardPackage;
18
+ exports.at = at;
19
+ exports.printer = printer;
20
+ exports.packageCalls = packageCalls;
21
+ const path_1 = __importDefault(require("path"));
22
+ const r_symbol_1 = require("../../../r-bridge/lang-4.x/ast/model/nodes/r-symbol");
23
+ const r_string_1 = require("../../../r-bridge/lang-4.x/ast/model/nodes/r-string");
24
+ const r_binary_op_1 = require("../../../r-bridge/lang-4.x/ast/model/nodes/r-binary-op");
25
+ const flowr_file_1 = require("../../../project/context/flowr-file");
26
+ const package_files_1 = require("./package-files");
27
+ const flowr_description_file_1 = require("../../../project/plugins/file-plugins/files/flowr-description-file");
28
+ const r_function_definition_1 = require("../../../r-bridge/lang-4.x/ast/model/nodes/r-function-definition");
29
+ const edge_1 = require("../../../dataflow/graph/edge");
30
+ const df_helper_1 = require("../../../dataflow/graph/df-helper");
31
+ const r_base_packages_1 = require("../../../util/r-base-packages");
32
+ const r_project_1 = require("../../../r-bridge/lang-4.x/ast/model/nodes/r-project");
33
+ const model_1 = require("../../../r-bridge/lang-4.x/ast/model/model");
34
+ const identifier_1 = require("../../../dataflow/environments/identifier");
35
+ const linter_format_1 = require("../../linter-format");
36
+ const range_1 = require("../../../util/range");
37
+ const vertex_1 = require("../../../dataflow/graph/vertex");
38
+ /** The DESCRIPTION fields declaring a package dependency. */
39
+ exports.DependencyFields = ['Depends', 'Imports', 'Suggests', 'Enhances', 'LinkingTo'];
40
+ const DeclaredGetters = {
41
+ Depends: (d) => d.depends(),
42
+ Imports: (d) => d.imports(),
43
+ Suggests: (d) => d.suggests(),
44
+ Enhances: (d) => d.enhances(),
45
+ LinkingTo: (d) => d.linkingTo()
46
+ };
47
+ /** Roles of files that live in a package but are no code of its namespace. */
48
+ const NonNamespaceRoles = [flowr_file_1.FileRole.Test, flowr_file_1.FileRole.Vignette, flowr_file_1.FileRole.Install, flowr_file_1.FileRole.Startup, flowr_file_1.FileRole.Data];
49
+ /** Collects the {@link PackageInfo} of the analyzed project; code without a file or DESCRIPTION counts as package code. */
50
+ function packageInfo(ctx) {
51
+ const descFile = (0, package_files_1.rootDescriptionFile)(ctx);
52
+ const description = descFile === undefined ? undefined : flowr_description_file_1.FlowrDescriptionFile.from(descFile);
53
+ const declared = new Map(exports.DependencyFields.map(f => [f, (description ? DeclaredGetters[f](description) ?? [] : []).map(p => p.name).filter(n => n !== 'R')]));
54
+ const namespace = ctx.files.getFilesByRole(flowr_file_1.FileRole.Namespace)[0]?.content().current;
55
+ const excluded = new Set(NonNamespaceRoles.flatMap(r => ctx.files.getFilesByRole(r).map(f => f.path())));
56
+ const codeDirs = descFile === undefined ? [] : [path_1.default.join(path_1.default.dirname(descFile.path()), 'R') + path_1.default.sep];
57
+ return {
58
+ name: description?.packageName(),
59
+ description,
60
+ declared,
61
+ namespace,
62
+ isPackageCode: file => file === undefined
63
+ || (!excluded.has(file) && (codeDirs.length === 0 || codeDirs.some(d => path_1.default.normalize(file).startsWith(d))))
64
+ };
65
+ }
66
+ /** All packages the DESCRIPTION declares in any dependency field. */
67
+ function allDeclared(info) {
68
+ return new Set([...info.declared.values()].flat());
69
+ }
70
+ /** The name a function definition is bound to by a plain assignment (`f <- function() ...`). */
71
+ function boundName(def, idMap) {
72
+ const parent = def.info.parent === undefined ? undefined : idMap.get(def.info.parent);
73
+ if (!r_binary_op_1.RBinaryOp.is(parent) || parent.rhs !== def || !['<-', '=', '<<-'].includes(parent.operator) || !r_symbol_1.RSymbol.is(parent.lhs) && !r_string_1.RString.is(parent.lhs)) {
74
+ return undefined;
75
+ }
76
+ return r_symbol_1.RSymbol.is(parent.lhs) ? identifier_1.Identifier.getName(parent.lhs.content) : parent.lhs.content.str;
77
+ }
78
+ /** Every node of the normalized project, each once (unlike the values of the id map). */
79
+ function projectNodes(ast) {
80
+ const nodes = [];
81
+ r_project_1.RProject.visitAst(ast.ast, n => {
82
+ nodes.push(n);
83
+ });
84
+ return nodes;
85
+ }
86
+ /** The function definitions bound to `name` at the top level of the analyzed code. */
87
+ function topLevelDefinitions(ast, name) {
88
+ const result = [];
89
+ const idMap = ast.idMap;
90
+ for (const node of projectNodes(ast)) {
91
+ if (!r_function_definition_1.RFunctionDefinition.is(node)) {
92
+ continue;
93
+ }
94
+ const bound = boundName(node, idMap);
95
+ if (bound !== undefined && name(bound) && model_1.RNode.strictlyEnclosingFunction(node.info.id, idMap) === undefined) {
96
+ result.push({ name: bound, def: node });
97
+ }
98
+ }
99
+ return result;
100
+ }
101
+ /** The formal parameter names of a function definition, in order. */
102
+ function formalNames(def) {
103
+ return def.parameters.map(p => p.name.content);
104
+ }
105
+ /** Whether the node with the given id is (nested) within the given definition. */
106
+ function isWithin(id, def, idMap) {
107
+ for (let cur = idMap.get(id); cur !== undefined; cur = cur.info.parent === undefined ? undefined : idMap.get(cur.info.parent)) {
108
+ if (cur.info.id === def) {
109
+ return true;
110
+ }
111
+ }
112
+ return false;
113
+ }
114
+ /** The function definitions a call reaches by its `Calls` edges. */
115
+ function calledDefinitions(graph, call, idMap) {
116
+ const defs = [];
117
+ for (const [target, edge] of graph.edgesFrom(call)) {
118
+ const def = edge_1.DfEdge.includesType(edge, edge_1.EdgeType.Calls) ? idMap.get(target) : undefined;
119
+ if (r_function_definition_1.RFunctionDefinition.is(def)) {
120
+ defs.push(def);
121
+ }
122
+ }
123
+ return defs;
124
+ }
125
+ /** Whether the call reaches the built-in function only, and no definition of the code. */
126
+ function isBuiltInCall(graph, id) {
127
+ const origins = df_helper_1.Dataflow.origin(graph, id);
128
+ return origins === undefined || origins.every(o => o.type === 3 /* OriginType.BuiltInFunctionOrigin */);
129
+ }
130
+ /** Whether the node or an ancestor is quoted or otherwise evaluated elsewhere (`quote(...)`, a data mask). */
131
+ function isQuoted(graph, id, idMap) {
132
+ for (let cur = idMap.get(id); cur !== undefined; cur = cur.info.parent === undefined ? undefined : idMap.get(cur.info.parent)) {
133
+ if (graph.edgesTo(cur.info.id).values().some(e => edge_1.DfEdge.includesType(e, edge_1.EdgeType.NonStandardEvaluation))) {
134
+ return true;
135
+ }
136
+ }
137
+ return false;
138
+ }
139
+ /** The packages `R CMD check` takes as declared without a DESCRIPTION entry: the base packages but `methods` and `stats4`. */
140
+ function isStandardPackage(pkg) {
141
+ return (0, r_base_packages_1.isBaseRPackage)(pkg) && pkg !== 'methods' && pkg !== 'stats4';
142
+ }
143
+ /** The certainty, involved node, and location of a finding at a node or location. */
144
+ function at(where, certain = true) {
145
+ const node = Array.isArray(where) ? undefined : where;
146
+ return {
147
+ certainty: certain ? linter_format_1.LintingResultCertainty.Certain : linter_format_1.LintingResultCertainty.Uncertain,
148
+ involvedId: node?.info.id,
149
+ loc: (node ? range_1.SourceLocation.fromNode(node) : where) ?? range_1.SourceLocation.invalid()
150
+ };
151
+ }
152
+ /** The pretty printers of a rule: `query` describes a result, the full one is its message and location. */
153
+ function printer(query) {
154
+ return {
155
+ [linter_format_1.LintingPrettyPrintContext.Query]: (r) => `${query(r)} at ${range_1.SourceLocation.format(r.loc)}`,
156
+ [linter_format_1.LintingPrettyPrintContext.Full]: (r) => `${r.message} at ${range_1.SourceLocation.format(r.loc)}`
157
+ };
158
+ }
159
+ /** The calls (by name, if given) of package code, with the node and vertex of each; `builtIn` drops redefined ones. */
160
+ function* packageCalls(graph, idMap, pkg, names, builtIn = false) {
161
+ for (const [id, vertex] of graph.verticesOfType(vertex_1.VertexType.FunctionCall)) {
162
+ const name = identifier_1.Identifier.getName(vertex.name);
163
+ const node = idMap.get(id);
164
+ if (node !== undefined && (names === undefined || names.has(name)) && pkg.isPackageCode(node.info.file) && (!builtIn || isBuiltInCall(graph, id))) {
165
+ yield { id, name, node, vertex };
166
+ }
167
+ }
168
+ }
169
+ //# sourceMappingURL=cmd-check-util.js.map
@@ -0,0 +1,86 @@
1
+ import { LintingRuleCertainty } from '../../linter-format';
2
+ import type { MergeableRecord } from '../../../util/objects';
3
+ import { LintingRuleTag } from '../../linter-tags';
4
+ import { type FileResult } from './file-checks';
5
+ /** The `R CMD check` checks (by the title it logs them under) this rule ports. */
6
+ export type CompiledCodeKind = 'compilation flags in Makevars' | 'use of PKG_*FLAGS in Makefiles' | 'use of SHLIB_OPENMP_*FLAGS in Makefiles' | 'for portable use of $(BLAS_LIBS) and $(LAPACK_LIBS)' | 'for GNU extensions in Makefiles' | 'include directives in Makefiles' | 'line endings in Makefiles' | 'line endings in C/C++/Fortran sources/headers' | 'line endings in shell scripts' | 'pragmas in C/C++ headers and code' | 'usage of KIND in Fortran files' | 'C++ specification' | 'compiled code' | 'whether package can be installed';
7
+ export type CompiledCodeResult = FileResult<CompiledCodeKind>;
8
+ export interface CompiledCodeConfig extends MergeableRecord {
9
+ /** checks (by their `R CMD check` title) to skip */
10
+ readonly skip: readonly CompiledCodeKind[];
11
+ /** regular expressions (anchored by flowR, without the leading dash) for the compiler flags `R CMD check` calls non-portable */
12
+ readonly nonPortableFlags: readonly string[];
13
+ /** flags (with the dash) that are fine even though they match {@link nonPortableFlags} */
14
+ readonly allowedFlags: readonly string[];
15
+ /** the C++ standards `R` still honors; others requested through `CXX_STD` are unknown */
16
+ readonly knownCxxStandards: readonly string[];
17
+ /** the C++ standards `R` ignores as obsolete */
18
+ readonly obsoleteCxxStandards: readonly string[];
19
+ /** the functions compiled code must not call because they might terminate R, write to stdout, use system RNGs or `[v]sprintf` */
20
+ readonly unportableCalls: readonly string[];
21
+ /** the objects (and C++ streams) compiled code must not use for the same reason */
22
+ readonly unportableObjects: readonly string[];
23
+ /** the Fortran statements compiled code must not use (I/O, `stop`, system RNGs) */
24
+ readonly unportableFortran: readonly string[];
25
+ /** also look for calls of the non-API entry points of R (default `true`) */
26
+ readonly checkNonApi: boolean;
27
+ /** further non-API entry points to flag besides the ones `R` lists */
28
+ readonly extraNonApiEntryPoints: readonly string[];
29
+ /** also look for the missing registration of native routines (default `true`) */
30
+ readonly checkRegistration: boolean;
31
+ /** the header (a file name, or a directory prefix ending in `/`) to the package that has to be in `LinkingTo` for it */
32
+ readonly headerPackages: Readonly<Record<string, string>>;
33
+ /** also flag Fortran type declarations like `real*8`, which are no standard Fortran (default `true`) */
34
+ readonly flagStarKinds: boolean;
35
+ }
36
+ export interface CompiledCodeMetadata extends MergeableRecord {
37
+ /** the files inspected */
38
+ readonly consideredFiles: number;
39
+ }
40
+ /** Port of the static `R CMD check` checks on compiled code and build files (Rust compilation and the binary part of the compiled code check are not ported). */
41
+ export declare const COMPILED_CODE: {
42
+ readonly createSearch: () => import("../../../search/flowr-search-builder").FlowrSearchBuilder<"from", [], import("../../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, import("../../../search/flowr-search").FlowrSearchElements<import("../../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, import("../../../search/flowr-search").FlowrSearchElement<import("../../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation>[]>>;
43
+ readonly processSearchResult: (_elements: 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: CompiledCodeConfig, data: import("../../..").ReadonlyFlowrAnalysisProvider<import("../../..").KnownParser>) => {
44
+ results: FileResult<CompiledCodeKind>[];
45
+ '.meta': {
46
+ consideredFiles: number;
47
+ };
48
+ };
49
+ readonly prettyPrint: {
50
+ readonly query: (result: CompiledCodeResult) => string;
51
+ readonly full: (result: CompiledCodeResult) => string;
52
+ };
53
+ readonly info: {
54
+ readonly name: "Compiled Code";
55
+ readonly tags: readonly [LintingRuleTag.CmdCheck];
56
+ readonly certainty: LintingRuleCertainty.BestEffort;
57
+ readonly description: "Finds problems in `src/` and the build files: non-portable Makevars flags, BLAS/LAPACK and OpenMP flag use, GNU make extensions, pragmas, line endings, Fortran KIND, the C++ standard, calls to non-API or non-portable entry points, and `useDynLib` against `src/`.";
58
+ readonly defaultConfig: () => {
59
+ skip: never[];
60
+ nonPortableFlags: string[];
61
+ allowedFlags: never[];
62
+ knownCxxStandards: string[];
63
+ obsoleteCxxStandards: string[];
64
+ unportableCalls: string[];
65
+ unportableObjects: string[];
66
+ unportableFortran: string[];
67
+ checkNonApi: true;
68
+ extraNonApiEntryPoints: never[];
69
+ checkRegistration: true;
70
+ headerPackages: {
71
+ 'Rcpp.h': string;
72
+ 'Rcpp/': string;
73
+ 'RcppArmadillo.h': string;
74
+ armadillo: string;
75
+ 'RcppEigen.h': string;
76
+ 'Eigen/': string;
77
+ 'cpp11.hpp': string;
78
+ 'cpp11/': string;
79
+ 'boost/': string;
80
+ 'RcppParallel.h': string;
81
+ 'RcppThread.hpp': string;
82
+ };
83
+ flagStarKinds: true;
84
+ };
85
+ };
86
+ };