@eagleoutice/flowr 2.10.8 → 2.10.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (260) hide show
  1. package/README.md +106 -36
  2. package/abstract-interpretation/absint-visitor.js +6 -3
  3. package/abstract-interpretation/domains/abstract-domain.d.ts +1 -1
  4. package/abstract-interpretation/domains/bounded-set-domain.d.ts +1 -1
  5. package/abstract-interpretation/domains/bounded-set-domain.js +1 -1
  6. package/abstract-interpretation/domains/interval-domain.d.ts +1 -1
  7. package/abstract-interpretation/domains/interval-domain.js +1 -1
  8. package/abstract-interpretation/domains/lattice.d.ts +1 -1
  9. package/abstract-interpretation/domains/partial-product-domain.d.ts +1 -1
  10. package/abstract-interpretation/domains/partial-product-domain.js +2 -2
  11. package/abstract-interpretation/domains/set-range-domain.d.ts +1 -1
  12. package/abstract-interpretation/domains/set-range-domain.js +1 -1
  13. package/abstract-interpretation/domains/set-upper-bound-domain.d.ts +1 -1
  14. package/abstract-interpretation/domains/set-upper-bound-domain.js +1 -1
  15. package/abstract-interpretation/domains/singleton-domain.d.ts +1 -1
  16. package/abstract-interpretation/domains/singleton-domain.js +1 -1
  17. package/abstract-interpretation/domains/state-abstract-domain.d.ts +1 -1
  18. package/abstract-interpretation/domains/state-abstract-domain.js +2 -2
  19. package/abstract-interpretation/unsupported-functions.d.ts +3 -2
  20. package/abstract-interpretation/unsupported-functions.js +38 -28
  21. package/cli/benchmark-app.js +2 -1
  22. package/cli/common/script.js +3 -2
  23. package/cli/flowr.js +47 -10
  24. package/cli/repl/commands/repl-cfg.js +9 -9
  25. package/cli/repl/commands/repl-commands.js +5 -0
  26. package/cli/repl/commands/repl-dataflow.js +31 -24
  27. package/cli/repl/commands/repl-main.d.ts +6 -0
  28. package/cli/repl/commands/repl-normalize.js +15 -12
  29. package/cli/repl/commands/repl-parse.js +1 -1
  30. package/cli/repl/commands/repl-query.js +4 -5
  31. package/cli/repl/commands/repl-quit.js +2 -1
  32. package/cli/repl/core.d.ts +11 -0
  33. package/cli/repl/core.js +101 -3
  34. package/cli/repl/execute.js +3 -2
  35. package/cli/repl/parser/slice-query-parser.d.ts +16 -0
  36. package/cli/repl/parser/slice-query-parser.js +52 -0
  37. package/cli/repl/server/connection.d.ts +1 -0
  38. package/cli/repl/server/connection.js +25 -0
  39. package/cli/repl/server/messages/message-analysis.d.ts +10 -0
  40. package/cli/repl/server/messages/message-analysis.js +6 -2
  41. package/cli/repl/server/messages/message-slice.d.ts +1 -1
  42. package/cli/script-core/statistics-core.js +2 -1
  43. package/cli/script-core/statistics-helper-core.js +2 -1
  44. package/cli/wiki.d.ts +2 -1
  45. package/cli/wiki.js +4 -1
  46. package/config.d.ts +9 -0
  47. package/config.js +23 -1
  48. package/control-flow/diff-cfg.d.ts +1 -1
  49. package/control-flow/diff-cfg.js +1 -1
  50. package/control-flow/extract-cfg.js +9 -3
  51. package/control-flow/semantic-cfg-guided-visitor.js +1 -0
  52. package/control-flow/simple-visitor.js +6 -5
  53. package/control-flow/useless-loop.js +2 -2
  54. package/core/print/dataflow-printer.d.ts +2 -2
  55. package/core/print/dataflow-printer.js +2 -2
  56. package/core/steps/all/static-slicing/00-slice.js +1 -1
  57. package/core/steps/pipeline/default-pipelines.d.ts +146 -146
  58. package/dataflow/environments/append.d.ts +2 -1
  59. package/dataflow/environments/append.js +2 -1
  60. package/dataflow/environments/built-in-proc-name.d.ts +2 -0
  61. package/dataflow/environments/built-in-proc-name.js +2 -0
  62. package/dataflow/environments/built-in.d.ts +2 -0
  63. package/dataflow/environments/built-in.js +2 -0
  64. package/dataflow/environments/default-builtin-config.d.ts +122 -66
  65. package/dataflow/environments/default-builtin-config.js +324 -145
  66. package/dataflow/environments/environment.d.ts +2 -1
  67. package/dataflow/environments/environment.js +13 -9
  68. package/dataflow/environments/identifier.d.ts +55 -2
  69. package/dataflow/environments/identifier.js +14 -2
  70. package/dataflow/environments/reference-to-maybe.d.ts +2 -0
  71. package/dataflow/environments/reference-to-maybe.js +56 -11
  72. package/dataflow/environments/resolve-by-name.js +13 -7
  73. package/dataflow/eval/values/general.js +4 -0
  74. package/dataflow/extractor.js +22 -3
  75. package/dataflow/graph/df-helper.d.ts +6 -0
  76. package/dataflow/graph/df-helper.js +33 -0
  77. package/dataflow/graph/graph.js +7 -3
  78. package/dataflow/info.d.ts +1 -1
  79. package/dataflow/info.js +3 -1
  80. package/dataflow/internal/linker.d.ts +5 -1
  81. package/dataflow/internal/linker.js +34 -9
  82. package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +3 -1
  83. package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +1 -1
  84. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +53 -0
  85. package/dataflow/internal/process/functions/call/built-in/built-in-namespace-access.d.ts +13 -0
  86. package/dataflow/internal/process/functions/call/built-in/built-in-namespace-access.js +58 -0
  87. package/dataflow/internal/process/functions/call/built-in/built-in-repeat-loop.js +1 -1
  88. package/dataflow/internal/process/functions/call/built-in/built-in-rm.d.ts +1 -1
  89. package/dataflow/internal/process/functions/call/built-in/built-in-rm.js +38 -14
  90. package/dataflow/internal/process/functions/call/built-in/built-in-source.js +19 -0
  91. package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.js +1 -1
  92. package/dataflow/internal/process/functions/call/known-call-handling.js +4 -3
  93. package/dataflow/internal/process/functions/call/named-call-handling.js +6 -0
  94. package/dataflow/origin/dfg-get-origin.d.ts +1 -1
  95. package/dataflow/origin/dfg-get-origin.js +1 -1
  96. package/dataflow/processor.d.ts +6 -0
  97. package/documentation/data/faq/faqs.d.ts +2 -1
  98. package/documentation/data/faq/faqs.js +75 -57
  99. package/documentation/data/server/doc-data-server-messages.d.ts +2 -1
  100. package/documentation/data/server/doc-data-server-messages.js +15 -7
  101. package/documentation/doc-readme.js +15 -15
  102. package/documentation/doc-util/doc-cfg.d.ts +3 -1
  103. package/documentation/doc-util/doc-cfg.js +3 -3
  104. package/documentation/doc-util/doc-dfg.d.ts +3 -1
  105. package/documentation/doc-util/doc-dfg.js +3 -3
  106. package/documentation/doc-util/doc-files.d.ts +3 -1
  107. package/documentation/doc-util/doc-files.js +9 -6
  108. package/documentation/doc-util/doc-normalized-ast.d.ts +3 -1
  109. package/documentation/doc-util/doc-normalized-ast.js +2 -2
  110. package/documentation/doc-util/doc-query.d.ts +2 -1
  111. package/documentation/doc-util/doc-query.js +2 -2
  112. package/documentation/doc-util/doc-repl.js +1 -0
  113. package/documentation/doc-util/doc-types.d.ts +6 -6
  114. package/documentation/doc-util/doc-types.js +11 -9
  115. package/documentation/issue-linting-rule.js +1 -2
  116. package/documentation/wiki-analyzer.js +9 -9
  117. package/documentation/wiki-cfg.js +40 -41
  118. package/documentation/wiki-core.js +119 -31
  119. package/documentation/wiki-create-linting-rules.d.ts +6 -0
  120. package/documentation/wiki-create-linting-rules.js +95 -0
  121. package/documentation/wiki-dataflow-graph.js +77 -76
  122. package/documentation/wiki-engine.js +1 -2
  123. package/documentation/wiki-faq.d.ts +2 -1
  124. package/documentation/wiki-faq.js +4 -4
  125. package/documentation/wiki-interface.js +19 -6
  126. package/documentation/wiki-linter.d.ts +1 -1
  127. package/documentation/wiki-linter.js +14 -6
  128. package/documentation/wiki-linting-and-testing.js +2 -2
  129. package/documentation/wiki-mk/doc-context.d.ts +3 -3
  130. package/documentation/wiki-mk/doc-maker.d.ts +2 -0
  131. package/documentation/wiki-mk/doc-maker.js +7 -1
  132. package/documentation/wiki-normalized-ast.js +5 -5
  133. package/documentation/wiki-onboarding.d.ts +2 -1
  134. package/documentation/wiki-onboarding.js +5 -5
  135. package/documentation/wiki-overview.js +3 -3
  136. package/documentation/wiki-query.js +85 -84
  137. package/documentation/wiki-search.js +4 -5
  138. package/documentation/wiki-setup.js +6 -7
  139. package/gas.d.ts +74 -0
  140. package/gas.js +18 -0
  141. package/linter/linter-executor.js +2 -8
  142. package/linter/linter-format.d.ts +4 -11
  143. package/linter/linter-rules.d.ts +88 -86
  144. package/linter/linter-rules.js +7 -1
  145. package/linter/rules/absolute-path.d.ts +2 -7
  146. package/linter/rules/absolute-path.js +6 -4
  147. package/linter/rules/dataframe-access-validation.d.ts +1 -6
  148. package/linter/rules/dataframe-access-validation.js +8 -6
  149. package/linter/rules/dead-code.d.ts +2 -11
  150. package/linter/rules/dead-code.js +16 -11
  151. package/linter/rules/deprecated-functions.d.ts +3 -3
  152. package/linter/rules/file-path-validity.d.ts +1 -6
  153. package/linter/rules/file-path-validity.js +5 -5
  154. package/linter/rules/function-finder-util.d.ts +7 -11
  155. package/linter/rules/function-finder-util.js +9 -6
  156. package/linter/rules/naming-convention.d.ts +2 -7
  157. package/linter/rules/naming-convention.js +3 -2
  158. package/linter/rules/network-functions.d.ts +2 -7
  159. package/linter/rules/network-functions.js +14 -12
  160. package/linter/rules/no-leaked-credentials.d.ts +36 -0
  161. package/linter/rules/no-leaked-credentials.js +75 -0
  162. package/linter/rules/problematic-inputs.d.ts +1 -8
  163. package/linter/rules/problematic-inputs.js +5 -4
  164. package/linter/rules/roxygen-arguments.d.ts +2 -7
  165. package/linter/rules/roxygen-arguments.js +13 -20
  166. package/linter/rules/seeded-randomness.d.ts +2 -7
  167. package/linter/rules/seeded-randomness.js +7 -4
  168. package/linter/rules/software-has-license.d.ts +31 -0
  169. package/linter/rules/software-has-license.js +46 -0
  170. package/linter/rules/software-has-tests.d.ts +38 -0
  171. package/linter/rules/software-has-tests.js +48 -0
  172. package/linter/rules/stop-with-call-arg.d.ts +2 -7
  173. package/linter/rules/stop-with-call-arg.js +3 -2
  174. package/linter/rules/unused-definition.d.ts +3 -8
  175. package/linter/rules/unused-definition.js +7 -5
  176. package/linter/rules/useless-loop.d.ts +2 -7
  177. package/linter/rules/useless-loop.js +5 -2
  178. package/package.json +3 -2
  179. package/project/context/flowr-analyzer-context.d.ts +13 -14
  180. package/project/context/flowr-analyzer-context.js +4 -0
  181. package/project/context/flowr-analyzer-files-context.d.ts +12 -0
  182. package/project/context/flowr-analyzer-files-context.js +12 -2
  183. package/project/context/flowr-analyzer-gas-context.d.ts +28 -0
  184. package/project/context/flowr-analyzer-gas-context.js +101 -0
  185. package/project/plugins/file-plugins/files/flowr-rmarkdown-file.d.ts +13 -7
  186. package/project/plugins/file-plugins/files/flowr-rmarkdown-file.js +56 -11
  187. package/project/plugins/file-plugins/notebooks/flowr-analyzer-qmd-file-plugin.d.ts +1 -1
  188. package/project/plugins/file-plugins/notebooks/flowr-analyzer-qmd-file-plugin.js +2 -2
  189. package/project/plugins/file-plugins/notebooks/flowr-analyzer-rmd-file-plugin.d.ts +2 -1
  190. package/project/plugins/file-plugins/notebooks/flowr-analyzer-rmd-file-plugin.js +5 -5
  191. package/project/plugins/flowr-analyzer-plugin.d.ts +15 -8
  192. package/project/plugins/flowr-analyzer-plugin.js +14 -7
  193. package/project/plugins/gas-plugins/flowr-analyzer-gas-plugin.d.ts +19 -0
  194. package/project/plugins/gas-plugins/flowr-analyzer-gas-plugin.js +35 -0
  195. package/project/plugins/plugin-registry.d.ts +2 -1
  196. package/project/plugins/plugin-registry.js +3 -1
  197. package/project/plugins/project-discovery/flowr-analyzer-gitignore-project-discovery-plugin.d.ts +22 -0
  198. package/project/plugins/project-discovery/flowr-analyzer-gitignore-project-discovery-plugin.js +47 -0
  199. package/project/plugins/project-discovery/flowr-analyzer-project-discovery-plugin.js +1 -1
  200. package/queries/catalog/call-context-query/call-context-query-executor.js +54 -8
  201. package/queries/catalog/call-context-query/call-context-query-format.d.ts +2 -2
  202. package/queries/catalog/dependencies-query/function-info/test-functions.d.ts +2 -0
  203. package/queries/catalog/dependencies-query/function-info/test-functions.js +18 -177
  204. package/queries/catalog/df-shape-query/df-shape-query-format.js +1 -1
  205. package/queries/catalog/dice-query/dice-query-executor.d.ts +8 -0
  206. package/queries/catalog/dice-query/dice-query-executor.js +52 -0
  207. package/queries/catalog/dice-query/dice-query-format.d.ts +53 -0
  208. package/queries/catalog/dice-query/dice-query-format.js +102 -0
  209. package/queries/catalog/happens-before-query/happens-before-query-executor.js +2 -2
  210. package/queries/catalog/input-sources-query/input-sources-query-format.d.ts +2 -0
  211. package/queries/catalog/input-sources-query/input-sources-query-format.js +1 -0
  212. package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.d.ts +2 -0
  213. package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.js +1 -0
  214. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.d.ts +2 -0
  215. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.js +1 -0
  216. package/queries/catalog/linter-query/linter-query-executor.js +7 -0
  217. package/queries/catalog/location-map-query/location-map-query-format.d.ts +2 -0
  218. package/queries/catalog/location-map-query/location-map-query-format.js +1 -0
  219. package/queries/catalog/origin-query/origin-query-format.d.ts +2 -0
  220. package/queries/catalog/origin-query/origin-query-format.js +1 -0
  221. package/queries/catalog/provenance-query/provenance-query-format.d.ts +2 -0
  222. package/queries/catalog/provenance-query/provenance-query-format.js +1 -0
  223. package/queries/catalog/resolve-value-query/resolve-value-query-format.d.ts +2 -0
  224. package/queries/catalog/resolve-value-query/resolve-value-query-format.js +1 -0
  225. package/queries/catalog/static-slice-query/static-slice-query-executor.js +1 -1
  226. package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +2 -0
  227. package/queries/catalog/static-slice-query/static-slice-query-format.js +1 -0
  228. package/queries/query.d.ts +18 -1
  229. package/queries/query.js +3 -1
  230. package/r-bridge/data/data.d.ts +5 -0
  231. package/r-bridge/data/data.js +6 -0
  232. package/r-bridge/lang-4.x/ast/model/nodes/r-string.d.ts +0 -1
  233. package/r-bridge/lang-4.x/ast/model/processing/decorate.js +10 -1
  234. package/r-bridge/lang-4.x/ast/parser/main/internal/values/normalize-number.d.ts +1 -1
  235. package/r-bridge/lang-4.x/ast/parser/main/internal/values/normalize-number.js +1 -1
  236. package/r-bridge/lang-4.x/ast/parser/main/internal/values/normalize-string.d.ts +1 -1
  237. package/r-bridge/lang-4.x/ast/parser/main/internal/values/normalize-string.js +1 -1
  238. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +63 -44
  239. package/r-bridge/parser.js +2 -9
  240. package/r-bridge/shell.d.ts +8 -1
  241. package/r-bridge/shell.js +26 -7
  242. package/search/flowr-search-builder.d.ts +2 -2
  243. package/search/flowr-search-builder.js +1 -1
  244. package/search/flowr-search-filters.d.ts +30 -9
  245. package/search/flowr-search-filters.js +26 -21
  246. package/search/search-executor/search-enrichers.d.ts +600 -0
  247. package/search/search-executor/search-enrichers.js +23 -2
  248. package/slicing/static/static-slicer.d.ts +39 -11
  249. package/slicing/static/static-slicer.js +44 -14
  250. package/util/collections/queue.d.ts +16 -0
  251. package/util/collections/queue.js +38 -0
  252. package/util/log.d.ts +1 -1
  253. package/util/log.js +1 -1
  254. package/util/mermaid/dfg.d.ts +2 -2
  255. package/util/mermaid/dfg.js +2 -2
  256. package/util/objects.d.ts +9 -0
  257. package/util/objects.js +57 -1
  258. package/util/proc.d.ts +6 -0
  259. package/util/proc.js +20 -0
  260. package/util/version.js +1 -1
