@eagleoutice/flowr 2.16.6 → 2.16.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (321) hide show
  1. package/README.md +21 -15
  2. package/abstract-interpretation/data-frame/dataframe-semantics.d.ts +2 -0
  3. package/abstract-interpretation/data-frame/dataframe-semantics.js +3 -1
  4. package/abstract-interpretation/data-frame/resolve-args.d.ts +1 -7
  5. package/abstract-interpretation/data-frame/resolve-args.js +2 -11
  6. package/cli/repl/commands/repl-cfg.js +5 -19
  7. package/cli/repl/commands/repl-code-command.d.ts +10 -0
  8. package/cli/repl/commands/repl-code-command.js +18 -0
  9. package/cli/repl/commands/repl-dataflow.js +34 -59
  10. package/cli/repl/commands/repl-normalize.js +24 -41
  11. package/cli/repl/commands/repl-query.js +10 -17
  12. package/config.js +3 -3
  13. package/control-flow/cfg-dead-code.js +15 -2
  14. package/control-flow/useless-loop.js +1 -2
  15. package/data/r-base-packages.generated.d.ts +1 -1
  16. package/data/r-base-packages.generated.js +3 -3
  17. package/dataflow/environments/ambient-state-name.d.ts +80 -0
  18. package/dataflow/environments/ambient-state-name.js +113 -0
  19. package/dataflow/environments/built-in-eval-name.d.ts +3 -1
  20. package/dataflow/environments/built-in-eval-name.js +2 -0
  21. package/dataflow/environments/built-in-props.d.ts +27 -7
  22. package/dataflow/environments/built-in-props.js +59 -44
  23. package/dataflow/environments/built-in.d.ts +5 -2
  24. package/dataflow/environments/built-in.js +22 -5
  25. package/dataflow/environments/default-builtin-config.d.ts +538 -14
  26. package/dataflow/environments/default-builtin-config.js +189 -123
  27. package/dataflow/environments/environment.d.ts +7 -1
  28. package/dataflow/environments/environment.js +19 -1
  29. package/dataflow/environments/identifier.d.ts +12 -1
  30. package/dataflow/environments/reference-to-maybe.js +1 -6
  31. package/dataflow/eval/resolve/alias-tracking.d.ts +13 -3
  32. package/dataflow/eval/resolve/alias-tracking.js +66 -37
  33. package/dataflow/eval/resolve/resolve-argument.d.ts +4 -2
  34. package/dataflow/eval/resolve/resolve-argument.js +23 -11
  35. package/dataflow/eval/resolve/resolve.d.ts +5 -0
  36. package/dataflow/eval/resolve/resolve.js +25 -3
  37. package/dataflow/eval/values/r-value.d.ts +4 -2
  38. package/dataflow/eval/values/r-value.js +3 -1
  39. package/dataflow/eval/values/string/string-constants.d.ts +7 -1
  40. package/dataflow/eval/values/string/string-constants.js +38 -36
  41. package/dataflow/extractor.js +105 -2
  42. package/dataflow/fn/argument-roles.js +22 -8
  43. package/dataflow/fn/function-semantics.d.ts +3 -2
  44. package/dataflow/fn/strict-function.js +13 -2
  45. package/dataflow/graph/dataflowgraph-builder.d.ts +4 -4
  46. package/dataflow/graph/df-helper.d.ts +14 -1
  47. package/dataflow/graph/df-helper.js +37 -4
  48. package/dataflow/graph/graph.d.ts +6 -0
  49. package/dataflow/graph/graph.js +9 -10
  50. package/dataflow/graph/vertex.d.ts +1 -1
  51. package/dataflow/hooks.d.ts +1 -1
  52. package/dataflow/info.d.ts +3 -3
  53. package/dataflow/internal/linker.d.ts +4 -1
  54. package/dataflow/internal/linker.js +12 -8
  55. package/dataflow/internal/process/functions/call/built-in/built-in-ambient-keys.d.ts +41 -0
  56. package/dataflow/internal/process/functions/call/built-in/built-in-ambient-keys.js +88 -0
  57. package/dataflow/internal/process/functions/call/built-in/built-in-ambient-state.d.ts +21 -46
  58. package/dataflow/internal/process/functions/call/built-in/built-in-ambient-state.js +125 -158
  59. package/dataflow/internal/process/functions/call/built-in/built-in-apply.d.ts +6 -1
  60. package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +35 -9
  61. package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +10 -1
  62. package/dataflow/internal/process/functions/call/built-in/built-in-attach.d.ts +4 -1
  63. package/dataflow/internal/process/functions/call/built-in/built-in-attach.js +6 -1
  64. package/dataflow/internal/process/functions/call/built-in/built-in-eval.js +1 -1
  65. package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +3 -2
  66. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.d.ts +7 -0
  67. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +21 -12
  68. package/dataflow/internal/process/functions/call/built-in/built-in-get.d.ts +1 -1
  69. package/dataflow/internal/process/functions/call/built-in/built-in-get.js +8 -1
  70. package/dataflow/internal/process/functions/call/built-in/built-in-library.d.ts +4 -1
  71. package/dataflow/internal/process/functions/call/built-in/built-in-library.js +5 -0
  72. package/dataflow/internal/process/functions/call/built-in/built-in-local.js +5 -2
  73. package/dataflow/internal/process/functions/call/built-in/built-in-pipe.js +11 -12
  74. package/dataflow/internal/process/functions/call/built-in/built-in-s-three-dispatch.d.ts +1 -1
  75. package/dataflow/internal/process/functions/call/built-in/built-in-s-three-dispatch.js +6 -0
  76. package/dataflow/internal/process/functions/call/built-in/built-in-string-template.js +1 -1
  77. package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.d.ts +7 -0
  78. package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.js +43 -7
  79. package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.d.ts +11 -0
  80. package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.js +29 -4
  81. package/dataflow/internal/process/functions/call/common.js +3 -4
  82. package/dataflow/internal/process/functions/call/deferred.d.ts +3 -2
  83. package/dataflow/internal/process/functions/call/deferred.js +17 -9
  84. package/dataflow/internal/process/functions/call/quoted.js +1 -1
  85. package/dataflow/processor.d.ts +1 -1
  86. package/documentation/doc-capabilities.js +3 -2
  87. package/documentation/doc-readme.js +1 -2
  88. package/documentation/doc-util/doc-dfg.js +2 -2
  89. package/documentation/doc-util/doc-query.d.ts +3 -1
  90. package/documentation/doc-util/doc-query.js +4 -4
  91. package/documentation/wiki-create-linting-rules.js +1 -1
  92. package/documentation/wiki-linter.js +16 -206
  93. package/documentation/wiki-linting-and-testing.js +31 -64
  94. package/documentation/wiki-query.js +41 -0
  95. package/index.d.ts +1 -0
  96. package/index.js +5 -1
  97. package/linter/linter-format.d.ts +6 -0
  98. package/linter/linter-format.js +10 -0
  99. package/linter/linter-rules.d.ts +155 -103
  100. package/linter/linter-rules.js +2 -0
  101. package/linter/linter-util.d.ts +23 -0
  102. package/linter/linter-util.js +58 -0
  103. package/linter/rules/absolute-path.d.ts +2 -2
  104. package/linter/rules/absolute-path.js +1 -4
  105. package/linter/rules/cmd-check/bogus-return.d.ts +2 -2
  106. package/linter/rules/cmd-check/bogus-return.js +3 -7
  107. package/linter/rules/cmd-check/call-arguments.d.ts +2 -2
  108. package/linter/rules/cmd-check/class-string-comparison.d.ts +2 -2
  109. package/linter/rules/cmd-check/class-string-comparison.js +3 -7
  110. package/linter/rules/cmd-check/cmd-check-util.d.ts +8 -9
  111. package/linter/rules/cmd-check/cmd-check-util.js +14 -26
  112. package/linter/rules/cmd-check/compiled-code.d.ts +8 -3
  113. package/linter/rules/cmd-check/compiled-code.js +3 -13
  114. package/linter/rules/cmd-check/dependency-declaration.d.ts +2 -2
  115. package/linter/rules/cmd-check/dependency-declaration.js +6 -7
  116. package/linter/rules/cmd-check/description-metadata.d.ts +4 -4
  117. package/linter/rules/cmd-check/documentation-mismatch.d.ts +2 -2
  118. package/linter/rules/cmd-check/documentation-mismatch.js +4 -11
  119. package/linter/rules/cmd-check/file-checks.d.ts +19 -6
  120. package/linter/rules/cmd-check/file-checks.js +13 -5
  121. package/linter/rules/cmd-check/foreign-function-calls.d.ts +2 -2
  122. package/linter/rules/cmd-check/global-environment-modification.d.ts +2 -2
  123. package/linter/rules/cmd-check/global-environment-modification.js +3 -2
  124. package/linter/rules/cmd-check/namespace-tampering.d.ts +2 -2
  125. package/linter/rules/cmd-check/namespace-tampering.js +9 -9
  126. package/linter/rules/cmd-check/non-ascii-code.d.ts +2 -2
  127. package/linter/rules/cmd-check/package-data.d.ts +11 -5
  128. package/linter/rules/cmd-check/package-data.js +5 -12
  129. package/linter/rules/cmd-check/package-files.js +4 -10
  130. package/linter/rules/cmd-check/package-hooks.d.ts +2 -2
  131. package/linter/rules/cmd-check/package-hooks.js +10 -8
  132. package/linter/rules/cmd-check/package-metafiles.d.ts +8 -3
  133. package/linter/rules/cmd-check/package-metafiles.js +3 -12
  134. package/linter/rules/cmd-check/package-runtime.d.ts +18 -5
  135. package/linter/rules/cmd-check/package-runtime.js +64 -20
  136. package/linter/rules/cmd-check/package-structure.d.ts +11 -5
  137. package/linter/rules/cmd-check/package-structure.js +4 -12
  138. package/linter/rules/cmd-check/rd-files.d.ts +8 -3
  139. package/linter/rules/cmd-check/rd-files.js +4 -14
  140. package/linter/rules/cmd-check/s-three-method-consistency.d.ts +2 -2
  141. package/linter/rules/cmd-check/s-three-method-consistency.js +3 -4
  142. package/linter/rules/cmd-check/true-false-abbreviation.d.ts +2 -2
  143. package/linter/rules/dataframe-access-validation.d.ts +2 -2
  144. package/linter/rules/dataframe-access-validation.js +5 -8
  145. package/linter/rules/dead-code.d.ts +5 -4
  146. package/linter/rules/dead-code.js +25 -14
  147. package/linter/rules/deprecated-functions.d.ts +3 -3
  148. package/linter/rules/deprecated-functions.js +16 -23
  149. package/linter/rules/file-path-validity.d.ts +2 -2
  150. package/linter/rules/file-path-validity.js +3 -6
  151. package/linter/rules/function-finder-util.d.ts +3 -3
  152. package/linter/rules/function-finder-util.js +7 -14
  153. package/linter/rules/namespace-access.d.ts +2 -2
  154. package/linter/rules/namespace-access.js +6 -9
  155. package/linter/rules/naming-convention.d.ts +2 -2
  156. package/linter/rules/naming-convention.js +1 -4
  157. package/linter/rules/network-functions.d.ts +3 -3
  158. package/linter/rules/no-leaked-credentials.d.ts +2 -2
  159. package/linter/rules/no-leaked-credentials.js +1 -4
  160. package/linter/rules/overwritten-file.d.ts +38 -0
  161. package/linter/rules/overwritten-file.js +102 -0
  162. package/linter/rules/problematic-inputs.d.ts +16 -6
  163. package/linter/rules/problematic-inputs.js +78 -34
  164. package/linter/rules/roxygen-arguments.d.ts +2 -2
  165. package/linter/rules/roxygen-arguments.js +1 -4
  166. package/linter/rules/seeded-randomness.d.ts +3 -3
  167. package/linter/rules/seeded-randomness.js +6 -23
  168. package/linter/rules/software-has-license.d.ts +2 -2
  169. package/linter/rules/software-has-license.js +1 -4
  170. package/linter/rules/software-has-tests.d.ts +2 -2
  171. package/linter/rules/software-has-tests.js +1 -4
  172. package/linter/rules/stop-with-call-arg.d.ts +2 -2
  173. package/linter/rules/stop-with-call-arg.js +4 -11
  174. package/linter/rules/syntactically-valid.d.ts +4 -2
  175. package/linter/rules/syntactically-valid.js +29 -10
  176. package/linter/rules/unclosed-connection.d.ts +2 -2
  177. package/linter/rules/unclosed-connection.js +1 -4
  178. package/linter/rules/undefined-symbol.d.ts +2 -2
  179. package/linter/rules/undefined-symbol.js +25 -22
  180. package/linter/rules/unescaped-arguments.d.ts +2 -2
  181. package/linter/rules/unescaped-arguments.js +1 -4
  182. package/linter/rules/unused-definition.d.ts +2 -2
  183. package/linter/rules/unused-definition.js +37 -25
  184. package/linter/rules/unused-import.d.ts +2 -2
  185. package/linter/rules/unused-import.js +9 -14
  186. package/linter/rules/useless-loop.d.ts +7 -6
  187. package/linter/rules/useless-loop.js +4 -8
  188. package/package.json +5 -3
  189. package/project/cache/flowr-analyzer-cache.d.ts +2 -0
  190. package/project/cache/flowr-analyzer-cache.js +15 -11
  191. package/project/context/flowr-analyzer-files-context.d.ts +3 -0
  192. package/project/context/flowr-analyzer-files-context.js +6 -0
  193. package/project/plugins/file-plugins/files/flowr-jupyter-file.d.ts +6 -1
  194. package/project/plugins/file-plugins/files/flowr-jupyter-file.js +35 -0
  195. package/project/plugins/file-plugins/files/flowr-namespace-file.js +2 -1
  196. package/project/plugins/file-plugins/files/flowr-rsession-file.d.ts +26 -0
  197. package/project/plugins/file-plugins/files/flowr-rsession-file.js +44 -0
  198. package/project/plugins/file-plugins/files/r-session.d.ts +20 -0
  199. package/project/plugins/file-plugins/files/r-session.js +58 -0
  200. package/project/plugins/file-plugins/files/recorded-runs.d.ts +18 -0
  201. package/project/plugins/file-plugins/files/recorded-runs.js +8 -0
  202. package/project/plugins/file-plugins/notebooks/flowr-analyzer-rsession-file-plugin.d.ts +20 -0
  203. package/project/plugins/file-plugins/notebooks/flowr-analyzer-rsession-file-plugin.js +28 -0
  204. package/project/plugins/plugin-registry.d.ts +2 -1
  205. package/project/plugins/plugin-registry.js +2 -0
  206. package/project/sigdb/spec-query.d.ts +73 -0
  207. package/project/sigdb/spec-query.js +339 -0
  208. package/queries/base-query-format.d.ts +1 -1
  209. package/queries/base-query-format.js +2 -2
  210. package/queries/catalog/absint-query/absint-query-executor.js +3 -6
  211. package/queries/catalog/call-context-query/call-context-query-executor.d.ts +1 -0
  212. package/queries/catalog/call-context-query/call-context-query-executor.js +113 -73
  213. package/queries/catalog/call-graph-query/call-graph-query-executor.js +2 -3
  214. package/queries/catalog/cluster-query/cluster-query-executor.js +2 -3
  215. package/queries/catalog/config-query/config-query-format.d.ts +0 -1
  216. package/queries/catalog/config-query/config-query-format.js +1 -2
  217. package/queries/catalog/control-flow-query/control-flow-query-executor.js +2 -3
  218. package/queries/catalog/dataflow-lens-query/dataflow-lens-query-executor.js +2 -4
  219. package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.d.ts +0 -1
  220. package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.js +1 -2
  221. package/queries/catalog/dataflow-query/dataflow-query-executor.js +2 -3
  222. package/queries/catalog/dependencies-query/dependencies-query-executor.d.ts +7 -0
  223. package/queries/catalog/dependencies-query/dependencies-query-executor.js +72 -42
  224. package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +24 -6
  225. package/queries/catalog/dependencies-query/dependencies-query-format.js +108 -3
  226. package/queries/catalog/dependencies-query/function-info/function-info.d.ts +6 -1
  227. package/queries/catalog/dependencies-query/function-info/read-functions.js +6 -6
  228. package/queries/catalog/dependencies-query/function-info/write-functions.js +13 -7
  229. package/queries/catalog/dependencies-query/implicit-echo.js +21 -7
  230. package/queries/catalog/dice-query/dice-query-executor.js +2 -3
  231. package/queries/catalog/does-call-query/does-call-query-executor.js +2 -3
  232. package/queries/catalog/files-query/files-query-executor.js +2 -3
  233. package/queries/catalog/function-info-query/function-info-query-executor.js +2 -1
  234. package/queries/catalog/function-info-query/function-info-query-format.d.ts +0 -2
  235. package/queries/catalog/function-info-query/function-info-query-format.js +1 -2
  236. package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-executor.js +3 -2
  237. package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-format.d.ts +0 -2
  238. package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-format.js +1 -2
  239. package/queries/catalog/happens-before-query/happens-before-query-executor.js +2 -3
  240. package/queries/catalog/happens-before-query/happens-before-query-format.d.ts +0 -1
  241. package/queries/catalog/happens-before-query/happens-before-query-format.js +1 -2
  242. package/queries/catalog/id-map-query/id-map-query-executor.js +2 -3
  243. package/queries/catalog/id-map-query/id-map-query-format.d.ts +0 -1
  244. package/queries/catalog/id-map-query/id-map-query-format.js +1 -2
  245. package/queries/catalog/input-sources-query/input-sources-query-executor.js +3 -4
  246. package/queries/catalog/input-sources-query/simple-input-classifier.d.ts +2 -1
  247. package/queries/catalog/input-sources-query/simple-input-classifier.js +60 -13
  248. package/queries/catalog/inspect-exceptions-query/inspect-exception-query-executor.js +2 -3
  249. package/queries/catalog/inspect-fn-props-query/inspect-fn-props-query-executor.js +2 -3
  250. package/queries/catalog/inspect-fn-props-query/inspect-fn-props-query-format.js +2 -1
  251. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-executor.d.ts +3 -2
  252. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-executor.js +1 -7
  253. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.d.ts +6 -9
  254. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.js +8 -33
  255. package/queries/catalog/inspect-recursion-query/inspect-recursion-query-executor.d.ts +3 -2
  256. package/queries/catalog/inspect-recursion-query/inspect-recursion-query-executor.js +1 -7
  257. package/queries/catalog/inspect-recursion-query/inspect-recursion-query-format.d.ts +6 -7
  258. package/queries/catalog/inspect-recursion-query/inspect-recursion-query-format.js +8 -31
  259. package/queries/catalog/linter-query/linter-query-executor.js +2 -3
  260. package/queries/catalog/location-map-query/location-map-query-executor.js +2 -3
  261. package/queries/catalog/location-map-query/location-map-query-format.d.ts +0 -1
  262. package/queries/catalog/location-map-query/location-map-query-format.js +1 -2
  263. package/queries/catalog/normalized-ast-query/normalized-ast-query-executor.js +2 -3
  264. package/queries/catalog/normalized-ast-query/normalized-ast-query-format.d.ts +0 -1
  265. package/queries/catalog/normalized-ast-query/normalized-ast-query-format.js +1 -2
  266. package/queries/catalog/origin-query/origin-query-executor.d.ts +0 -5
  267. package/queries/catalog/origin-query/origin-query-executor.js +3 -11
  268. package/queries/catalog/project-query/project-query-executor.js +23 -7
  269. package/queries/catalog/project-query/project-query-format.d.ts +5 -0
  270. package/queries/catalog/project-query/project-query-format.js +20 -2
  271. package/queries/catalog/provenance-query/provenance-query-executor.js +2 -3
  272. package/queries/catalog/resolve-value-query/resolve-value-query-executor.js +2 -3
  273. package/queries/catalog/resolve-value-query/resolve-value-query-format.d.ts +0 -1
  274. package/queries/catalog/resolve-value-query/resolve-value-query-format.js +1 -2
  275. package/queries/catalog/search-query/search-query-executor.js +2 -3
  276. package/queries/catalog/signature-query/signature-query-executor.js +39 -0
  277. package/queries/catalog/signature-query/signature-query-format.d.ts +7 -1
  278. package/queries/catalog/signature-query/signature-query-format.js +15 -1
  279. package/queries/catalog/signature-query/signature-query-render.js +2 -1
  280. package/queries/catalog/static-slice-query/static-slice-query-executor.js +2 -3
  281. package/queries/query-function-property.d.ts +28 -0
  282. package/queries/query-function-property.js +48 -0
  283. package/queries/query-meta.d.ts +3 -0
  284. package/queries/query-meta.js +8 -0
  285. package/queries/query.d.ts +13 -18
  286. package/r-bridge/lang-4.x/ast/model/processing/decorate.d.ts +2 -2
  287. package/r-bridge/lang-4.x/ast/model/processing/decorate.js +4 -3
  288. package/r-bridge/lang-4.x/ast/model/processing/node-id.d.ts +6 -0
  289. package/r-bridge/lang-4.x/ast/model/processing/node-id.js +9 -0
  290. package/r-bridge/lang-4.x/ast/model/syntax-version.d.ts +8 -0
  291. package/r-bridge/lang-4.x/ast/model/syntax-version.js +49 -0
  292. package/r-bridge/lang-4.x/ast/model/type.d.ts +2 -0
  293. package/r-bridge/lang-4.x/ast/model/type.js +3 -0
  294. package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-parameter.js +4 -1
  295. package/r-bridge/lang-4.x/ast/parser/main/internal/structure/normalize-single-node.js +1 -0
  296. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +1 -1
  297. package/reconstruct/reconstruct.js +35 -1
  298. package/search/search-executor/search-generators.js +1 -1
  299. package/slicing/static/fingerprint.js +7 -3
  300. package/slicing/static/static-slicer.js +6 -0
  301. package/util/assert.js +2 -2
  302. package/util/collections/arrays.d.ts +4 -0
  303. package/util/collections/arrays.js +11 -0
  304. package/util/collections/defaultmap.d.ts +5 -1
  305. package/util/collections/defaultmap.js +6 -1
  306. package/util/files.js +26 -5
  307. package/util/flowr-version.d.ts +10 -0
  308. package/util/flowr-version.js +20 -0
  309. package/util/glob.js +6 -4
  310. package/util/r-regex.d.ts +6 -0
  311. package/util/r-regex.js +17 -0
  312. package/util/text/args.d.ts +5 -0
  313. package/util/text/args.js +28 -22
  314. package/util/text/name-rank.d.ts +2 -0
  315. package/util/text/name-rank.js +3 -1
  316. package/util/text/regex.d.ts +10 -0
  317. package/util/text/regex.js +29 -0
  318. package/util/version.d.ts +1 -6
  319. package/util/version.js +6 -14
  320. package/documentation/doc-util/doc-functions.d.ts +0 -24
  321. package/documentation/doc-util/doc-functions.js +0 -65
