@eagleoutice/flowr 2.4.8 → 2.6.0

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 (234) hide show
  1. package/README.md +66 -45
  2. package/benchmark/slicer.js +1 -1
  3. package/benchmark/summarizer/second-phase/graph.js +2 -2
  4. package/cli/flowr.js +3 -29
  5. package/cli/repl/commands/repl-cfg.d.ts +5 -5
  6. package/cli/repl/commands/repl-cfg.js +21 -22
  7. package/cli/repl/commands/repl-commands.d.ts +3 -3
  8. package/cli/repl/commands/repl-commands.js +2 -0
  9. package/cli/repl/commands/repl-dataflow.d.ts +5 -5
  10. package/cli/repl/commands/repl-dataflow.js +27 -30
  11. package/cli/repl/commands/repl-execute.js +1 -0
  12. package/cli/repl/commands/repl-lineage.js +1 -0
  13. package/cli/repl/commands/repl-main.d.ts +34 -3
  14. package/cli/repl/commands/repl-normalize.d.ts +3 -3
  15. package/cli/repl/commands/repl-normalize.js +15 -19
  16. package/cli/repl/commands/repl-parse.d.ts +2 -2
  17. package/cli/repl/commands/repl-parse.js +13 -8
  18. package/cli/repl/commands/repl-query.d.ts +3 -3
  19. package/cli/repl/commands/repl-query.js +29 -19
  20. package/cli/repl/commands/repl-quit.js +1 -0
  21. package/cli/repl/commands/repl-version.js +1 -0
  22. package/cli/repl/core.d.ts +4 -1
  23. package/cli/repl/core.js +21 -1
  24. package/cli/repl/server/connection.d.ts +7 -3
  25. package/cli/repl/server/connection.js +40 -48
  26. package/cli/repl/server/messages/message-slice.d.ts +1 -1
  27. package/cli/slicer-app.js +8 -3
  28. package/config.d.ts +1 -1
  29. package/config.js +4 -1
  30. package/control-flow/extract-cfg.d.ts +1 -1
  31. package/control-flow/extract-cfg.js +1 -1
  32. package/core/pipeline-executor.d.ts +5 -0
  33. package/core/pipeline-executor.js +5 -0
  34. package/core/steps/pipeline/create-pipeline.js +1 -1
  35. package/core/steps/pipeline/default-pipelines.d.ts +42 -42
  36. package/core/steps/pipeline/default-pipelines.js +4 -1
  37. package/dataflow/graph/dataflowgraph-builder.d.ts +11 -12
  38. package/dataflow/graph/dataflowgraph-builder.js +6 -6
  39. package/documentation/doc-util/doc-query.d.ts +3 -6
  40. package/documentation/doc-util/doc-query.js +5 -17
  41. package/documentation/doc-util/doc-search.js +7 -10
  42. package/documentation/doc-util/doc-structure.d.ts +4 -0
  43. package/documentation/doc-util/doc-structure.js +28 -0
  44. package/documentation/doc-util/doc-types.d.ts +5 -1
  45. package/documentation/doc-util/doc-types.js +29 -3
  46. package/documentation/print-analyzer-wiki.d.ts +1 -0
  47. package/documentation/print-analyzer-wiki.js +137 -0
  48. package/documentation/print-core-wiki.d.ts +2 -1
  49. package/documentation/print-core-wiki.js +58 -4
  50. package/documentation/print-dataflow-graph-wiki.js +15 -22
  51. package/documentation/print-interface-wiki.js +18 -1
  52. package/documentation/print-linter-wiki.js +5 -1
  53. package/documentation/print-linting-and-testing-wiki.js +4 -0
  54. package/documentation/print-normalized-ast-wiki.js +6 -8
  55. package/documentation/print-readme.js +6 -0
  56. package/engines.d.ts +9 -0
  57. package/engines.js +38 -0
  58. package/linter/linter-executor.d.ts +2 -8
  59. package/linter/linter-executor.js +9 -4
  60. package/linter/linter-format.d.ts +8 -9
  61. package/linter/linter-rules.d.ts +57 -15
  62. package/linter/linter-rules.js +2 -0
  63. package/linter/rules/absolute-path.d.ts +1 -0
  64. package/linter/rules/dataframe-access-validation.d.ts +4 -3
  65. package/linter/rules/dataframe-access-validation.js +7 -4
  66. package/linter/rules/dead-code.d.ts +2 -1
  67. package/linter/rules/deprecated-functions.d.ts +15 -28
  68. package/linter/rules/deprecated-functions.js +5 -43
  69. package/linter/rules/file-path-validity.d.ts +2 -1
  70. package/linter/rules/file-path-validity.js +1 -1
  71. package/linter/rules/function-finder-util.d.ts +51 -0
  72. package/linter/rules/function-finder-util.js +77 -0
  73. package/linter/rules/naming-convention.d.ts +2 -1
  74. package/linter/rules/network-functions.d.ts +40 -0
  75. package/linter/rules/network-functions.js +24 -0
  76. package/linter/rules/seeded-randomness.d.ts +2 -1
  77. package/linter/rules/unused-definition.d.ts +2 -1
  78. package/linter/rules/useless-loop.d.ts +3 -2
  79. package/linter/rules/useless-loop.js +4 -6
  80. package/package.json +5 -1
  81. package/project/cache/flowr-analyzer-cache.d.ts +93 -0
  82. package/project/cache/flowr-analyzer-cache.js +156 -0
  83. package/project/cache/flowr-cache.d.ts +28 -0
  84. package/project/cache/flowr-cache.js +49 -0
  85. package/project/context/abstract-flowr-analyzer-context.d.ts +35 -0
  86. package/project/context/abstract-flowr-analyzer-context.js +46 -0
  87. package/project/context/flowr-analyzer-context.d.ts +48 -0
  88. package/project/context/flowr-analyzer-context.js +47 -0
  89. package/project/context/flowr-analyzer-dependencies-context.d.ts +38 -0
  90. package/project/context/flowr-analyzer-dependencies-context.js +39 -0
  91. package/project/context/flowr-analyzer-files-context.d.ts +86 -0
  92. package/project/context/flowr-analyzer-files-context.js +130 -0
  93. package/project/context/flowr-analyzer-loading-order-context.d.ts +76 -0
  94. package/project/context/flowr-analyzer-loading-order-context.js +90 -0
  95. package/project/context/flowr-file.d.ts +89 -0
  96. package/project/context/flowr-file.js +78 -0
  97. package/project/flowr-analyzer-builder.d.ts +106 -0
  98. package/project/flowr-analyzer-builder.js +197 -0
  99. package/project/flowr-analyzer.d.ts +125 -0
  100. package/project/flowr-analyzer.js +81 -0
  101. package/project/plugins/file-plugins/flowr-analyzer-description-file-plugin.d.ts +17 -0
  102. package/project/plugins/file-plugins/flowr-analyzer-description-file-plugin.js +28 -0
  103. package/project/plugins/file-plugins/flowr-analyzer-file-plugin.d.ts +21 -0
  104. package/project/plugins/file-plugins/flowr-analyzer-file-plugin.js +34 -0
  105. package/project/plugins/file-plugins/flowr-description-file.d.ts +24 -0
  106. package/project/plugins/file-plugins/flowr-description-file.js +38 -0
  107. package/project/plugins/flowr-analyzer-plugin.d.ts +90 -0
  108. package/project/plugins/flowr-analyzer-plugin.js +82 -0
  109. package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-description-file-plugin.d.ts +14 -0
  110. package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-description-file-plugin.js +56 -0
  111. package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-plugin.d.ts +13 -0
  112. package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-plugin.js +33 -0
  113. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-description-file-plugin.d.ts +14 -0
  114. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-description-file-plugin.js +41 -0
  115. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-plugin.d.ts +10 -0
  116. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-plugin.js +29 -0
  117. package/project/plugins/package-version-plugins/package.d.ts +15 -0
  118. package/project/plugins/package-version-plugins/package.js +56 -0
  119. package/project/plugins/project-discovery/flowr-analyzer-project-discovery-plugin.d.ts +15 -0
  120. package/project/plugins/project-discovery/flowr-analyzer-project-discovery-plugin.js +44 -0
  121. package/queries/base-query-format.d.ts +2 -8
  122. package/queries/catalog/call-context-query/call-context-query-executor.d.ts +1 -1
  123. package/queries/catalog/call-context-query/call-context-query-executor.js +20 -13
  124. package/queries/catalog/call-context-query/call-context-query-format.d.ts +2 -3
  125. package/queries/catalog/call-context-query/call-context-query-format.js +2 -2
  126. package/queries/catalog/cluster-query/cluster-query-executor.d.ts +1 -1
  127. package/queries/catalog/cluster-query/cluster-query-executor.js +2 -2
  128. package/queries/catalog/cluster-query/cluster-query-format.d.ts +1 -54
  129. package/queries/catalog/cluster-query/cluster-query-format.js +2 -2
  130. package/queries/catalog/config-query/config-query-executor.d.ts +1 -1
  131. package/queries/catalog/config-query/config-query-executor.js +5 -5
  132. package/queries/catalog/config-query/config-query-format.d.ts +1 -1
  133. package/queries/catalog/config-query/config-query-format.js +1 -1
  134. package/queries/catalog/control-flow-query/control-flow-query-executor.d.ts +1 -1
  135. package/queries/catalog/control-flow-query/control-flow-query-executor.js +2 -3
  136. package/queries/catalog/control-flow-query/control-flow-query-format.d.ts +1 -54
  137. package/queries/catalog/control-flow-query/control-flow-query-format.js +2 -2
  138. package/queries/catalog/dataflow-lens-query/dataflow-lens-query-executor.d.ts +1 -1
  139. package/queries/catalog/dataflow-lens-query/dataflow-lens-query-executor.js +2 -2
  140. package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.d.ts +1 -54
  141. package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.js +1 -1
  142. package/queries/catalog/dataflow-query/dataflow-query-executor.d.ts +1 -1
  143. package/queries/catalog/dataflow-query/dataflow-query-executor.js +2 -2
  144. package/queries/catalog/dataflow-query/dataflow-query-format.d.ts +1 -54
  145. package/queries/catalog/dataflow-query/dataflow-query-format.js +1 -1
  146. package/queries/catalog/dependencies-query/dependencies-query-executor.d.ts +1 -1
  147. package/queries/catalog/dependencies-query/dependencies-query-executor.js +19 -12
  148. package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +7 -56
  149. package/queries/catalog/dependencies-query/dependencies-query-format.js +7 -4
  150. package/queries/catalog/df-shape-query/df-shape-query-executor.d.ts +1 -1
  151. package/queries/catalog/df-shape-query/df-shape-query-executor.js +4 -4
  152. package/queries/catalog/df-shape-query/df-shape-query-format.d.ts +1 -54
  153. package/queries/catalog/df-shape-query/df-shape-query-format.js +1 -1
  154. package/queries/catalog/happens-before-query/happens-before-query-executor.d.ts +1 -1
  155. package/queries/catalog/happens-before-query/happens-before-query-executor.js +2 -1
  156. package/queries/catalog/happens-before-query/happens-before-query-format.d.ts +1 -54
  157. package/queries/catalog/happens-before-query/happens-before-query-format.js +1 -1
  158. package/queries/catalog/id-map-query/id-map-query-executor.d.ts +1 -1
  159. package/queries/catalog/id-map-query/id-map-query-executor.js +2 -2
  160. package/queries/catalog/id-map-query/id-map-query-format.d.ts +1 -54
  161. package/queries/catalog/id-map-query/id-map-query-format.js +2 -2
  162. package/queries/catalog/lineage-query/lineage-query-executor.d.ts +1 -1
  163. package/queries/catalog/lineage-query/lineage-query-executor.js +2 -2
  164. package/queries/catalog/lineage-query/lineage-query-format.d.ts +1 -54
  165. package/queries/catalog/lineage-query/lineage-query-format.js +1 -1
  166. package/queries/catalog/linter-query/linter-query-executor.d.ts +1 -1
  167. package/queries/catalog/linter-query/linter-query-executor.js +2 -3
  168. package/queries/catalog/linter-query/linter-query-format.d.ts +1 -54
  169. package/queries/catalog/linter-query/linter-query-format.js +1 -1
  170. package/queries/catalog/location-map-query/location-map-query-executor.d.ts +1 -1
  171. package/queries/catalog/location-map-query/location-map-query-executor.js +3 -2
  172. package/queries/catalog/location-map-query/location-map-query-format.d.ts +1 -1
  173. package/queries/catalog/location-map-query/location-map-query-format.js +1 -1
  174. package/queries/catalog/normalized-ast-query/normalized-ast-query-executor.d.ts +1 -1
  175. package/queries/catalog/normalized-ast-query/normalized-ast-query-executor.js +2 -2
  176. package/queries/catalog/normalized-ast-query/normalized-ast-query-format.d.ts +1 -54
  177. package/queries/catalog/normalized-ast-query/normalized-ast-query-format.js +1 -1
  178. package/queries/catalog/origin-query/origin-query-executor.d.ts +2 -2
  179. package/queries/catalog/origin-query/origin-query-executor.js +3 -3
  180. package/queries/catalog/origin-query/origin-query-format.d.ts +1 -54
  181. package/queries/catalog/origin-query/origin-query-format.js +1 -1
  182. package/queries/catalog/project-query/project-query-executor.d.ts +1 -1
  183. package/queries/catalog/project-query/project-query-executor.js +2 -2
  184. package/queries/catalog/project-query/project-query-format.d.ts +1 -54
  185. package/queries/catalog/project-query/project-query-format.js +1 -1
  186. package/queries/catalog/resolve-value-query/resolve-value-query-executor.d.ts +1 -1
  187. package/queries/catalog/resolve-value-query/resolve-value-query-executor.js +4 -2
  188. package/queries/catalog/resolve-value-query/resolve-value-query-format.d.ts +1 -54
  189. package/queries/catalog/resolve-value-query/resolve-value-query-format.js +1 -1
  190. package/queries/catalog/search-query/search-query-executor.d.ts +1 -1
  191. package/queries/catalog/search-query/search-query-executor.js +3 -3
  192. package/queries/catalog/search-query/search-query-format.d.ts +1 -54
  193. package/queries/catalog/search-query/search-query-format.js +1 -1
  194. package/queries/catalog/static-slice-query/static-slice-query-executor.d.ts +1 -1
  195. package/queries/catalog/static-slice-query/static-slice-query-executor.js +3 -3
  196. package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +1 -54
  197. package/queries/catalog/static-slice-query/static-slice-query-format.js +1 -1
  198. package/queries/query-print.d.ts +4 -4
  199. package/queries/query-print.js +12 -12
  200. package/queries/query.d.ts +29 -885
  201. package/queries/query.js +1 -1
  202. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-executor.js +1 -1
  203. package/r-bridge/retriever.d.ts +15 -2
  204. package/r-bridge/retriever.js +15 -5
  205. package/search/flowr-search-executor.d.ts +3 -5
  206. package/search/flowr-search-executor.js +6 -4
  207. package/search/flowr-search-filters.d.ts +12 -6
  208. package/search/flowr-search-filters.js +1 -1
  209. package/search/flowr-search.d.ts +5 -16
  210. package/search/flowr-search.js +14 -5
  211. package/search/search-executor/search-enrichers.d.ts +37 -36
  212. package/search/search-executor/search-enrichers.js +4 -4
  213. package/search/search-executor/search-generators.d.ts +12 -12
  214. package/search/search-executor/search-generators.js +27 -19
  215. package/search/search-executor/search-mappers.d.ts +5 -5
  216. package/search/search-executor/search-transformer.d.ts +17 -17
  217. package/search/search-executor/search-transformer.js +14 -7
  218. package/util/collections/arrays.d.ts +1 -0
  219. package/util/collections/arrays.js +15 -0
  220. package/util/collections/objectmap.d.ts +17 -0
  221. package/util/collections/objectmap.js +28 -0
  222. package/util/containers.d.ts +0 -1
  223. package/util/containers.js +0 -1
  224. package/util/files.d.ts +17 -0
  225. package/util/files.js +65 -0
  226. package/util/formats/adapter-format.d.ts +6 -0
  227. package/util/formats/adapter-format.js +3 -0
  228. package/util/formats/adapter.d.ts +18 -0
  229. package/util/formats/adapter.js +49 -0
  230. package/util/formats/adapters/r-adapter.d.ts +4 -0
  231. package/util/formats/adapters/r-adapter.js +7 -0
  232. package/util/formats/adapters/rmd-adapter.d.ts +26 -0
  233. package/util/formats/adapters/rmd-adapter.js +91 -0
  234. package/util/version.js +1 -1