@@ -9,13 +9,8 @@ export interface RoxygenArgsResult extends LintingResult {
9
9
  export type RoxygenArgsConfig = MergeableRecord;
10
10
  export type RoxygenArgsMetadata = MergeableRecord;
11
11
  export declare const ROXYGEN_ARGS: {
12
- 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>[]>>>;
13
- 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: MergeableRecord, { normalize }: {
14
- normalize: import("../../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
15
- dataflow: import("../../dataflow/info").DataflowInformation;
16
- cfg: import("../../control-flow/control-flow-graph").ControlFlowInformation;
17
- analyzer: import("../../project/flowr-analyzer").ReadonlyFlowrAnalysisProvider;
18
- }) => {
12
+ readonly createSearch: () => import("../../search/flowr-search-builder").FlowrSearchBuilder<"all", ["filter", "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>[]>>>;
13
+ 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: MergeableRecord) => {
19
14
  results: Writable<RoxygenArgsResult>[];
20
15
  '.meta': {};
21
16
  };
@@ -9,14 +9,7 @@ const assert_1 = require("../../util/assert");
9
9
  const vertex_1 = require("../../dataflow/graph/vertex");
10
10
  const roxygen_ast_1 = require("../../r-bridge/roxygen2/roxygen-ast");
11
11
  const r_function_definition_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-function-definition");
12
- const documentation_provider_1 = require("../../r-bridge/roxygen2/documentation-provider");
13
- function getDocumentation(id, idMap) {
14
- const comment = (0, documentation_provider_1.getDocumentationOf)(id, idMap);
15
- if (comment === undefined) {
16
- return undefined;
17
- }
18
- return Array.isArray(comment) ? comment : [comment];
19
- }
12
+ const search_enrichers_1 = require("../../search/search-executor/search-enrichers");
20
13
  function calculateArgumentDiff(inheritedParams, functionParam, roxygenParam) {
21
14
  //match documented against existing params
22
15
  let underDocumented = new Set(functionParam);
@@ -39,8 +32,10 @@ function calculateArgumentDiff(inheritedParams, functionParam, roxygenParam) {
39
32
  return underDocumented.size === 0 && overDocumented.size === 0 ? false : { under: Array.from(underDocumented), over: Array.from(overDocumented) };
40
33
  }
41
34
  exports.ROXYGEN_ARGS = {
42
- createSearch: () => flowr_search_builder_1.Q.all().filter(vertex_1.VertexType.FunctionDefinition),
43
- processSearchResult: (elements, _config, { normalize }) => {
35
+ createSearch: () => flowr_search_builder_1.Q.all()
36
+ .filter(vertex_1.VertexType.FunctionDefinition)
37
+ .with(search_enrichers_1.Enrichment.Roxygen),
38
+ processSearchResult: (elements, _config) => {
44
39
  return {
45
40
  results: elements.getElements()
46
41
  .map(element => ({
@@ -48,22 +43,20 @@ exports.ROXYGEN_ARGS = {
48
43
  underDocumented: [],
49
44
  overDocumented: []
50
45
  }))
51
- .filter(({ element: { node }, underDocumented, overDocumented }) => {
52
- const comments = getDocumentation(node.info.id, normalize.idMap);
53
- if (!comments) {
46
+ .filter(({ element, underDocumented, overDocumented }) => {
47
+ const roxygen = (0, search_enrichers_1.enrichmentContent)(element, search_enrichers_1.Enrichment.Roxygen);
48
+ if (!roxygen.documentation.length) {
54
49
  return false;
55
50
  }
56
- const parameters = getParameters(node);
57
51
  //get parameter names
58
- const functionParamNames = parameters.map(p => p.name.content.toString());
59
- const inheritedParams = comments.filter(tag => (tag?.inherited && tag.type === roxygen_ast_1.KnownRoxygenTags.Param)).map(tag => (tag.value.name));
60
- const roxygenParamNames = comments
61
- .filter(tag => tag.type === roxygen_ast_1.KnownRoxygenTags.Param)
62
- .map(tag => tag.value.name);
52
+ const params = roxygen.tags[roxygen_ast_1.KnownRoxygenTags.Param] ?? [];
53
+ const functionParamNames = getParameters(element.node).map(p => p.name.content.toString());
54
+ const inheritedParams = params.filter(tag => tag.inherited).map(tag => tag.value.name);
55
+ const roxygenParamNames = params.map(tag => tag.value.name);
63
56
  if (functionParamNames === null || roxygenParamNames == null) {
64
57
  return false;
65
58
  }
66
- const result = calculateArgumentDiff(inheritedParams, functionParamNames, roxygenParamNames);
59
+ const result = calculateArgumentDiff(inheritedParams ?? [], functionParamNames, roxygenParamNames);
67
60
  if (result === false) {
68
61
  return false;
69
62
  }
@@ -29,12 +29,7 @@ export interface SeededRandomnessMeta extends MergeableRecord {
29
29
  }
30
30
  export declare const SEEDED_RANDOMNESS: {
31
31
  readonly createSearch: (config: SeededRandomnessConfig) => import("../../search/flowr-search-builder").FlowrSearchBuilder<"all", ["filter", "with", "filter", "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>[]>>>;
32
- 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: SeededRandomnessConfig, { dataflow, analyzer }: {
33
- normalize: import("../../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
34
- dataflow: import("../../dataflow/info").DataflowInformation;
35
- cfg: import("../../control-flow/control-flow-graph").ControlFlowInformation;
36
- analyzer: import("../../project/flowr-analyzer").ReadonlyFlowrAnalysisProvider;
37
- }) => {
32
+ 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: SeededRandomnessConfig, data: import("../../project/flowr-analyzer").ReadonlyFlowrAnalysisProvider<import("../../r-bridge/parser").KnownParser>) => Promise<{
38
33
  results: {
39
34
  involvedId: import("../../r-bridge/lang-4.x/ast/model/processing/node-id").NodeId;
40
35
  certainty: LintingResultCertainty;
@@ -42,7 +37,7 @@ export declare const SEEDED_RANDOMNESS: {
42
37
  loc: [startLine: number, startColumn: number, endLine: number, endColumn: number, f?: string | undefined];
43
38
  }[];
44
39
  '.meta': SeededRandomnessMeta;
45
- };
40
+ }>;
46
41
  readonly info: {
47
42
  readonly defaultConfig: {
48
43
  readonly randomnessProducers: readonly [{
@@ -27,14 +27,17 @@ exports.SEEDED_RANDOMNESS = {
27
27
  name: flowr_search_filters_1.FlowrFilter.MatchesEnrichment,
28
28
  args: {
29
29
  enrichment: search_enrichers_1.Enrichment.CallTargets,
30
- test: (0, flowr_search_filters_1.testFunctionsIgnoringPackage)(config.randomnessConsumers)
30
+ test: {
31
+ targets: (0, flowr_search_filters_1.testFunctionsIgnoringPackage)(config.randomnessConsumers)
32
+ }
31
33
  }
32
34
  })
33
35
  .with(search_enrichers_1.Enrichment.LastCall, [
34
36
  { callName: config.randomnessProducers.filter(p => p.type === 'function').map(p => p.name) },
35
37
  { callName: getDefaultAssignments().flatMap(b => b.names).map(identifier_1.Identifier.getName), cascadeIf: () => cascade_action_1.CascadeAction.Continue }
36
38
  ]),
37
- processSearchResult: (elements, config, { dataflow, analyzer }) => {
39
+ processSearchResult: async (elements, config, data) => {
40
+ const dataflow = await data.dataflow();
38
41
  const assignmentProducers = new Set(config.randomnessProducers.filter(p => p.type === 'assignment').map(p => p.name));
39
42
  const assignmentArgIndexes = new Map(getDefaultAssignments().flatMap(a => a.names.map(n => ([identifier_1.Identifier.getName(n), a.config?.swapSourceAndTarget ? 1 : 0]))));
40
43
  const metadata = {
@@ -67,7 +70,7 @@ exports.SEEDED_RANDOMNESS = {
67
70
  const cdsOfProduces = new Set();
68
71
  // function calls are already taken care of through the LastCall enrichment itself
69
72
  for (const f of func ?? []) {
70
- if (isConstantArgument(dataflow.graph, f, 0, analyzer.inspectContext())) {
73
+ if (isConstantArgument(dataflow.graph, f, 0, data.inspectContext())) {
71
74
  const fCds = new Set(f.cds).difference(cds);
72
75
  metadata.callsWithFunctionProducers++;
73
76
  if (fCds.size <= 0 || (0, info_1.happensInEveryBranchSet)(fCds)) {
@@ -89,7 +92,7 @@ exports.SEEDED_RANDOMNESS = {
89
92
  const dest = graph_1.FunctionArgument.getReference(a.args[argIdx]);
90
93
  if (dest !== undefined && assignmentProducers.has((0, node_id_1.recoverName)(dest, dataflow.graph.idMap))) {
91
94
  // we either have arg index 0 or 1 for the assignmentProducers destination, so we select the assignment value as 1-argIdx here
92
- if (isConstantArgument(dataflow.graph, a, 1 - argIdx, analyzer.inspectContext())) {
95
+ if (isConstantArgument(dataflow.graph, a, 1 - argIdx, data.inspectContext())) {
93
96
  const aCds = new Set(a.cds).difference(cds);
94
97
  if (aCds.size <= 0 || (0, info_1.happensInEveryBranchSet)(aCds)) {
95
98
  metadata.callsWithAssignmentProducers++;
@@ -0,0 +1,31 @@
1
+ import { type LintingResult, LintingRuleCertainty } from '../linter-format';
2
+ import type { MergeableRecord } from '../../util/objects';
3
+ import { LintingRuleTag } from '../linter-tags';
4
+ export interface SoftwareHasLicenseResult extends LintingResult {
5
+ readonly message: string;
6
+ }
7
+ export interface SoftwareHasLicenseConfig extends MergeableRecord {
8
+ /** Whether to also inspect the DESCRIPTION file for a License field */
9
+ readonly checkDescriptionFile: boolean;
10
+ }
11
+ export type SoftwareHasLicenseMetadata = MergeableRecord;
12
+ export declare const SOFTWARE_HAS_LICENSE: {
13
+ readonly createSearch: () => import("../../search/flowr-search-builder").FlowrSearchBuilder<"from-query", [], 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>[]>>;
14
+ 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: SoftwareHasLicenseConfig, data: import("../../project/flowr-analyzer").ReadonlyFlowrAnalysisProvider<import("../../r-bridge/parser").KnownParser>) => {
15
+ results: SoftwareHasLicenseResult[];
16
+ '.meta': {};
17
+ };
18
+ readonly prettyPrint: {
19
+ readonly query: (result: SoftwareHasLicenseResult) => string;
20
+ readonly full: (result: SoftwareHasLicenseResult) => string;
21
+ };
22
+ readonly info: {
23
+ readonly name: "Software Has License";
24
+ readonly description: "Checks whether the software project provides a license (via a LICENSE file or the DESCRIPTION file License field).";
25
+ readonly tags: readonly [LintingRuleTag.Documentation, LintingRuleTag.Usability];
26
+ readonly certainty: LintingRuleCertainty.BestEffort;
27
+ readonly defaultConfig: {
28
+ readonly checkDescriptionFile: true;
29
+ };
30
+ };
31
+ };
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SOFTWARE_HAS_LICENSE = void 0;
4
+ const linter_format_1 = require("../linter-format");
5
+ const flowr_search_builder_1 = require("../../search/flowr-search-builder");
6
+ const range_1 = require("../../util/range");
7
+ const linter_tags_1 = require("../linter-tags");
8
+ const flowr_file_1 = require("../../project/context/flowr-file");
9
+ const flowr_description_file_1 = require("../../project/plugins/file-plugins/files/flowr-description-file");
10
+ exports.SOFTWARE_HAS_LICENSE = {
11
+ createSearch: () => flowr_search_builder_1.Q.fromQuery({ type: 'dependencies', enabledCategories: [] }),
12
+ processSearchResult: (_elements, config, data) => {
13
+ const ctx = data.inspectContext();
14
+ const licenseFiles = ctx.files.getFilesByRole(flowr_file_1.FileRole.License);
15
+ let hasLicense = licenseFiles.length > 0;
16
+ if (!hasLicense && config.checkDescriptionFile) {
17
+ for (const f of ctx.files.getFilesByRole(flowr_file_1.FileRole.Description)) {
18
+ if (flowr_description_file_1.FlowrDescriptionFile.from(f).license()) {
19
+ hasLicense = true;
20
+ break;
21
+ }
22
+ }
23
+ }
24
+ const results = hasLicense ? [] : [{
25
+ certainty: linter_format_1.LintingResultCertainty.Certain,
26
+ involvedId: undefined,
27
+ loc: range_1.SourceLocation.invalid(),
28
+ message: 'No license found in the project'
29
+ }];
30
+ return { results, '.meta': {} };
31
+ },
32
+ prettyPrint: {
33
+ [linter_format_1.LintingPrettyPrintContext.Query]: (result) => result.message,
34
+ [linter_format_1.LintingPrettyPrintContext.Full]: (result) => result.message
35
+ },
36
+ info: {
37
+ name: 'Software Has License',
38
+ description: 'Checks whether the software project provides a license (via a LICENSE file or the DESCRIPTION file License field).',
39
+ tags: [linter_tags_1.LintingRuleTag.Documentation, linter_tags_1.LintingRuleTag.Usability],
40
+ certainty: linter_format_1.LintingRuleCertainty.BestEffort,
41
+ defaultConfig: {
42
+ checkDescriptionFile: true
43
+ }
44
+ }
45
+ };
46
+ //# sourceMappingURL=software-has-license.js.map
@@ -0,0 +1,38 @@
1
+ import { type LintingResult, LintingRuleCertainty } from '../linter-format';
2
+ import type { MergeableRecord } from '../../util/objects';
3
+ import { LintingRuleTag } from '../linter-tags';
4
+ import type { FunctionInfo } from '../../queries/catalog/dependencies-query/function-info/function-info';
5
+ export interface SoftwareHasTestsResult extends LintingResult {
6
+ readonly message: string;
7
+ }
8
+ export interface SoftwareHasTestsConfig extends MergeableRecord {
9
+ /** Additional test function patterns beyond the defaults */
10
+ readonly additionalTestFunctions: FunctionInfo[];
11
+ }
12
+ export interface SoftwareHasTestsMetadata extends MergeableRecord {
13
+ readonly testFilesFound: number;
14
+ readonly testCallsFound: number;
15
+ }
16
+ export declare const SOFTWARE_HAS_TESTS: {
17
+ readonly createSearch: (config: SoftwareHasTestsConfig) => import("../../search/flowr-search-builder").FlowrSearchBuilder<"from-query", [], 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>[]>>;
18
+ 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: SoftwareHasTestsConfig, data: import("../../project/flowr-analyzer").ReadonlyFlowrAnalysisProvider<import("../../r-bridge/parser").KnownParser>) => {
19
+ results: SoftwareHasTestsResult[];
20
+ '.meta': {
21
+ testFilesFound: number;
22
+ testCallsFound: number;
23
+ };
24
+ };
25
+ readonly prettyPrint: {
26
+ readonly query: (result: SoftwareHasTestsResult) => string;
27
+ readonly full: (result: SoftwareHasTestsResult) => string;
28
+ };
29
+ readonly info: {
30
+ readonly name: "Software Has Tests";
31
+ readonly description: "Checks whether the software project has tests (test files in a test directory or test function calls in R code).";
32
+ readonly tags: readonly [LintingRuleTag.Usability, LintingRuleTag.Reproducibility];
33
+ readonly certainty: LintingRuleCertainty.BestEffort;
34
+ readonly defaultConfig: {
35
+ readonly additionalTestFunctions: readonly [];
36
+ };
37
+ };
38
+ };
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SOFTWARE_HAS_TESTS = void 0;
4
+ const linter_format_1 = require("../linter-format");
5
+ const flowr_search_builder_1 = require("../../search/flowr-search-builder");
6
+ const range_1 = require("../../util/range");
7
+ const linter_tags_1 = require("../linter-tags");
8
+ const flowr_file_1 = require("../../project/context/flowr-file");
9
+ exports.SOFTWARE_HAS_TESTS = {
10
+ createSearch: (config) => flowr_search_builder_1.Q.fromQuery({
11
+ type: 'dependencies',
12
+ enabledCategories: ['test'],
13
+ ...(config.additionalTestFunctions.length > 0 ? { testFunctions: config.additionalTestFunctions } : {})
14
+ }),
15
+ processSearchResult: (elements, _config, data) => {
16
+ const ctx = data.inspectContext();
17
+ const testFiles = ctx.files.getFilesByRole(flowr_file_1.FileRole.Test);
18
+ const testCalls = elements.getElements().length;
19
+ const hasTests = testFiles.length > 0 || testCalls > 0;
20
+ const results = hasTests ? [] : [{
21
+ certainty: linter_format_1.LintingResultCertainty.Certain,
22
+ involvedId: undefined,
23
+ loc: range_1.SourceLocation.invalid(),
24
+ message: 'No tests found in the project'
25
+ }];
26
+ return {
27
+ results,
28
+ '.meta': {
29
+ testFilesFound: testFiles.length,
30
+ testCallsFound: testCalls
31
+ }
32
+ };
33
+ },
34
+ prettyPrint: {
35
+ [linter_format_1.LintingPrettyPrintContext.Query]: (result) => result.message,
36
+ [linter_format_1.LintingPrettyPrintContext.Full]: (result) => result.message
37
+ },
38
+ info: {
39
+ name: 'Software Has Tests',
40
+ description: 'Checks whether the software project has tests (test files in a test directory or test function calls in R code).',
41
+ tags: [linter_tags_1.LintingRuleTag.Usability, linter_tags_1.LintingRuleTag.Reproducibility],
42
+ certainty: linter_format_1.LintingRuleCertainty.BestEffort,
43
+ defaultConfig: {
44
+ additionalTestFunctions: []
45
+ }
46
+ }
47
+ };
48
+ //# sourceMappingURL=software-has-tests.js.map
@@ -9,15 +9,10 @@ export interface StopWithCallMetadata extends MergeableRecord {
9
9
  }
10
10
  export declare const STOP_WITH_CALL_ARG: {
11
11
  readonly createSearch: () => import("../../search/flowr-search-builder").FlowrSearchBuilder<"get", ["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>[]>>>;
12
- 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: MergeableRecord, { dataflow, analyzer }: {
13
- normalize: import("../../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
14
- dataflow: import("../../dataflow/info").DataflowInformation;
15
- cfg: import("../../control-flow/control-flow-graph").ControlFlowInformation;
16
- analyzer: import("../../project/flowr-analyzer").ReadonlyFlowrAnalysisProvider;
17
- }) => {
12
+ 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: MergeableRecord, data: import("../../project/flowr-analyzer").ReadonlyFlowrAnalysisProvider<import("../../r-bridge/parser").KnownParser>) => Promise<{
18
13
  results: Writable<StopWithCallResult>[];
19
14
  '.meta': StopWithCallMetadata;
20
- };
15
+ }>;
21
16
  readonly prettyPrint: {
22
17
  readonly query: (result: LintingResult) => string;
23
18
  readonly full: (result: LintingResult) => string;
@@ -13,7 +13,8 @@ const linker_1 = require("../../dataflow/internal/linker");
13
13
  const general_1 = require("../../dataflow/eval/values/general");
14
14
  exports.STOP_WITH_CALL_ARG = {
15
15
  createSearch: () => flowr_search_builder_1.Q.var('stop').filter(vertex_1.VertexType.FunctionCall),
16
- processSearchResult: (elements, _config, { dataflow, analyzer }) => {
16
+ processSearchResult: async (elements, _config, data) => {
17
+ const dataflow = await data.dataflow();
17
18
  const meta = {
18
19
  consideredNodes: 0
19
20
  };
@@ -38,7 +39,7 @@ exports.STOP_WITH_CALL_ARG = {
38
39
  const mapping = (0, linker_1.pMatch)(fCall.args, stopParamMap);
39
40
  const mappedToStop = mapping.get('call.') ?? [];
40
41
  for (const argId of mappedToStop) {
41
- const res = (0, alias_tracking_1.resolveIdToValue)(argId, { graph: dataflow.graph, environment: fCall.environment, ctx: analyzer.inspectContext() });
42
+ const res = (0, alias_tracking_1.resolveIdToValue)(argId, { graph: dataflow.graph, environment: fCall.environment, ctx: data.inspectContext() });
42
43
  const values = (0, general_1.valueSetGuard)(res);
43
44
  if (values?.type === 'set' && values.elements.length !== 0) {
44
45
  if (values.elements[0].type === 'logical') {
@@ -1,7 +1,7 @@
1
1
  import { type LintingResult, LintingRuleCertainty } from '../linter-format';
2
2
  import type { MergeableRecord } from '../../util/objects';
3
3
  import { LintingRuleTag } from '../linter-tags';
4
- import type { NormalizedAst, ParentInformation } from '../../r-bridge/lang-4.x/ast/model/processing/decorate';
4
+ import type { ParentInformation } from '../../r-bridge/lang-4.x/ast/model/processing/decorate';
5
5
  export interface UnusedDefinitionResult extends LintingResult {
6
6
  variableName?: string;
7
7
  }
@@ -16,15 +16,10 @@ export interface UnusedDefinitionMetadata extends MergeableRecord {
16
16
  }
17
17
  export declare const UNUSED_DEFINITION: {
18
18
  readonly createSearch: (config: UnusedDefinitionConfig) => import("../../search/flowr-search-builder").FlowrSearchBuilder<"all", ["filter"], ParentInformation, Promise<import("../../search/flowr-search").FlowrSearchElements<ParentInformation, [] | import("../../search/flowr-search").FlowrSearchElement<ParentInformation>[]>>>;
19
- readonly processSearchResult: (elements: import("../../search/flowr-search").FlowrSearchElements<ParentInformation, import("../../search/flowr-search").FlowrSearchElement<ParentInformation>[]>, config: UnusedDefinitionConfig, data: {
20
- normalize: NormalizedAst;
21
- dataflow: import("../../dataflow/info").DataflowInformation;
22
- cfg: import("../../control-flow/control-flow-graph").ControlFlowInformation;
23
- analyzer: import("../../project/flowr-analyzer").ReadonlyFlowrAnalysisProvider;
24
- }) => {
19
+ readonly processSearchResult: (elements: import("../../search/flowr-search").FlowrSearchElements<ParentInformation, import("../../search/flowr-search").FlowrSearchElement<ParentInformation>[]>, config: UnusedDefinitionConfig, data: import("../../project/flowr-analyzer").ReadonlyFlowrAnalysisProvider<import("../../r-bridge/parser").KnownParser>) => Promise<{
25
20
  results: UnusedDefinitionResult[];
26
21
  ".meta": UnusedDefinitionMetadata;
27
- };
22
+ }>;
28
23
  readonly prettyPrint: {
29
24
  readonly query: (result: UnusedDefinitionResult) => string;
30
25
  readonly full: (result: UnusedDefinitionResult) => string;
@@ -58,20 +58,22 @@ function onlyKeepSupersetOfUnused(elements) {
58
58
  }
59
59
  exports.UNUSED_DEFINITION = {
60
60
  /* this can be done better once we have types */
61
- createSearch: config => flowr_search_builder_1.Q.all().filter(config.includeFunctionDefinitions ? flowr_search_filters_1.FlowrFilterCombinator.is(vertex_1.VertexType.VariableDefinition).or(vertex_1.VertexType.FunctionDefinition) : vertex_1.VertexType.VariableDefinition),
62
- processSearchResult: (elements, config, data) => {
61
+ createSearch: config => flowr_search_builder_1.Q.all().filter(config.includeFunctionDefinitions ? flowr_search_filters_1.F.or(vertex_1.VertexType.VariableDefinition, vertex_1.VertexType.FunctionDefinition) : vertex_1.VertexType.VariableDefinition),
62
+ processSearchResult: async (elements, config, data) => {
63
+ const normalize = await data.normalize();
64
+ const dataflow = await data.dataflow();
63
65
  const metadata = {
64
66
  totalConsidered: 0
65
67
  };
66
68
  return {
67
69
  results: onlyKeepSupersetOfUnused(elements.getElements().flatMap(element => {
68
70
  metadata.totalConsidered++;
69
- const dfgVertex = data.dataflow.graph.getVertex(element.node.info.id);
71
+ const dfgVertex = dataflow.graph.getVertex(element.node.info.id);
70
72
  if (!dfgVertex || (!(0, vertex_1.isVariableDefinitionVertex)(dfgVertex)
71
73
  && (0, vertex_1.isFunctionDefinitionVertex)(dfgVertex) && !config.includeFunctionDefinitions)) {
72
74
  return undefined;
73
75
  }
74
- const ingoingEdges = data.dataflow.graph.ingoingEdges(dfgVertex.id);
76
+ const ingoingEdges = dataflow.graph.ingoingEdges(dfgVertex.id);
75
77
  const interestedIn = (0, vertex_1.isVariableDefinitionVertex)(dfgVertex) ? InterestingEdgesVariable : InterestingEdgesFunction;
76
78
  const ingoingInteresting = ingoingEdges?.values().some(e => edge_1.DfEdge.includesType(e, interestedIn));
77
79
  if (ingoingInteresting) {
@@ -84,7 +86,7 @@ exports.UNUSED_DEFINITION = {
84
86
  variableName,
85
87
  involvedId: element.node.info.id,
86
88
  loc: range_1.SourceLocation.fromNode(element.node) ?? range_1.SourceLocation.invalid(),
87
- quickFix: buildQuickFix(element.node, data.dataflow.graph, data.normalize)
89
+ quickFix: buildQuickFix(element.node, dataflow.graph, normalize)
88
90
  }];
89
91
  }).filter(assert_1.isNotUndefined)),
90
92
  '.meta': metadata
@@ -14,12 +14,7 @@ export interface UselessLoopMetadata extends MergeableRecord {
14
14
  }
15
15
  export declare const USELESS_LOOP: {
16
16
  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>[]>>>;
17
- 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>[]>, useLessLoopConfig: UselessLoopConfig, { analyzer, dataflow, normalize, cfg }: {
18
- normalize: import("../../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
19
- dataflow: import("../../dataflow/info").DataflowInformation;
20
- cfg: import("../../control-flow/control-flow-graph").ControlFlowInformation;
21
- analyzer: import("../../project/flowr-analyzer").ReadonlyFlowrAnalysisProvider;
22
- }) => {
17
+ 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>[]>, useLessLoopConfig: UselessLoopConfig, data: import("../../project/flowr-analyzer").ReadonlyFlowrAnalysisProvider<import("../../r-bridge/parser").KnownParser>) => Promise<{
23
18
  results: {
24
19
  certainty: LintingResultCertainty.Certain;
25
20
  name: string;
@@ -29,7 +24,7 @@ export declare const USELESS_LOOP: {
29
24
  '.meta': {
30
25
  numOfUselessLoops: number;
31
26
  };
32
- };
27
+ }>;
33
28
  readonly prettyPrint: {
34
29
  readonly query: (result: UselessLoopResult) => string;
35
30
  readonly full: (result: UselessLoopResult) => string;
@@ -9,14 +9,17 @@ const linter_format_1 = require("../linter-format");
9
9
  const linter_tags_1 = require("../linter-tags");
10
10
  exports.USELESS_LOOP = {
11
11
  createSearch: () => flowr_search_builder_1.Q.all().filter(vertex_1.VertexType.FunctionCall),
12
- processSearchResult: (elements, useLessLoopConfig, { analyzer, dataflow, normalize, cfg }) => {
12
+ processSearchResult: async (elements, useLessLoopConfig, data) => {
13
+ const normalize = await data.normalize();
14
+ const dataflow = await data.dataflow();
15
+ const cfg = await data.controlflow();
13
16
  const results = elements.getElements().filter(e => {
14
17
  const vertex = dataflow.graph.getVertex(e.node.info.id);
15
18
  return vertex
16
19
  && (0, vertex_1.isFunctionCallVertex)(vertex)
17
20
  && vertex.origin !== 'unnamed'
18
21
  && useLessLoopConfig.loopyFunctions.has(vertex.origin[0]);
19
- }).filter(loop => (0, useless_loop_1.onlyLoopsOnce)(loop.node.info.id, dataflow.graph, cfg, normalize, analyzer.inspectContext())).map(res => ({
22
+ }).filter(loop => (0, useless_loop_1.onlyLoopsOnce)(loop.node.info.id, dataflow.graph, cfg, normalize, data.inspectContext())).map(res => ({
20
23
  certainty: linter_format_1.LintingResultCertainty.Certain,
21
24
  name: res.node.lexeme,
22
25
  loc: range_1.SourceLocation.fromNode(res.node) ?? range_1.SourceLocation.invalid(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eagleoutice/flowr",
3
- "version": "2.10.8",
3
+ "version": "2.10.10",
4
4
  "description": "Static Dataflow Analyzer and Program Slicer for the R Programming Language",
5
5
  "types": "dist/src/index.d.ts",
6
6
  "repository": {
@@ -38,6 +38,7 @@
38
38
  "license-compat": "license-checker-rseidelsohn --onlyAllow 'MIT;MPL-2.0;MIT OR X11;GPLv2;LGPL;GNUGPL;ISC;Apache-2.0;FreeBSD;BSD-2-Clause;clearbsd;ModifiedBSD;BSD-3-Clause;Python-2.0;Unlicense;WTFPL;BlueOak-1.0.0;CC-BY-4.0;CC-BY-3.0;CC0-1.0;0BSD'",
39
39
  "doc": "typedoc",
40
40
  "test": "vitest --exclude \"test/system-tests/**\" --config test/vitest.config.mts",
41
+ "test:verbose": "FLOWR_VERBOSE=true vitest --exclude \"test/system-tests/**\" --config test/vitest.config.mts",
41
42
  "test:system": "vitest --dir test/system-tests --config test/system-tests/vitest.config.mts",
42
43
  "test:coverage": "npm run test -- --coverage",
43
44
  "test:full": "npm run test-full",
@@ -168,7 +169,7 @@
168
169
  "devDependencies": {
169
170
  "@commitlint/cli": "^20.5.0",
170
171
  "@commitlint/config-angular": "^20.5.0",
171
- "@eagleoutice/eslint-config-flowr": "^1.0.40",
172
+ "@eagleoutice/eslint-config-flowr": "^1.0.43",
172
173
  "@eslint/eslintrc": "^3.3.3",
173
174
  "@eslint/js": "^9.39.2",
174
175
  "@j-ulrich/release-it-regex-bumper": "^5.4.0",
@@ -9,32 +9,30 @@ import { FlowrAnalyzerEnvironmentContext } from './flowr-analyzer-environment-co
9
9
  import type { ReadOnlyFlowrAnalyzerMetaContext } from './flowr-analyzer-meta-context';
10
10
  import { FlowrAnalyzerMetaContext } from './flowr-analyzer-meta-context';
11
11
  import type { FlowrAnalyzer } from '../flowr-analyzer';
12
+ import { FlowrAnalyzerGasContext, type ReadOnlyFlowrAnalyzerGasContext } from './flowr-analyzer-gas-context';
12
13
  /**
13
14
  * This is a read-only interface to the {@link FlowrAnalyzerContext}.
14
15
  * It prevents you from modifying the context, but allows you to inspect it (which is probably what you want when using the {@link FlowrAnalyzer}).
15
16
  * If you are a {@link FlowrAnalyzerPlugin} and want to modify the context, you can use the {@link FlowrAnalyzerContext} directly.
16
17
  */
17
18
  export interface ReadOnlyFlowrAnalyzerContext {
18
- /**
19
- * The meta context provides access to the project metadata such as name, version, and namespace.
20
- */
19
+ /** Project metadata such as name, version, and namespace. */
21
20
  readonly meta: ReadOnlyFlowrAnalyzerMetaContext;
22
- /**
23
- * The files context provides access to the files to be analyzed and their loading order.
24
- */
21
+ /** Files to be analyzed and their loading order. */
25
22
  readonly files: ReadOnlyFlowrAnalyzerFilesContext;
26
- /**
27
- * The dependencies context provides access to the identified dependencies and their versions.
28
- */
23
+ /** Identified dependencies and their versions. */
29
24
  readonly deps: ReadOnlyFlowrAnalyzerDependenciesContext;
30
- /**
31
- * The environment context provides access to the environment information used during analysis.
32
- */
25
+ /** Environment information used during analysis. */
33
26
  readonly env: ReadOnlyFlowrAnalyzerEnvironmentContext;
27
+ /** The configuration options used by the analyzer. */
28
+ readonly config: FlowrConfig;
34
29
  /**
35
- * The configuration options used by the analyzer.
30
+ * Resource-usage guard (gas).
31
+ * Call `ctx.gas.checkGas(key)` at expensive analysis sites to obtain the current pressure level.
32
+ * Returns `GasLevel.Normal` with zero overhead when gas is disabled for `key`.
33
+ * @see {@link ReadOnlyFlowrAnalyzerGasContext}
36
34
  */
37
- readonly config: FlowrConfig;
35
+ readonly gas: ReadOnlyFlowrAnalyzerGasContext;
38
36
  }
39
37
  /**
40
38
  * This summarizes the other context layers used by the {@link FlowrAnalyzer}.
@@ -52,6 +50,7 @@ export declare class FlowrAnalyzerContext implements ReadOnlyFlowrAnalyzerContex
52
50
  readonly files: FlowrAnalyzerFilesContext;
53
51
  readonly deps: FlowrAnalyzerDependenciesContext;
54
52
  readonly env: FlowrAnalyzerEnvironmentContext;
53
+ readonly gas: FlowrAnalyzerGasContext;
55
54
  private _analyzer;
56
55
  readonly config: FlowrConfig;
57
56
  constructor(config: FlowrConfig, plugins: ReadonlyMap<PluginType, readonly FlowrAnalyzerPlugin[]>);
@@ -14,6 +14,7 @@ const config_1 = require("../../config");
14
14
  const flowr_file_1 = require("./flowr-file");
15
15
  const flowr_analyzer_environment_context_1 = require("./flowr-analyzer-environment-context");
16
16
  const flowr_analyzer_meta_context_1 = require("./flowr-analyzer-meta-context");
17
+ const flowr_analyzer_gas_context_1 = require("./flowr-analyzer-gas-context");
17
18
  /**
18
19
  * This summarizes the other context layers used by the {@link FlowrAnalyzer}.
19
20
  * Have a look at the attributes and layers listed below (e.g., {@link files} and {@link deps})
@@ -30,6 +31,7 @@ class FlowrAnalyzerContext {
30
31
  files;
31
32
  deps;
32
33
  env;
34
+ gas;
33
35
  _analyzer;
34
36
  config;
35
37
  constructor(config, plugins) {
@@ -40,6 +42,7 @@ class FlowrAnalyzerContext {
40
42
  const functions = new flowr_analyzer_functions_context_1.FlowrAnalyzerFunctionsContext(this);
41
43
  this.deps = new flowr_analyzer_dependencies_context_1.FlowrAnalyzerDependenciesContext(functions, (plugins.get(flowr_analyzer_plugin_1.PluginType.DependencyIdentification) ?? []));
42
44
  this.meta = new flowr_analyzer_meta_context_1.FlowrAnalyzerMetaContext();
45
+ this.gas = new flowr_analyzer_gas_context_1.FlowrAnalyzerGasContext(this, config.gas, (plugins.get(flowr_analyzer_plugin_1.PluginType.Gas) ?? []));
43
46
  }
44
47
  /**
45
48
  * Provides the analyzer associated with this context, if any.
@@ -77,6 +80,7 @@ class FlowrAnalyzerContext {
77
80
  this.files.reset();
78
81
  this.deps.reset();
79
82
  this.meta.reset();
83
+ this.gas.reset();
80
84
  }
81
85
  }
82
86
  exports.FlowrAnalyzerContext = FlowrAnalyzerContext;
@@ -56,6 +56,14 @@ export interface ReadOnlyFlowrAnalyzerFilesContext {
56
56
  * @returns An array of all files.
57
57
  */
58
58
  getAllFiles(): FlowrFileProvider[];
59
+ /**
60
+ * Get a file by its path.
61
+ * Checks both disk-backed files and inline files.
62
+ * However, this will not load new files that have not yet been requested by flowR.
63
+ * @param path - The exact path of the file.
64
+ * @returns The file if found, otherwise `undefined`.
65
+ */
66
+ getFileByPath(path: string): FlowrFileProvider | undefined;
59
67
  /**
60
68
  * Check if the context has a cached file with the given path.
61
69
  * @param path - The path to the file.
@@ -105,6 +113,8 @@ export declare class FlowrAnalyzerFilesContext extends AbstractFlowrAnalyzerCont
105
113
  private readonly fileLoaders;
106
114
  /** these are all the paths of files that have been considered by the dataflow graph (even if not added) */
107
115
  private readonly consideredFiles;
116
+ /** User-registered project discovery plugins; if non-empty, they replace the default. */
117
+ private readonly discoveryPlugins;
108
118
  private byRole;
109
119
  constructor(loadingOrder: FlowrAnalyzerLoadingOrderContext, plugins: readonly FlowrAnalyzerProjectDiscoveryPlugin[], fileLoaders: readonly FlowrAnalyzerFilePlugin[]);
110
120
  reset(): void;
@@ -122,6 +132,7 @@ export declare class FlowrAnalyzerFilesContext extends AbstractFlowrAnalyzerCont
122
132
  addRequests(requests: readonly RAnalysisRequest[]): void;
123
133
  /**
124
134
  * Add a request to the context. If the request is of type `project`, it will be expanded using the registered {@link FlowrAnalyzerProjectDiscoveryPlugin}s.
135
+ * User-registered discovery plugins replace the built-in default; if none are registered, the default runs.
125
136
  */
126
137
  private addRequest;
127
138
  /**
@@ -150,4 +161,5 @@ export declare class FlowrAnalyzerFilesContext extends AbstractFlowrAnalyzerCont
150
161
  computeLoadingOrder(): readonly RParseRequest[];
151
162
  getFilesByRole<Role extends FileRole>(role: Role): RoleBasedFiles[Role];
152
163
  getAllFiles(): FlowrFileProvider[];
164
+ getFileByPath(path: string): FlowrFileProvider | undefined;
153
165
  }