@@ -2,10 +2,13 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.MessageAtLocation = void 0;
4
4
  exports.fileFindings = fileFindings;
5
+ exports.onPackageFiles = onPackageFiles;
5
6
  exports.linesOf = linesOf;
6
7
  exports.firstLine = firstLine;
7
8
  const linter_format_1 = require("../../linter-format");
8
9
  const range_1 = require("../../../util/range");
10
+ const cmd_check_util_1 = require("./cmd-check-util");
11
+ const package_files_1 = require("./package-files");
9
12
  /** Collects findings located at package files; findings of the kinds in `skip` are dropped. */
10
13
  function fileFindings(pf, skip = []) {
11
14
  const results = [];
@@ -16,6 +19,15 @@ function fileFindings(pf, skip = []) {
16
19
  };
17
20
  return { results, add };
18
21
  }
22
+ /** Runs `run` on the files of the package, yielding no results and the `zeroed` metadata if they are not available. */
23
+ function onPackageFiles(zeroed, run) {
24
+ return (_elements, config, data) => {
25
+ const ctx = data.inspectContext();
26
+ const pkg = (0, cmd_check_util_1.packageInfo)(ctx);
27
+ const pf = (0, package_files_1.packageFiles)(ctx, pkg.name);
28
+ return pf === undefined ? { results: [], '.meta': zeroed } : run(pf, pkg, config, data);
29
+ };
30
+ }
19
31
  /** The lines of a package file, empty if it cannot be read. */
