@eagleoutice/flowr 2.16.3 → 2.16.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/README.md +14 -14
  2. package/dataflow/environments/query-fn-props.js +2 -1
  3. package/dataflow/eval/resolve/resolve.js +2 -6
  4. package/documentation/doc-util/doc-query.d.ts +1 -1
  5. package/documentation/doc-util/doc-query.js +3 -1
  6. package/documentation/doc-util/doc-timings.js +3 -2
  7. package/documentation/wiki-create-linting-rules.js +1 -1
  8. package/documentation/wiki-linter.d.ts +14 -0
  9. package/documentation/wiki-linter.js +341 -126
  10. package/linter/linter-rules.d.ts +47 -47
  11. package/linter/rules/absolute-path.d.ts +1 -1
  12. package/linter/rules/absolute-path.js +6 -4
  13. package/linter/rules/cmd-check/call-arguments.d.ts +1 -1
  14. package/linter/rules/cmd-check/call-arguments.js +10 -5
  15. package/linter/rules/cmd-check/compiled-code.d.ts +1 -1
  16. package/linter/rules/cmd-check/compiled-code.js +1 -1
  17. package/linter/rules/cmd-check/conformance.d.ts +5 -1
  18. package/linter/rules/cmd-check/conformance.js +64 -64
  19. package/linter/rules/cmd-check/description-metadata.d.ts +1 -1
  20. package/linter/rules/cmd-check/description-metadata.js +1 -1
  21. package/linter/rules/cmd-check/documentation-mismatch.d.ts +6 -0
  22. package/linter/rules/cmd-check/foreign-function-calls.d.ts +1 -1
  23. package/linter/rules/cmd-check/foreign-function-calls.js +1 -1
  24. package/linter/rules/cmd-check/namespace-tampering.d.ts +1 -1
  25. package/linter/rules/cmd-check/namespace-tampering.js +1 -1
  26. package/linter/rules/cmd-check/non-ascii-code.d.ts +1 -1
  27. package/linter/rules/cmd-check/non-ascii-code.js +1 -1
  28. package/linter/rules/cmd-check/package-data.d.ts +3 -1
  29. package/linter/rules/cmd-check/package-data.js +1 -1
  30. package/linter/rules/cmd-check/package-hooks.d.ts +2 -2
  31. package/linter/rules/cmd-check/package-hooks.js +13 -5
  32. package/linter/rules/cmd-check/package-metafiles.d.ts +1 -1
  33. package/linter/rules/cmd-check/package-metafiles.js +1 -1
  34. package/linter/rules/cmd-check/package-structure.d.ts +1 -1
  35. package/linter/rules/cmd-check/package-structure.js +1 -1
  36. package/linter/rules/cmd-check/rd-files.d.ts +17 -1
  37. package/linter/rules/cmd-check/rd-files.js +1 -1
  38. package/linter/rules/cmd-check/true-false-abbreviation.d.ts +1 -1
  39. package/linter/rules/cmd-check/true-false-abbreviation.js +1 -1
  40. package/linter/rules/dataframe-access-validation.d.ts +1 -1
  41. package/linter/rules/dataframe-access-validation.js +1 -1
  42. package/linter/rules/dead-code.d.ts +4 -4
  43. package/linter/rules/dead-code.js +19 -4
  44. package/linter/rules/deprecated-functions.d.ts +1 -1
  45. package/linter/rules/deprecated-functions.js +1 -1
  46. package/linter/rules/file-path-validity.d.ts +6 -2
  47. package/linter/rules/file-path-validity.js +7 -3
  48. package/linter/rules/namespace-access.d.ts +3 -3
  49. package/linter/rules/namespace-access.js +12 -3
  50. package/linter/rules/naming-convention.d.ts +1 -1
  51. package/linter/rules/naming-convention.js +1 -1
  52. package/linter/rules/network-functions.d.ts +1 -1
  53. package/linter/rules/network-functions.js +1 -1
  54. package/linter/rules/no-leaked-credentials.d.ts +1 -1
  55. package/linter/rules/no-leaked-credentials.js +1 -1
  56. package/linter/rules/problematic-inputs.d.ts +2 -2
  57. package/linter/rules/problematic-inputs.js +2 -2
  58. package/linter/rules/roxygen-arguments.d.ts +2 -2
  59. package/linter/rules/roxygen-arguments.js +2 -2
  60. package/linter/rules/seeded-randomness.d.ts +2 -2
  61. package/linter/rules/seeded-randomness.js +2 -2
  62. package/linter/rules/software-has-license.d.ts +2 -2
  63. package/linter/rules/software-has-license.js +2 -2
  64. package/linter/rules/software-has-tests.d.ts +2 -2
  65. package/linter/rules/software-has-tests.js +2 -2
  66. package/linter/rules/stop-with-call-arg.d.ts +3 -3
  67. package/linter/rules/stop-with-call-arg.js +21 -4
  68. package/linter/rules/syntactically-valid.d.ts +1 -1
  69. package/linter/rules/syntactically-valid.js +1 -1
  70. package/linter/rules/unclosed-connection.d.ts +2 -2
  71. package/linter/rules/unclosed-connection.js +2 -2
  72. package/linter/rules/undefined-symbol.d.ts +1 -1
  73. package/linter/rules/undefined-symbol.js +1 -1
  74. package/linter/rules/unescaped-arguments.d.ts +1 -1
  75. package/linter/rules/unescaped-arguments.js +1 -1
  76. package/linter/rules/unused-definition.d.ts +1 -1
  77. package/linter/rules/unused-definition.js +1 -1
  78. package/linter/rules/unused-import.d.ts +1 -1
  79. package/linter/rules/unused-import.js +1 -1
  80. package/linter/rules/useless-loop.d.ts +1 -1
  81. package/linter/rules/useless-loop.js +1 -1
  82. package/package.json +1 -1
  83. package/project/context/flowr-analyzer-environment-context.d.ts +1 -1
  84. package/project/context/flowr-analyzer-environment-context.js +2 -1
  85. package/project/context/flowr-analyzer-files-context.js +12 -11
  86. package/project/plugins/file-plugins/flowr-analyzer-test-file-plugin.js +1 -1
  87. package/project/plugins/file-plugins/flowr-analyzer-vignette-file-plugin.js +1 -1
  88. package/queries/catalog/dependencies-query/data-flow.d.ts +2 -0
  89. package/queries/catalog/dependencies-query/data-flow.js +6 -0
  90. package/queries/catalog/dependencies-query/implicit-echo.js +3 -1
  91. package/util/version.js +2 -2
