@eagleoutice/flowr 2.15.10 → 2.16.1

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 (213) hide show
  1. package/README.md +23 -26
  2. package/abstract-interpretation/data-frame/arguments.js +11 -7
  3. package/cli/flowr-main-options.d.ts +15 -0
  4. package/cli/flowr-main-options.js +18 -0
  5. package/cli/flowr.d.ts +18 -0
  6. package/cli/flowr.js +13 -2
  7. package/cli/repl/commands/repl-clipboard.js +2 -1
  8. package/cli/repl/commands/repl-commands.js +2 -0
  9. package/cli/repl/commands/repl-main.d.ts +5 -0
  10. package/cli/repl/commands/repl-signature.js +2 -0
  11. package/cli/repl/core.d.ts +7 -1
  12. package/cli/repl/core.js +17 -8
  13. package/cli/repl/execute.js +2 -0
  14. package/cli/repl/server/connection.js +2 -1
  15. package/cli/repl/server/net.d.ts +10 -0
  16. package/cli/repl/server/net.js +34 -1
  17. package/cli/slicer-app.js +2 -1
  18. package/config.d.ts +12 -2
  19. package/config.js +91 -14
  20. package/control-flow/happens-before.d.ts +5 -0
  21. package/control-flow/happens-before.js +48 -34
  22. package/control-flow/useless-loop.d.ts +1 -1
  23. package/control-flow/useless-loop.js +29 -42
  24. package/dataflow/environments/built-in-props.d.ts +9 -0
  25. package/dataflow/environments/built-in-props.js +25 -19
  26. package/dataflow/environments/built-in.d.ts +2 -2
  27. package/dataflow/environments/built-in.js +41 -77
  28. package/dataflow/environments/default-builtin-config.d.ts +181 -29
  29. package/dataflow/environments/default-builtin-config.js +38 -24
  30. package/dataflow/environments/environment.d.ts +6 -4
  31. package/dataflow/environments/environment.js +54 -121
  32. package/dataflow/environments/identifier.d.ts +4 -2
  33. package/dataflow/environments/identifier.js +23 -69
  34. package/dataflow/environments/reference-to-maybe.d.ts +9 -0
  35. package/dataflow/environments/reference-to-maybe.js +23 -51
  36. package/dataflow/environments/resolve-by-name.js +37 -76
  37. package/dataflow/eval/resolve/resolve-argument.d.ts +3 -1
  38. package/dataflow/eval/resolve/resolve-argument.js +61 -64
  39. package/dataflow/eval/resolve/resolve-working-directory.d.ts +8 -2
  40. package/dataflow/eval/resolve/resolve-working-directory.js +12 -20
  41. package/dataflow/eval/resolve/resolve.d.ts +4 -0
  42. package/dataflow/eval/resolve/resolve.js +23 -14
  43. package/dataflow/extractor.js +185 -59
  44. package/dataflow/fn/class-declaration.d.ts +8 -2
  45. package/dataflow/fn/class-declaration.js +96 -97
  46. package/dataflow/fn/exceptions-of-function.js +68 -37
  47. package/dataflow/fn/frame-reflection.d.ts +12 -4
  48. package/dataflow/fn/frame-reflection.js +64 -42
  49. package/dataflow/fn/function-props.js +15 -33
  50. package/dataflow/fn/function-semantics.d.ts +11 -3
  51. package/dataflow/fn/function-semantics.js +6 -0
  52. package/dataflow/fn/higher-order-function.js +13 -17
  53. package/dataflow/fn/strict-function.d.ts +13 -0
  54. package/dataflow/fn/strict-function.js +285 -122
  55. package/dataflow/graph/call-graph.d.ts +7 -6
  56. package/dataflow/graph/call-graph.js +35 -46
  57. package/dataflow/graph/graph.d.ts +6 -1
  58. package/dataflow/graph/graph.js +57 -66
  59. package/dataflow/info.d.ts +8 -1
  60. package/dataflow/info.js +24 -30
  61. package/dataflow/internal/control-flow.d.ts +42 -4
  62. package/dataflow/internal/control-flow.js +76 -39
  63. package/dataflow/internal/linker.d.ts +15 -9
  64. package/dataflow/internal/linker.js +253 -241
  65. package/dataflow/internal/process/functions/call/built-in/built-in-ambient-state.d.ts +80 -14
  66. package/dataflow/internal/process/functions/call/built-in/built-in-ambient-state.js +441 -79
  67. package/dataflow/internal/process/functions/call/built-in/built-in-apply.d.ts +3 -1
  68. package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +51 -48
  69. package/dataflow/internal/process/functions/call/built-in/built-in-assignment.d.ts +2 -2
  70. package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +119 -185
  71. package/dataflow/internal/process/functions/call/built-in/built-in-class-generator.js +7 -9
  72. package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.d.ts +1 -1
  73. package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +122 -147
  74. package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +55 -25
  75. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +290 -252
  76. package/dataflow/internal/process/functions/call/built-in/built-in-get.d.ts +1 -1
  77. package/dataflow/internal/process/functions/call/built-in/built-in-get.js +30 -32
  78. package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.js +68 -67
  79. package/dataflow/internal/process/functions/call/built-in/built-in-library.js +72 -126
  80. package/dataflow/internal/process/functions/call/built-in/built-in-local.d.ts +1 -3
  81. package/dataflow/internal/process/functions/call/built-in/built-in-local.js +10 -10
  82. package/dataflow/internal/process/functions/call/built-in/built-in-quote.d.ts +4 -4
  83. package/dataflow/internal/process/functions/call/built-in/built-in-quote.js +9 -35
  84. package/dataflow/internal/process/functions/call/built-in/built-in-rm.js +8 -3
  85. package/dataflow/internal/process/functions/call/built-in/built-in-s-four.d.ts +1 -1
  86. package/dataflow/internal/process/functions/call/built-in/built-in-s-four.js +12 -28
  87. package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.d.ts +1 -1
  88. package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.js +40 -118
  89. package/dataflow/internal/process/functions/call/built-in/built-in-s-three-dispatch.d.ts +1 -3
  90. package/dataflow/internal/process/functions/call/built-in/built-in-s-three-dispatch.js +16 -24
  91. package/dataflow/internal/process/functions/call/built-in/built-in-source.d.ts +2 -0
  92. package/dataflow/internal/process/functions/call/built-in/built-in-source.js +93 -102
  93. package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.d.ts +7 -3
  94. package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.js +173 -114
  95. package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.d.ts +1 -3
  96. package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.js +22 -27
  97. package/dataflow/internal/process/functions/call/built-in/built-in-with.d.ts +1 -1
  98. package/dataflow/internal/process/functions/call/built-in/built-in-with.js +34 -9
  99. package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.d.ts +1 -1
  100. package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.js +120 -93
  101. package/dataflow/internal/process/functions/call/common.d.ts +1 -3
  102. package/dataflow/internal/process/functions/call/common.js +36 -76
  103. package/dataflow/internal/process/functions/call/deferred.d.ts +6 -2
  104. package/dataflow/internal/process/functions/call/deferred.js +60 -58
  105. package/dataflow/internal/process/functions/call/known-call-handling.d.ts +4 -2
  106. package/dataflow/internal/process/functions/call/known-call-handling.js +65 -68
  107. package/dataflow/internal/process/functions/call/named-call-handling.d.ts +3 -5
  108. package/dataflow/internal/process/functions/call/named-call-handling.js +44 -21
  109. package/dataflow/internal/process/functions/call/quoted.d.ts +2 -0
  110. package/dataflow/internal/process/functions/call/quoted.js +162 -172
  111. package/dataflow/internal/process/functions/call/unnamed-call-handling.js +17 -38
  112. package/dataflow/internal/process/functions/process-parameter.js +25 -32
  113. package/dataflow/internal/process/process-symbol.js +3 -6
  114. package/dataflow/internal/program-order.d.ts +26 -0
  115. package/dataflow/internal/program-order.js +49 -0
  116. package/documentation/doc-capabilities.js +4 -1
  117. package/documentation/wiki-interface.js +4 -0
  118. package/documentation/wiki-setup.js +23 -0
  119. package/engines.js +11 -3
  120. package/linter/linter-executor.js +19 -1
  121. package/linter/linter-rules.d.ts +17 -8
  122. package/linter/rules/absolute-path.js +63 -87
  123. package/linter/rules/file-path-validity.d.ts +4 -2
  124. package/linter/rules/file-path-validity.js +117 -80
  125. package/linter/rules/namespace-access.js +21 -33
  126. package/linter/rules/naming-convention.d.ts +1 -1
  127. package/linter/rules/naming-convention.js +60 -48
  128. package/linter/rules/network-functions.js +11 -7
  129. package/linter/rules/no-leaked-credentials.js +15 -18
  130. package/linter/rules/problematic-inputs.d.ts +2 -1
  131. package/linter/rules/problematic-inputs.js +39 -59
  132. package/linter/rules/roxygen-arguments.d.ts +9 -4
  133. package/linter/rules/roxygen-arguments.js +29 -48
  134. package/linter/rules/seeded-randomness.d.ts +7 -4
  135. package/linter/rules/seeded-randomness.js +130 -89
  136. package/linter/rules/stop-with-call-arg.d.ts +4 -2
  137. package/linter/rules/stop-with-call-arg.js +25 -22
  138. package/linter/rules/unclosed-connection.js +31 -24
  139. package/linter/rules/undefined-symbol.d.ts +4 -6
  140. package/linter/rules/undefined-symbol.js +58 -75
  141. package/linter/rules/unescaped-arguments.js +18 -44
  142. package/linter/rules/unused-definition.d.ts +6 -0
  143. package/linter/rules/unused-definition.js +105 -145
  144. package/linter/rules/unused-import.d.ts +3 -0
  145. package/linter/rules/unused-import.js +25 -43
  146. package/package.json +5 -2
  147. package/project/flowr-analyzer.js +6 -2
  148. package/project/plugins/file-plugins/files/flowr-jupyter-file.d.ts +2 -2
  149. package/project/plugins/file-plugins/files/flowr-jupyter-file.js +8 -12
  150. package/project/plugins/file-plugins/files/flowr-rda-file.d.ts +14 -5
  151. package/project/plugins/file-plugins/files/flowr-rda-file.js +35 -24
  152. package/project/plugins/file-plugins/files/flowr-rmarkdown-file.d.ts +7 -5
  153. package/project/plugins/file-plugins/files/flowr-rmarkdown-file.js +34 -56
  154. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.js +18 -42
  155. package/project/sigdb/decompress.js +3 -1
  156. package/project/sigdb/sigdb-download.js +9 -6
  157. package/queries/base-query-format.js +1 -2
  158. package/queries/catalog/absint-query/absint-query-format.js +1 -1
  159. package/queries/catalog/config-query/config-query-executor.js +9 -2
  160. package/queries/catalog/dataflow-query/dataflow-query-executor.js +2 -2
  161. package/queries/catalog/dataflow-query/dataflow-query-format.d.ts +2 -0
  162. package/queries/catalog/dataflow-query/dataflow-query-format.js +4 -7
  163. package/queries/catalog/dependencies-query/dependencies-query-executor.js +50 -114
  164. package/queries/catalog/dependencies-query/function-info/library-functions.d.ts +5 -9
  165. package/queries/catalog/dependencies-query/function-info/library-functions.js +6 -0
  166. package/queries/catalog/dependencies-query/function-info/read-functions.js +1 -1
  167. package/queries/catalog/dependencies-query/function-info/write-functions.js +7 -3
  168. package/queries/catalog/input-sources-query/simple-input-classifier.d.ts +4 -4
  169. package/queries/catalog/input-sources-query/simple-input-classifier.js +192 -301
  170. package/r-bridge/lang-4.x/ast/model/model.d.ts +3 -1
  171. package/r-bridge/lang-4.x/ast/model/model.js +19 -43
  172. package/r-bridge/lang-4.x/ast/model/nodes/r-access.d.ts +1 -0
  173. package/r-bridge/lang-4.x/ast/model/nodes/r-argument.d.ts +3 -0
  174. package/r-bridge/lang-4.x/ast/model/nodes/r-argument.js +5 -12
  175. package/r-bridge/lang-4.x/ast/model/nodes/r-binary-op.d.ts +1 -0
  176. package/r-bridge/lang-4.x/ast/model/nodes/r-break.d.ts +1 -0
  177. package/r-bridge/lang-4.x/ast/model/nodes/r-comment.d.ts +1 -0
  178. package/r-bridge/lang-4.x/ast/model/nodes/r-expression-list.d.ts +1 -0
  179. package/r-bridge/lang-4.x/ast/model/nodes/r-for-loop.d.ts +1 -0
  180. package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.d.ts +1 -0
  181. package/r-bridge/lang-4.x/ast/model/nodes/r-function-definition.d.ts +1 -0
  182. package/r-bridge/lang-4.x/ast/model/nodes/r-if-then-else.d.ts +1 -0
  183. package/r-bridge/lang-4.x/ast/model/nodes/r-line-directive.d.ts +1 -0
  184. package/r-bridge/lang-4.x/ast/model/nodes/r-logical.d.ts +1 -0
  185. package/r-bridge/lang-4.x/ast/model/nodes/r-next.d.ts +1 -0
  186. package/r-bridge/lang-4.x/ast/model/nodes/r-number.d.ts +1 -0
  187. package/r-bridge/lang-4.x/ast/model/nodes/r-parameter.d.ts +1 -0
  188. package/r-bridge/lang-4.x/ast/model/nodes/r-pipe.d.ts +1 -0
  189. package/r-bridge/lang-4.x/ast/model/nodes/r-repeat-loop.d.ts +1 -0
  190. package/r-bridge/lang-4.x/ast/model/nodes/r-string.d.ts +1 -0
  191. package/r-bridge/lang-4.x/ast/model/nodes/r-symbol.d.ts +1 -0
  192. package/r-bridge/lang-4.x/ast/model/nodes/r-unary-op.d.ts +1 -0
  193. package/r-bridge/lang-4.x/ast/model/nodes/r-while-loop.d.ts +1 -0
  194. package/r-bridge/roxygen2/roxygen-parse.js +28 -42
  195. package/r-bridge/shell-executor.js +2 -0
  196. package/r-bridge/shell.js +8 -0
  197. package/search/search-executor/search-enrichers.js +25 -37
  198. package/slicing/static/slice-call.d.ts +4 -3
  199. package/slicing/static/slice-call.js +56 -88
  200. package/slicing/static/static-slicer.js +120 -79
  201. package/slicing/static/visiting-queue.d.ts +4 -6
  202. package/slicing/static/visiting-queue.js +9 -13
  203. package/util/files.d.ts +6 -0
  204. package/util/files.js +12 -0
  205. package/util/parallel.js +2 -0
  206. package/util/proc.js +2 -1
  207. package/util/r-base-packages.d.ts +2 -0
  208. package/util/r-base-packages.js +23 -13
  209. package/util/secure-mode.d.ts +42 -0
  210. package/util/secure-mode.js +70 -0
  211. package/util/text/playground-link.d.ts +12 -3
  212. package/util/text/playground-link.js +18 -27
  213. package/util/version.js +4 -10