20
32
  function linesOf(pf, file) {
21
33
  return (pf.read(file) ?? '').split(/\r?\n/);
@@ -25,10 +37,6 @@ function firstLine(pf, file, pattern) {
25
37
  const i = linesOf(pf, file).findIndex(l => pattern.test(l));
26
38
  return i < 0 ? undefined : i + 1;
27
39
  }
28
- const atLocation = (r) => `${r.message} at ${range_1.SourceLocation.format(r.loc)}`;
29
40
  /** Pretty printing of a finding as its message and location. */
30
- exports.MessageAtLocation = {
31
- [linter_format_1.LintingPrettyPrintContext.Query]: atLocation,
32
- [linter_format_1.LintingPrettyPrintContext.Full]: atLocation
33
- };
41
+ exports.MessageAtLocation = (0, linter_format_1.prettyPrint)((r) => `${r.message} at ${range_1.SourceLocation.format(r.loc)}`);
34
42
  //# sourceMappingURL=file-checks.js.map
@@ -39,8 +39,8 @@ export declare const FOREIGN_FUNCTION_CALLS: {
39
39
  };
40
40
  }>;
41
41
  readonly prettyPrint: {
42
- query: (r: ForeignFunctionCallsResult) => string;
43
- full: (r: ForeignFunctionCallsResult) => string;
42
+ readonly query: (r: ForeignFunctionCallsResult, metadata: unknown) => string;
43
+ readonly full: (r: ForeignFunctionCallsResult, metadata: unknown) => string;
44
44
  };