@@ -304,7 +304,7 @@ exports.UNUSED_DEFINITION = {
304
304
  },
305
305
  info: {
306
306
  name: 'Unused Definitions',
307
- description: 'Checks for unused definitions.',
307
+ description: 'Finds definitions that are never used.',
308
308
  tags: [linter_tags_1.LintingRuleTag.Readability, linter_tags_1.LintingRuleTag.Smell, linter_tags_1.LintingRuleTag.QuickFix],
309
309
  // our limited analysis causes unused definitions involving complex reflection etc. not to be included in our result, but unused definitions are correctly validated
310
310
  certainty: linter_format_1.LintingRuleCertainty.BestEffort,
@@ -55,7 +55,7 @@ export declare const UNUSED_IMPORT: {
55
55
  readonly name: "Unused Import";
56
56
  readonly tags: readonly [LintingRuleTag.Smell, LintingRuleTag.Readability, LintingRuleTag.QuickFix];
57
57
  readonly certainty: LintingRuleCertainty.BestEffort;
58
- readonly description: "Highlights packages that are attached but never used, so the code runs just the same without them. Requires a signature database, and packages that only do their work on load should be whitelisted in the configuration.";
58
+ readonly description: "Finds packages that are attached but never used, so the code runs just the same without them. Requires a signature database, and packages that only do their work on load should be whitelisted in the configuration.";
59
59
  readonly defaultConfig: () => {
60
60
  whitelist: never[];
61
61
  };
@@ -161,7 +161,7 @@ exports.UNUSED_IMPORT = {
161
161
  name: 'Unused Import',
162
162
  tags: [linter_tags_1.LintingRuleTag.Smell, linter_tags_1.LintingRuleTag.Readability, linter_tags_1.LintingRuleTag.QuickFix],
163
163
  certainty: linter_format_1.LintingRuleCertainty.BestEffort,
164
- description: 'Highlights packages that are attached but never used, so the code runs just the same without them. Requires a signature database, and packages that only do their work on load should be whitelisted in the configuration.',
164
+ description: 'Finds packages that are attached but never used, so the code runs just the same without them. Requires a signature database, and packages that only do their work on load should be whitelisted in the configuration.',
165
165
  defaultConfig: () => ({
166
166
  whitelist: []
167
167
  })
@@ -31,7 +31,7 @@ export declare const USELESS_LOOP: {
31
31
  };
32
32
  readonly info: {
33
33
  readonly name: "Useless Loops";
34
- readonly description: "Detect loops which only iterate once";
34
+ readonly description: "Finds loops that iterate only once.";
35
35
  readonly certainty: LintingRuleCertainty.BestEffort;
36
36
  readonly tags: readonly [LintingRuleTag.Smell, LintingRuleTag.Readability];
37
37
  readonly defaultConfig: () => {
@@ -38,7 +38,7 @@ exports.USELESS_LOOP = {
38
38
  },
39
39
  info: {
40
40
  name: 'Useless Loops',
41
- description: 'Detect loops which only iterate once',
41
+ description: 'Finds loops that iterate only once.',
42
42
  certainty: linter_format_1.LintingRuleCertainty.BestEffort,
43
43
  tags: [linter_tags_1.LintingRuleTag.Smell, linter_tags_1.LintingRuleTag.Readability],
44
44
  defaultConfig: () => ({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eagleoutice/flowr",
3
- "version": "2.16.3",
3
+ "version": "2.16.4",
4
4
  "description": "Static Dataflow Analyzer and Program Slicer for the R Programming Language",
5
5
  "engines": {
6
6
  "node": ">=22"
@@ -16,7 +16,7 @@ export interface ReadOnlyFlowrAnalyzerEnvironmentContext {
16
16
  */
17
17
  get builtInEnvironment(): DeepReadonly<IEnvironment>;
18
18
  /**
19
- * Every built-in definition flowR carries for `name`, matched by its plain name.
19
+ * Every built-in definition flowR carries for `name`: what its namespace states when it names one, else matched by its plain name.
20
20
  */
21
21
  builtInDefinitionsOf(name: Identifier): readonly IdentifierDefinition[];
22
22
  /**
@@ -85,7 +85,8 @@ class FlowrAnalyzerEnvironmentContext {
85
85
  return this.emptyBuiltInEnv;
86
86
  }
87
87
  builtInDefinitionsOf(name) {
88
- return this.builtInEnv.memory.get(identifier_1.Identifier.getName(name)) ?? this.statedDefinitionsOf(name) ?? [];
88
+ const namespaced = identifier_1.Identifier.getNamespace(name) === undefined ? undefined : this.statedDefinitionsOf(name);
89
+ return namespaced ?? this.builtInEnv.memory.get(identifier_1.Identifier.getName(name)) ?? this.statedDefinitionsOf(name) ?? [];
89
90
  }
90
91
  knowsPackage(pkg) {
91
92
  if (this.knownPackages === undefined) {
@@ -251,9 +251,9 @@ class FlowrAnalyzerFilesContext extends abstract_flowr_analyzer_context_1.Abstra
251
251
  this.inlineFiles.push(f);
252
252
  }
253
253
  else {
254
- const exist = this.files.get(f.path());
254
+ const exist = this.files.get(files_1.RPath.of(f.path()));
255
255
  (0, assert_1.guard)(exist === undefined || exist === f, `File ${f.path()} already added to the context.`);
256
- this.files.set(f.path(), f);
256
+ this.files.set(files_1.RPath.of(f.path()), f);
257
257
  this.caseIndex = undefined;
258
258
  }
259
259
  if (f.roles) {
@@ -265,7 +265,7 @@ class FlowrAnalyzerFilesContext extends abstract_flowr_analyzer_context_1.Abstra
265
265
  return f;
266
266
  }
267
267
  hasCached(path) {
268
- return this.files.has(path);
268
+ return this.files.has(files_1.RPath.of(path));
269
269
  }
270
270
  hasFile(path) {
271
271
  return this.hasCached(path) || (this.ctx.config.project.resolveUnknownPathsOnDisk && onDisk(path));
@@ -273,14 +273,15 @@ class FlowrAnalyzerFilesContext extends abstract_flowr_analyzer_context_1.Abstra
273
273
  fileIndex() {
274
274
  if (this.caseIndex === undefined) {
275
275
  const index = new Map();
276
- for (const f of this.files.keys()) {
277
- const dir = path_1.default.dirname(f).toLowerCase();
276
+ for (const file of this.files.values()) {
277
+ const f = file.path();
278
+ const dir = files_1.RPath.dirname(f).toLowerCase();
278
279
  let entries = index.get(dir);
279
280
  if (entries === undefined) {
280
281
  entries = new Map();
281
282
  index.set(dir, entries);
282
283
  }
283
- const base = path_1.default.basename(f).toLowerCase();
284
+ const base = files_1.RPath.basename(f).toLowerCase();
284
285
  if (!entries.has(base)) {
285
286
  entries.set(base, f);
286
287
  }
@@ -314,14 +315,14 @@ class FlowrAnalyzerFilesContext extends abstract_flowr_analyzer_context_1.Abstra
314
315
  if (this.hasFile(p)) {
315
316
  return p;
316
317
  }
317
- const dir = path_1.default.dirname(p);
318
- const file = path_1.default.basename(p).toLowerCase();
318
+ const file = files_1.RPath.basename(p).toLowerCase();
319
319
  // try to find in local known files first
320
- const known = this.fileIndex().get(dir.toLowerCase())?.get(file);
320
+ const known = this.fileIndex().get(files_1.RPath.dirname(p).toLowerCase())?.get(file);
321
321
  if (known !== undefined) {
322
322
  return known;
323
323
  }
324
324
  if (this.ctx.config.project.resolveUnknownPathsOnDisk) {
325
+ const dir = path_1.default.dirname(p);
325
326
  let realDir = dir;
326
327
  let files = this.readdir(dir);
327
328
  if (files === undefined) {
@@ -366,7 +367,7 @@ class FlowrAnalyzerFilesContext extends abstract_flowr_analyzer_context_1.Abstra
366
367
  }
367
368
  /** Resolve the file at `path`, loading it from disk through the {@link FlowrAnalyzerFilePlugin}s if unknown. */
368
369
  resolveFile(path) {
369
- const file = this.files.get(path);
370
+ const file = this.files.get(files_1.RPath.of(path));
370
371
  if (file !== undefined && file !== null) {
371
372
  return file;
372
373
  }
@@ -430,7 +431,7 @@ class FlowrAnalyzerFilesContext extends abstract_flowr_analyzer_context_1.Abstra
430
431
  return [...this.files.values(), ...this.inlineFiles];
431
432
  }
432
433
  getFileByPath(path) {
433
- return this.files.get(path) ?? this.inlineFiles.find(f => f.path() === path);
434
+ return this.files.get(files_1.RPath.of(path)) ?? this.inlineFiles.find(f => f.path() === path);
434
435
  }
435
436
  getFileCount() {
436
437
  return this.files.size + this.inlineFiles.length;
@@ -4,7 +4,7 @@ exports.FlowrAnalyzerMetaTestFilesPlugin = void 0;
4
4
  const flowr_analyzer_file_plugin_1 = require("./flowr-analyzer-file-plugin");
5
5
  const semver_1 = require("semver");
6
6
  const flowr_file_1 = require("../../context/flowr-file");
7
- const TestPathPattern = /tests?/i;
7
+ const TestPathPattern = /(^|\/)tests?(\/|$)/i;
8
8
  /**
9
9
  * This plugin provides supports for the identification of test files.
10
10
  * If you use multiple plugins, this should be included *before* other plugins.
@@ -4,7 +4,7 @@ exports.FlowrAnalyzerMetaVignetteFilesPlugin = void 0;
4
4
  const flowr_analyzer_file_plugin_1 = require("./flowr-analyzer-file-plugin");
5
5
  const semver_1 = require("semver");
6
6
  const flowr_file_1 = require("../../context/flowr-file");
7
- const VignettePathPattern = /vignettes?/i;
7
+ const VignettePathPattern = /(^|\/)vignettes?(\/|$)/i;
8
8
  /**
9
9
  * This plugin provides supports for the loading of Vignette files.
10
10
  * If you use multiple plugins, this should be included *before* other plugins.
@@ -31,6 +31,8 @@ export declare function argumentRoles(dataflow: DataflowInformation, call: Dataf
31
31
  * `filter(df, x > 1)`), or a use that only names a function.
32
32
  */
33
33
  export declare function inputVariablesOf(dataflow: DataflowInformation, ast: NormalizedAst, call: DataflowGraphVertexFunctionCall, memo?: FlowMemo): string[];
34
+ /** The variables the value `id` is computed from: those of {@link inputVariablesOf} for a call, the variable itself for a use. */
35
+ export declare function inputVariablesAt(dataflow: DataflowInformation, ast: NormalizedAst, id: NodeId, memo?: FlowMemo): string[];
34
36
  /**
35
37
  * The arguments the call hands on as its own result: the {@link ArgProp.Alias} one of its signature (`(x)`, a pipe
36
38
  * into a call), or both operands of a `+` that adds to a plot, as ggplot's method for it returns the plot.
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.makeFlowMemo = makeFlowMemo;
4
4
  exports.argumentRoles = argumentRoles;
5
5
  exports.inputVariablesOf = inputVariablesOf;
6
+ exports.inputVariablesAt = inputVariablesAt;
6
7
  exports.handedOn = handedOn;
7
8
  exports.assignmentOf = assignmentOf;
8
9
  const vertex_1 = require("../../../dataflow/graph/vertex");
@@ -121,6 +122,11 @@ function inputVariablesOf(dataflow, ast, call, memo) {
121
122
  }
122
123
  return [...into];
123
124
  }
125
+ /** The variables the value `id` is computed from: those of {@link inputVariablesOf} for a call, the variable itself for a use. */
126
+ function inputVariablesAt(dataflow, ast, id, memo) {
127
+ const vertex = dataflow.graph.getVertex(id);
128
+ return vertex_1.DfgVertex.isFunctionCall(vertex) ? inputVariablesOf(dataflow, ast, vertex, memo) : [...variablesOf(dataflow, ast, id, new Set(), memo)];
129
+ }
124
130
  function targetOf(dataflow, assignment, value) {
125
131
  return dataflow.graph.edgesFrom(assignment.id).entries()
126
132
  .find(([to, edge]) => to !== value && edge_1.DfEdge.includesType(edge, edge_1.EdgeType.Returns) && vertex_1.DfgVertex.isVariableDefinition(dataflow.graph.getVertex(to)))?.[0];
@@ -15,6 +15,7 @@ const query_fn_props_1 = require("../../../dataflow/environments/query-fn-props"
15
15
  const built_in_props_1 = require("../../../dataflow/environments/built-in-props");
16
16
  const built_in_ambient_state_1 = require("../../../dataflow/internal/process/functions/call/built-in/built-in-ambient-state");
17
17
  const plot_objects_1 = require("./plot-objects");
18
+ const data_flow_1 = require("./data-flow");
18
19
  const test_functions_1 = require("./function-info/test-functions");
19
20
  /** the node whose value R echoes for a statement, `undefined` if the statement yields nothing visible */
20
21
  function echoedValue(node, dataflow, invisible) {
@@ -148,7 +149,8 @@ function collectImplicitEchoes(ast, dataflow, accountedFor, invisible, result) {
148
149
  if (echoed === undefined || accountedFor.has(echoed.info.id) || (0, plot_objects_1.isPlot)(echoed, dataflow)) {
149
150
  continue;
150
151
  }
151
- result.push({ nodeId: echoed.info.id, functionName: echoName(echoed, dataflow), value: 'stdout', implicit: true });
152
+ const inputs = (0, data_flow_1.inputVariablesAt)(dataflow, ast, echoed.info.id);
153
+ result.push({ nodeId: echoed.info.id, functionName: echoName(echoed, dataflow), value: 'stdout', implicit: true, inputVariables: inputs.length > 0 ? inputs : undefined });
152
154
  }
153
155
  }
154
156
  }
package/util/version.js CHANGED
@@ -43,9 +43,9 @@ const sigdb_download_1 = require("../project/sigdb/sigdb-download");
43
43
  const doc_files_1 = require("../documentation/doc-util/doc-files");
44
44
  const strings_1 = require("./text/strings");
45
45
  // this is automatically replaced with the current version by release-it
46
- const version = '2.16.3';
46
+ const version = '2.16.4';
47
47
  // this is automatically replaced with the release date by release-it (scripts/bump-version.ts)
48
- const versionDate = '2026-10-19T07:04:59Z';
48
+ const versionDate = '2026-10-19T19:06:26Z';
49
49
  /**
50
50
  * Retrieves the current flowR version as a new {@link SemVer} object.
51
51
  */