@eagleoutice/flowr 2.10.6 → 2.10.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/README.md +9 -9
  2. package/abstract-interpretation/domains/multi-value-state-domain.d.ts +4 -10
  3. package/abstract-interpretation/domains/multi-value-state-domain.js +1 -6
  4. package/abstract-interpretation/domains/partial-product-domain.d.ts +6 -2
  5. package/abstract-interpretation/domains/partial-product-domain.js +7 -3
  6. package/control-flow/semantic-cfg-guided-visitor.js +1 -0
  7. package/dataflow/environments/built-in-proc-name.d.ts +22 -20
  8. package/dataflow/environments/built-in-proc-name.js +22 -20
  9. package/dataflow/environments/built-in.d.ts +19 -19
  10. package/dataflow/environments/identifier.d.ts +5 -0
  11. package/dataflow/environments/reference-to-maybe.js +32 -6
  12. package/dataflow/eval/resolve/alias-tracking.js +5 -0
  13. package/dataflow/graph/graph.js +51 -30
  14. package/dataflow/graph/vertex.d.ts +12 -11
  15. package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +49 -12
  16. package/dataflow/internal/process/functions/call/built-in/built-in-attach.d.ts +4 -2
  17. package/dataflow/internal/process/functions/call/built-in/built-in-attach.js +12 -6
  18. package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +22 -8
  19. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +57 -1
  20. package/dataflow/internal/process/functions/call/built-in/built-in-new-env.d.ts +1 -1
  21. package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.js +7 -7
  22. package/documentation/wiki-linting-and-testing.js +1 -1
  23. package/documentation/wiki-mk/doc-context.d.ts +21 -1
  24. package/documentation/wiki-mk/doc-context.js +9 -0
  25. package/documentation/wiki-search.js +13 -2
  26. package/linter/linter-format.d.ts +4 -0
  27. package/linter/linter-rules.d.ts +9 -7
  28. package/linter/rules/absolute-path.d.ts +3 -2
  29. package/linter/rules/absolute-path.js +37 -12
  30. package/linter/rules/dataframe-access-validation.d.ts +4 -7
  31. package/linter/rules/dataframe-access-validation.js +3 -3
  32. package/linter/rules/dead-code.d.ts +4 -7
  33. package/linter/rules/file-path-validity.d.ts +9 -4
  34. package/linter/rules/file-path-validity.js +83 -36
  35. package/linter/rules/function-finder-util.d.ts +1 -3
  36. package/linter/rules/function-finder-util.js +2 -2
  37. package/linter/rules/naming-convention.d.ts +0 -2
  38. package/linter/rules/network-functions.js +4 -1
  39. package/linter/rules/problematic-inputs.d.ts +0 -2
  40. package/linter/rules/problematic-inputs.js +4 -1
  41. package/linter/rules/roxygen-arguments.d.ts +0 -2
  42. package/linter/rules/seeded-randomness.d.ts +0 -2
  43. package/linter/rules/stop-with-call-arg.d.ts +3 -6
  44. package/linter/rules/unused-definition.d.ts +0 -2
  45. package/linter/rules/useless-loop.d.ts +0 -2
  46. package/package.json +7 -6
  47. package/queries/catalog/dependencies-query/dependencies-query-executor.js +6 -2
  48. package/queries/catalog/dependencies-query/function-info/function-info.d.ts +2 -0
  49. package/queries/catalog/dependencies-query/function-info/read-functions.js +21 -1
  50. package/queries/catalog/dependencies-query/function-info/source-functions.js +1 -1
  51. package/queries/catalog/dependencies-query/function-info/write-functions.js +18 -1
  52. package/queries/catalog/input-sources-query/input-source-functions.d.ts +3 -1
  53. package/queries/catalog/input-sources-query/input-source-functions.js +322 -46
  54. package/queries/catalog/input-sources-query/input-sources-query-executor.js +14 -9
  55. package/queries/catalog/input-sources-query/input-sources-query-format.d.ts +4 -2
  56. package/queries/catalog/input-sources-query/input-sources-query-format.js +8 -4
  57. package/queries/catalog/input-sources-query/simple-input-classifier.d.ts +13 -6
  58. package/queries/catalog/input-sources-query/simple-input-classifier.js +33 -8
  59. package/queries/catalog/linter-query/linter-query-format.d.ts +2 -2
  60. package/queries/catalog/linter-query/linter-query-format.js +9 -3
  61. package/queries/query.d.ts +3 -2
  62. package/r-bridge/lang-4.x/ast/model/processing/decorate.d.ts +1 -1
  63. package/r-bridge/lang-4.x/ast/model/processing/decorate.js +16 -16
  64. package/r-bridge/lang-4.x/ast/model/processing/node-id.d.ts +6 -0
  65. package/r-bridge/lang-4.x/ast/model/processing/node-id.js +8 -0
  66. package/search/flowr-search-builder.d.ts +64 -16
  67. package/search/flowr-search-builder.js +41 -16
  68. package/search/flowr-search-filters.d.ts +10 -1
  69. package/search/flowr-search-filters.js +10 -0
  70. package/search/flowr-search.d.ts +17 -3
  71. package/search/search-executor/search-generators.d.ts +3 -1
  72. package/search/search-executor/search-generators.js +30 -4
  73. package/slicing/static/static-slicer.js +2 -2
  74. package/util/range.d.ts +13 -1
  75. package/util/range.js +32 -2
  76. package/util/text/strings.d.ts +7 -0
  77. package/util/text/strings.js +23 -0
  78. package/util/version.js +1 -1