@@ -2,50 +2,12 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DEPRECATED_FUNCTIONS = void 0;
4
4
  const linter_format_1 = require("../linter-format");
5
- const flowr_search_builder_1 = require("../../search/flowr-search-builder");
6
- const dfg_1 = require("../../util/mermaid/dfg");
7
- const search_enrichers_1 = require("../../search/search-executor/search-enrichers");
8
- const flowr_search_filters_1 = require("../../search/flowr-search-filters");
9
5
  const linter_tags_1 = require("../linter-tags");
6
+ const function_finder_util_1 = require("./function-finder-util");
10
7
  exports.DEPRECATED_FUNCTIONS = {
11
- createSearch: (config) => flowr_search_builder_1.Q.all()
12
- .with(search_enrichers_1.Enrichment.CallTargets, { onlyBuiltin: true })
13
- .filter({
14
- name: flowr_search_filters_1.FlowrFilter.MatchesEnrichment,
15
- args: {
16
- enrichment: search_enrichers_1.Enrichment.CallTargets,
17
- test: (0, flowr_search_filters_1.testFunctionsIgnoringPackage)(config.deprecatedFunctions)
18
- }
19
- }),
20
- processSearchResult: (elements) => {
21
- const metadata = {
22
- totalDeprecatedCalls: 0,
23
- totalDeprecatedFunctionDefinitions: 0
24
- };
25
- return {
26
- results: elements.getElements()
27
- .flatMap(element => {
28
- metadata.totalDeprecatedCalls++;
29
- return (0, search_enrichers_1.enrichmentContent)(element, search_enrichers_1.Enrichment.CallTargets).targets.map(target => {
30
- metadata.totalDeprecatedFunctionDefinitions++;
31
- return {
32
- range: element.node.info.fullRange,
33
- target: target
34
- };
35
- });
36
- })
37
- .map(element => ({
38
- certainty: linter_format_1.LintingResultCertainty.Certain,
39
- function: element.target,
40
- range: element.range
41
- })),
42
- '.meta': metadata
43
- };
44
- },
45
- prettyPrint: {
46
- [linter_format_1.LintingPrettyPrintContext.Query]: result => `Function \`${result.function}\` at ${(0, dfg_1.formatRange)(result.range)}`,
47
- [linter_format_1.LintingPrettyPrintContext.Full]: result => `Function \`${result.function}\` called at ${(0, dfg_1.formatRange)(result.range)} is deprecated`
48
- },
8
+ createSearch: (config) => function_finder_util_1.functionFinderUtil.createSearch(config.fns),
9
+ processSearchResult: function_finder_util_1.functionFinderUtil.processSearchResult,
10
+ prettyPrint: function_finder_util_1.functionFinderUtil.prettyPrint('deprecated'),
49
11
  info: {
50
12
  name: 'Deprecated Functions',
51
13
  tags: [linter_tags_1.LintingRuleTag.Deprecated, linter_tags_1.LintingRuleTag.Smell, linter_tags_1.LintingRuleTag.Usability, linter_tags_1.LintingRuleTag.Reproducibility],
@@ -53,7 +15,7 @@ exports.DEPRECATED_FUNCTIONS = {
53
15
  certainty: linter_format_1.LintingRuleCertainty.BestEffort,
54
16
  description: 'Marks deprecated functions that should not be used anymore.',
55
17
  defaultConfig: {
56
- deprecatedFunctions: ['all_equal', 'arrange_all', 'distinct_all', 'filter_all', 'group_by_all', 'summarise_all', 'mutate_all', 'select_all', 'vars', 'all_vars', 'id', 'failwith', 'select_vars', 'rename_vars', 'select_var', 'current_vars', 'bench_tbls', 'compare_tbls', 'compare_tbls2', 'eval_tbls', 'eval_tbls2', 'location', 'changes', 'combine', 'do', 'funs', 'add_count_', 'add_tally_', 'arrange_', 'count_', 'distinct_', 'do_', 'filter_', 'funs_', 'group_by_', 'group_indices_', 'mutate_', 'tally_', 'transmute_', 'rename_', 'rename_vars_', 'select_', 'select_vars_', 'slice_', 'summarise_', 'summarize_', 'summarise_each', 'src_local', 'tbl_df', 'add_rownames', 'group_nest', 'group_split', 'with_groups', 'nest_by', 'progress_estimated', 'recode', 'sample_n', 'top_n', 'transmute', 'fct_explicit_na', 'aes_', 'aes_auto', 'annotation_logticks', 'is.Coord', 'coord_flip', 'coord_map', 'is.facet', 'fortify', 'is.ggproto', 'guide_train', 'is.ggplot', 'qplot', 'is.theme', 'gg_dep', 'liply', 'isplit2', 'list_along', 'cross', 'invoke', 'at_depth', 'prepend', 'rerun', 'splice', '`%@%`', 'rbernoulli', 'rdunif', 'when', 'update_list', 'map_raw', 'accumulate', 'reduce_right', 'flatten', 'map_dfr', 'as_vector', 'transpose', 'melt_delim', 'melt_fwf', 'melt_table', 'read_table2', 'str_interp', 'as_tibble', 'data_frame', 'tibble_', 'data_frame_', 'lst_', 'as_data_frame', 'as.tibble', 'frame_data', 'trunc_mat', 'is.tibble', 'tidy_names', 'set_tidy_names', 'repair_names', 'extract_numeric', 'complete_', 'drop_na_', 'expand_', 'crossing_', 'nesting_', 'extract_', 'fill_', 'gather_', 'nest_', 'separate_rows_', 'separate_', 'spread_', 'unite_', 'unnest_', 'extract', 'gather', 'nest_legacy', 'separate_rows', 'separate', 'spread',]
18
+ fns: ['all_equal', 'arrange_all', 'distinct_all', 'filter_all', 'group_by_all', 'summarise_all', 'mutate_all', 'select_all', 'vars', 'all_vars', 'id', 'failwith', 'select_vars', 'rename_vars', 'select_var', 'current_vars', 'bench_tbls', 'compare_tbls', 'compare_tbls2', 'eval_tbls', 'eval_tbls2', 'location', 'changes', 'combine', 'do', 'funs', 'add_count_', 'add_tally_', 'arrange_', 'count_', 'distinct_', 'do_', 'filter_', 'funs_', 'group_by_', 'group_indices_', 'mutate_', 'tally_', 'transmute_', 'rename_', 'rename_vars_', 'select_', 'select_vars_', 'slice_', 'summarise_', 'summarize_', 'summarise_each', 'src_local', 'tbl_df', 'add_rownames', 'group_nest', 'group_split', 'with_groups', 'nest_by', 'progress_estimated', 'recode', 'sample_n', 'top_n', 'transmute', 'fct_explicit_na', 'aes_', 'aes_auto', 'annotation_logticks', 'is.Coord', 'coord_flip', 'coord_map', 'is.facet', 'fortify', 'is.ggproto', 'guide_train', 'is.ggplot', 'qplot', 'is.theme', 'gg_dep', 'liply', 'isplit2', 'list_along', 'cross', 'invoke', 'at_depth', 'prepend', 'rerun', 'splice', '`%@%`', 'rbernoulli', 'rdunif', 'when', 'update_list', 'map_raw', 'accumulate', 'reduce_right', 'flatten', 'map_dfr', 'as_vector', 'transpose', 'melt_delim', 'melt_fwf', 'melt_table', 'read_table2', 'str_interp', 'as_tibble', 'data_frame', 'tibble_', 'data_frame_', 'lst_', 'as_data_frame', 'as.tibble', 'frame_data', 'trunc_mat', 'is.tibble', 'tidy_names', 'set_tidy_names', 'repair_names', 'extract_numeric', 'complete_', 'drop_na_', 'expand_', 'crossing_', 'nesting_', 'extract_', 'fill_', 'gather_', 'nest_', 'separate_rows_', 'separate_', 'spread_', 'unite_', 'unnest_', 'extract', 'gather', 'nest_legacy', 'separate_rows', 'separate', 'spread',]
57
19
  }
58
20
  }
59
21
  };
@@ -31,10 +31,11 @@ export interface FilePathValidityMetadata extends MergeableRecord {
31
31
  totalValid: number;
32
32
  }
33
33
  export declare const FILE_PATH_VALIDITY: {
34
- readonly createSearch: (config: FilePathValidityConfig) => import("../../search/flowr-search-builder").FlowrSearchBuilder<"from-query", ["with"], 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>[]>>;
34
+ 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>[]>>>;
35
35
  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: {
36
36
  normalize: import("../../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
37
37
  dataflow: import("../../dataflow/info").DataflowInformation;
38
+ cfg: import("../../control-flow/control-flow-graph").ControlFlowInformation;
38
39
  config: import("../../config").FlowrConfigOptions;
39
40
  }) => {
40
41
  results: FilePathValidityResult[];
@@ -26,9 +26,9 @@ exports.FILE_PATH_VALIDITY = {
26
26
  totalWritesBeforeAlways: 0,
27
27
  totalValid: 0
28
28
  };
29
+ const results = elements.enrichmentContent(search_enrichers_1.Enrichment.QueryData).queries['dependencies'];
29
30
  return {
30
31
  results: elements.getElements().flatMap(element => {
31
- const results = elements.enrichmentContent(search_enrichers_1.Enrichment.QueryData).queries['dependencies'];
32
32
  const matchingRead = results.read.find(r => r.nodeId == element.node.info.id);
33
33
  if (!matchingRead) {
34
34
  return [];
@@ -0,0 +1,51 @@
1
+ import type { SourceRange } from '../../util/range';
2
+ import type { Identifier } from '../../dataflow/environments/identifier';
3
+ import type { LintingResult } from '../linter-format';
4
+ import { LintingResultCertainty } from '../linter-format';
5
+ import type { FlowrSearchElement, FlowrSearchElements } from '../../search/flowr-search';
6
+ import type { NormalizedAst, ParentInformation } from '../../r-bridge/lang-4.x/ast/model/processing/decorate';
7
+ import type { MergeableRecord } from '../../util/objects';
8
+ import type { DataflowInformation } from '../../dataflow/info';
9
+ import type { FlowrConfigOptions } from '../../config';
10
+ import type { FunctionInfo } from '../../queries/catalog/dependencies-query/function-info/function-info';
11
+ export interface FunctionsResult extends LintingResult {
12
+ function: string;
13
+ range: SourceRange;
14
+ }
15
+ export interface FunctionsMetadata extends MergeableRecord {
16
+ totalCalls: number;
17
+ totalFunctionDefinitions: number;
18
+ }
19
+ export interface FunctionsToDetectConfig extends MergeableRecord {
20
+ /**
21
+ * The list of function names that should be marked in the given context.
22
+ */
23
+ fns: readonly string[];
24
+ }
25
+ /**
26
+ * This helper object collects utility functions used to create linting rules that search for specific functions.
27
+ */
28
+ export declare const functionFinderUtil: {
29
+ createSearch: (functions: readonly string[]) => import("../../search/flowr-search-builder").FlowrSearchBuilder<"all", ["with", "filter"], ParentInformation, Promise<FlowrSearchElements<ParentInformation, [] | FlowrSearchElement<ParentInformation>[]>>>;
30
+ processSearchResult: <T extends FlowrSearchElement<ParentInformation>[]>(elements: FlowrSearchElements<ParentInformation, T>, _config: FunctionsToDetectConfig, _data: {
31
+ normalize: NormalizedAst;
32
+ dataflow: DataflowInformation;
33
+ config: FlowrConfigOptions;
34
+ }, refineSearch?: (elements: T) => T) => {
35
+ results: {
36
+ certainty: LintingResultCertainty;
37
+ function: Identifier;
38
+ range: SourceRange;
39
+ }[];
40
+ '.meta': FunctionsMetadata;
41
+ };
42
+ prettyPrint: (functionType: string) => {
43
+ query: (result: FunctionsResult) => string;
44
+ full: (result: FunctionsResult) => string;
45
+ };
46
+ requireArgumentValue(element: FlowrSearchElement<ParentInformation>, pool: readonly FunctionInfo[], data: {
47
+ normalize: NormalizedAst;
48
+ dataflow: DataflowInformation;
49
+ config: FlowrConfigOptions;
50
+ }, requireValue: RegExp | string | undefined): boolean;
51
+ };
@@ -0,0 +1,77 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.functionFinderUtil = void 0;
4
+ const flowr_search_builder_1 = require("../../search/flowr-search-builder");
5
+ const flowr_search_filters_1 = require("../../search/flowr-search-filters");
6
+ const search_enrichers_1 = require("../../search/search-executor/search-enrichers");
7
+ const linter_format_1 = require("../linter-format");
8
+ const dfg_1 = require("../../util/mermaid/dfg");
9
+ const assert_1 = require("../../util/assert");
10
+ const resolve_argument_1 = require("../../dataflow/eval/resolve/resolve-argument");
11
+ const vertex_1 = require("../../dataflow/graph/vertex");
12
+ const dependencies_query_format_1 = require("../../queries/catalog/dependencies-query/dependencies-query-format");
13
+ /**
14
+ * This helper object collects utility functions used to create linting rules that search for specific functions.
15
+ */
16
+ exports.functionFinderUtil = {
17
+ createSearch: (functions) => {
18
+ return (flowr_search_builder_1.Q.all()
19
+ .with(search_enrichers_1.Enrichment.CallTargets, { onlyBuiltin: true })
20
+ .filter({
21
+ name: flowr_search_filters_1.FlowrFilter.MatchesEnrichment,
22
+ args: {
23
+ enrichment: search_enrichers_1.Enrichment.CallTargets,
24
+ test: (0, flowr_search_filters_1.testFunctionsIgnoringPackage)(functions)
25
+ }
26
+ }));
27
+ },
28
+ processSearchResult: (elements, _config, _data, refineSearch = e => e) => {
29
+ const metadata = {
30
+ totalCalls: 0,
31
+ totalFunctionDefinitions: 0
32
+ };
33
+ const results = refineSearch(elements.getElements())
34
+ .flatMap(element => {
35
+ metadata.totalCalls++;
36
+ return (0, search_enrichers_1.enrichmentContent)(element, search_enrichers_1.Enrichment.CallTargets).targets.map(target => {
37
+ metadata.totalFunctionDefinitions++;
38
+ return {
39
+ node: element.node,
40
+ range: element.node.info.fullRange,
41
+ target: target
42
+ };
43
+ });
44
+ });
45
+ return {
46
+ results: results.map(element => ({
47
+ certainty: linter_format_1.LintingResultCertainty.Certain,
48
+ function: element.target,
49
+ range: element.range
50
+ })),
51
+ '.meta': metadata
52
+ };
53
+ },
54
+ prettyPrint: (functionType) => {
55
+ return {
56
+ [linter_format_1.LintingPrettyPrintContext.Query]: (result) => `Function \`${result.function}\` at ${(0, dfg_1.formatRange)(result.range)}`,
57
+ [linter_format_1.LintingPrettyPrintContext.Full]: (result) => `Function \`${result.function}\` called at ${(0, dfg_1.formatRange)(result.range)} is related to ${functionType}`
58
+ };
59
+ },
60
+ requireArgumentValue(element, pool, data, requireValue) {
61
+ const info = pool.find(f => f.name === element.node.lexeme);
62
+ /* if we have no additional info, we assume they always access the network */
63
+ if (info === undefined) {
64
+ return true;
65
+ }
66
+ const vert = data.dataflow.graph.getVertex(element.node.info.id);
67
+ if ((0, vertex_1.isFunctionCallVertex)(vert)) {
68
+ const args = (0, resolve_argument_1.getArgumentStringValue)(data.config.solver.variables, data.dataflow.graph, vert, info.argIdx, info.argName, info.resolveValue);
69
+ // we obtain all values, at least one of them has to trigger for the request
70
+ const argValues = args ? args.values().flatMap(v => [...v]).filter(assert_1.isNotUndefined).toArray() : [];
71
+ /* if there are no arguments we assume they may access the network, otherwise we check for the flag */
72
+ return argValues.length === 0 || argValues.some(v => v === dependencies_query_format_1.Unknown || (requireValue instanceof RegExp ? requireValue.test(v) : v === requireValue));
73
+ }
74
+ return false;
75
+ }
76
+ };
77
+ //# sourceMappingURL=function-finder-util.js.map
@@ -41,10 +41,11 @@ export declare function getMostUsedCasing(symbols: {
41
41
  export declare function fixCasing(identifier: string, convention: CasingConvention): string | undefined;
42
42
  export declare function createNamingConventionQuickFixes(graph: DataflowGraph, nodeId: NodeId, replacement: string, conv: CasingConvention): LintQuickFixReplacement[] | undefined;
43
43
  export declare const NAMING_CONVENTION: {
44
- readonly createSearch: (_config: NamingConventionConfig) => import("../../search/flowr-search-builder").FlowrSearchBuilder<"all", ["filter"], 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>[]>>;
44
+ 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>[]>>>;
45
45
  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: {
46
46
  normalize: import("../../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
47
47
  dataflow: import("../../dataflow/info").DataflowInformation;
48
+ cfg: import("../../control-flow/control-flow-graph").ControlFlowInformation;
48
49
  config: import("../../config").FlowrConfigOptions;
49
50
  }) => {
50
51
  results: {
@@ -0,0 +1,40 @@
1
+ import { LintingRuleCertainty } from '../linter-format';
2
+ import type { FunctionsMetadata, FunctionsResult } from './function-finder-util';
3
+ import { LintingRuleTag } from '../linter-tags';
4
+ import type { MergeableRecord } from '../../util/objects';
5
+ export interface NetworkFunctionsConfig extends MergeableRecord {
6
+ /** The list of function names that should be marked in the given context if their arguments match. */
7
+ fns: readonly string[];
8
+ /** only trigger if the function's read argument is linked to a value that matches this pattern */
9
+ onlyTriggerWithArgument?: RegExp | string;
10
+ }
11
+ export declare const NETWORK_FUNCTIONS: {
12
+ readonly createSearch: (config: NetworkFunctionsConfig) => import("../../search/flowr-search-builder").FlowrSearchBuilder<"all", ["with", "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: (e: 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>[]>, c: NetworkFunctionsConfig, d: {
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
+ config: import("../../config").FlowrConfigOptions;
18
+ }) => {
19
+ results: {
20
+ certainty: import("../linter-format").LintingResultCertainty;
21
+ function: import("../../dataflow/environments/identifier").Identifier;
22
+ range: import("../../util/range").SourceRange;
23
+ }[];
24
+ '.meta': FunctionsMetadata;
25
+ };
26
+ readonly prettyPrint: {
27
+ query: (result: FunctionsResult) => string;
28
+ full: (result: FunctionsResult) => string;
29
+ };
30
+ readonly info: {
31
+ readonly name: "Network Functions";
32
+ readonly tags: readonly [LintingRuleTag.Reproducibility, LintingRuleTag.Security, LintingRuleTag.Performance, LintingRuleTag.Smell];
33
+ readonly certainty: LintingRuleCertainty.BestEffort;
34
+ readonly description: "Marks network functions that execute network operations, such as downloading files or making HTTP requests.";
35
+ readonly defaultConfig: {
36
+ readonly fns: readonly ["read.table", "read.csv", "read.csv2", "read.delim", "read.delim2", "readRDS", "download.file", "url", "GET", "POST", "PUT", "DELETE", "PATCH", "HEAD", "content", "handle", "get_callback", "VERB", "fread", "gzcon", "readlines", "source", "load", "curl_download", "curl_fetch_memory", "getURL", "getForm", "read_html", "html_nodes", "html_text", "fromJSON", "read.xlsx", "drive_download", "drive_get", "s3read_using", "s3write_using", "storage_download", "AnnotationHub", "ExperimentHub"];
37
+ readonly onlyTriggerWithArgument: RegExp;
38
+ };
39
+ };
40
+ };
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NETWORK_FUNCTIONS = void 0;
4
+ const linter_format_1 = require("../linter-format");
5
+ const function_finder_util_1 = require("./function-finder-util");
6
+ const linter_tags_1 = require("../linter-tags");
7
+ const read_functions_1 = require("../../queries/catalog/dependencies-query/function-info/read-functions");
8
+ exports.NETWORK_FUNCTIONS = {
9
+ createSearch: (config) => function_finder_util_1.functionFinderUtil.createSearch(config.fns),
10
+ processSearchResult: (e, c, d) => function_finder_util_1.functionFinderUtil.processSearchResult(e, c, d, es => es.filter(e => function_finder_util_1.functionFinderUtil.requireArgumentValue(e, read_functions_1.ReadFunctions, d, c.onlyTriggerWithArgument))),
11
+ prettyPrint: function_finder_util_1.functionFinderUtil.prettyPrint('network operations'),
12
+ info: {
13
+ name: 'Network Functions',
14
+ tags: [linter_tags_1.LintingRuleTag.Reproducibility, linter_tags_1.LintingRuleTag.Security, linter_tags_1.LintingRuleTag.Performance, linter_tags_1.LintingRuleTag.Smell],
15
+ // ensures all network functions found are actually network functions through its limited config, but doesn't find all network functions since the config is pre-crawled, and the DFG may be over-approximated
16
+ certainty: linter_format_1.LintingRuleCertainty.BestEffort,
17
+ description: 'Marks network functions that execute network operations, such as downloading files or making HTTP requests.',
18
+ defaultConfig: {
19
+ fns: ['read.table', 'read.csv', 'read.csv2', 'read.delim', 'read.delim2', 'readRDS', 'download.file', 'url', 'GET', 'POST', 'PUT', 'DELETE', 'PATCH', 'HEAD', 'content', 'handle', 'get_callback', 'VERB', 'fread', 'gzcon', 'readlines', 'source', 'load', 'curl_download', 'curl_fetch_memory', 'getURL', 'getForm', 'read_html', 'html_nodes', 'html_text', 'fromJSON', 'read.xlsx', 'drive_download', 'drive_get', 's3read_using', 's3write_using', 'storage_download', 'AnnotationHub', 'ExperimentHub'],
20
+ onlyTriggerWithArgument: /^(https?|ftps?|file):\/\//
21
+ }
22
+ }
23
+ };
24
+ //# sourceMappingURL=network-functions.js.map
@@ -30,10 +30,11 @@ export interface SeededRandomnessMeta extends MergeableRecord {
30
30
  callsWithNonConstantProducers: number;
31
31
  }
32
32
  export declare const SEEDED_RANDOMNESS: {
33
- readonly createSearch: (config: SeededRandomnessConfig) => import("../../search/flowr-search-builder").FlowrSearchBuilder<"all", ["with", "filter", "with"], 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>[]>>;
33
+ readonly createSearch: (config: SeededRandomnessConfig) => import("../../search/flowr-search-builder").FlowrSearchBuilder<"all", ["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>[]>>>;
34
34
  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 }: {
35
35
  normalize: import("../../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
36
36
  dataflow: import("../../dataflow/info").DataflowInformation;
37
+ cfg: import("../../control-flow/control-flow-graph").ControlFlowInformation;
37
38
  config: import("../../config").FlowrConfigOptions;
38
39
  }) => {
39
40
  results: {
@@ -18,10 +18,11 @@ export interface UnusedDefinitionMetadata extends MergeableRecord {
18
18
  totalConsidered: number;
19
19
  }
20
20
  export declare const UNUSED_DEFINITION: {
21
- readonly createSearch: (config: UnusedDefinitionConfig) => import("../../search/flowr-search-builder").FlowrSearchBuilder<"all", ["filter"], ParentInformation, import("../../search/flowr-search").FlowrSearchElements<ParentInformation, [] | import("../../search/flowr-search").FlowrSearchElement<ParentInformation>[]>>;
21
+ 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>[]>>>;
22
22
  readonly processSearchResult: (elements: import("../../search/flowr-search").FlowrSearchElements<ParentInformation, import("../../search/flowr-search").FlowrSearchElement<ParentInformation>[]>, config: UnusedDefinitionConfig, data: {
23
23
  normalize: NormalizedAst;
24
24
  dataflow: import("../../dataflow/info").DataflowInformation;
25
+ cfg: import("../../control-flow/control-flow-graph").ControlFlowInformation;
25
26
  config: import("../../config").FlowrConfigOptions;
26
27
  }) => {
27
28
  results: UnusedDefinitionResult[];
@@ -16,10 +16,11 @@ export interface UselessLoopMetadata extends MergeableRecord {
16
16
  numOfUselessLoops: number;
17
17
  }
18
18
  export declare const USELESS_LOOP: {
19
- readonly createSearch: () => import("../../search/flowr-search-builder").FlowrSearchBuilder<"all", ["filter"], 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>[]>>;
20
- 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: UselessLoopConfig, data: {
19
+ 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>[]>>>;
20
+ 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, { config, dataflow, normalize, cfg }: {
21
21
  normalize: import("../../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
22
22
  dataflow: import("../../dataflow/info").DataflowInformation;
23
+ cfg: import("../../control-flow/control-flow-graph").ControlFlowInformation;
23
24
  config: import("../../config").FlowrConfigOptions;
24
25
  }) => {
25
26
  results: {
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.USELESS_LOOP = void 0;
4
- const extract_cfg_1 = require("../../control-flow/extract-cfg");
5
4
  const useless_loop_1 = require("../../control-flow/useless-loop");
6
5
  const vertex_1 = require("../../dataflow/graph/vertex");
7
6
  const flowr_search_builder_1 = require("../../search/flowr-search-builder");
@@ -10,15 +9,14 @@ const linter_format_1 = require("../linter-format");
10
9
  const linter_tags_1 = require("../linter-tags");
11
10
  exports.USELESS_LOOP = {
12
11
  createSearch: () => flowr_search_builder_1.Q.all().filter(vertex_1.VertexType.FunctionCall),
13
- processSearchResult: (elements, config, data) => {
14
- const cfg = (0, extract_cfg_1.extractCfg)(data.normalize, data.config, data.dataflow.graph);
12
+ processSearchResult: (elements, useLessLoopConfig, { config, dataflow, normalize, cfg }) => {
15
13
  const results = elements.getElements().filter(e => {
16
- const vertex = data.dataflow.graph.getVertex(e.node.info.id);
14
+ const vertex = dataflow.graph.getVertex(e.node.info.id);
17
15
  return vertex
18
16
  && (0, vertex_1.isFunctionCallVertex)(vertex)
19
17
  && vertex.origin !== 'unnamed'
20
- && config.loopyFunctions.has(vertex.origin[0]);
21
- }).filter(loop => (0, useless_loop_1.onlyLoopsOnce)(loop.node.info.id, data.dataflow.graph, cfg, data.normalize, data.config)).map(res => ({
18
+ && useLessLoopConfig.loopyFunctions.has(vertex.origin[0]);
19
+ }).filter(loop => (0, useless_loop_1.onlyLoopsOnce)(loop.node.info.id, dataflow.graph, cfg, normalize, config)).map(res => ({
22
20
  certainty: linter_format_1.LintingResultCertainty.Certain,
23
21
  name: res.node.lexeme,
24
22
  range: res.node.info.fullRange
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eagleoutice/flowr",
3
- "version": "2.4.8",
3
+ "version": "2.6.0",
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": {
@@ -30,6 +30,7 @@
30
30
  "wiki:normalized-ast": "ts-node src/documentation/print-normalized-ast-wiki.ts",
31
31
  "wiki:query-api": "ts-node src/documentation/print-query-wiki.ts",
32
32
  "wiki:core": "ts-node src/documentation/print-core-wiki.ts",
33
+ "wiki:analyzer": "ts-node src/documentation/print-analyzer-wiki.ts",
33
34
  "wiki:engines": "ts-node src/documentation/print-engines-wiki.ts",
34
35
  "wiki:search-api": "ts-node src/documentation/print-search-wiki.ts",
35
36
  "wiki:linting-and-testing": "ts-node src/documentation/print-linting-and-testing-wiki.ts",
@@ -183,6 +184,7 @@
183
184
  "@j-ulrich/release-it-regex-bumper": "^5.3.0",
184
185
  "@types/command-line-args": "^5.2.3",
185
186
  "@types/command-line-usage": "^5.0.4",
187
+ "@types/commonmark": "^0.27.10",
186
188
  "@types/n-readlines": "^1.0.6",
187
189
  "@types/n3": "^1.26.0",
188
190
  "@types/object-hash": "^3.0.6",
@@ -212,6 +214,8 @@
212
214
  "clipboardy": "^4.0.0",
213
215
  "command-line-args": "^6.0.1",
214
216
  "command-line-usage": "^7.0.3",
217
+ "commonmark": "^0.31.2",
218
+ "gray-matter": "^4.0.3",
215
219
  "joi": "^18.0.1",
216
220
  "lz-string": "^1.5.0",
217
221
  "n-readlines": "^1.0.1",
@@ -0,0 +1,93 @@
1
+ import type { KnownParser } from '../../r-bridge/parser';
2
+ import type { CacheInvalidationEvent } from './flowr-cache';
3
+ import { FlowrCache } from './flowr-cache';
4
+ import type { DEFAULT_DATAFLOW_PIPELINE, TREE_SITTER_DATAFLOW_PIPELINE } from '../../core/steps/pipeline/default-pipelines';
5
+ import type { FlowrConfigOptions } from '../../config';
6
+ import type { RParseRequests } from '../../r-bridge/retriever';
7
+ import type { IdGenerator } from '../../r-bridge/lang-4.x/ast/model/processing/decorate';
8
+ import type { NoInfo } from '../../r-bridge/lang-4.x/ast/model/model';
9
+ import type { TreeSitterExecutor } from '../../r-bridge/lang-4.x/tree-sitter/tree-sitter-executor';
10
+ import type { PipelineOutput } from '../../core/steps/pipeline/pipeline';
11
+ import type { CfgSimplificationPassName } from '../../control-flow/cfg-simplification';
12
+ import type { ControlFlowInformation } from '../../control-flow/control-flow-graph';
13
+ interface FlowrAnalyzerCacheOptions<Parser extends KnownParser> {
14
+ parser: Parser;
15
+ config: FlowrConfigOptions;
16
+ request: RParseRequests;
17
+ getId?: IdGenerator<NoInfo>;
18
+ overwriteFilePath?: string;
19
+ }
20
+ type AnalyzerCacheType<Parser extends KnownParser> = Parser extends TreeSitterExecutor ? Partial<PipelineOutput<typeof TREE_SITTER_DATAFLOW_PIPELINE>> : Partial<PipelineOutput<typeof DEFAULT_DATAFLOW_PIPELINE>>;
21
+ /**
22
+ * This provides the full analyzer caching layer, please avoid using this directly
23
+ * and prefer the {@link FlowrAnalyzer}.
24
+ */
25
+ export declare class FlowrAnalyzerCache<Parser extends KnownParser> extends FlowrCache<AnalyzerCacheType<Parser>> {
26
+ private args;
27
+ private pipeline;
28
+ private controlFlowCache;
29
+ protected constructor(args: FlowrAnalyzerCacheOptions<Parser>);
30
+ private initCacheProviders;
31
+ static create<Parser extends KnownParser>(data: FlowrAnalyzerCacheOptions<Parser>): FlowrAnalyzerCache<Parser>;
32
+ receive(event: CacheInvalidationEvent): void;
33
+ private get;
34
+ reset(): void;
35
+ private runTapeUntil;
36
+ /**
37
+ * Get the parse output for the request, parsing if necessary.
38
+ * @param force - Do not use the cache, instead force a new parse.
39
+ *
40
+ * @see {@link FlowrAnalyzerCache#peekParse} - to get the parse output if already available without triggering a new parse.
41
+ */
42
+ parse(force?: boolean): Promise<NonNullable<AnalyzerCacheType<Parser>['parse']>>;
43
+ /**
44
+ * Get the parse output for the request if already available, otherwise return `undefined`.
45
+ * This will not trigger a new parse.
46
+ *
47
+ * @see {@link FlowrAnalyzerCache#parse} - to get the parse output, parsing if necessary.
48
+ */
49
+ peekParse(): NonNullable<AnalyzerCacheType<Parser>['parse']> | undefined;
50
+ /**
51
+ * Get the normalized abstract syntax tree for the request, normalizing if necessary.
52
+ * @param force - Do not use the cache, instead force new analyses.
53
+ * @see {@link FlowrAnalyzerCache#peekNormalize} - to get the normalized AST if already available without triggering a new normalization.
54
+ */
55
+ normalize(force?: boolean): Promise<NonNullable<AnalyzerCacheType<Parser>['normalize']>>;
56
+ /**
57
+ * Get the normalized abstract syntax tree for the request if already available, otherwise return `undefined`.
58
+ * This will not trigger a new normalization.
59
+ *
60
+ * @see {@link FlowrAnalyzerCache#normalize} - to get the normalized AST, normalizing if necessary.
61
+ */
62
+ peekNormalize(): NonNullable<AnalyzerCacheType<Parser>['normalize']> | undefined;
63
+ /**
64
+ * Get the dataflow graph for the request, computing if necessary.
65
+ * @param force - Do not use the cache, instead force new analyses.
66
+ *
67
+ * @see {@link FlowrAnalyzerCache#peekDataflow} - to get the dataflow graph if already available without triggering a new computation.
68
+ */
69
+ dataflow(force?: boolean): Promise<NonNullable<AnalyzerCacheType<Parser>['dataflow']>>;
70
+ /**
71
+ * Get the dataflow graph for the request if already available, otherwise return `undefined`.
72
+ * This will not trigger a new computation.
73
+ *
74
+ * @see {@link FlowrAnalyzerCache#dataflow} - to get the dataflow graph, computing if necessary.
75
+ */
76
+ peekDataflow(): NonNullable<AnalyzerCacheType<Parser>['dataflow']> | undefined;
77
+ /**
78
+ * Get the control flow graph (CFG) for the request, computing if necessary.
79
+ * @param force - Do not use the cache, instead force new analyses.
80
+ * @param useDataflow - Whether to use the dataflow graph for the creation of the CFG.
81
+ * @param simplifications - Simplification passes to be applied to the CFG.
82
+ */
83
+ controlflow(force: boolean | undefined, useDataflow: boolean, simplifications: readonly CfgSimplificationPassName[] | undefined): Promise<ControlFlowInformation>;
84
+ /**
85
+ * Get the control flow graph (CFG) for the request if already available, otherwise return `undefined`.
86
+ * @param useDataflow - Whether to use the dataflow graph for the creation of the CFG.
87
+ * @param simplifications - Simplification passes to be applied to the CFG.
88
+ *
89
+ * @see {@link FlowrAnalyzerCache#controlflow} - to get the control flow graph, computing if necessary.
90
+ */
91
+ peekControlflow(useDataflow: boolean, simplifications: readonly CfgSimplificationPassName[] | undefined): ControlFlowInformation | undefined;
92
+ }
93
+ export {};