45
45
  readonly info: {
46
46
  readonly name: "Foreign Function Calls";
@@ -45,8 +45,8 @@ export declare const GLOBAL_ENVIRONMENT_MODIFICATION: {
45
45
  };
46
46
  }>;
47
47
  readonly prettyPrint: {
48
- query: (r: GlobalEnvironmentModificationResult) => string;
49
- full: (r: GlobalEnvironmentModificationResult) => string;
48
+ readonly query: (r: GlobalEnvironmentModificationResult, metadata: unknown) => string;
49
+ readonly full: (r: GlobalEnvironmentModificationResult, metadata: unknown) => string;
50
50
  };
51
51
  readonly info: {
52
52
  readonly name: "Global Environment Modification";
@@ -19,6 +19,7 @@ const node_id_1 = require("../../../r-bridge/lang-4.x/ast/model/processing/node-
19
19
  const type_1 = require("../../../r-bridge/lang-4.x/ast/model/type");
20
20
  const r_function_definition_1 = require("../../../r-bridge/lang-4.x/ast/model/nodes/r-function-definition");
21
21
  const r_function_call_1 = require("../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
22
+ const linter_util_1 = require("../../linter-util");
22
23
  const cmd_check_util_1 = require("./cmd-check-util");
23
24
  const r_for_loop_1 = require("../../../r-bridge/lang-4.x/ast/model/nodes/r-for-loop");
24
25
  const model_1 = require("../../../r-bridge/lang-4.x/ast/model/model");
@@ -38,7 +39,7 @@ function denotesGlobalEnv(node, environment, df, idMap, ctx, depth = 0) {
38
39
  return true;
39
40
  }
40
41
  /* `as.environment(1)`, `as.environment(".GlobalEnv")` */
41
- if (r_function_call_1.RFunctionCall.isNamed(node, 'as.environment') && node.arguments.length === 1 && node.arguments[0] !== r_function_call_1.EmptyArgument) {
42
+ if (r_function_call_1.RFunctionCall.is(node) && (0, linter_util_1.callsBuiltIn)(df.graph, node.info.id, 'as.environment') && node.arguments.length === 1 && node.arguments[0] !== r_function_call_1.EmptyArgument) {
42
43
  return denotesGlobalPos(node.arguments[0].value);
43
44
  }
44
45
  if (!r_symbol_1.RSymbol.is(node)) {
@@ -166,7 +167,7 @@ exports.GLOBAL_ENVIRONMENT_MODIFICATION = {
166
167
  const results = [];
167
168
  let consideredCalls = 0;
168
169
  const add = (node, kind, message, variable) => results.push({ ...(0, cmd_check_util_1.at)(node), kind, ...(variable !== undefined ? { variable } : {}), message });
169
- for (const { name, node, vertex: call } of (0, cmd_check_util_1.packageCalls)(df.graph, idMap, pkg, WriterNames, true)) {
170
+ for (const { name, node, vertex: call } of (0, cmd_check_util_1.packageCalls)(df.graph, idMap, pkg, WriterNames)) {
170
171
  consideredCalls++;
171
172
  const args = function_semantics_1.FunctionSemantics.call.match.toSpec(call.args, EnvironmentWriters[name]);
172
173
  const arg = (formal) => {
@@ -37,8 +37,8 @@ export declare const NAMESPACE_TAMPERING: {
37
37
  '.meta': {};
38
38
  }>;
39
39
  readonly prettyPrint: {
40
- query: (r: NamespaceTamperingResult) => string;
41
- full: (r: NamespaceTamperingResult) => string;
40
+ readonly query: (r: NamespaceTamperingResult, metadata: unknown) => string;
41
+ readonly full: (r: NamespaceTamperingResult, metadata: unknown) => string;
42
42
  };
43
43
  readonly info: {
44
44
  readonly name: "Namespace Tampering";
@@ -14,9 +14,8 @@ const function_semantics_1 = require("../../../dataflow/fn/function-semantics");
14
14
  const node_value_1 = require("../../../dataflow/eval/resolve/node-value");
15
15
  const resolve_helper_1 = require("../../../dataflow/environments/resolve-helper");
16
16
  const r_function_call_1 = require("../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
17
+ const linter_util_1 = require("../../linter-util");
17
18
  const cmd_check_util_1 = require("./cmd-check-util");
18
- /** the calls this rule is about, which spares resolving every other call */
19
- const TamperingCalls = new Set(['unlockBinding', 'assignInNamespace', '.Internal', 'library.dynam', 'library.dynam.unload']);
20
19
  /** the calls that name a namespace by the package name they are handed */
21
20
  const NamespaceGetters = new Set(['asNamespace', 'getNamespace', 'loadNamespace']);
22
21
  /** the package a namespace argument names, `'own'` for the package's own one, `undefined` if unknown */
@@ -28,12 +27,13 @@ function namespaceOf(node, info, own, depth = 0) {
28
27
  return namespaceOf(node.value, info, own, depth);
29
28
  }
30
29
  let name;
31
- if (r_function_call_1.RFunctionCall.isNamed(node)) {
32
- const fn = identifier_1.Identifier.getName(node.functionName.content);
30
+ if (r_function_call_1.RFunctionCall.is(node)) {
31
+ const called = info.graph === undefined ? undefined : (0, linter_util_1.builtInOf)(info.graph, node.info.id);
32
+ const fn = called === undefined ? undefined : identifier_1.Identifier.getName(called);
33
33
  if (fn === 'topenv' || fn === 'environment') {
34
34
  return 'own';
35
35
  }
36
- if (!NamespaceGetters.has(fn) || node.arguments.length < 1 || node.arguments[0] === r_function_call_1.EmptyArgument) {
36
+ if (fn === undefined || !NamespaceGetters.has(fn) || node.arguments.length < 1 || node.arguments[0] === r_function_call_1.EmptyArgument) {
37
37
  return undefined;
38
38
  }
39
39
  name = node_value_1.NodeValue.singleStringOf(node.arguments[0].value?.info.id, info);
@@ -64,10 +64,10 @@ function namespaceOfVariable(node, info, own, depth) {
64
64
  return answers.size === 1 ? [...answers][0] : undefined;
65
65
  }
66
66
  /** whether the call is the one a `.Internal` call is handed, which is reported with the `.Internal` */
67
- function isInternalArgument(node, idMap) {
67
+ function isInternalArgument(node, idMap, graph) {
68
68
  const arg = node.info.parent === undefined ? undefined : idMap.get(node.info.parent);
69
69
  const call = arg?.info.parent === undefined ? undefined : idMap.get(arg.info.parent);
70
- return r_function_call_1.RFunctionCall.isNamed(call, '.Internal');
70
+ return call !== undefined && (0, linter_util_1.callsBuiltIn)(graph, call.info.id, '.Internal');
71
71
  }
72
72
  /**
73
73
  * Port of the `R CMD check` notes on calls that tamper with R or other packages
@@ -85,14 +85,14 @@ exports.NAMESPACE_TAMPERING = {
85
85
  const info = resolve_helper_1.Resolve.info(df.graph, ctx);
86
86
  const results = [];
87
87
  const add = (node, result, certain = true) => results.push({ ...(0, cmd_check_util_1.at)(node, certain), ...result });
88
- for (const { name, node, vertex: call } of (0, cmd_check_util_1.packageCalls)(df.graph, idMap, pkg, TamperingCalls, true)) {
88
+ for (const { name, node, vertex: call } of (0, cmd_check_util_1.packageCalls)(df.graph, idMap, pkg)) {
89
89
  const arg = (formals, formal) => {
90
90
  const ids = function_semantics_1.FunctionSemantics.call.match.toSpec(call.args, formals).get(formal);
91
91
  return ids?.length === 1 ? idMap.get(ids[0]) : undefined;
92
92
  };
93
93
  switch (name) {
94
94
  case 'unlockBinding': {
95
- if (isInternalArgument(node, idMap)) {
95
+ if (isInternalArgument(node, idMap, df.graph)) {
96
96
  break;
97
97
  }
98
98
  const ns = namespaceOf(arg({ sym: 'sym', env: 'env' }, 'env'), info, pkg.name);
@@ -35,8 +35,8 @@ export declare const NON_ASCII_CODE: {
35
35
  };
36
36
  };
37
37
  readonly prettyPrint: {
38
- query: (r: NonAsciiCodeResult) => string;
39
- full: (r: NonAsciiCodeResult) => string;
38
+ readonly query: (r: NonAsciiCodeResult, metadata: unknown) => string;
39
+ readonly full: (r: NonAsciiCodeResult, metadata: unknown) => string;
40
40
  };
41
41
  readonly info: {
42
42
  readonly name: "Non-ASCII Code";
@@ -20,7 +20,13 @@ export interface PackageDataMetadata extends MergeableRecord {
20
20
  /** Port of the data checks of `R CMD check`: `data/`, `LazyData`, save compression and serialization version, undocumented data sets. */
21
21
  export declare const PACKAGE_DATA: {
22
22
  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>[]>>;
23
- 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: PackageDataConfig, data: import("../../..").ReadonlyFlowrAnalysisProvider<import("../../..").KnownParser>) => {
23
+ readonly processSearchResult: (_elements: unknown, config: PackageDataConfig, data: import("../../..").ReadonlyFlowrAnalysisProvider) => PromiseLike<{
24
+ results: FileResult<PackageDataKind>[];
25
+ '.meta': {
26
+ inspectedDataFiles: number;
27
+ onDisk: boolean;
28
+ };
29
+ }> | {
24
30
  results: FileResult<PackageDataKind>[];
25
31
  '.meta': {
26
32
  inspectedDataFiles: number;
@@ -28,14 +34,14 @@ export declare const PACKAGE_DATA: {
28
34
  };
29
35
  };
30
36
  readonly prettyPrint: {
31
- query: (r: {
37
+ readonly query: (r: {
32
38
  readonly message: string;
33
39
  readonly loc: import("../../..").SourceLocation;
34
- }) => string;
35
- full: (r: {
40
+ }, metadata: unknown) => string;
41
+ readonly full: (r: {
36
42
  readonly message: string;
37
43
  readonly loc: import("../../..").SourceLocation;
38
- }) => string;
44
+ }, metadata: unknown) => string;
39
45
  };
40
46
  readonly info: {
41
47
  readonly name: "Package Data";
@@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.PACKAGE_DATA = void 0;
7
+ const cmd_check_util_1 = require("./cmd-check-util");
7
8
  const fs_1 = __importDefault(require("fs"));
8
9
  const path_1 = __importDefault(require("path"));
9
10
  const linter_format_1 = require("../../linter-format");
@@ -12,10 +13,7 @@ const linter_tags_1 = require("../../linter-tags");
12
13
  const r_version_1 = require("../../../util/r-version");
13
14
  const flowr_file_1 = require("../../../project/context/flowr-file");
14
15
  const flowr_rda_file_1 = require("../../../project/plugins/file-plugins/files/flowr-rda-file");
15
- const cmd_check_util_1 = require("./cmd-check-util");
16
- const package_files_1 = require("./package-files");
17
16
  const file_checks_1 = require("./file-checks");
18
- const DataFile = /\.(R|r|RData|rdata|rda|TXT|CSV|(tab|txt|csv)(\.(gz|bz2|xz))?)$/;
19
17
  const RdaFile = /\.(rda|RData)$/;
20
18
  const DatalistLine = /^[^ :]+($|: +[A-Za-z.])/;
21
19
  const LazyDataCompressions = ['gzip', 'bzip2', 'xz', 'none'];
@@ -71,13 +69,8 @@ function dependsOnR(desc, minimum) {
71
69
  /** Port of the data checks of `R CMD check`: `data/`, `LazyData`, save compression and serialization version, undocumented data sets. */
72
70
  exports.PACKAGE_DATA = {
73
71
  createSearch: () => flowr_search_builder_1.Q.from([]),
74
- processSearchResult: (_elements, config, data) => {
72
+ processSearchResult: (0, file_checks_1.onPackageFiles)({ inspectedDataFiles: 0, onDisk: false }, (pf, pkg, config, data) => {
75
73
  const ctx = data.inspectContext();
76
- const pkg = (0, cmd_check_util_1.packageInfo)(ctx);
77
- const pf = (0, package_files_1.packageFiles)(ctx, pkg.name);
78
- if (pf === undefined) {
79
- return { results: [], '.meta': { inspectedDataFiles: 0, onDisk: false } };
80
- }
81
74
  const { results, add } = (0, file_checks_1.fileFindings)(pf);
82
75
  const desc = pkg.description;
83
76
  const entries = pf.entries;
@@ -103,7 +96,7 @@ exports.PACKAGE_DATA = {
103
96
  }
104
97
  });
105
98
  }
106
- const isData = (e) => !e.isDirectory && DataFile.test(path_1.default.posix.basename(e.relative));
99
+ const isData = (e) => !e.isDirectory && cmd_check_util_1.DataFile.test(path_1.default.posix.basename(e.relative));
107
100
  const dataSets = children.filter(e => e.relative !== 'data/datalist' && isData(e));
108
101
  for (const e of children) {
109
102
  if (e.relative !== 'data/datalist' && !isData(e)) {
@@ -113,7 +106,7 @@ exports.PACKAGE_DATA = {
113
106
  const names = new Map();
114
107
  const namesOf = (e) => {
115
108
  if (!names.has(e)) {
116
- const base = path_1.default.posix.basename(e.relative).replace(DataFile, '');
109
+ const base = path_1.default.posix.basename(e.relative).replace(cmd_check_util_1.DataFile, '');
117
110
  const objects = ctx.files.datasetObjects(base);
118
111
  names.set(e, (pf.onDisk && RdaFile.test(e.relative) ? objectNamesOf(e.absolute) : undefined) ?? (objects.length > 0 ? [...objects] : [base]));
119
112
  }
@@ -168,7 +161,7 @@ exports.PACKAGE_DATA = {
168
161
  }
169
162
  }
170
163
  return { results, '.meta': { inspectedDataFiles: dataSets.length + entries.filter(e => e.relative === SysData).length, onDisk: pf.onDisk } };
171
- },
164
+ }),
172
165
  prettyPrint: file_checks_1.MessageAtLocation,
173
166
  info: {
174
167
  name: 'Package Data',
@@ -7,6 +7,8 @@ exports.rootDescriptionFile = rootDescriptionFile;
7
7
  exports.packageFiles = packageFiles;
8
8
  const fs_1 = __importDefault(require("fs"));
9
9
  const path_1 = __importDefault(require("path"));
10
+ const regex_1 = require("../../../util/text/regex");
11
+ const assert_1 = require("../../../util/assert");
10
12
  const flowr_file_1 = require("../../../project/context/flowr-file");
11
13
  const range_1 = require("../../../util/range");
12
14
  const files_1 = require("../../../util/files");
@@ -38,16 +40,8 @@ const MaxEntries = 50_000;
38
40
  /** the `.Rbuildignore` patterns plus the defaults, compiled; a pattern that is no valid regular expression is skipped */
39
41
  function excludePatterns(rbuildignore) {
40
42
  const lines = [...DefaultExcludePatterns, ...(rbuildignore?.split(/\r?\n/) ?? [])].filter(l => l.trim() !== '');
41
- const result = [];
42
- for (const line of lines) {
43
- try {
44
- result.push(new RegExp(line, 'i'));
45
- }
46
- catch {
47
- /* R would fail on it as well, but that is not this listing's finding to make */
48
- }
49
- }
50
- return result;
43
+ /* R would fail on an invalid one as well, but that is not this listing's finding to make */
44
+ return lines.map(line => (0, regex_1.compileRegex)(line, 'i')).filter(assert_1.isNotUndefined);
51
45
  }
52
46
  /** whether `R CMD build` drops the entry (and, for a directory, everything below it) */
53
47
  function isExcludedByBuild(relative, isDirectory, pkgName, patterns) {
@@ -39,8 +39,8 @@ export declare const PACKAGE_HOOKS: {
39
39
  };
40
40
  }>;
41
41
  readonly prettyPrint: {
42
- query: (r: PackageHooksResult) => string;
43
- full: (r: PackageHooksResult) => string;
42
+ readonly query: (r: PackageHooksResult, metadata: unknown) => string;
43
+ readonly full: (r: PackageHooksResult, metadata: unknown) => string;
44
44
  };
45
45
  readonly info: {
46
46
  readonly name: "Package Hooks";
@@ -18,6 +18,7 @@ const r_repeat_loop_1 = require("../../../r-bridge/lang-4.x/ast/model/nodes/r-re
18
18
  const model_1 = require("../../../r-bridge/lang-4.x/ast/model/model");
19
19
  const function_semantics_1 = require("../../../dataflow/fn/function-semantics");
20
20
  const flowr_namespace_file_1 = require("../../../project/plugins/file-plugins/files/flowr-namespace-file");
21
+ const linter_util_1 = require("../../linter-util");
21
22
  const cmd_check_util_1 = require("./cmd-check-util");
22
23
  /** the hooks R calls as the package is loaded or attached */
23
24
  const StartupHooks = new Set(['.onLoad', '.onAttach', '.First.lib']);
@@ -28,9 +29,10 @@ const MisplacedCalls = {
28
29
  'library.dynam': { in: ['.onAttach'], instead: '.onLoad' },
29
30
  'library.dynam.unload': { in: ['.onDetach', '.Last.lib'], instead: '.onUnload' }
30
31
  };
32
+ const BranchingCalls = new Set(['switch', 'tryCatch']);
31
33
  /** the constructs whose body may or may not run */
32
- function isConditional(node) {
33
- return r_if_then_else_1.RIfThenElse.is(node) || r_while_loop_1.RWhileLoop.is(node) || r_for_loop_1.RForLoop.is(node) || r_repeat_loop_1.RRepeatLoop.is(node) || r_function_call_1.RFunctionCall.isNamed(node, 'switch') || r_function_call_1.RFunctionCall.isNamed(node, 'tryCatch');
34
+ function isConditional(node, graph) {
35
+ return r_if_then_else_1.RIfThenElse.is(node) || r_while_loop_1.RWhileLoop.is(node) || r_for_loop_1.RForLoop.is(node) || r_repeat_loop_1.RRepeatLoop.is(node) || r_function_call_1.RFunctionCall.is(node) && (0, linter_util_1.callsBuiltIn)(graph, node.info.id, BranchingCalls);
34
36
  }
35
37
  /**
36
38
  * Every call made within the given definition and, if asked, within the package functions it calls (transitively).
@@ -45,14 +47,14 @@ function reachedCalls(def, df, idMap, follow) {
45
47
  const { via } = item;
46
48
  let conditional = 0;
47
49
  model_1.RNode.visitAst(item.def.body, node => {
48
- if (via !== undefined && (isConditional(node) || r_function_definition_1.RFunctionDefinition.is(node))) {
50
+ if (via !== undefined && (isConditional(node, df.graph) || r_function_definition_1.RFunctionDefinition.is(node))) {
49
51
  conditional++;
50
52
  }
51
53
  const vertex = df.graph.getVertex(node.info.id);
52
54
  if (!vertex_1.DfgVertex.isFunctionCall(vertex) || conditional > 0) {
53
55
  return false;
54
56
  }
55
- result.push({ id: node.info.id, name: identifier_1.Identifier.getName(vertex.name), via });
57
+ result.push({ id: node.info.id, name: identifier_1.Identifier.getName((0, linter_util_1.builtInOf)(df.graph, node.info.id) ?? vertex.name), via });
56
58
  for (const callee of follow ? (0, cmd_check_util_1.calledDefinitions)(df.graph, node.info.id, idMap) : []) {
57
59
  if (!visited.has(callee.info.id)) {
58
60
  visited.add(callee.info.id);
@@ -61,7 +63,7 @@ function reachedCalls(def, df, idMap, follow) {
61
63
  }
62
64
  return false;
63
65
  }, node => {
64
- if (via !== undefined && (isConditional(node) || r_function_definition_1.RFunctionDefinition.is(node))) {
66
+ if (via !== undefined && (isConditional(node, df.graph) || r_function_definition_1.RFunctionDefinition.is(node))) {
65
67
  conditional--;
66
68
  }
67
69
  });
@@ -84,10 +86,10 @@ function hasNamedArgument(id, df, name) {
84
86
  return vertex_1.DfgVertex.isFunctionCall(vertex) && vertex.args.some(a => a !== r_function_call_1.EmptyArgument && a.name === name);
85
87
  }
86
88
  /** `message()` called in a hook as the startup message function, which takes the same arguments */
87
- function asStartupMessage(call, startup) {
89
+ function asStartupMessage(call, startup, graph) {
88
90
  const own = r_function_call_1.RFunctionCall.isNamed(call) ? range_1.SourceRange.ownFromNode(call.functionName) : undefined;
89
91
  const loc = own === undefined ? undefined : range_1.SourceLocation.from(own, call?.info.file);
90
- return startup === undefined || loc === undefined || !r_function_call_1.RFunctionCall.isNamed(call) || identifier_1.Identifier.getName(call.functionName.content) !== 'message'
92
+ return startup === undefined || loc === undefined || call === undefined || !(0, linter_util_1.callsBuiltIn)(graph, call.info.id, 'message')
91
93
  ? undefined : [{ type: 'replace', loc, description: `Use \`${startup}\``, replacement: startup }];
92
94
  }
93
95
  /**
@@ -150,7 +152,7 @@ exports.PACKAGE_HOOKS = {
150
152
  else if (startupMessages.has(name) ? hook === '.onLoad' : built_in_props_1.CallProps.hasAny(props, built_in_props_1.SemanticCallTag.Prints) && !allowedOutput.has(name) && !writesToResource(id, df, props?.sig)) {
151
153
  report('output', hook === '.onLoad' && startupMessages.has(name)
152
154
  ? `.onLoad should not print startup messages with ${name}, use .onAttach instead${through}`
153
- : `Package startup functions should use ${config.startupMessageFunctions[0] ?? 'packageStartupMessage'} to generate messages, but ${hook} calls ${name}${through}`, at, name, via === undefined, via === undefined && hook !== '.onLoad' ? asStartupMessage(idMap.get(id), config.startupMessageFunctions[0]) : undefined);
155
+ : `Package startup functions should use ${config.startupMessageFunctions[0] ?? 'packageStartupMessage'} to generate messages, but ${hook} calls ${name}${through}`, at, name, via === undefined, via === undefined && hook !== '.onLoad' ? asStartupMessage(idMap.get(id), config.startupMessageFunctions[0], df.graph) : undefined);
154
156
  }
155
157
  }
156
158
  }
@@ -24,15 +24,20 @@ export interface PackageMetafilesMetadata extends MergeableRecord {
24
24
  /** Port of the `R CMD check` notes on `INDEX`, `demo/00Index`, `inst/CITATION`, CITATION locations, and relative links of README, NEWS and vignettes. */
25
25
  export declare const PACKAGE_METAFILES: {
26
26
  readonly createSearch: () => import("../../../search/flowr-search-builder").FlowrSearchBuilder<"from", [], ParentInformation, import("../../../search/flowr-search").FlowrSearchElements<ParentInformation, import("../../../search/flowr-search").FlowrSearchElement<ParentInformation>[]>>;
27
- readonly processSearchResult: (_elements: import("../../../search/flowr-search").FlowrSearchElements<ParentInformation, import("../../../search/flowr-search").FlowrSearchElement<ParentInformation>[]>, config: PackageMetafilesConfig, data: ReadonlyFlowrAnalysisProvider<import("../../..").KnownParser>) => {
27
+ readonly processSearchResult: (_elements: unknown, config: PackageMetafilesConfig, data: ReadonlyFlowrAnalysisProvider) => PromiseLike<{
28
+ results: FileResult<PackageMetafilesKind>[];
29
+ '.meta': {
30
+ checkedFiles: number;
31
+ };
32
+ }> | {
28
33
  results: FileResult<PackageMetafilesKind>[];
29
34
  '.meta': {
30
35
  checkedFiles: number;
31
36
  };
32
37
  };
33
38
  readonly prettyPrint: {
34
- readonly query: (result: PackageMetafilesResult) => string;
35
- readonly full: (result: PackageMetafilesResult) => string;
39
+ readonly query: (r: PackageMetafilesResult, metadata: unknown) => string;
40
+ readonly full: (r: PackageMetafilesResult, metadata: unknown) => string;
36
41
  };
37
42
  readonly info: {
38
43
  readonly name: "Package Metafiles";
@@ -16,7 +16,6 @@ const model_1 = require("../../../r-bridge/lang-4.x/ast/model/model");
16
16
  const identifier_1 = require("../../../dataflow/environments/identifier");
17
17
  const cmd_check_util_1 = require("./cmd-check-util");
18
18
  const file_checks_1 = require("./file-checks");
19
- const package_files_1 = require("./package-files");
20
19
  /** the `BibTeX` entry types `R CMD check` knows, with their required fields (alternatives joined by `|`) */
21
20
  const BibTeXRequiredFields = new Map(Object.entries({
22
21
  article: ['author', 'title', 'journal', 'year'],
@@ -249,12 +248,7 @@ function checkRelativeLinks(files, report) {
249
248
  /** Port of the `R CMD check` notes on `INDEX`, `demo/00Index`, `inst/CITATION`, CITATION locations, and relative links of README, NEWS and vignettes. */
250
249
  exports.PACKAGE_METAFILES = {
251
250
  createSearch: () => flowr_search_builder_1.Q.from([]),
252
- processSearchResult: (_elements, config, data) => {
253
- const ctx = data.inspectContext();
254
- const files = (0, package_files_1.packageFiles)(ctx, (0, cmd_check_util_1.packageInfo)(ctx).name);
255
- if (files === undefined) {
256
- return { results: [], '.meta': { checkedFiles: 0 } };
257
- }
251
+ processSearchResult: (0, file_checks_1.onPackageFiles)({ checkedFiles: 0 }, (files, _pkg, config, data) => {
258
252
  const { results, add } = (0, file_checks_1.fileFindings)(files);
259
253
  const report = (kind, file, line, message) => add(kind, file, message, line);
260
254
  let checked = 0;
@@ -271,11 +265,8 @@ exports.PACKAGE_METAFILES = {
271
265
  checked += checkRelativeLinks(files, report);
272
266
  }
273
267
  return { results, '.meta': { checkedFiles: checked } };
274
- },
275
- prettyPrint: {
276
- [linter_format_1.LintingPrettyPrintContext.Query]: result => `${result.kind} in ${result.file} at ${range_1.SourceLocation.format(result.loc)}`,
277
- [linter_format_1.LintingPrettyPrintContext.Full]: result => `${result.message} (at ${range_1.SourceLocation.format(result.loc)})`
278
- },
268
+ }),
269
+ prettyPrint: (0, linter_format_1.prettyPrint)(result => `${result.kind} in ${result.file} at ${range_1.SourceLocation.format(result.loc)}`, result => `${result.message} (at ${range_1.SourceLocation.format(result.loc)})`),
279
270
  info: {
280
271
  name: 'Package Metafiles',
281
272
  tags: [linter_tags_1.LintingRuleTag.CmdCheck, linter_tags_1.LintingRuleTag.Robustness],
@@ -29,6 +29,10 @@ export type PackageRuntimeKind =
29
29
  | 'rust-requirements'
30
30
  /** a package without a NAMESPACE file, which no package may be since R 3.0.0 */
31
31
  | 'missing-namespace'
32
+ /** an `exportPattern` that matches nothing the package defines, so it exports nothing */
33
+ | 'empty-export-pattern'
34
+ /** a NAMESPACE that exports nothing at all, so attaching the package gives access to nothing */
35
+ | 'no-exports'
32
36
  /** a DESCRIPTION `Type` other than `Package` */
33
37
  | 'extension-type'
34
38
  /** an installed package (or a build left inside the sources) handed to the check instead of a source package */
@@ -39,6 +43,10 @@ export interface PackageRuntimeResult extends CmdCheckResult {
39
43
  export interface PackageRuntimeConfig extends MergeableRecord {
40
44
  /** report writes of tests and vignettes into the working directory (default `true`) */
41
45
  readonly checkWrites: boolean;
46
+ /** report exports of undefined names and export patterns matching nothing (default `true`) */
47
+ readonly checkExports: boolean;
48
+ /** report a NAMESPACE that exports nothing, unless the package ships data (default `true`) */
49
+ readonly requireExports: boolean;
42
50
  }
43
51
  export type PackageRuntimeMetadata = MergeableRecord;
44
52
  /**
@@ -47,21 +55,26 @@ export type PackageRuntimeMetadata = MergeableRecord;
47
55
  */
48
56
  export declare const PACKAGE_RUNTIME: {
49
57
  readonly createSearch: () => import("../../../search/flowr-search-builder").FlowrSearchBuilder<"from", [], ParentInformation, import("../../../search/flowr-search").FlowrSearchElements<ParentInformation, import("../../../search/flowr-search").FlowrSearchElement<ParentInformation>[]>>;
50
- readonly processSearchResult: (_elements: import("../../../search/flowr-search").FlowrSearchElements<ParentInformation, import("../../../search/flowr-search").FlowrSearchElement<ParentInformation>[]>, config: PackageRuntimeConfig, data: ReadonlyFlowrAnalysisProvider<import("../../..").KnownParser>) => Promise<{
58
+ readonly processSearchResult: (_elements: unknown, config: PackageRuntimeConfig, data: ReadonlyFlowrAnalysisProvider) => PromiseLike<{
51
59
  results: PackageRuntimeResult[];
52
60
  '.meta': {};
53
- }>;
61
+ }> | {
62
+ results: PackageRuntimeResult[];
63
+ '.meta': {};
64
+ };
54
65
  readonly prettyPrint: {
55
- query: (r: PackageRuntimeResult) => string;
56
- full: (r: PackageRuntimeResult) => string;
66
+ readonly query: (r: PackageRuntimeResult, metadata: unknown) => string;
67
+ readonly full: (r: PackageRuntimeResult, metadata: unknown) => string;
57
68
  };
58
69
  readonly info: {
59
70
  readonly name: "Package Runtime";
60
71
  readonly tags: readonly [LintingRuleTag.CmdCheck, LintingRuleTag.Bug, LintingRuleTag.Robustness];
61
72
  readonly certainty: LintingRuleCertainty.BestEffort;
62
- readonly description: "Finds what makes installing, loading, or running the package fail without doing so: undefined exports, S3 methods without a function, bad NAMESPACE imports, a package attaching itself, tests that never run, test or vignette code that does not parse, missing vignette metadata, and files written into the working directory.";
73
+ readonly description: "Finds what makes installing, loading, or running the package fail without doing so: undefined exports, export patterns matching nothing, a NAMESPACE exporting nothing, S3 methods without a function, bad NAMESPACE imports, a package attaching itself, tests that never run, test or vignette code that does not parse, missing vignette metadata, and files written into the working directory.";
63
74
  readonly defaultConfig: () => {
64
75
  checkWrites: true;
76
+ checkExports: true;
77
+ requireExports: true;
65
78
  };
66
79
  };
67
80
  };