@@ -1,6 +1,5 @@
1
1
  import { type LintingResult, LintingRuleCertainty } from '../linter-format';
2
2
  import type { MergeableRecord } from '../../util/objects';
3
- import { SourceLocation } from '../../util/range';
4
3
  import { LintingRuleTag } from '../linter-tags';
5
4
  import type { InputClassifierConfig, InputSources } from '../../queries/catalog/input-sources-query/simple-input-classifier';
6
5
  export interface PipeCommandFunctionSpec {
@@ -10,7 +9,6 @@ export interface PipeCommandFunctionSpec {
10
9
  }
11
10
  export interface ProblematicInputsResult extends LintingResult {
12
11
  name: string;
13
- loc: SourceLocation;
14
12
  sources: InputSources;
15
13
  pipeCommand?: string;
16
14
  }
@@ -84,7 +84,10 @@ function checkPipeInjection(nid, loc, name, sources) {
84
84
  exports.PROBLEMATIC_INPUTS = {
85
85
  createSearch: config => {
86
86
  const toQ = (name, subkind) => ({ type: 'call-context', callName: name, callNameExact: false, subkind });
87
- return flowr_search_builder_1.Q.fromQuery(...normalizePatternList(config?.consider, defaultConsider).map((n, i) => toQ(n, `fn-${i}`)), ...normalizePipeSpecs(config?.pipeCommandFunctions).map((s, i) => toQ(s.pattern, `pipe-${i}`)));
87
+ return flowr_search_builder_1.Q.fromQuery([
88
+ ...normalizePatternList(config?.consider, defaultConsider).map((n, i) => toQ(n, `fn-${i}`)),
89
+ ...normalizePipeSpecs(config?.pipeCommandFunctions).map((s, i) => toQ(s.pattern, `pipe-${i}`))
90
+ ]);
88
91
  },
89
92
  processSearchResult: async (elements, config, data) => {
90
93
  const results = [];
@@ -1,10 +1,8 @@
1
1
  import { type LintingResult, LintingRuleCertainty } from '../linter-format';
2
- import { SourceLocation } from '../../util/range';
3
2
  import type { MergeableRecord } from '../../util/objects';
4
3
  import { LintingRuleTag } from '../linter-tags';
5
4
  import type { Writable } from 'ts-essentials';
6
5
  export interface RoxygenArgsResult extends LintingResult {
7
- readonly loc: SourceLocation;
8
6
  readonly overDocumented?: string[];
9
7
  readonly underDocumented?: string[];
10
8
  }
@@ -1,11 +1,9 @@
1
1
  import { type LintingResult, LintingResultCertainty, LintingRuleCertainty } from '../linter-format';
2
- import { SourceLocation } from '../../util/range';
3
2
  import type { MergeableRecord } from '../../util/objects';
4
3
  import type { BrandedIdentifier } from '../../dataflow/environments/identifier';
5
4
  import { LintingRuleTag } from '../linter-tags';
6
5
  export interface SeededRandomnessResult extends LintingResult {
7
6
  function: string;
8
- loc: SourceLocation;
9
7
  }
10
8
  export interface SeededRandomnessConfig extends MergeableRecord {
11
9
  /**
@@ -1,11 +1,8 @@
1
1
  import { type LintingResult, LintingRuleCertainty } from '../linter-format';
2
- import { SourceLocation } from '../../util/range';
3
2
  import type { MergeableRecord } from '../../util/objects';
4
3
  import { LintingRuleTag } from '../linter-tags';
5
4
  import type { Writable } from 'ts-essentials';
6
- export interface StopWithCallResult extends LintingResult {
7
- readonly loc: SourceLocation;
8
- }
5
+ export type StopWithCallResult = LintingResult;
9
6
  export type StopWithCallConfig = MergeableRecord;
10
7
  export interface StopWithCallMetadata extends MergeableRecord {
11
8
  consideredNodes: number;
@@ -22,8 +19,8 @@ export declare const STOP_WITH_CALL_ARG: {
22
19
  '.meta': StopWithCallMetadata;
23
20
  };
24
21
  readonly prettyPrint: {
25
- readonly query: (result: StopWithCallResult) => string;
26
- readonly full: (result: StopWithCallResult) => string;
22
+ readonly query: (result: LintingResult) => string;
23
+ readonly full: (result: LintingResult) => string;
27
24
  };
28
25
  readonly info: {
29
26
  readonly name: "Stop without call.=False argument";
@@ -1,11 +1,9 @@
1
1
  import { type LintingResult, LintingRuleCertainty } from '../linter-format';
2
2
  import type { MergeableRecord } from '../../util/objects';
3
- import { SourceLocation } from '../../util/range';
4
3
  import { LintingRuleTag } from '../linter-tags';
5
4
  import type { NormalizedAst, ParentInformation } from '../../r-bridge/lang-4.x/ast/model/processing/decorate';
6
5
  export interface UnusedDefinitionResult extends LintingResult {
7
6
  variableName?: string;
8
- loc: SourceLocation;
9
7
  }
10
8
  export interface UnusedDefinitionConfig extends MergeableRecord {
11
9
  /**
@@ -1,11 +1,9 @@
1
1
  import type { MergeableRecord } from '../../util/objects';
2
- import { SourceLocation } from '../../util/range';
3
2
  import { type LintingResult, LintingResultCertainty, LintingRuleCertainty } from '../linter-format';
4
3
  import { LintingRuleTag } from '../linter-tags';
5
4
  import type { BuiltInProcName } from '../../dataflow/environments/built-in-proc-name';
6
5
  export interface UselessLoopResult extends LintingResult {
7
6
  name: string;
8
- loc: SourceLocation;
9
7
  }
10
8
  export interface UselessLoopConfig extends MergeableRecord {
11
9
  /** Function origins that are considered loops */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eagleoutice/flowr",
3
- "version": "2.10.6",
3
+ "version": "2.10.8",
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": {
@@ -35,17 +35,18 @@
35
35
  "build:copy-wasm": "mkdir -p dist/node_modules/@davisvaughan/tree-sitter-r/ && mkdir -p dist/node_modules/web-tree-sitter && cp node_modules/@davisvaughan/tree-sitter-r/tree-sitter-r.wasm dist/node_modules/@davisvaughan/tree-sitter-r/ && cp node_modules/web-tree-sitter/tree-sitter.wasm dist/node_modules/web-tree-sitter/",
36
36
  "lint-local": "npx eslint --version && npx eslint src/ test/ --rule \"no-warning-comments: off\"",
37
37
  "lint": "npm run license-compat -- --summary && npx eslint --version && npx eslint src/ test/",
38
- "license-compat": "license-checker-rseidelsohn --onlyAllow 'MIT;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'",
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
41
  "test:system": "vitest --dir test/system-tests --config test/system-tests/vitest.config.mts",
42
42
  "test:coverage": "npm run test -- --coverage",
43
43
  "test:full": "npm run test-full",
44
+ "test:bench": "vitest bench --config test/vitest.config.mts",
44
45
  "test-full": "npm run test:coverage -- --no-watch -- --make-summary --test-installation",
45
46
  "performance-test": "func() { cd test/performance/ && bash run-all-suites.sh $1 $2 $3 $4; cd ../../; }; func",
46
47
  "test:performance": "npm run performance-test --",
47
48
  "detect-circular-deps": "npx madge --extensions ts,tsx --circular src/",
48
- "checkup": "npm run flowr -- --execute \":version\" && npm run lint && npm run test-full -- --allowOnly=false && npm run test:system -- --no-watch && docker build -t test-flowr -f scripts/Dockerfile . && npm run doc && npm run gen:readme && npm-run-all wiki:*"
49
+ "checkup": "npm run flowr -- --execute \":version\" && npm run lint && npm run test-full -- --allowOnly=false && npm run test:system -- --no-watch && docker build -t test-flowr -f scripts/Dockerfile . && npm run doc && npm run wiki"
49
50
  },
50
51
  "keywords": [
51
52
  "static code analysis",
@@ -183,8 +184,8 @@
183
184
  "@types/tmp": "^0.2.6",
184
185
  "@types/ws": "^8.18.1",
185
186
  "@typescript-eslint/eslint-plugin": "^8.40.0",
186
- "@vitest/coverage-v8": "^3.2.4",
187
- "esbuild": "^0.27.2",
187
+ "@vitest/coverage-v8": "^4.1.8",
188
+ "esbuild": "^0.28.1",
188
189
  "eslint": "^9.39.2",
189
190
  "license-checker-rseidelsohn": "^4.4.2",
190
191
  "npm-run-all": "^4.1.5",
@@ -195,7 +196,7 @@
195
196
  "typedoc-theme-hierarchy": "^6.0.0",
196
197
  "typedoc-umlclass": "^0.10.2",
197
198
  "typescript": "^5.9.3",
198
- "vitest": "^3.2.4"
199
+ "vitest": "^4.1.8"
199
200
  },
200
201
  "dependencies": {
201
202
  "@davisvaughan/tree-sitter-r": "^1.2.0",
@@ -162,13 +162,17 @@ function getResults(queries, { dataflow, config, normalize }, results, kind, fun
162
162
  }
163
163
  for (const [arg, values] of foundValues.entries()) {
164
164
  for (const value of values) {
165
- const dep = value ? d.getDependency(value) ?? undefined : undefined;
165
+ let resolvedValue = value;
166
+ if (info.stringReplacements && resolvedValue !== undefined && Object.hasOwn(info.stringReplacements, resolvedValue)) {
167
+ resolvedValue = info.stringReplacements[resolvedValue];
168
+ }
169
+ const dep = resolvedValue ? d.getDependency(resolvedValue) ?? undefined : undefined;
166
170
  finalResults.push((0, objects_1.compactRecord)({
167
171
  nodeId: id,
168
172
  functionName: vertex.name,
169
173
  lexemeOfArgument: getLexeme(value, arg),
170
174
  linkedIds: linked?.length ? linked : undefined,
171
- value: value ?? info.defaultValue ?? defaultValue,
175
+ value: resolvedValue ?? info.defaultValue ?? defaultValue,
172
176
  versionConstraints: dep?.versionConstraints,
173
177
  derivedVersion: dep?.derivedVersion,
174
178
  namespaceInfo: dep?.namespaceInfo
@@ -32,4 +32,6 @@ export interface FunctionInfo extends FunctionArgInfo {
32
32
  ignoreIf?: 'arg-missing' | 'mode-only-read' | 'mode-only-write' | 'arg-true' | 'arg-false';
33
33
  /** additional info on arguments - e.g. for the mode flag */
34
34
  additionalArgs?: Record<string, FunctionArgInfo>;
35
+ /** string replacements to apply to resolved values, e.g. `{ '': 'stdin' }` */
36
+ stringReplacements?: Record<string, string>;
35
37
  }
@@ -115,6 +115,26 @@ exports.ReadFunctions = [
115
115
  { package: 'readODS', name: 'read_ods', argIdx: 0, argName: 'path', resolveValue: true },
116
116
  { package: 'vroom', name: 'vroom', argIdx: 0, argName: 'file', resolveValue: true },
117
117
  { package: 'compiler', name: 'loadcmp', argIdx: 0, argName: 'file', resolveValue: true },
118
- { package: 'compiler', name: 'cmpfile', argIdx: 0, argName: 'infile', resolveValue: true }
118
+ { package: 'compiler', name: 'cmpfile', argIdx: 0, argName: 'infile', resolveValue: true },
119
+ /* image / raster */
120
+ { package: 'jpeg', name: 'readJPEG', argIdx: 0, argName: 'source', resolveValue: true },
121
+ { package: 'png', name: 'readPNG', argIdx: 0, argName: 'source', resolveValue: true },
122
+ { package: 'tiff', name: 'readTIFF', argIdx: 0, argName: 'source', resolveValue: true },
123
+ { package: 'imager', name: 'load.image', argIdx: 0, argName: 'file', resolveValue: true },
124
+ { package: 'imager', name: 'load.video', argIdx: 0, argName: 'file', resolveValue: true },
125
+ { package: 'imager', name: 'load.dir', argIdx: 0, argName: 'path', resolveValue: true },
126
+ { package: 'OpenImageR', name: 'readImage', argIdx: 0, argName: 'path', resolveValue: true },
127
+ { package: 'EBImage', name: 'readImage', argIdx: 0, argName: 'files', resolveValue: true },
128
+ /* audio / video */
129
+ { package: 'av', name: 'av_video_images', argIdx: 0, argName: 'video', resolveValue: true },
130
+ { package: 'av', name: 'read_audio_bin', argIdx: 0, argName: 'audio', resolveValue: true },
131
+ { package: 'av', name: 'read_audio_fft', argIdx: 0, argName: 'audio', resolveValue: true },
132
+ { package: 'tuneR', name: 'readWave', argIdx: 0, argName: 'filename', resolveValue: true },
133
+ { package: 'tuneR', name: 'readMP3', argIdx: 0, argName: 'file', resolveValue: true },
134
+ { package: 'tuneR', name: 'readMidi', argIdx: 0, argName: 'file', resolveValue: true },
135
+ { package: 'seewave', name: 'read.audacity', argIdx: 0, argName: 'file', resolveValue: true },
136
+ { package: 'audio', name: 'load.wave', argIdx: 0, argName: 'where', resolveValue: true },
137
+ /* shinyjs - loads an external JavaScript file */
138
+ { package: 'shinyjs', name: 'extendShinyjs', argIdx: 0, argName: 'script', resolveValue: true, ignoreIf: 'arg-missing' }
119
139
  ];
120
140
  //# sourceMappingURL=read-functions.js.map
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SourceFunctions = void 0;
4
4
  // these lists are originally based on https://github.com/duncantl/CodeDepends/blob/7fd96dfee16b252e5f642c77a7ababf48e9326f8/R/codeTypes.R
5
5
  exports.SourceFunctions = [
6
- { package: 'base', name: 'source', argIdx: 0, argName: 'file', resolveValue: true },
6
+ { package: 'base', name: 'source', argIdx: 0, argName: 'file', resolveValue: true, stringReplacements: { '': 'stdin' } },
7
7
  { package: 'base', name: 'sys.source', argIdx: 0, argName: 'file', resolveValue: true },
8
8
  { package: 'devtools', name: 'source_url', argIdx: 0, argName: 'url', resolveValue: true },
9
9
  { package: 'devtools', name: 'source_gist', argIdx: 0, argName: 'id', resolveValue: true }
@@ -123,6 +123,23 @@ exports.WriteFunctions = [
123
123
  { package: 'rio', name: 'export', argIdx: 1, argName: 'file', resolveValue: true },
124
124
  { package: 'rio', name: 'export_list', argIdx: 1, argName: 'file', resolveValue: true },
125
125
  { package: 'magick', name: 'image_write', argIdx: 1, argName: 'path', resolveValue: true, ignoreIf: 'arg-missing' },
126
- { package: 'compiler', name: 'cmpfile', argIdx: 1, argName: 'outfile', resolveValue: true }
126
+ { package: 'compiler', name: 'cmpfile', argIdx: 1, argName: 'outfile', resolveValue: true },
127
+ /* image / raster */
128
+ { package: 'jpeg', name: 'writeJPEG', argIdx: 1, argName: 'target', resolveValue: true, ignoreIf: 'arg-missing' },
129
+ { package: 'png', name: 'writePNG', argIdx: 1, argName: 'target', resolveValue: true, ignoreIf: 'arg-missing' },
130
+ { package: 'tiff', name: 'writeTIFF', argIdx: 1, argName: 'where', resolveValue: true },
131
+ { package: 'imager', name: 'make.video', argIdx: 1, argName: 'file', resolveValue: true },
132
+ { package: 'OpenImageR', name: 'writeImage', argIdx: 1, argName: 'file_name', resolveValue: true },
133
+ { package: 'EBImage', name: 'writeImage', argIdx: 1, argName: 'files', resolveValue: true },
134
+ { package: 'gifski', name: 'gifski', argIdx: 1, argName: 'gif_file', resolveValue: true },
135
+ { package: 'gifski', name: 'save_gif', argIdx: 1, argName: 'gif_file', resolveValue: true },
136
+ { package: 'svglite', name: 'svglite', argIdx: 0, argName: 'file', resolveValue: true },
137
+ /* audio / video */
138
+ { package: 'av', name: 'av_encode_video', argIdx: 1, argName: 'output', resolveValue: true },
139
+ { package: 'av', name: 'av_audio_convert', argIdx: 1, argName: 'output', resolveValue: true },
140
+ { package: 'av', name: 'av_capture_graphics', argIdx: 1, argName: 'output', resolveValue: true },
141
+ { package: 'tuneR', name: 'writeWave', argIdx: 1, argName: 'filename', resolveValue: true },
142
+ { package: 'seewave', name: 'savewav', argName: 'filename', resolveValue: true, defaultValue: '<wave-name>' },
143
+ { package: 'audio', name: 'save.wave', argIdx: 1, argName: 'where', resolveValue: true }
127
144
  ];
128
145
  //# sourceMappingURL=write-functions.js.map
@@ -1,7 +1,9 @@
1
- import type { Identifier } from '../../../dataflow/environments/identifier';
1
+ import { Identifier } from '../../../dataflow/environments/identifier';
2
2
  export declare const PureFunctions: Identifier[];
3
3
  export declare const SystemFunctions: Identifier[];
4
4
  export declare const FfiFunctions: Identifier[];
5
5
  export declare const LangFunctions: Identifier[];
6
6
  export declare const OptionsFunctions: Identifier[];
7
7
  export declare const UserFunctions: Identifier[];
8
+ /** R functions that produce temporary file/directory paths (sub-type of {@link InputType.File}). */
9
+ export declare const TempFileFunctions: Identifier[];