@@ -47,29 +47,24 @@ function buildQuickFix(str, filePath, wd) {
47
47
  replacement: `${str.content.quotes}${files_1.RPath.relative(wd, filePath)}${str.content.quotes}`
48
48
  }];
49
49
  }
50
- /** return all strings constructable by these functions */
51
- const PathFunctions = new Map([
52
- ['file.path', (df, vtx, ctx) => {
53
- const fsep = (0, resolve_argument_1.getArgumentStringValue)(ctx.config.solver.variables, df, vtx, undefined, 'fsep', true, ctx);
54
- // in the future we can access `.Platform$file.sep` here
55
- const sepValues = fsep?.values()?.flatMap(s => s.values().filter(assert_1.isNotUndefined)).toArray() ?? ['/'];
56
- if (sepValues.some(s => s === dependencies_query_format_1.Unknown || (0, assert_1.isUndefined)(s))) {
57
- // if we have no fsep, we cannot construct a path
58
- return undefined;
59
- }
60
- const args = (0, resolve_argument_1.getArgumentStringValue)(ctx.config.solver.variables, df, vtx, 'unnamed', undefined, true, ctx);
61
- const argValues = args ? Array.from(args.values()).flatMap(v => [...v]) : [];
62
- if (!argValues || argValues.length === 0 || argValues.some(v => v === dependencies_query_format_1.Unknown || (0, assert_1.isUndefined)(v))) {
63
- // if we have no arguments, we cannot construct a path
64
- return undefined;
65
- }
66
- const results = [];
67
- for (const val of sepValues) {
68
- results.push(argValues.join(val));
69
- }
70
- return results;
71
- }]
72
- ]);
50
+ /** The paths `file.path(...)` builds, `undefined` if a part is unknown. */
51
+ function filePathStrings(graph, vtx, ctx) {
52
+ const variables = ctx.config.solver.variables;
53
+ // in the future we can access `.Platform$file.sep` here
54
+ const fsep = (0, resolve_argument_1.getArgumentStringValue)(variables, graph, vtx, undefined, 'fsep', true, ctx);
55
+ const seps = fsep?.values().flatMap(s => s.values().filter(assert_1.isNotUndefined)).toArray() ?? ['/'];
56
+ if (seps.includes(dependencies_query_format_1.Unknown)) {
57
+ // if we have no fsep, we cannot construct a path
58
+ return undefined;
59
+ }
60
+ const unnamed = (0, resolve_argument_1.getArgumentStringValue)(variables, graph, vtx, 'unnamed', undefined, true, ctx);
61
+ const args = [...unnamed?.values() ?? []].flatMap(v => [...v]);
62
+ if (args.length === 0 || args.some(v => v === dependencies_query_format_1.Unknown || v === undefined)) {
63
+ // if we have no arguments, we cannot construct a path
64
+ return undefined;
65
+ }
66
+ return seps.map(sep => args.join(sep));
67
+ }
73
68
  /**
74
69
  * Resolve a raw string value to the path that should be checked for absoluteness.
75
70
  * - `file://` URIs: extract the local path (always checked, ignoreUrls has no effect)
@@ -83,24 +78,24 @@ function resolvePathForAbsoluteCheck(value, ignoreUrls) {
83
78
  }
84
79
  return ignoreUrls && (0, strings_1.isUrl)(value) ? undefined : value;
85
80
  }
81
+ /** A path built within a call that already reports it, as `file.path` within `read.csv`, is one finding. */
82
+ function withoutNested(results) {
83
+ return results.filter((r, i) => !results.some((o, j) => i !== j && o.filePath === r.filePath
84
+ && (range_1.SourceRange.isStrictSubsetOf(r.loc, o.loc) || (j < i && range_1.SourceRange.equals(r.loc, o.loc)))));
85
+ }
86
86
  exports.ABSOLUTE_PATH = {
87
87
  /* this can be done better once we have types */
88
88
  createSearch: (config, data) => {
89
- let q;
90
- if (config.include.allStrings) {
91
- q = flowr_search_builder_1.Q.all().filter(type_1.RType.String);
92
- }
93
- else {
94
- q = flowr_search_builder_1.Q.fromQuery({
95
- type: 'dependencies',
96
- // we use the dependencies query to give us all functions that take a file path as input
97
- ignoreDefaultFunctions: true,
98
- readFunctions: (0, read_functions_1.readFunctions)(data.inspectContext()).concat((0, write_functions_1.writeFunctions)(data.inspectContext()), source_functions_1.SourceFunctions, other_path_functions_1.OtherPathFunctions, config.additionalPathFunctions),
99
- });
100
- }
89
+ const ctx = data.inspectContext();
90
+ const pathFunctions = (0, read_functions_1.readFunctions)(ctx).concat((0, write_functions_1.writeFunctions)(ctx), source_functions_1.SourceFunctions, other_path_functions_1.OtherPathFunctions, config.additionalPathFunctions);
91
+ let q = config.include.allStrings ? flowr_search_builder_1.Q.all().filter(type_1.RType.String) : flowr_search_builder_1.Q.fromQuery({
92
+ type: 'dependencies',
93
+ // we use the dependencies query to give us all functions that take a file path as input
94
+ ignoreDefaultFunctions: true,
95
+ readFunctions: pathFunctions,
96
+ });
101
97
  if (config.include.constructed) {
102
98
  q = q.merge(flowr_search_builder_1.Q.all().filter(vertex_1.VertexType.FunctionCall).with(search_enrichers_1.Enrichment.CallTargets));
103
- /* in the future, we want to directly check whether this is one of the supported functions */
104
99
  }
105
100
  return q.unique();
106
101
  },
@@ -111,76 +106,57 @@ exports.ABSOLUTE_PATH = {
111
106
  };
112
107
  const queryResults = elements.enrichmentContent(search_enrichers_1.Enrichment.QueryData)?.queries;
113
108
  const regex = config.absolutePathRegex ? new RegExp(config.absolutePathRegex) : undefined;
114
- const normalize = await data.normalize();
115
- const dataflow = await data.dataflow();
109
+ const { idMap } = await data.normalize();
110
+ const { graph } = await data.dataflow();
116
111
  const ctx = data.inspectContext();
112
+ const absolute = (value) => {
113
+ const path = resolvePathForAbsoluteCheck(value, config.ignoreUrls);
114
+ return path !== undefined && (0, strings_1.isAbsolutePath)(path, regex) ? path : undefined;
115
+ };
116
+ const finding = (certainty, filePath, node, wd) => (0, objects_1.compactRecord)({
117
+ certainty,
118
+ filePath,
119
+ loc: range_1.SourceLocation.fromNode(node) ?? range_1.SourceLocation.invalid(),
120
+ quickFix: buildQuickFix(node, filePath, wd)
121
+ });
117
122
  return {
118
- results: elements.getElements().flatMap(element => {
123
+ results: withoutNested(elements.getElements().flatMap(element => {
119
124
  metadata.totalConsidered++;
120
125
  const node = element.node;
121
126
  const wd = inferWd(node.info.file, config.useAsWd, ctx);
127
+ const query = (0, search_enrichers_1.enrichmentContent)(element, search_enrichers_1.Enrichment.QueryData);
122
128
  if (r_string_1.RString.is(node)) {
123
- const resolved = resolvePathForAbsoluteCheck(node.content.str, config.ignoreUrls);
124
- if (resolved !== undefined && resolved.length >= 3 && (0, strings_1.isAbsolutePath)(resolved, regex)) {
125
- return [{
126
- certainty: linter_format_1.LintingResultCertainty.Uncertain,
127
- filePath: resolved,
128
- loc: range_1.SourceLocation.fromNode(node) ?? range_1.SourceLocation.invalid(),
129
- quickFix: buildQuickFix(node, resolved, wd)
130
- }];
131
- }
132
- else {
133
- return [];
134
- }
129
+ const path = absolute(node.content.str);
130
+ return path !== undefined && path.length >= 3 ? [finding(linter_format_1.LintingResultCertainty.Uncertain, path, node, wd)] : [];
135
131
  }
136
- else if ((0, search_enrichers_1.enrichmentContent)(element, search_enrichers_1.Enrichment.QueryData)) {
137
- const result = queryResults[(0, search_enrichers_1.enrichmentContent)(element, search_enrichers_1.Enrichment.QueryData).query];
138
- const mappedStrings = result.read.flatMap(r => {
132
+ else if (query) {
133
+ const result = queryResults[query.query];
134
+ const reads = result.read.filter(r => r.nodeId === node.info.id);
135
+ const found = reads.flatMap(r => {
139
136
  if (r.value === undefined || r.value === dependencies_query_format_1.Unknown || r.nodeId === undefined) {
140
137
  return [];
141
138
  }
142
- const resolved = resolvePathForAbsoluteCheck(r.value, config.ignoreUrls);
143
- if (resolved === undefined || !(0, strings_1.isAbsolutePath)(resolved, regex)) {
144
- return [];
145
- }
146
- const elem = normalize.idMap.get(r.nodeId);
147
- return [{
148
- certainty: linter_format_1.LintingResultCertainty.Certain,
149
- filePath: resolved,
150
- loc: elem ? range_1.SourceLocation.fromNode(elem) ?? range_1.SourceLocation.invalid() : range_1.SourceLocation.invalid(),
151
- quickFix: buildQuickFix(elem, resolved, wd)
152
- }];
139
+ const path = absolute(r.value);
140
+ return path === undefined ? [] : [finding(linter_format_1.LintingResultCertainty.Certain, path, idMap.get(r.nodeId), wd)];
153
141
  });
154
- if (mappedStrings.length > 0) {
155
- return mappedStrings;
156
- }
157
- else if (result.read.every(r => r.value !== dependencies_query_format_1.Unknown)) {
158
- // if we have no absolute paths, but all paths are known, we can return an empty array
159
- return [];
142
+ // if we have no absolute paths, but all paths are known, we can return an empty array
143
+ if (found.length > 0 || reads.every(r => r.value !== dependencies_query_format_1.Unknown)) {
144
+ return found;
160
145
  }
161
146
  }
162
147
  else {
163
- const dfNode = dataflow.graph.getVertex(node.info.id);
164
- if (vertex_1.DfgVertex.isFunctionCall(dfNode)) {
165
- const handler = dfNode.name ? PathFunctions.get(dfNode.name) : undefined;
166
- const strings = handler ? handler(dataflow.graph, dfNode, data.inspectContext()) : [];
148
+ const vertex = graph.getVertex(node.info.id);
149
+ if (vertex_1.DfgVertex.isFunctionCall(vertex)) {
150
+ /* `file.path` is the only supported function that returns a file path */
151
+ const strings = vertex.name === 'file.path' ? filePathStrings(graph, vertex, ctx) : [];
167
152
  if (strings) {
168
- return strings.flatMap(s => {
169
- const resolved = resolvePathForAbsoluteCheck(s, config.ignoreUrls);
170
- return resolved !== undefined && (0, strings_1.isAbsolutePath)(resolved, regex) ? [resolved] : [];
171
- }).map(str => ({
172
- certainty: linter_format_1.LintingResultCertainty.Uncertain,
173
- filePath: str,
174
- loc: range_1.SourceLocation.fromNode(element.node) ?? range_1.SourceLocation.invalid(),
175
- quickFix: undefined
176
- }));
153
+ return strings.map(absolute).filter(assert_1.isNotUndefined).map(path => finding(linter_format_1.LintingResultCertainty.Uncertain, path, node));
177
154
  }
178
155
  }
179
- // check whether the df node is a function call that returns a file path
180
156
  }
181
157
  metadata.totalUnknown++;
182
- return undefined;
183
- }).filter(assert_1.isNotUndefined).map(r => (0, objects_1.compactRecord)(r)),
158
+ return [];
159
+ })),
184
160
  '.meta': metadata
185
161
  };
186
162
  },
@@ -2,6 +2,8 @@ import { type LintingResult, LintingRuleCertainty } from '../linter-format';
2
2
  import type { MergeableRecord } from '../../util/objects';
3
3
  import type { FunctionInfo } from '../../queries/catalog/dependencies-query/function-info/function-info';
4
4
  import { LintingRuleTag } from '../linter-tags';
5
+ import type { ParentInformation } from '../../r-bridge/lang-4.x/ast/model/processing/decorate';
6
+ import type { ReadonlyFlowrAnalysisProvider } from '../../project/flowr-analyzer';
5
7
  export interface FilePathValidityResult extends LintingResult {
6
8
  filePath: string;
7
9
  }
@@ -34,8 +36,8 @@ export interface FilePathValidityMetadata extends MergeableRecord {
34
36
  totalValid: number;
35
37
  }
36
38
  export declare const FILE_PATH_VALIDITY: {
37
- readonly createSearch: (config: FilePathValidityConfig) => import("../../search/flowr-search-builder").FlowrSearchBuilder<"from-query", ["with"], import("../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, Promise<import("../../search/flowr-search").FlowrSearchElements<import("../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, import("../../search/flowr-search").FlowrSearchElement<import("../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation>[]>>>;
38
- 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: FilePathValidityConfig, data: import("../..").ReadonlyFlowrAnalysisProvider<import("../..").KnownParser>) => Promise<{
39
+ readonly createSearch: (config: FilePathValidityConfig) => import("../../search/flowr-search-builder").FlowrSearchBuilder<"from-query", ["with"], ParentInformation, Promise<import("../../search/flowr-search").FlowrSearchElements<ParentInformation, import("../../search/flowr-search").FlowrSearchElement<ParentInformation>[]>>>;
40
+ readonly processSearchResult: (elements: import("../../search/flowr-search").FlowrSearchElements<ParentInformation, import("../../search/flowr-search").FlowrSearchElement<ParentInformation>[]>, config: FilePathValidityConfig, data: ReadonlyFlowrAnalysisProvider<import("../..").KnownParser>) => Promise<{
39
41
  results: FilePathValidityResult[];
40
42
  ".meta": FilePathValidityMetadata;
41
43
  }>;
@@ -9,25 +9,44 @@ const dependencies_query_format_1 = require("../../queries/catalog/dependencies-
9
9
  const built_in_source_1 = require("../../dataflow/internal/process/functions/call/built-in/built-in-source");
10
10
  const logic_1 = require("../../util/logic");
11
11
  const happens_before_1 = require("../../control-flow/happens-before");
12
+ const read_functions_1 = require("../../queries/catalog/dependencies-query/function-info/read-functions");
13
+ const library_functions_1 = require("../../queries/catalog/dependencies-query/function-info/library-functions");
14
+ const identifier_1 = require("../../dataflow/environments/identifier");
12
15
  const linter_tags_1 = require("../linter-tags");
13
16
  const search_enrichers_1 = require("../../search/search-executor/search-enrichers");
14
17
  const resolve_working_directory_1 = require("../../dataflow/eval/resolve/resolve-working-directory");
15
18
  const config_1 = require("../../config");
16
19
  const r_function_call_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
17
20
  const r_string_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-string");
21
+ const r_argument_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-argument");
22
+ const model_1 = require("../../r-bridge/lang-4.x/ast/model/model");
23
+ const r_function_definition_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-function-definition");
24
+ const r_if_then_else_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-if-then-else");
25
+ const r_while_loop_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-while-loop");
26
+ const vertex_1 = require("../../dataflow/graph/vertex");
27
+ const function_semantics_1 = require("../../dataflow/fn/function-semantics");
28
+ const query_fn_props_1 = require("../../dataflow/environments/query-fn-props");
29
+ const built_in_props_1 = require("../../dataflow/environments/built-in-props");
30
+ const resolve_argument_1 = require("../../dataflow/eval/resolve/resolve-argument");
31
+ const r_base_packages_1 = require("../../util/r-base-packages");
32
+ const secure_mode_1 = require("../../util/secure-mode");
33
+ const DataSetExtensions = ['R', 'r', 'RData', 'rdata', 'rda', 'tab', 'txt', 'TXT', 'tab.gz', 'tab.bz2', 'tab.xz', 'txt.gz', 'txt.bz2', 'txt.xz', 'csv', 'CSV'];
34
+ function namesPackage(node) {
35
+ return r_function_call_1.RFunctionCall.is(node) && node.arguments.some(a => a !== r_function_call_1.EmptyArgument && a.name !== undefined && ['package', 'lib.loc'].includes(identifier_1.Identifier.getName(a.name.content)));
36
+ }
18
37
  async function urlExists(url) {
38
+ secure_mode_1.SecureMode.guard('network access', url);
19
39
  try {
20
- const response = await fetch(url, { method: 'HEAD' });
21
- return response.ok;
40
+ return (await fetch(url, { method: 'HEAD' })).ok;
22
41
  }
23
42
  catch {
24
43
  return false;
25
44
  }
26
45
  }
27
46
  exports.FILE_PATH_VALIDITY = {
28
- createSearch: (config) => flowr_search_builder_1.Q.fromQuery({
47
+ createSearch: config => flowr_search_builder_1.Q.fromQuery({
29
48
  type: 'dependencies',
30
- enabledCategories: ['read', 'write'],
49
+ enabledCategories: ['read', 'write', 'library'],
31
50
  readFunctions: config.additionalReadFunctions,
32
51
  writeFunctions: config.additionalWriteFunctions
33
52
  }).with(search_enrichers_1.Enrichment.CfgInformation),
@@ -41,96 +60,90 @@ exports.FILE_PATH_VALIDITY = {
41
60
  };
42
61
  const results = elements.enrichmentContent(search_enrichers_1.Enrichment.QueryData).queries['dependencies'];
43
62
  const ctx = data.inspectContext();
44
- const dfg = (await data.dataflow()).graph;
45
- const resolveSource = data.flowrConfig.solver.resolveSource;
63
+ const df = await data.dataflow();
64
+ const dfg = df.graph;
65
+ const { resolveSource } = data.flowrConfig.solver;
46
66
  const wdRootsFor = resolve_working_directory_1.WorkingDirectory.rootsResolver(dfg, cfg, ctx);
47
- const findings = await Promise.all(elements.getElements().map(async (element) => {
48
- const matchingRead = results.read.find(r => r.nodeId === element.node.info.id);
49
- if (!matchingRead || matchingRead.nodeId === undefined) {
67
+ /* `data("x")` names a data set, not a file */
68
+ const namesOnly = new Set((0, read_functions_1.readFunctions)(ctx).concat(config.additionalReadFunctions).filter(f => f.resolveValue === 'library').map(f => f.name));
69
+ const attached = (results.library ?? []).filter(library_functions_1.attachesPackage);
70
+ const atTopLevel = (id) => dfg.idMap === undefined || model_1.RNode.findEnclosing(id, dfg.idMap, r_function_definition_1.RFunctionDefinition.is) === undefined;
71
+ const librariesLoadedBefore = (read) => attached.some(l => l.nodeId === undefined || !atTopLevel(l.nodeId) || !atTopLevel(read)
72
+ || !cfg.hasVertex(l.nodeId) || (0, happens_before_1.happensBefore)(cfg, l.nodeId, read) !== logic_1.Ternary.Never);
73
+ const uniqueElements = [...new Map(elements.getElements().map(e => [e.node.info.id, e])).values()];
74
+ const reads = uniqueElements.flatMap(element => results.read
75
+ .filter(r => r.nodeId === element.node.info.id)
76
+ .map(matchingRead => ({ element, matchingRead })));
77
+ const findings = await Promise.all(reads.map(async ({ element, matchingRead }) => {
78
+ const { nodeId, value } = matchingRead;
79
+ /* data built from constants, like `matrix(1:6, 2)`, reads no file */
80
+ if (nodeId === undefined || value === dependencies_query_format_1.Constant) {
50
81
  return [];
51
82
  }
52
- metadata.totalReads++;
83
+ const { id, file } = element.node.info;
53
84
  const loc = range_1.SourceLocation.fromNode(element.node);
85
+ const referenceChain = file ? [file] : [];
86
+ const verdict = (valid, filePath, certainty, quickFix) => {
87
+ if (valid) {
88
+ metadata.totalValid++;
89
+ return [];
90
+ }
91
+ return [{ involvedId: nodeId, loc: loc, filePath, certainty, ...(quickFix ? { quickFix } : {}) }];
92
+ };
93
+ if (namesOnly.has(identifier_1.Identifier.getName(matchingRead.functionName))) {
94
+ if (!loc || typeof value !== 'string' || value === dependencies_query_format_1.Unknown
95
+ || librariesLoadedBefore(id) || r_base_packages_1.BaseDatasets.has(value) || namesPackage(element.node)) {
96
+ return [];
97
+ }
98
+ metadata.totalReads++;
99
+ const find = finderAt(resolveSource, wdRootsFor(id, file), file, ctx);
100
+ const exists = DataSetExtensions.some(ext => find(`data/${value}.${ext}`).length);
101
+ return verdict(exists, `data/${value}`, linter_format_1.LintingResultCertainty.Uncertain);
102
+ }
103
+ metadata.totalReads++;
54
104
  if (!loc) {
55
105
  return [];
56
106
  }
57
107
  // check if we can't parse the file path statically
58
- if (matchingRead.value === dependencies_query_format_1.Unknown) {
108
+ if (value === dependencies_query_format_1.Unknown) {
59
109
  metadata.totalUnknown++;
60
- if (config.includeUnknown) {
61
- return [{
62
- involvedId: matchingRead.nodeId,
63
- loc,
64
- filePath: dependencies_query_format_1.Unknown,
65
- certainty: linter_format_1.LintingResultCertainty.Uncertain
66
- }];
67
- }
68
- else {
69
- return [];
70
- }
110
+ return config.includeUnknown ? [{ involvedId: nodeId, loc, filePath: dependencies_query_format_1.Unknown, certainty: linter_format_1.LintingResultCertainty.Uncertain }] : [];
71
111
  }
112
+ const path = value;
72
113
  // file:// URIs are local paths; resolve and check existence directly
73
- const localFromFileUrl = (0, strings_1.fileUrlToPath)(matchingRead.value);
114
+ const localFromFileUrl = (0, strings_1.fileUrlToPath)(path);
74
115
  if (localFromFileUrl !== undefined) {
75
- const paths = (0, built_in_source_1.findSource)(data.flowrConfig.solver.resolveSource, localFromFileUrl, {
76
- referenceChain: element.node.info.file ? [element.node.info.file] : [],
77
- ctx: data.inspectContext()
78
- });
79
- if (paths && paths.length) {
80
- metadata.totalValid++;
81
- return [];
82
- }
83
- return [{
84
- involvedId: matchingRead.nodeId,
85
- loc,
86
- filePath: localFromFileUrl,
87
- certainty: linter_format_1.LintingResultCertainty.Certain
88
- }];
116
+ const exists = !!(0, built_in_source_1.findSource)(resolveSource, localFromFileUrl, { referenceChain, ctx })?.length;
117
+ return verdict(exists, localFromFileUrl, linter_format_1.LintingResultCertainty.Certain);
89
118
  }
90
119
  // handle remote URLs separately from file paths
91
- if ((0, strings_1.isUrl)(matchingRead.value)) {
92
- if (!config.checkUrls) {
93
- return [];
94
- }
95
- const exists = await urlExists(matchingRead.value);
96
- if (exists) {
97
- metadata.totalValid++;
98
- return [];
99
- }
100
- return [{
101
- involvedId: matchingRead.nodeId,
102
- loc,
103
- filePath: matchingRead.value,
104
- certainty: linter_format_1.LintingResultCertainty.Uncertain
105
- }];
120
+ if ((0, strings_1.isUrl)(path)) {
121
+ // the secure mode forbids network access, so the URL stays unchecked as if checkUrls was off
122
+ return config.checkUrls && !secure_mode_1.SecureMode.isEnabled() ? verdict(await urlExists(path), path, linter_format_1.LintingResultCertainty.Uncertain) : [];
106
123
  }
107
124
  // check if any write to the same file happens before the read, and exclude this case if so
108
- const writesToFile = results.write.filter((r) => r.nodeId !== undefined && samePath(r.value, matchingRead.value, data.flowrConfig.solver.resolveSource?.ignoreCapitalization));
109
- const writesBefore = writesToFile.map(w => (0, happens_before_1.happensBefore)(cfg, w.nodeId, element.node.info.id));
125
+ const writesToFile = results.write.filter((r) => r.nodeId !== undefined && samePath(r.value, path, resolveSource?.ignoreCapitalization));
126
+ const writesBefore = writesToFile.map(w => (0, happens_before_1.happensBefore)(cfg, w.nodeId, id));
110
127
  if (writesBefore.includes(logic_1.Ternary.Always)) {
111
128
  metadata.totalWritesBeforeAlways++;
112
129
  return [];
113
130
  }
114
131
  // check if the file exists, resolving relative paths against the effective working directory
115
- const value = matchingRead.value;
116
- const referenceChain = element.node.info.file ? [element.node.info.file] : [];
117
- const wdRoots = wdRootsFor(element.node.info.id, element.node.info.file);
118
- const withWd = { ...resolveSource, searchPath: [...(resolveSource?.searchPath ?? []), ...wdRoots] };
119
- const paths = (0, built_in_source_1.findSource)(withWd, value, { referenceChain, ctx });
120
- if (paths && paths.length) {
121
- metadata.totalValid++;
122
- return [];
132
+ const wdRoots = wdRootsFor(id, file);
133
+ if (finderAt(resolveSource, wdRoots, file, ctx)(path).length) {
134
+ return verdict(true, path, linter_format_1.LintingResultCertainty.Certain);
123
135
  }
124
- // a lax retry (drop leading dirs, ignore case) may surface a near match to offer as a quick fix
125
- const near = (0, built_in_source_1.findSource)({ ...withWd, ignoreCapitalization: true, dropPaths: config_1.DropPathsOption.All }, value, { referenceChain, ctx });
126
- const quickFix = dfg.idMap && near && near.length ? buildDidYouMeanFix(dfg.idMap, matchingRead.nodeId, value, near[0]) : undefined;
127
- return [{
128
- involvedId: matchingRead.nodeId,
129
- loc,
130
- filePath: value,
131
- certainty: writesBefore && writesBefore.length && writesBefore.every(w => w === logic_1.Ternary.Maybe) ? linter_format_1.LintingResultCertainty.Uncertain : linter_format_1.LintingResultCertainty.Certain,
132
- ...(quickFix ? { quickFix } : {})
133
- }];
136
+ /* a lax retry (drop leading dirs, ignore case) may surface a near match to offer as a quick fix */
137
+ const laxOptions = {
138
+ ...searchingFrom(resolveSource, wdRoots.roots),
139
+ ignoreCapitalization: true,
140
+ dropPaths: config_1.DropPathsOption.All
141
+ };
142
+ const near = (0, built_in_source_1.findSource)(laxOptions, path, { referenceChain, ctx });
143
+ const quickFix = dfg.idMap && near?.length ? buildDidYouMeanFix(dfg.idMap, nodeId, path, near[0]) : undefined;
144
+ const maybeWrittenBefore = writesBefore.length > 0 && writesBefore.every(w => w === logic_1.Ternary.Maybe);
145
+ const uncertain = maybeWrittenBefore || guardedByFileQuery(df, id, path, data);
146
+ return verdict(false, path, uncertain ? linter_format_1.LintingResultCertainty.Uncertain : linter_format_1.LintingResultCertainty.Certain, quickFix);
134
147
  }));
135
148
  return {
136
149
  results: findings.flat(),
@@ -155,6 +168,35 @@ exports.FILE_PATH_VALIDITY = {
155
168
  [linter_format_1.LintingPrettyPrintContext.Full]: result => `Path \`${result.filePath}\` at ${range_1.SourceLocation.format(result.loc)} does not point to a valid file`
156
169
  }
157
170
  };
171
+ /** Whether the read only runs depending on a condition that queries the same file, as in `if(file.exists(p)) readLines(p)`. */
172
+ function guardedByFileQuery(df, read, path, data) {
173
+ const dfg = df.graph;
174
+ return (dfg.getVertex(read)?.cds ?? []).some(cd => {
175
+ const construct = dfg.idMap?.get(cd.id);
176
+ const condition = r_if_then_else_1.RIfThenElse.is(construct) || r_while_loop_1.RWhileLoop.is(construct) ? construct.condition : undefined;
177
+ return [...model_1.RNode.collectAllIds(condition)].some(id => {
178
+ const call = dfg.getVertex(id);
179
+ if (!vertex_1.DfgVertex.isFunctionCall(call) || !function_semantics_1.FunctionSemantics.call.props.hasAny((0, query_fn_props_1.callFnProps)(call.id, df), built_in_props_1.SemanticCallTag.File)) {
180
+ return false;
181
+ }
182
+ const args = (0, resolve_argument_1.getArgumentStringValue)(data.flowrConfig.solver.variables, dfg, call, 'unnamed', undefined, true, data.inspectContext());
183
+ return args?.values().some(v => v.has(path)) ?? false;
184
+ });
185
+ });
186
+ }
187
+ function searchingFrom(resolveSource, roots) {
188
+ return { ...resolveSource, searchPath: [...(resolveSource?.searchPath ?? []), ...roots] };
189
+ }
190
+ /** looks a path up from the working directories a `setwd` pins down, and laxly along the configured search path if none does. */
191
+ function finderAt(resolveSource, { roots, pinned }, file, ctx) {
192
+ const referenceChain = file ? [file] : [];
193
+ if (!pinned) {
194
+ const lax = searchingFrom(resolveSource, roots);
195
+ return value => (0, built_in_source_1.findSource)(lax, value, { referenceChain, ctx }) ?? [];
196
+ }
197
+ const strict = { ...resolveSource, searchPath: [], dropPaths: config_1.DropPathsOption.No, inferWorkingDirectory: config_1.InferWorkingDirectory.No };
198
+ return value => roots.flatMap(root => (0, built_in_source_1.findSource)(strict, resolve_working_directory_1.WorkingDirectory.applyChange(root, value), { referenceChain, ctx }) ?? []);
199
+ }
158
200
  function samePath(a, b, ignoreCapitalization) {
159
201
  if (ignoreCapitalization === true) {
160
202
  a = a.toLowerCase();
@@ -168,19 +210,14 @@ function pathArgStringNode(idMap, callId, value) {
168
210
  if (!r_function_call_1.RFunctionCall.is(call)) {
169
211
  return undefined;
170
212
  }
171
- for (const arg of call.arguments) {
172
- if (arg !== r_function_call_1.EmptyArgument && arg.value && r_string_1.RString.is(arg.value) && arg.value.content.str === value) {
173
- return arg.value;
174
- }
175
- }
176
- return undefined;
213
+ return call.arguments.map(r_argument_1.RArgument.valueOf).find(v => r_string_1.RString.is(v) && v.content.str === value);
177
214
  }
178
215
  /** rewrite the read path to `found`, an existing file surfaced by the lax retry */
179
216
  function buildDidYouMeanFix(idMap, callId, value, found) {
180
217
  const str = pathArgStringNode(idMap, callId, value);
181
218
  const loc = str === undefined ? undefined : range_1.SourceLocation.fromNode(str);
182
- if (!str || loc === undefined) {
183
- /* a fix that names no place cannot be carried out, so none is offered */
219
+ if (!str || loc === undefined || found === value) {
220
+ /* a fix that names no place or changes nothing cannot be carried out, so none is offered */
184
221
  return undefined;
185
222
  }
186
223
  return [{
@@ -8,6 +8,7 @@ const flowr_search_builder_1 = require("../../search/flowr-search-builder");
8
8
  const range_1 = require("../../util/range");
9
9
  const linter_format_1 = require("../linter-format");
10
10
  const linter_tags_1 = require("../linter-tags");
11
+ const schema_1 = require("../../project/sigdb/schema");
11
12
  /**
12
13
  * Cross-checks every `pkg::name`/`pkg:::name` against the signature database's exported bit.
13
14
  * An absent entry (unknown package, unresolved version, uncatalogued name) is never read as "not exported" -
@@ -21,39 +22,26 @@ exports.NAMESPACE_ACCESS = {
21
22
  const db = data.inspectContext().deps.signatures();
22
23
  const results = [];
23
24
  let unresolved = 0;
24
- if (db.available()) {
25
- for (const element of elements.getElements()) {
26
- const node = element.node;
27
- if (!r_symbol_1.RSymbol.is(node)) {
28
- continue;
29
- }
30
- const [name, pkg, internal] = identifier_1.Identifier.toArray(node.content);
31
- if (pkg === undefined) {
32
- continue;
33
- }
34
- const raw = db.rawFunctionOf(node.content);
35
- if (raw === undefined) {
36
- unresolved++;
37
- continue;
38
- }
39
- const kind = internal === true
40
- ? (raw.exported ? 'unnecessary-internal' : undefined)
41
- : (raw.exported ? undefined : 'not-exported');
42
- if (kind === undefined) {
43
- continue;
44
- }
45
- const loc = range_1.SourceLocation.fromNode(node);
46
- if (loc === undefined) {
47
- continue;
48
- }
49
- results.push({
50
- certainty: linter_format_1.LintingResultCertainty.Certain,
51
- involvedId: node.info.id,
52
- loc,
53
- pkg,
54
- name,
55
- kind
56
- });
25
+ for (const { node } of db.available() ? elements.getElements() : []) {
26
+ if (!r_symbol_1.RSymbol.is(node)) {
27
+ continue;
28
+ }
29
+ const [name, pkg, internal] = identifier_1.Identifier.toArray(node.content);
30
+ if (pkg === undefined) {
31
+ continue;
32
+ }
33
+ const raw = db.rawFunctionOf(node.content);
34
+ /* a registered S3 method counts as exported in the database although `::` does not reach it */
35
+ if (raw === undefined || (internal === true && raw.props.includes(schema_1.FnPropNames[512 /* FnProp.S3Method */]))) {
36
+ unresolved++;
37
+ continue;
38
+ }
39
+ const kind = internal === true
40
+ ? (raw.exported ? 'unnecessary-internal' : undefined)
41
+ : (raw.exported ? undefined : 'not-exported');
42
+ const loc = range_1.SourceLocation.fromNode(node);
43
+ if (kind !== undefined && loc !== undefined) {
44
+ results.push({ certainty: linter_format_1.LintingResultCertainty.Certain, involvedId: node.info.id, loc, pkg, name, kind });
57
45
  }
58
46
  }
59
47
  return { results, '.meta': { unresolved } };
@@ -57,7 +57,7 @@ export declare function fixCasing(identifier: string, convention: CasingConventi
57
57
  */
58
58
  export declare function createNamingConventionQuickFixes(graph: DataflowGraph, nodeId: NodeId, replacement: string, conv: CasingConvention): LintQuickFixReplacement[] | undefined;
59
59
  export declare const NAMING_CONVENTION: {
60
- readonly createSearch: (_config: NamingConventionConfig) => import("../../search/flowr-search-builder").FlowrSearchBuilder<"all", ["filter"], import("../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, Promise<import("../../search/flowr-search").FlowrSearchElements<import("../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, [] | import("../../search/flowr-search").FlowrSearchElement<import("../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation>[]>>>;
60
+ readonly createSearch: () => import("../../search/flowr-search-builder").FlowrSearchBuilder<"all", ["filter"], import("../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, Promise<import("../../search/flowr-search").FlowrSearchElements<import("../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, [] | import("../../search/flowr-search").FlowrSearchElement<import("../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation>[]>>>;
61
61
  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: NamingConventionConfig, data: import("../..").ReadonlyFlowrAnalysisProvider<import("../..").KnownParser>) => Promise<{
62
62
  results: NamingConventionResult[];
63
63
  '.meta': {